summaryrefslogtreecommitdiff
path: root/source4/dsdb/samdb/ldb_modules/samba3sam.c
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mdw@samba.org>2010-11-27 14:07:31 +0100
committerMatthias Dieter Wallnöfer <mdw@samba.org>2010-11-27 15:17:18 +0100
commit2163c7a2985b750218661552760400ce485bf894 (patch)
tree29e80ca3a11de5b900aedb713b176ccbe4443b49 /source4/dsdb/samdb/ldb_modules/samba3sam.c
parente9f019e28c267b35c1f5e5a232751c2ca920e1e5 (diff)
downloadsamba-2163c7a2985b750218661552760400ce485bf894.tar.gz
samba-2163c7a2985b750218661552760400ce485bf894.tar.bz2
samba-2163c7a2985b750218661552760400ce485bf894.zip
s4:samba3sam LDB module - make the "pw_uid"/"pw_gid" conversion a bit clearer
And remove the "long" specifier since at least on the major platforms (Linux, BSD and Solaris) these types are defined as "uint32_t".
Diffstat (limited to 'source4/dsdb/samdb/ldb_modules/samba3sam.c')
-rw-r--r--source4/dsdb/samdb/ldb_modules/samba3sam.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/samba3sam.c b/source4/dsdb/samdb/ldb_modules/samba3sam.c
index 318d605ecd..3a8521dbde 100644
--- a/source4/dsdb/samdb/ldb_modules/samba3sam.c
+++ b/source4/dsdb/samdb/ldb_modules/samba3sam.c
@@ -151,7 +151,9 @@ static struct ldb_val lookup_gid(struct ldb_module *module, TALLOC_CTX *ctx, con
return *talloc_zero(ctx, struct ldb_val);
}
- retval.data = (uint8_t *)talloc_asprintf(ctx, "%ld", (unsigned long)pwd->pw_gid);
+ /* "pw_gid" is per POSIX definition "unsigned".
+ * But write it out as "signed" for LDAP compliance. */
+ retval.data = (uint8_t *)talloc_asprintf(ctx, "%d", (int) pwd->pw_gid);
retval.length = strlen((char *)retval.data);
return retval;
@@ -168,7 +170,9 @@ static struct ldb_val lookup_uid(struct ldb_module *module, TALLOC_CTX *ctx, con
return *talloc_zero(ctx, struct ldb_val);
}
- retval.data = (uint8_t *)talloc_asprintf(ctx, "%ld", (unsigned long)pwd->pw_uid);
+ /* "pw_uid" is per POSIX definition "unsigned".
+ * But write it out as "signed" for LDAP compliance. */
+ retval.data = (uint8_t *)talloc_asprintf(ctx, "%d", (int) pwd->pw_uid);
retval.length = strlen((char *)retval.data);
return retval;