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/rootdse.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/rootdse.c')
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/rootdse.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/rootdse.c b/source4/dsdb/samdb/ldb_modules/rootdse.c index 7334bf3bc5..a51785e64d 100644 --- a/source4/dsdb/samdb/ldb_modules/rootdse.c +++ b/source4/dsdb/samdb/ldb_modules/rootdse.c @@ -285,8 +285,9 @@ static int rootdse_add_dynamic(struct ldb_module *module, struct ldb_message *ms uint64_t seq_num; int ret = ldb_sequence_number(ldb, LDB_SEQ_HIGHEST_SEQ, &seq_num); if (ret == LDB_SUCCESS) { - if (ldb_msg_add_fmt(msg, "highestCommittedUSN", - "%llu", (unsigned long long)seq_num) != LDB_SUCCESS) { + if (samdb_msg_add_uint64(ldb, msg, msg, + "highestCommittedUSN", + seq_num) != LDB_SUCCESS) { goto failed; } } @@ -300,8 +301,8 @@ static int rootdse_add_dynamic(struct ldb_module *module, struct ldb_message *ms n++; } - if (ldb_msg_add_fmt(msg, "dsSchemaAttrCount", - "%u", n) != LDB_SUCCESS) { + if (samdb_msg_add_uint(ldb, msg, msg, "dsSchemaAttrCount", + n) != LDB_SUCCESS) { goto failed; } } @@ -314,15 +315,15 @@ static int rootdse_add_dynamic(struct ldb_module *module, struct ldb_message *ms n++; } - if (ldb_msg_add_fmt(msg, "dsSchemaClassCount", - "%u", n) != LDB_SUCCESS) { + if (samdb_msg_add_uint(ldb, msg, msg, "dsSchemaClassCount", + n) != LDB_SUCCESS) { goto failed; } } if (schema && do_attribute_explicit(attrs, "dsSchemaPrefixCount")) { - if (ldb_msg_add_fmt(msg, "dsSchemaPrefixCount", - "%u", schema->prefixmap->length) != LDB_SUCCESS) { + if (samdb_msg_add_uint(ldb, msg, msg, "dsSchemaPrefixCount", + schema->prefixmap->length) != LDB_SUCCESS) { goto failed; } } |