summaryrefslogtreecommitdiff
path: root/source4/rpc_server/samr
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2005-03-23 01:30:43 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:11:12 -0500
commit79f6bcd5ae1711075ce0e75392ce83a72766698e (patch)
treeeb7928570c6843880253d0ce053957b1a17d0fcb /source4/rpc_server/samr
parent9b48673ad9ed5cf2019df7111fe6ef89ad57573d (diff)
downloadsamba-79f6bcd5ae1711075ce0e75392ce83a72766698e.tar.gz
samba-79f6bcd5ae1711075ce0e75392ce83a72766698e.tar.bz2
samba-79f6bcd5ae1711075ce0e75392ce83a72766698e.zip
r5988: Fix the -P option (use machine account credentials) to use the Samba4
secrets system, and not the old system from Samba3. This allowed the code from auth_domain to be shared - we now only lookup the secrets.ldb in lib/credentials.c. In order to link the resultant binary, samdb_search() has been moved from deep inside rpc_server into lib/gendb.c, along with the existing gendb_search_v(). The vast majority of this patch is the simple rename that followed, (Depending on the whole SAMDB for just this function seemed pointless, and brought in futher dependencies, such as smbencrypt.c). Andrew Bartlett (This used to be commit e13c671619bd290a8b3cae8555cb281a9a185ee0)
Diffstat (limited to 'source4/rpc_server/samr')
-rw-r--r--source4/rpc_server/samr/dcesrv_samr.c40
-rw-r--r--source4/rpc_server/samr/samr_password.c12
2 files changed, 26 insertions, 26 deletions
diff --git a/source4/rpc_server/samr/dcesrv_samr.c b/source4/rpc_server/samr/dcesrv_samr.c
index 44f3890e44..41074b4128 100644
--- a/source4/rpc_server/samr/dcesrv_samr.c
+++ b/source4/rpc_server/samr/dcesrv_samr.c
@@ -288,7 +288,7 @@ static NTSTATUS samr_OpenDomain(struct dcesrv_call_state *dce_call, TALLOC_CTX *
return NT_STATUS_INVALID_PARAMETER;
}
- ret = samdb_search(c_state->sam_ctx,
+ ret = gendb_search(c_state->sam_ctx,
mem_ctx, NULL, &msgs, attrs,
"(&(objectSid=%s)(objectclass=domain))",
sidstr);
@@ -343,7 +343,7 @@ static NTSTATUS samr_info_DomInfo1(struct samr_domain_state *state,
int ret;
struct ldb_message **res;
- ret = samdb_search(state->sam_ctx, mem_ctx, NULL, &res, attrs,
+ ret = gendb_search(state->sam_ctx, mem_ctx, NULL, &res, attrs,
"dn=%s", state->domain_dn);
if (ret != 1) {
return NT_STATUS_INTERNAL_DB_CORRUPTION;
@@ -373,7 +373,7 @@ static NTSTATUS samr_info_DomInfo2(struct samr_domain_state *state, TALLOC_CTX *
int ret;
struct ldb_message **res;
- ret = samdb_search(state->sam_ctx, mem_ctx, NULL, &res, attrs,
+ ret = gendb_search(state->sam_ctx, mem_ctx, NULL, &res, attrs,
"dn=%s", state->domain_dn);
if (ret != 1) {
return NT_STATUS_INTERNAL_DB_CORRUPTION;
@@ -887,7 +887,7 @@ static NTSTATUS samr_EnumDomainUsers(struct dcesrv_call_state *dce_call, TALLOC_
/* search for all users in this domain. This could possibly be cached and
resumed based on resume_key */
- count = samdb_search(d_state->sam_ctx, mem_ctx, d_state->domain_dn, &res, attrs,
+ count = gendb_search(d_state->sam_ctx, mem_ctx, d_state->domain_dn, &res, attrs,
"objectclass=user");
if (count == -1) {
return NT_STATUS_INTERNAL_DB_CORRUPTION;
@@ -1288,7 +1288,7 @@ static NTSTATUS samr_LookupNames(struct dcesrv_call_state *dce_call, TALLOC_CTX
r->out.rids.ids[i] = 0;
r->out.types.ids[i] = SID_NAME_UNKNOWN;
- count = samdb_search(d_state->sam_ctx, mem_ctx, d_state->domain_dn, &res, attrs,
+ count = gendb_search(d_state->sam_ctx, mem_ctx, d_state->domain_dn, &res, attrs,
"sAMAccountName=%s", r->in.names[i].string);
if (count != 1) {
status = STATUS_SOME_UNMAPPED;
@@ -1367,7 +1367,7 @@ static NTSTATUS samr_LookupRids(struct dcesrv_call_state *dce_call, TALLOC_CTX *
ids[i] = SID_NAME_UNKNOWN;
- count = samdb_search(d_state->sam_ctx, mem_ctx,
+ count = gendb_search(d_state->sam_ctx, mem_ctx,
d_state->domain_dn, &res, attrs,
"(objectSid=%s-%u)", d_state->domain_sid,
r->in.rids[i]);
@@ -1431,7 +1431,7 @@ static NTSTATUS samr_OpenGroup(struct dcesrv_call_state *dce_call, TALLOC_CTX *m
}
/* search for the group record */
- ret = samdb_search(d_state->sam_ctx,
+ ret = gendb_search(d_state->sam_ctx,
mem_ctx, d_state->domain_dn, &msgs, attrs,
"(&(objectSid=%s)(objectclass=group)"
"(grouptype=%s))",
@@ -1547,7 +1547,7 @@ static NTSTATUS samr_QueryGroupInfo(struct dcesrv_call_state *dce_call, TALLOC_C
a_state = h->data;
/* pull all the group attributes */
- ret = samdb_search(a_state->sam_ctx, mem_ctx, NULL, &res, attrs,
+ ret = gendb_search(a_state->sam_ctx, mem_ctx, NULL, &res, attrs,
"dn=%s", a_state->account_dn);
if (ret != 1) {
return NT_STATUS_INTERNAL_DB_CORRUPTION;
@@ -1667,7 +1667,7 @@ static NTSTATUS samr_AddGroupMember(struct dcesrv_call_state *dce_call, TALLOC_C
/* In native mode, AD can also nest domain groups. Not sure yet
* whether this is also available via RPC. */
- ret = samdb_search(d_state->sam_ctx, mem_ctx, d_state->domain_dn,
+ ret = gendb_search(d_state->sam_ctx, mem_ctx, d_state->domain_dn,
&msgs, attrs, "(&(objectSid=%s)(objectclass=user))",
membersidstr);
@@ -1755,7 +1755,7 @@ static NTSTATUS samr_DeleteGroupMember(struct dcesrv_call_state *dce_call, TALLO
/* In native mode, AD can also nest domain groups. Not sure yet
* whether this is also available via RPC. */
- ret = samdb_search(d_state->sam_ctx, mem_ctx, d_state->domain_dn,
+ ret = gendb_search(d_state->sam_ctx, mem_ctx, d_state->domain_dn,
&msgs, attrs, "(&(objectSid=%s)(objectclass=user))",
membersidstr);
@@ -1807,7 +1807,7 @@ static NTSTATUS samr_QueryGroupMember(struct dcesrv_call_state *dce_call, TALLOC
a_state = h->data;
/* pull the member attribute */
- ret = samdb_search(a_state->sam_ctx, mem_ctx, NULL, &res, attrs,
+ ret = gendb_search(a_state->sam_ctx, mem_ctx, NULL, &res, attrs,
"dn=%s", a_state->account_dn);
if (ret != 1) {
@@ -1841,7 +1841,7 @@ static NTSTATUS samr_QueryGroupMember(struct dcesrv_call_state *dce_call, TALLOC
for (i=0; i<el->num_values; i++) {
struct ldb_message **res2;
const char * const attrs2[2] = { "objectSid", NULL };
- ret = samdb_search(a_state->sam_ctx, mem_ctx, NULL,
+ ret = gendb_search(a_state->sam_ctx, mem_ctx, NULL,
&res2, attrs2, "dn=%s",
(char *)el->values[i].data);
if (ret != 1)
@@ -1902,7 +1902,7 @@ static NTSTATUS samr_OpenAlias(struct dcesrv_call_state *dce_call, TALLOC_CTX *m
return NT_STATUS_NO_MEMORY;
/* search for the group record */
- ret = samdb_search(d_state->sam_ctx,
+ ret = gendb_search(d_state->sam_ctx,
mem_ctx, d_state->domain_dn, &msgs, attrs,
"(&(objectSid=%s)(objectclass=group)"
"(|(grouptype=%s)(grouptype=%s)))",
@@ -1973,7 +1973,7 @@ static NTSTATUS samr_QueryAliasInfo(struct dcesrv_call_state *dce_call, TALLOC_C
a_state = h->data;
/* pull all the alias attributes */
- ret = samdb_search(a_state->sam_ctx, mem_ctx, NULL, &res, attrs,
+ ret = gendb_search(a_state->sam_ctx, mem_ctx, NULL, &res, attrs,
"dn=%s", a_state->account_dn);
if (ret != 1) {
return NT_STATUS_INTERNAL_DB_CORRUPTION;
@@ -2092,7 +2092,7 @@ static NTSTATUS samr_AddAliasMember(struct dcesrv_call_state *dce_call, TALLOC_C
if (sidstr == NULL)
return NT_STATUS_INVALID_PARAMETER;
- ret = samdb_search(d_state->sam_ctx, mem_ctx, NULL,
+ ret = gendb_search(d_state->sam_ctx, mem_ctx, NULL,
&msgs, attrs, "(objectsid=%s)", sidstr);
if (ret == 1) {
@@ -2269,7 +2269,7 @@ static NTSTATUS samr_GetMembersInAlias(struct dcesrv_call_state *dce_call, TALLO
a_state = h->data;
d_state = a_state->domain_state;
- ret = samdb_search(d_state->sam_ctx, mem_ctx, NULL, &msgs, attrs,
+ ret = gendb_search(d_state->sam_ctx, mem_ctx, NULL, &msgs, attrs,
"dn=%s", a_state->account_dn);
if (ret != 1)
@@ -2292,7 +2292,7 @@ static NTSTATUS samr_GetMembersInAlias(struct dcesrv_call_state *dce_call, TALLO
for (i=0; i<el->num_values; i++) {
struct ldb_message **msgs2;
const char * const attrs2[2] = { "objectSid", NULL };
- ret = samdb_search(a_state->sam_ctx, mem_ctx, NULL,
+ ret = gendb_search(a_state->sam_ctx, mem_ctx, NULL,
&msgs2, attrs2, "dn=%s",
(char *)el->values[i].data);
if (ret != 1)
@@ -2339,7 +2339,7 @@ static NTSTATUS samr_OpenUser(struct dcesrv_call_state *dce_call, TALLOC_CTX *me
}
/* search for the user record */
- ret = samdb_search(d_state->sam_ctx,
+ ret = gendb_search(d_state->sam_ctx,
mem_ctx, d_state->domain_dn, &msgs, attrs,
"(&(objectSid=%s)(objectclass=user))",
sidstr);
@@ -2431,7 +2431,7 @@ static NTSTATUS samr_QueryUserInfo(struct dcesrv_call_state *dce_call, TALLOC_CT
a_state = h->data;
/* pull all the user attributes */
- ret = samdb_search(a_state->sam_ctx, mem_ctx, NULL, &res, NULL,
+ ret = gendb_search(a_state->sam_ctx, mem_ctx, NULL, &res, NULL,
"dn=%s", a_state->account_dn);
if (ret != 1) {
return NT_STATUS_INTERNAL_DB_CORRUPTION;
@@ -3362,7 +3362,7 @@ static NTSTATUS samr_GetDomPwInfo(struct dcesrv_call_state *dce_call, TALLOC_CTX
return NT_STATUS_INVALID_SYSTEM_SERVICE;
}
- ret = samdb_search(sam_ctx,
+ ret = gendb_search(sam_ctx,
mem_ctx, NULL, &msgs, attrs,
"(&(name=%s)(objectclass=domain))",
lp_workgroup());
diff --git a/source4/rpc_server/samr/samr_password.c b/source4/rpc_server/samr/samr_password.c
index 468f02d831..f5390cc1d5 100644
--- a/source4/rpc_server/samr/samr_password.c
+++ b/source4/rpc_server/samr/samr_password.c
@@ -50,7 +50,7 @@ NTSTATUS samr_ChangePasswordUser(struct dcesrv_call_state *dce_call, TALLOC_CTX
a_state = h->data;
/* fetch the old hashes */
- ret = samdb_search(a_state->sam_ctx, mem_ctx, NULL, &res, attrs,
+ ret = gendb_search(a_state->sam_ctx, mem_ctx, NULL, &res, attrs,
"dn=%s", a_state->account_dn);
if (ret != 1) {
return NT_STATUS_INTERNAL_DB_CORRUPTION;
@@ -167,7 +167,7 @@ NTSTATUS samr_OemChangePasswordUser2(struct dcesrv_call_state *dce_call, TALLOC_
/* we need the users dn and the domain dn (derived from the
user SID). We also need the current lm password hash in
order to decrypt the incoming password */
- ret = samdb_search(sam_ctx,
+ ret = gendb_search(sam_ctx,
mem_ctx, NULL, &res, attrs,
"(&(sAMAccountName=%s)(objectclass=user))",
r->in.account->string);
@@ -295,7 +295,7 @@ NTSTATUS samr_ChangePasswordUser3(struct dcesrv_call_state *dce_call,
/* we need the users dn and the domain dn (derived from the
user SID). We also need the current lm and nt password hashes
in order to decrypt the incoming passwords */
- ret = samdb_search(sam_ctx,
+ ret = gendb_search(sam_ctx,
mem_ctx, NULL, &res, attrs,
"(&(sAMAccountName=%s)(objectclass=user))",
r->in.account->string);
@@ -400,7 +400,7 @@ NTSTATUS samr_ChangePasswordUser3(struct dcesrv_call_state *dce_call,
return NT_STATUS_OK;
failed:
- ret = samdb_search(sam_ctx,
+ ret = gendb_search(sam_ctx,
mem_ctx, NULL, &res, dom_attrs,
"dn=%s", domain_dn);
@@ -517,7 +517,7 @@ NTSTATUS samdb_set_password(void *ctx, TALLOC_CTX *mem_ctx,
unix_to_nt_time(&now_nt, now);
/* pull all the user parameters */
- count = samdb_search(ctx, mem_ctx, NULL, &res, user_attrs, "dn=%s", user_dn);
+ count = gendb_search(ctx, mem_ctx, NULL, &res, user_attrs, "dn=%s", user_dn);
if (count != 1) {
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
@@ -533,7 +533,7 @@ NTSTATUS samdb_set_password(void *ctx, TALLOC_CTX *mem_ctx,
pwdLastSet = samdb_result_uint64(res[0], "pwdLastSet", 0);
/* pull the domain parameters */
- count = samdb_search(ctx, mem_ctx, NULL, &res, domain_attrs, "dn=%s", domain_dn);
+ count = gendb_search(ctx, mem_ctx, NULL, &res, domain_attrs, "dn=%s", domain_dn);
if (count != 1) {
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}