diff options
author | Volker Lendecke <vlendec@samba.org> | 2004-12-30 17:01:49 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:07:46 -0500 |
commit | 8da7a605576bf7dc4f96759b65f1387c6a52467d (patch) | |
tree | f03c92ab3058db1db7f8a3e5a086aadf3f4609cc /source4/dsdb | |
parent | 3450ed666c50ec908557213672ff6b1b4534e9c1 (diff) | |
download | samba-8da7a605576bf7dc4f96759b65f1387c6a52467d.tar.gz samba-8da7a605576bf7dc4f96759b65f1387c6a52467d.tar.bz2 samba-8da7a605576bf7dc4f96759b65f1387c6a52467d.zip |
r4414: Various bits&pieces:
* Implement samr_search_domain, filter out all elements with no "objectSid"
attribute and all objects outside a specified domain sid.
* Minor cleanups in dcerpc_samr.c due to that.
* Implement srvsvc_NetSrvGetInfo level 100. A quick hack to get usrmgr.exe
one step further.
* Same for samr_info_DomInfo1.
Volker
(This used to be commit cdec89611355fb75d253ecf5b658d0e23de8e440)
Diffstat (limited to 'source4/dsdb')
-rw-r--r-- | source4/dsdb/samdb/samdb.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/source4/dsdb/samdb/samdb.c b/source4/dsdb/samdb/samdb.c index 934e6c240f..8188bf2016 100644 --- a/source4/dsdb/samdb/samdb.c +++ b/source4/dsdb/samdb/samdb.c @@ -55,6 +55,49 @@ int samdb_search(void *ctx, } /* + search the sam for the specified attributes in a specific domain, filter on + objectSid being in domain_sid. +*/ +int samdb_search_domain(void *ctx, + TALLOC_CTX *mem_ctx, + const char *basedn, + struct ldb_message ***res, + const char * const *attrs, + const struct dom_sid *domain_sid, + const char *format, ...) _PRINTF_ATTRIBUTE(7,8) +{ + struct ldb_wrap *sam_ctx = ctx; + va_list ap; + int i, count; + + va_start(ap, format); + count = gendb_search_v(sam_ctx->ldb, mem_ctx, basedn, res, attrs, + format, ap); + va_end(ap); + + i=0; + + while (i<count) { + struct dom_sid *entry_sid; + + entry_sid = samdb_result_dom_sid(mem_ctx, (*res)[i], + "objectSid"); + + if ((entry_sid == NULL) || + (!dom_sid_in_domain(domain_sid, entry_sid))) { + + /* Delete that entry from the result set */ + (*res)[i] = (*res)[count-1]; + count -= 1; + continue; + } + i += 1; + } + + return count; +} + +/* free up a search result */ int samdb_search_free(void *ctx, |