diff options
author | Andrew Tridgell <tridge@samba.org> | 2010-04-22 14:53:53 +1000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2010-04-22 19:36:15 +1000 |
commit | 1ecefd74a2b7a6cec0c6ef765669eab0635e5568 (patch) | |
tree | 01fe69144b8726c930026f8d74fd7b18a3c9df22 /source4/dsdb/common | |
parent | 6669152a4a5919ecad633b594708d6b95577b4dc (diff) | |
download | samba-1ecefd74a2b7a6cec0c6ef765669eab0635e5568.tar.gz samba-1ecefd74a2b7a6cec0c6ef765669eab0635e5568.tar.bz2 samba-1ecefd74a2b7a6cec0c6ef765669eab0635e5568.zip |
s4-dsdb: added dsdb_get_extended_dn_sid()
This will be used by the RODC code
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4/dsdb/common')
-rw-r--r-- | source4/dsdb/common/util.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c index e395ea540b..22100c9735 100644 --- a/source4/dsdb/common/util.c +++ b/source4/dsdb/common/util.c @@ -2887,6 +2887,35 @@ NTSTATUS dsdb_get_extended_dn_uint32(struct ldb_dn *dn, uint32_t *val, const cha } /* + return a dom_sid from a extended DN structure + */ +NTSTATUS dsdb_get_extended_dn_sid(struct ldb_dn *dn, struct dom_sid *sid, const char *component_name) +{ + const struct ldb_val *sid_blob; + struct TALLOC_CTX *tmp_ctx; + enum ndr_err_code ndr_err; + + sid_blob = ldb_dn_get_extended_component(dn, "SID"); + if (!sid_blob) { + return NT_STATUS_OBJECT_NAME_NOT_FOUND; + } + + tmp_ctx = talloc_new(NULL); + + ndr_err = ndr_pull_struct_blob_all(sid_blob, tmp_ctx, NULL, sid, + (ndr_pull_flags_fn_t)ndr_pull_dom_sid); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + NTSTATUS status = ndr_map_error2ntstatus(ndr_err); + talloc_free(tmp_ctx); + return status; + } + + talloc_free(tmp_ctx); + return NT_STATUS_OK; +} + + +/* return RMD_FLAGS directly from a ldb_dn returns 0 if not found */ |