diff options
author | Andrew Tridgell <tridge@samba.org> | 2004-05-09 12:32:25 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:51:51 -0500 |
commit | a765d3692fd6583ca98fea7907af4aa934dfc68c (patch) | |
tree | 2156304ce022d1af8ffb75e8493fe15cb8f7d858 /source4/rpc_server/samr/samdb.c | |
parent | 5dc73338d22ce95299ed62b73d1c15c94581495e (diff) | |
download | samba-a765d3692fd6583ca98fea7907af4aa934dfc68c.tar.gz samba-a765d3692fd6583ca98fea7907af4aa934dfc68c.tar.bz2 samba-a765d3692fd6583ca98fea7907af4aa934dfc68c.zip |
r608: - a couple of very minor fixes to the CreateGroup code
- added samr_GetUserPwInfo() samr server call
(This used to be commit 0250f5d6aaf4f9325ace707c69f5e24bcd7a0ed9)
Diffstat (limited to 'source4/rpc_server/samr/samdb.c')
-rw-r--r-- | source4/rpc_server/samr/samdb.c | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/source4/rpc_server/samr/samdb.c b/source4/rpc_server/samr/samdb.c index af915e599f..c6a85176da 100644 --- a/source4/rpc_server/samr/samdb.c +++ b/source4/rpc_server/samr/samdb.c @@ -205,6 +205,33 @@ const char *samdb_search_string(void *ctx, return str; } + +/* + search the sam for a single integer attribute in exactly 1 record +*/ +uint_t samdb_search_uint(void *ctx, + TALLOC_CTX *mem_ctx, + uint_t default_value, + const char *basedn, + const char *attr_name, + const char *format, ...) +{ + va_list ap; + int count; + struct ldb_message **res; + const char * const attrs[2] = { attr_name, NULL }; + + va_start(ap, format); + count = samdb_search_v(ctx, mem_ctx, basedn, &res, attrs, format, ap); + va_end(ap); + + if (count != 1) { + return default_value; + } + + return samdb_result_uint(res[0], attr_name, default_value); +} + /* search the sam for multipe records each giving a single string attribute return the number of matches, or -1 on error @@ -426,11 +453,8 @@ int samdb_copy_template(void *ctx, TALLOC_CTX *mem_ctx, } for (j=0;j<el->num_values;j++) { if (strcasecmp(el->name, "objectClass") == 0 && - strcasecmp((char *)el->values[j].data, "userTemplate") == 0) { - continue; - } - if (strcasecmp(el->name, "objectClass") == 0 && - strcasecmp((char *)el->values[j].data, "groupTemplate") == 0) { + (strcasecmp((char *)el->values[j].data, "userTemplate") == 0 || + strcasecmp((char *)el->values[j].data, "groupTemplate") == 0)) { continue; } samdb_msg_add_string(ctx, mem_ctx, msg, el->name, |