diff options
author | casper <none@none> | 2007-05-25 05:43:42 -0700 |
---|---|---|
committer | casper <none@none> | 2007-05-25 05:43:42 -0700 |
commit | f48205be61a214698b763ff550ab9e657525104c (patch) | |
tree | bc63168b8468284765bb770eb48473b7a0bf980e /usr/src/lib/libsldap/common/ns_writes.c | |
parent | 7387092aa96cd872b317dfab3fee34a96c681f3e (diff) | |
download | illumos-gate-f48205be61a214698b763ff550ab9e657525104c.tar.gz |
PSARC 2007/064 Unified POSIX and Windows Credentials for Solaris
4994017 data structure sharing between rpcbind and libnsl leads to accidents
6549510 Need the ability to store SIDs in the Solaris cred_t
6549515 PSARC 2007/064: uid_t and gid_t to become unsigned
Diffstat (limited to 'usr/src/lib/libsldap/common/ns_writes.c')
-rw-r--r-- | usr/src/lib/libsldap/common/ns_writes.c | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/usr/src/lib/libsldap/common/ns_writes.c b/usr/src/lib/libsldap/common/ns_writes.c index 474db98161..6c39272eba 100644 --- a/usr/src/lib/libsldap/common/ns_writes.c +++ b/usr/src/lib/libsldap/common/ns_writes.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -1362,8 +1362,8 @@ __s_cvt_passwd(const void *data, char **rdn, /* Convert the structure */ ptr = (struct passwd *)data; - if (ptr->pw_name == NULL || ptr->pw_uid < 0 || - ptr->pw_gid < 0 || ptr->pw_dir == NULL) { + if (ptr->pw_name == NULL || ptr->pw_uid > MAXUID || + ptr->pw_gid > MAXUID || ptr->pw_dir == NULL) { __ns_ldap_freeEntry(e); *entry = NULL; return (NS_LDAP_INVALID_PARAM); @@ -1399,22 +1399,14 @@ __s_cvt_passwd(const void *data, char **rdn, } } -#ifdef _LP64 - (void) sprintf(ibuf, "%d", ptr->pw_uid); -#else - (void) sprintf(ibuf, "%ld", ptr->pw_uid); -#endif + (void) sprintf(ibuf, "%u", ptr->pw_uid); rc = __s_add_attr(e, "uidNumber", ibuf); if (rc != NS_LDAP_SUCCESS) { __s_cvt_freeEntryRdn(entry, rdn); return (rc); } -#ifdef _LP64 - (void) sprintf(ibuf, "%d", ptr->pw_gid); -#else - (void) sprintf(ibuf, "%ld", ptr->pw_gid); -#endif + (void) sprintf(ibuf, "%u", ptr->pw_gid); rc = __s_add_attr(e, "gidNumber", ibuf); if (rc != NS_LDAP_SUCCESS) { __s_cvt_freeEntryRdn(entry, rdn); @@ -1603,7 +1595,7 @@ __s_cvt_group(const void *data, char **rdn, /* Convert the structure */ ptr = (struct group *)data; - if (ptr->gr_name == NULL || ptr->gr_gid < 0) { + if (ptr->gr_name == NULL || ptr->gr_gid > MAXUID) { __ns_ldap_freeEntry(e); *entry = NULL; return (NS_LDAP_INVALID_PARAM); @@ -1625,11 +1617,7 @@ __s_cvt_group(const void *data, char **rdn, return (rc); } -#ifdef _LP64 - (void) sprintf(ibuf, "%d", ptr->gr_gid); -#else - (void) sprintf(ibuf, "%ld", ptr->gr_gid); -#endif + (void) sprintf(ibuf, "%u", ptr->gr_gid); rc = __s_add_attr(e, "gidNumber", ibuf); if (rc != NS_LDAP_SUCCESS) { __s_cvt_freeEntryRdn(entry, rdn); |