diff options
author | Simo Sorce <ssorce@redhat.com> | 2009-03-10 01:59:13 -0400 |
---|---|---|
committer | Simo Sorce <ssorce@redhat.com> | 2009-03-10 02:08:39 -0400 |
commit | d0e33c2a035c4c877b9f624b6999899666cb6385 (patch) | |
tree | 427598b7f636fc826b4b7d5983e1e8acc2bb28f4 /sss_client | |
parent | 16187da9bae78b6f4dd4ea21faf49fccc821f153 (diff) | |
download | sssd-d0e33c2a035c4c877b9f624b6999899666cb6385.tar.gz sssd-d0e33c2a035c4c877b9f624b6999899666cb6385.tar.bz2 sssd-d0e33c2a035c4c877b9f624b6999899666cb6385.zip |
Treat uids and gids as 32 bit numbers not 64
In the nss communication protocol we were treating uids and gids as 64 bit
values, but uids and gids are really u32 values, change the protocol to reflect
the real size.
Diffstat (limited to 'sss_client')
-rw-r--r-- | sss_client/group.c | 32 | ||||
-rw-r--r-- | sss_client/passwd.c | 22 | ||||
-rw-r--r-- | sss_client/sss_cli.h | 2 |
3 files changed, 28 insertions, 28 deletions
diff --git a/sss_client/group.c b/sss_client/group.c index 66cec623..4ba11e30 100644 --- a/sss_client/group.c +++ b/sss_client/group.c @@ -51,21 +51,21 @@ static void sss_nss_getgrent_data_clean(void) { * * GERTGRGID Request: * - * 0-7: 64bit number with gid + * 0-7: 32bit number with gid * * INITGROUPS Request: * - * 0-7: 64bit number with gid - * 8-11: 32bit unsigned with max num of entries + * 0-3: 32bit number with gid + * 4-7: 32bit unsigned with max num of entries * * Replies: * * 0-3: 32bit unsigned number of results * 4-7: 32bit unsigned (reserved/padding) * For each result (64bit padded ?): - * 0-7: 64bit number gid - * 8-11: 32bit unsigned number of members - * 12-X: sequence of 0 terminated strings (name, passwd, mem..) + * 0-3: 32bit number gid + * 4-7: 32bit unsigned number of members + * 8-X: sequence of 0 terminated strings (name, passwd, mem..) */ struct sss_nss_gr_rep { struct group *result; @@ -82,15 +82,15 @@ static int sss_nss_getgr_readrep(struct sss_nss_gr_rep *pr, uint32_t mem_num; int err; - if (*len < 15) { /* not enough space for data, bad packet */ + if (*len < 11) { /* not enough space for data, bad packet */ return EBADMSG; } - pr->result->gr_gid = ((uint64_t *)buf)[0]; - mem_num = ((uint32_t *)buf)[2]; + pr->result->gr_gid = ((uint32_t *)buf)[0]; + mem_num = ((uint32_t *)buf)[1]; - sbuf = (char *)&buf[12]; - slen = *len - 12; + sbuf = (char *)&buf[8]; + slen = *len - 8; dlen = pr->buflen; pr->result->gr_name = &(pr->buffer[0]); @@ -165,7 +165,7 @@ static int sss_nss_getgr_readrep(struct sss_nss_gr_rep *pr, * 0-3: 32bit unsigned number of results * 4-7: 32bit unsigned (reserved/padding) * For each result: - * 0-7: 64bit number with gid + * 0-4: 32bit number with gid */ @@ -178,7 +178,7 @@ enum nss_status _nss_sss_initgroups_dyn(const char *user, gid_t group, uint8_t *repbuf; size_t replen; enum nss_status nret; - uint64_t *rbuf; + uint32_t *rbuf; uint32_t num_ret; long int l, max_ret; @@ -220,7 +220,7 @@ enum nss_status _nss_sss_initgroups_dyn(const char *user, gid_t group, *size = newsize; } - rbuf = &((uint64_t *)repbuf)[1]; + rbuf = &((uint32_t *)repbuf)[2]; for (l = 0; l < max_ret; l++) { (*groups)[*start] = rbuf[l]; *start += 1; @@ -284,11 +284,11 @@ enum nss_status _nss_sss_getgrgid_r(gid_t gid, struct group *result, uint8_t *repbuf; size_t replen, len; enum nss_status nret; - uint64_t group_gid; + uint32_t group_gid; int ret; group_gid = gid; - rd.len = sizeof(uint64_t); + rd.len = sizeof(uint32_t); rd.data = &group_gid; nret = sss_nss_make_request(SSS_NSS_GETGRGID, &rd, diff --git a/sss_client/passwd.c b/sss_client/passwd.c index d02e067f..a2ffcad6 100644 --- a/sss_client/passwd.c +++ b/sss_client/passwd.c @@ -51,16 +51,16 @@ static void sss_nss_getpwent_data_clean(void) { * * GERTPWUID Request: * - * 0-7: 64bit number with uid + * 0-3: 32bit number with uid * * Replies: * * 0-3: 32bit unsigned number of results * 4-7: 32bit unsigned (reserved/padding) * For each result: - * 0-7: 64bit number uid - * 8-15: 64bit number gid - * 16-X: sequence of 5, 0 terminated, strings (name, passwd, gecos, dir, shell) + * 0-3: 32bit number uid + * 4-7: 32bit number gid + * 8-X: sequence of 5, 0 terminated, strings (name, passwd, gecos, dir, shell) */ struct sss_nss_pw_rep { @@ -76,14 +76,14 @@ static int sss_nss_getpw_readrep(struct sss_nss_pw_rep *pr, char *sbuf; int err; - if (*len < 21) { /* not enough space for data, bad packet */ + if (*len < 13) { /* not enough space for data, bad packet */ return EBADMSG; } - pr->result->pw_uid = ((int64_t *)buf)[0]; - pr->result->pw_gid = ((int64_t *)buf)[1]; + pr->result->pw_uid = ((uint32_t *)buf)[0]; + pr->result->pw_gid = ((uint32_t *)buf)[1]; - sbuf = (char *)&buf[16]; + sbuf = (char *)&buf[8]; if (*len < pr->buflen) { slen = *len; err = EBADMSG; @@ -147,7 +147,7 @@ static int sss_nss_getpw_readrep(struct sss_nss_pw_rep *pr, return err; } - *len = *len -16 -i -1; + *len = *len -8 -i -1; return 0; } @@ -206,11 +206,11 @@ enum nss_status _nss_sss_getpwuid_r(uid_t uid, struct passwd *result, uint8_t *repbuf; size_t replen, len; enum nss_status nret; - int64_t user_uid; + uint32_t user_uid; int ret; user_uid = uid; - rd.len = sizeof(int64_t); + rd.len = sizeof(uint32_t); rd.data = &user_uid; nret = sss_nss_make_request(SSS_NSS_GETPWUID, &rd, diff --git a/sss_client/sss_cli.h b/sss_client/sss_cli.h index 1e19e5e2..dfb6380c 100644 --- a/sss_client/sss_cli.h +++ b/sss_client/sss_cli.h @@ -21,7 +21,7 @@ #define SSS_PAM_SOCKET_NAME "/var/lib/sss/pipes/pam" #define SSS_PAM_PRIV_SOCKET_NAME "/var/lib/sss/pipes/private/pam" -#define SSS_PROTOCOL_VERSION 0 +#define SSS_PROTOCOL_VERSION 1 enum sss_cli_command { /* null */ |