diff options
author | Matthias Dieter Wallnöfer <mdw@samba.org> | 2010-10-14 17:01:39 +0200 |
---|---|---|
committer | Matthias Dieter Wallnöfer <mdw@samba.org> | 2010-10-16 10:54:46 +0200 |
commit | c2918581996b58c3e2a2416e6dd693978becd3a2 (patch) | |
tree | d460eb0c2c6cd2a9aabdf846fac2c7e0cccc6e58 /source4/dsdb/samdb/ldb_modules/operational.c | |
parent | a72ffb0d0157dce2ac45e3b228f168a56c89f26e (diff) | |
download | samba-c2918581996b58c3e2a2416e6dd693978becd3a2.tar.gz samba-c2918581996b58c3e2a2416e6dd693978becd3a2.tar.bz2 samba-c2918581996b58c3e2a2416e6dd693978becd3a2.zip |
s4:dsdb - fix unsigned integer save problems using the "%u" specifier
The issue here is that we have not yet first cast to int32_t explicitly,
before we cast to an signed int to printf() into the %d or cast to a
int64_t before we then cast to a long long to printf into a %lld.
There are *no* unsigned integers in Active Directory LDAP, even the RID
allocations and ms-DS-Secondary-KrbTgt-Number are *signed* quantities.
(See the schema, and the syntax definitions in schema_syntax.c).
The failure has been detected by Matthieu Patou on the buildfarm host "tridge"
due to a malformed "groupType" attribute.
The solution is to use the "%d" specifier. Either to use it directly - or better
(when possible) use the call "samdb_msg_add_uint" (which encapsulates it).
This patch changes such problematic situations.
Diffstat (limited to 'source4/dsdb/samdb/ldb_modules/operational.c')
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/operational.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/operational.c b/source4/dsdb/samdb/ldb_modules/operational.c index 633fd8d28d..5a5b5e903a 100644 --- a/source4/dsdb/samdb/ldb_modules/operational.c +++ b/source4/dsdb/samdb/ldb_modules/operational.c @@ -454,6 +454,7 @@ static int construct_msds_keyversionnumber(struct ldb_module *module, enum ndr_err_code ndr_err; const struct ldb_val *omd_value; struct replPropertyMetaDataBlob *omd; + int ret; omd_value = ldb_msg_find_ldb_val(msg, "replPropertyMetaData"); if (!omd_value) { @@ -486,7 +487,14 @@ static int construct_msds_keyversionnumber(struct ldb_module *module, } for (i=0; i<omd->ctr.ctr1.count; i++) { if (omd->ctr.ctr1.array[i].attid == DRSUAPI_ATTRIBUTE_unicodePwd) { - ldb_msg_add_fmt(msg, "msDS-KeyVersionNumber", "%u", omd->ctr.ctr1.array[i].version); + ret = samdb_msg_add_uint(ldb_module_get_ctx(module), + msg, msg, + "msDS-KeyVersionNumber", + omd->ctr.ctr1.array[i].version); + if (ret != LDB_SUCCESS) { + talloc_free(omd); + return ret; + } break; } } |