URL: https://github.com/SSSD/sssd/pull/109
Title: #109: SSSCTL: fix netgroup-show parsing

jhrozek commented:
"""
Ah, I didn't realize we don't read the objectclass attribute by default. The 
following hunk should fix it:
```
@@ -219,12 +233,14 @@ static const char **sssctl_build_attrs(TALLOC_CTX 
*mem_ctx,
         /* no op */
     }
 
-    attrs = talloc_zero_array(mem_ctx, const char *, count + 1);
+    attrs = talloc_zero_array(mem_ctx, const char *, count + 2);
     if (attrs == NULL) {
         return NULL;
     }
 
-    for (i = 0; i < count; i++) {
+    attrs[0] = "objectclass";
+
+    for (i = 1; i < count; i++) {
```
One other nitpick is that you probably want to assign the original name to 
tmp_name by duplicating the memory to avoid a const-warning:
`tmp_name = talloc_strdup(mem_ctx, orig_name);`

Finally, please compare the value of the objectclass with strcmp, not pointer 
comparison:
`if ((strcmp(class, SYSDB_USER_CLASS) == 0) || (strcmp(class, 
SYSDB_GROUP_CLASS) == 0)) {`
(and split the line into two, so that it fits into the 80-chars limit)
"""

See the full comment at 
https://github.com/SSSD/sssd/pull/109#issuecomment-267568893
_______________________________________________
sssd-devel mailing list -- sssd-devel@lists.fedorahosted.org
To unsubscribe send an email to sssd-devel-le...@lists.fedorahosted.org

Reply via email to