diff options
-rw-r--r-- | source3/include/tldap_util.h | 2 | ||||
-rw-r--r-- | source3/lib/tldap_util.c | 12 |
2 files changed, 14 insertions, 0 deletions
diff --git a/source3/include/tldap_util.h b/source3/include/tldap_util.h index 2d5cf57a9c..1c993769d7 100644 --- a/source3/include/tldap_util.h +++ b/source3/include/tldap_util.h @@ -49,5 +49,7 @@ int tldap_search_fmt(struct tldap_context *ld, const char *base, int scope, const char *fmt, ...); bool tldap_pull_uint64(struct tldap_message *msg, const char *attr, uint64_t *presult); +bool tldap_pull_uint32(struct tldap_message *msg, const char *attr, + uint32_t *presult); #endif diff --git a/source3/lib/tldap_util.c b/source3/lib/tldap_util.c index 1f2cc1d8de..1b0c3446ee 100644 --- a/source3/lib/tldap_util.c +++ b/source3/lib/tldap_util.c @@ -349,3 +349,15 @@ bool tldap_pull_uint64(struct tldap_message *msg, const char *attr, *presult = result; return true; } + +bool tldap_pull_uint32(struct tldap_message *msg, const char *attr, + uint32_t *presult) +{ + uint64_t result; + + if (!tldap_pull_uint64(msg, attr, &result)) { + return false; + } + *presult = (uint32_t)result; + return true; +} |