summaryrefslogtreecommitdiff
path: root/src/responder/nss
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2011-07-21 10:55:11 +0200
committerSimo Sorce <ssorce@redhat.com>2011-07-21 08:24:28 -0400
commit6149a5a9d2399c2c68f5fb07a110333d7634311a (patch)
tree36568141b17d2c067d71c7be9023bf3fc63dc308 /src/responder/nss
parent9b85268eabe33d624b9d184251e89c0c7ae829a2 (diff)
downloadsssd-6149a5a9d2399c2c68f5fb07a110333d7634311a.tar.gz
sssd-6149a5a9d2399c2c68f5fb07a110333d7634311a.tar.bz2
sssd-6149a5a9d2399c2c68f5fb07a110333d7634311a.zip
Fix indexing of skipped groups
https://fedorahosted.org/sssd/ticket/928
Diffstat (limited to 'src/responder/nss')
-rw-r--r--src/responder/nss/nsssrv_cmd.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/responder/nss/nsssrv_cmd.c b/src/responder/nss/nsssrv_cmd.c
index d85e86cb..57eb9154 100644
--- a/src/responder/nss/nsssrv_cmd.c
+++ b/src/responder/nss/nsssrv_cmd.c
@@ -2921,7 +2921,7 @@ static int fill_initgr(struct sss_packet *packet, struct ldb_result *res)
uint8_t *body;
size_t blen;
gid_t gid;
- int ret, i, num;
+ int ret, i, num, bindex;
int skipped = 0;
const char *posix;
@@ -2939,6 +2939,7 @@ static int fill_initgr(struct sss_packet *packet, struct ldb_result *res)
sss_packet_get_body(packet, &body, &blen);
/* skip first entry, it's the user entry */
+ bindex = 0;
for (i = 0; i < num; i++) {
gid = ldb_msg_find_attr_as_uint64(res->msgs[i + 1], SYSDB_GIDNUM, 0);
posix = ldb_msg_find_attr_as_string(res->msgs[i + 1], SYSDB_POSIX, NULL);
@@ -2951,7 +2952,8 @@ static int fill_initgr(struct sss_packet *packet, struct ldb_result *res)
return EFAULT;
}
}
- ((uint32_t *)body)[2 + i] = gid;
+ ((uint32_t *)body)[2 + bindex] = gid;
+ bindex++;
}
((uint32_t *)body)[0] = num-skipped; /* num results */