diff options
author | Andrew Tridgell <tridge@samba.org> | 2009-12-18 20:54:23 +1100 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2009-12-21 23:41:04 +1100 |
commit | 2c88ffb8f1f3691d29a88ab263dde5b07f4f400a (patch) | |
tree | d55b2987807537013b87cde8af3351b4e665b9c7 /source4/dsdb | |
parent | dbda2c2db5a3c0c39134fde1ae58ceadf473a87f (diff) | |
download | samba-2c88ffb8f1f3691d29a88ab263dde5b07f4f400a.tar.gz samba-2c88ffb8f1f3691d29a88ab263dde5b07f4f400a.tar.bz2 samba-2c88ffb8f1f3691d29a88ab263dde5b07f4f400a.zip |
s4-dsdb: added two new dsdb_get_extended_dn_*() helper functions
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4/dsdb')
-rw-r--r-- | source4/dsdb/common/util.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c index 61d065b85c..774f9a757c 100644 --- a/source4/dsdb/common/util.c +++ b/source4/dsdb/common/util.c @@ -2735,6 +2735,49 @@ NTSTATUS dsdb_get_extended_dn_guid(struct ldb_dn *dn, struct GUID *guid) } /* + return a NTTIME from a extended DN structure + */ +NTSTATUS dsdb_get_extended_dn_nttime(struct ldb_dn *dn, NTTIME *nttime, const char *component_name) +{ + const struct ldb_val *v; + char *s; + + v = ldb_dn_get_extended_component(dn, component_name); + if (v == NULL) { + return NT_STATUS_OBJECT_NAME_NOT_FOUND; + } + s = talloc_strndup(dn, (const char *)v->data, v->length); + NT_STATUS_HAVE_NO_MEMORY(s); + + *nttime = strtoull(s, NULL, 0); + + talloc_free(s); + return NT_STATUS_OK; +} + +/* + return a uint32_t from a extended DN structure + */ +NTSTATUS dsdb_get_extended_dn_uint32(struct ldb_dn *dn, uint32_t *val, const char *component_name) +{ + const struct ldb_val *v; + char *s; + + v = ldb_dn_get_extended_component(dn, component_name); + if (v == NULL) { + return NT_STATUS_OBJECT_NAME_NOT_FOUND; + } + + s = talloc_strndup(dn, (const char *)v->data, v->length); + NT_STATUS_HAVE_NO_MEMORY(s); + + *val = strtoul(s, NULL, 0); + + talloc_free(s); + return NT_STATUS_OK; +} + +/* return true if a ldb_val containing a DN in storage form is deleted */ bool dsdb_dn_is_deleted_val(struct ldb_val *val) |