summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/include/passdb.h10
-rw-r--r--source3/passdb/pdb_interface.c38
-rw-r--r--source3/passdb/pdb_ldap.c27
-rw-r--r--source3/rpc_server/srv_samr_nt.c4
4 files changed, 30 insertions, 49 deletions
diff --git a/source3/include/passdb.h b/source3/include/passdb.h
index 293d18a42a..15f0701e9b 100644
--- a/source3/include/passdb.h
+++ b/source3/include/passdb.h
@@ -367,12 +367,11 @@ typedef struct pdb_context
size_t *p_num_alias_rids);
NTSTATUS (*pdb_lookup_rids)(struct pdb_context *context,
- TALLOC_CTX *mem_ctx,
const DOM_SID *domain_sid,
size_t num_rids,
uint32 *rids,
- const char ***pp_names,
- uint32 **attrs);
+ const char **pp_names,
+ uint32 *attrs);
NTSTATUS (*pdb_get_account_policy)(struct pdb_context *context,
int policy_index, uint32 *value);
@@ -491,12 +490,11 @@ typedef struct pdb_methods
size_t *p_num_alias_rids);
NTSTATUS (*lookup_rids)(struct pdb_methods *methods,
- TALLOC_CTX *mem_ctx,
const DOM_SID *domain_sid,
int num_rids,
uint32 *rids,
- const char ***pp_names,
- uint32 **attrs);
+ const char **pp_names,
+ uint32 *attrs);
NTSTATUS (*get_account_policy)(struct pdb_methods *methods,
int policy_index, uint32 *value);
diff --git a/source3/passdb/pdb_interface.c b/source3/passdb/pdb_interface.c
index 482f3e3c9b..9605349781 100644
--- a/source3/passdb/pdb_interface.c
+++ b/source3/passdb/pdb_interface.c
@@ -681,12 +681,11 @@ static NTSTATUS context_enum_alias_memberships(struct pdb_context *context,
}
static NTSTATUS context_lookup_rids(struct pdb_context *context,
- TALLOC_CTX *mem_ctx,
const DOM_SID *domain_sid,
size_t num_rids,
uint32 *rids,
- const char ***pp_names,
- uint32 **pp_attrs)
+ const char **pp_names,
+ uint32 *pp_attrs)
{
NTSTATUS ret = NT_STATUS_UNSUCCESSFUL;
@@ -696,7 +695,7 @@ static NTSTATUS context_lookup_rids(struct pdb_context *context,
}
return context->pdb_methods->lookup_rids(context->pdb_methods,
- mem_ctx, domain_sid, num_rids,
+ domain_sid, num_rids,
rids, pp_names, pp_attrs);
}
@@ -1398,12 +1397,11 @@ BOOL pdb_enum_alias_memberships(TALLOC_CTX *mem_ctx, const DOM_SID *domain_sid,
p_num_alias_rids));
}
-NTSTATUS pdb_lookup_rids(TALLOC_CTX *mem_ctx,
- const DOM_SID *domain_sid,
+NTSTATUS pdb_lookup_rids(const DOM_SID *domain_sid,
int num_rids,
uint32 *rids,
- const char ***names,
- uint32 **attrs)
+ const char **names,
+ uint32 *attrs)
{
struct pdb_context *pdb_context = pdb_get_static_context(False);
@@ -1411,7 +1409,7 @@ NTSTATUS pdb_lookup_rids(TALLOC_CTX *mem_ctx,
return NT_STATUS_NOT_IMPLEMENTED;
}
- return pdb_context->pdb_lookup_rids(pdb_context, mem_ctx, domain_sid,
+ return pdb_context->pdb_lookup_rids(pdb_context, domain_sid,
num_rids, rids, names, attrs);
}
@@ -1643,24 +1641,17 @@ NTSTATUS pdb_default_enum_group_members(struct pdb_methods *methods,
}
NTSTATUS pdb_default_lookup_rids(struct pdb_methods *methods,
- TALLOC_CTX *mem_ctx,
const DOM_SID *domain_sid,
int num_rids,
uint32 *rids,
- const char ***names,
- uint32 **attrs)
+ const char **names,
+ uint32 *attrs)
{
int i;
NTSTATUS result;
BOOL have_mapped = False;
BOOL have_unmapped = False;
- (*names) = TALLOC_ZERO_ARRAY(mem_ctx, const char *, num_rids);
- (*attrs) = TALLOC_ZERO_ARRAY(mem_ctx, uint32, num_rids);
-
- if ((num_rids != 0) && (((*names) == NULL) || ((*attrs) == NULL)))
- return NT_STATUS_NO_MEMORY;
-
if (!sid_equal(domain_sid, get_global_sam_sid())) {
/* TODO: Sooner or later we need to look up BUILTIN rids as
* well. -- vl */
@@ -1673,18 +1664,17 @@ NTSTATUS pdb_default_lookup_rids(struct pdb_methods *methods,
DOM_SID sid;
enum SID_NAME_USE type;
- (*attrs)[i] = SID_NAME_UNKNOWN;
+ attrs[i] = SID_NAME_UNKNOWN;
sid_copy(&sid, domain_sid);
sid_append_rid(&sid, rids[i]);
if (lookup_sid(&sid, domname, tmpname, &type)) {
- (*attrs)[i] = (uint32)type;
- (*names)[i] = talloc_strdup(mem_ctx, tmpname);
- if ((*names)[i] == NULL)
+ attrs[i] = (uint32)type;
+ names[i] = talloc_strdup(names, tmpname);
+ if (names[i] == NULL)
return NT_STATUS_NO_MEMORY;
- DEBUG(5,("lookup_rids: %s:%d\n", (*names)[i],
- (*attrs)[i]));
+ DEBUG(5,("lookup_rids: %s:%d\n", names[i], attrs[i]));
have_mapped = True;
} else {
have_unmapped = True;
diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c
index ef9eb81fbb..1254dba2b8 100644
--- a/source3/passdb/pdb_ldap.c
+++ b/source3/passdb/pdb_ldap.c
@@ -3514,12 +3514,11 @@ static NTSTATUS ldapsam_get_account_policy(struct pdb_methods *methods, int poli
}
static NTSTATUS ldapsam_lookup_rids(struct pdb_methods *methods,
- TALLOC_CTX *mem_ctx,
const DOM_SID *domain_sid,
int num_rids,
uint32 *rids,
- const char ***names,
- uint32 **attrs)
+ const char **names,
+ uint32 *attrs)
{
struct ldapsam_privates *ldap_state =
(struct ldapsam_privates *)methods->private_data;
@@ -3532,7 +3531,7 @@ static NTSTATUS ldapsam_lookup_rids(struct pdb_methods *methods,
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
if (!lp_parm_bool(-1, "ldapsam", "trusted", False))
- return pdb_default_lookup_rids(methods, mem_ctx, domain_sid,
+ return pdb_default_lookup_rids(methods, domain_sid,
num_rids, rids, names, attrs);
if (!sid_equal(domain_sid, get_global_sam_sid())) {
@@ -3541,14 +3540,8 @@ static NTSTATUS ldapsam_lookup_rids(struct pdb_methods *methods,
goto done;
}
- (*names) = TALLOC_ZERO_ARRAY(mem_ctx, const char *, num_rids);
- (*attrs) = TALLOC_ARRAY(mem_ctx, uint32, num_rids);
-
- if ((num_rids != 0) && (((*names) == NULL) || ((*attrs) == NULL)))
- return NT_STATUS_NO_MEMORY;
-
for (i=0; i<num_rids; i++)
- (*attrs)[i] = SID_NAME_UNKNOWN;
+ attrs[i] = SID_NAME_UNKNOWN;
allsids = SMB_STRDUP("");
if (allsids == NULL) return NT_STATUS_NO_MEMORY;
@@ -3618,9 +3611,9 @@ static NTSTATUS ldapsam_lookup_rids(struct pdb_methods *methods,
continue;
}
- (*attrs)[rid_index] = SID_NAME_USER;
- (*names)[rid_index] = talloc_strdup(mem_ctx, str);
- if ((*names)[rid_index] == NULL) return NT_STATUS_NO_MEMORY;
+ attrs[rid_index] = SID_NAME_USER;
+ names[rid_index] = talloc_strdup(names, str);
+ if (names[rid_index] == NULL) return NT_STATUS_NO_MEMORY;
num_mapped += 1;
}
@@ -3683,9 +3676,9 @@ static NTSTATUS ldapsam_lookup_rids(struct pdb_methods *methods,
continue;
}
- (*attrs)[rid_index] = SID_NAME_DOM_GRP;
- (*names)[rid_index] = talloc_strdup(mem_ctx, str);
- if ((*names)[rid_index] == NULL) return NT_STATUS_NO_MEMORY;
+ attrs[rid_index] = SID_NAME_DOM_GRP;
+ names[rid_index] = talloc_strdup(names, str);
+ if (names[rid_index] == NULL) return NT_STATUS_NO_MEMORY;
num_mapped += 1;
}
diff --git a/source3/rpc_server/srv_samr_nt.c b/source3/rpc_server/srv_samr_nt.c
index ac774355a7..65bb0ef1ab 100644
--- a/source3/rpc_server/srv_samr_nt.c
+++ b/source3/rpc_server/srv_samr_nt.c
@@ -1523,8 +1523,8 @@ NTSTATUS _samr_lookup_rids(pipes_struct *p, SAMR_Q_LOOKUP_RIDS *q_u, SAMR_R_LOOK
}
become_root(); /* lookup_sid can require root privs */
- r_u->status = pdb_lookup_rids(p->mem_ctx, &pol_sid, num_rids, q_u->rid,
- &names, &attrs);
+ r_u->status = pdb_lookup_rids(&pol_sid, num_rids, q_u->rid,
+ names, attrs);
unbecome_root();
done: