summaryrefslogtreecommitdiff
path: root/source3/passdb
diff options
context:
space:
mode:
Diffstat (limited to 'source3/passdb')
-rw-r--r--source3/passdb/pdb_interface.c8
-rw-r--r--source3/passdb/pdb_ipa.c8
-rw-r--r--source3/passdb/pdb_ldap.c54
-rw-r--r--source3/passdb/pdb_ldap_util.c6
-rw-r--r--source3/passdb/pdb_smbpasswd.c5
-rw-r--r--source3/passdb/pdb_tdb.c2
-rw-r--r--source3/passdb/secrets.c2
7 files changed, 41 insertions, 44 deletions
diff --git a/source3/passdb/pdb_interface.c b/source3/passdb/pdb_interface.c
index fee1e00231..7a73fbfacf 100644
--- a/source3/passdb/pdb_interface.c
+++ b/source3/passdb/pdb_interface.c
@@ -458,11 +458,9 @@ static NTSTATUS pdb_default_create_user(struct pdb_methods *methods,
fstring name2;
if ((acb_info & ACB_NORMAL) && name[strlen(name)-1] != '$') {
- add_script = talloc_strdup(tmp_ctx,
- lp_adduser_script());
+ add_script = lp_adduser_script(tmp_ctx);
} else {
- add_script = talloc_strdup(tmp_ctx,
- lp_addmachine_script());
+ add_script = lp_addmachine_script(tmp_ctx);
}
if (!add_script || add_script[0] == '\0') {
@@ -556,7 +554,7 @@ static int smb_delete_user(const char *unix_user)
return -1;
}
- del_script = talloc_strdup(talloc_tos(), lp_deluser_script());
+ del_script = lp_deluser_script(talloc_tos());
if (!del_script || !*del_script) {
return -1;
}
diff --git a/source3/passdb/pdb_ipa.c b/source3/passdb/pdb_ipa.c
index c4c3bc8e11..bbd3339f2f 100644
--- a/source3/passdb/pdb_ipa.c
+++ b/source3/passdb/pdb_ipa.c
@@ -121,10 +121,10 @@ static char *get_account_dn(const char *name)
if (name[strlen(name)-1] == '$') {
dn = talloc_asprintf(talloc_tos(), "uid=%s,%s", escape_name,
- lp_ldap_machine_suffix());
+ lp_ldap_machine_suffix(talloc_tos()));
} else {
dn = talloc_asprintf(talloc_tos(), "uid=%s,%s", escape_name,
- lp_ldap_user_suffix());
+ lp_ldap_user_suffix(talloc_tos()));
}
SAFE_FREE(escape_name);
@@ -1364,11 +1364,11 @@ static NTSTATUS ipasam_create_user(struct pdb_methods *pdb_methods,
if (name[strlen(name)-1] == '$') {
dn = talloc_asprintf(tmp_ctx, "uid=%s,%s",
escape_username,
- lp_ldap_machine_suffix());
+ lp_ldap_machine_suffix(talloc_tos()));
} else {
dn = talloc_asprintf(tmp_ctx, "uid=%s,%s",
escape_username,
- lp_ldap_user_suffix());
+ lp_ldap_user_suffix(talloc_tos()));
}
SAFE_FREE(escape_username);
if (!dn) {
diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c
index 68ced934d3..e4dcbc370c 100644
--- a/source3/passdb/pdb_ldap.c
+++ b/source3/passdb/pdb_ldap.c
@@ -190,9 +190,9 @@ static NTSTATUS ldapsam_get_seq_num(struct pdb_methods *my_methods, time_t *seq_
return ntstatus;
}
- if (!smbldap_has_naming_context(ldap_state->smbldap_state->ldap_struct, lp_ldap_suffix())) {
+ if (!smbldap_has_naming_context(ldap_state->smbldap_state->ldap_struct, lp_ldap_suffix(talloc_tos()))) {
DEBUG(3,("ldapsam_get_seq_num: DIT not configured to hold %s "
- "as top-level namingContext\n", lp_ldap_suffix()));
+ "as top-level namingContext\n", lp_ldap_suffix(talloc_tos())));
return ntstatus;
}
@@ -215,7 +215,7 @@ static NTSTATUS ldapsam_get_seq_num(struct pdb_methods *my_methods, time_t *seq_
attrs[0] = talloc_strdup(mem_ctx, "syncreplCookie");
attrs[1] = NULL;
suffix = talloc_asprintf(mem_ctx,
- "cn=syncrepl%d,%s", rid, lp_ldap_suffix());
+ "cn=syncrepl%d,%s", rid, lp_ldap_suffix(talloc_tos()));
if (!suffix) {
ntstatus = NT_STATUS_NO_MEMORY;
goto done;
@@ -227,7 +227,7 @@ static NTSTATUS ldapsam_get_seq_num(struct pdb_methods *my_methods, time_t *seq_
attrs[0] = talloc_strdup(mem_ctx, "contextCSN");
attrs[1] = NULL;
suffix = talloc_asprintf(mem_ctx,
- "cn=ldapsync,%s", lp_ldap_suffix());
+ "cn=ldapsync,%s", lp_ldap_suffix(talloc_tos()));
if (!suffix) {
ntstatus = NT_STATUS_NO_MEMORY;
@@ -1998,7 +1998,7 @@ static NTSTATUS ldapsam_rename_sam_account(struct pdb_methods *my_methods,
oldname = pdb_get_username(old_acct);
/* rename the posix user */
- rename_script = talloc_strdup(talloc_tos(), lp_renameuser_script());
+ rename_script = lp_renameuser_script(talloc_tos());
if (rename_script == NULL) {
return NT_STATUS_NO_MEMORY;
}
@@ -2219,12 +2219,12 @@ static NTSTATUS ldapsam_add_sam_account(struct pdb_methods *my_methods, struct s
dn = talloc_asprintf(ctx,
"uid=%s,%s",
escape_username,
- lp_ldap_machine_suffix());
+ lp_ldap_machine_suffix(talloc_tos()));
} else {
dn = talloc_asprintf(ctx,
"uid=%s,%s",
escape_username,
- lp_ldap_user_suffix());
+ lp_ldap_user_suffix(talloc_tos()));
}
SAFE_FREE(escape_username);
@@ -2291,7 +2291,7 @@ static int ldapsam_search_one_group (struct ldapsam_privates *ldap_state,
attr_list = get_attr_list(NULL, groupmap_attr_list);
rc = smbldap_search(ldap_state->smbldap_state,
- lp_ldap_suffix (), scope,
+ lp_ldap_suffix (talloc_tos()), scope,
filter, attr_list, 0, result);
TALLOC_FREE(attr_list);
@@ -2623,7 +2623,7 @@ static NTSTATUS ldapsam_enum_group_members(struct pdb_methods *methods,
goto done;
}
- rc = smbldap_search(conn, lp_ldap_suffix(),
+ rc = smbldap_search(conn, lp_ldap_suffix(talloc_tos()),
LDAP_SCOPE_SUBTREE, filter, id_attrs, 0,
&result);
@@ -2691,7 +2691,7 @@ static NTSTATUS ldapsam_enum_group_members(struct pdb_methods *methods,
goto done;
}
- rc = smbldap_search(conn, lp_ldap_suffix(),
+ rc = smbldap_search(conn, lp_ldap_suffix(talloc_tos()),
LDAP_SCOPE_SUBTREE, filter, sid_attrs, 0,
&result);
@@ -2747,7 +2747,7 @@ static NTSTATUS ldapsam_enum_group_members(struct pdb_methods *methods,
LDAP_OBJ_SAMBASAMACCOUNT,
gidstr);
- rc = smbldap_search(conn, lp_ldap_suffix(),
+ rc = smbldap_search(conn, lp_ldap_suffix(talloc_tos()),
LDAP_SCOPE_SUBTREE, filter, sid_attrs, 0,
&result);
@@ -2834,7 +2834,7 @@ static NTSTATUS ldapsam_enum_group_memberships(struct pdb_methods *methods,
goto done;
}
- rc = smbldap_search(conn, lp_ldap_suffix(),
+ rc = smbldap_search(conn, lp_ldap_suffix(talloc_tos()),
LDAP_SCOPE_SUBTREE, filter, attrs, 0, &result);
if (rc != LDAP_SUCCESS)
@@ -2875,7 +2875,7 @@ static NTSTATUS ldapsam_enum_group_memberships(struct pdb_methods *methods,
goto done;
}
- rc = smbldap_search(conn, lp_ldap_suffix(),
+ rc = smbldap_search(conn, lp_ldap_suffix(talloc_tos()),
LDAP_SCOPE_SUBTREE, filter, attrs, 0, &result);
if (rc != LDAP_SUCCESS)
@@ -3052,7 +3052,7 @@ static NTSTATUS ldapsam_add_group_mapping_entry(struct pdb_methods *methods,
goto done;
}
- rc = smbldap_search(ldap_state->smbldap_state, lp_ldap_suffix(),
+ rc = smbldap_search(ldap_state->smbldap_state, lp_ldap_suffix(talloc_tos()),
LDAP_SCOPE_SUBTREE, filter, attrs, True, &msg);
talloc_autofree_ldapmsg(mem_ctx, msg);
@@ -3113,7 +3113,7 @@ static NTSTATUS ldapsam_add_group_mapping_entry(struct pdb_methods *methods,
dn = talloc_asprintf(mem_ctx, "sambaSid=%s,%s",
sid_string_talloc(mem_ctx, &map->sid),
- lp_ldap_group_suffix());
+ lp_ldap_group_suffix(talloc_tos()));
if (dn == NULL) {
result = NT_STATUS_NO_MEMORY;
goto done;
@@ -3334,7 +3334,7 @@ static NTSTATUS ldapsam_setsamgrent(struct pdb_methods *my_methods,
return NT_STATUS_NO_MEMORY;
}
attr_list = get_attr_list( NULL, groupmap_attr_list );
- rc = smbldap_search(ldap_state->smbldap_state, lp_ldap_suffix(),
+ rc = smbldap_search(ldap_state->smbldap_state, lp_ldap_suffix(talloc_tos()),
LDAP_SCOPE_SUBTREE, filter,
attr_list, 0, &ldap_state->result);
TALLOC_FREE(attr_list);
@@ -3343,7 +3343,7 @@ static NTSTATUS ldapsam_setsamgrent(struct pdb_methods *my_methods,
DEBUG(0, ("ldapsam_setsamgrent: LDAP search failed: %s\n",
ldap_err2string(rc)));
DEBUG(3, ("ldapsam_setsamgrent: Query was: %s, %s\n",
- lp_ldap_suffix(), filter));
+ lp_ldap_suffix(talloc_tos()), filter));
ldap_msgfree(ldap_state->result);
ldap_state->result = NULL;
TALLOC_FREE(filter);
@@ -3764,7 +3764,7 @@ static NTSTATUS ldapsam_alias_memberships(struct pdb_methods *methods,
result = ldap_state->search_cache.result;
ldap_state->search_cache.result = NULL;
} else {
- rc = smbldap_search(ldap_state->smbldap_state, lp_ldap_suffix(),
+ rc = smbldap_search(ldap_state->smbldap_state, lp_ldap_suffix(talloc_tos()),
LDAP_SCOPE_SUBTREE, filter, attrs, 0, &result);
if (rc != LDAP_SUCCESS) {
return NT_STATUS_UNSUCCESSFUL;
@@ -4076,7 +4076,7 @@ static NTSTATUS ldapsam_lookup_rids(struct pdb_methods *methods,
}
rc = smbldap_search(ldap_state->smbldap_state,
- lp_ldap_user_suffix(),
+ lp_ldap_user_suffix(talloc_tos()),
LDAP_SCOPE_SUBTREE, filter, ldap_attrs, 0,
&msg);
talloc_autofree_ldapmsg(mem_ctx, msg);
@@ -4144,7 +4144,7 @@ static NTSTATUS ldapsam_lookup_rids(struct pdb_methods *methods,
}
rc = smbldap_search(ldap_state->smbldap_state,
- lp_ldap_suffix(),
+ lp_ldap_suffix(talloc_tos()),
LDAP_SCOPE_SUBTREE, filter, ldap_attrs, 0,
&msg);
talloc_autofree_ldapmsg(mem_ctx, msg);
@@ -4573,12 +4573,12 @@ static bool ldapsam_search_users(struct pdb_methods *methods,
state->connection = ldap_state->smbldap_state;
if ((acct_flags != 0) && ((acct_flags & ACB_NORMAL) != 0))
- state->base = lp_ldap_user_suffix();
+ state->base = lp_ldap_user_suffix(talloc_tos());
else if ((acct_flags != 0) &&
((acct_flags & (ACB_WSTRUST|ACB_SVRTRUST|ACB_DOMTRUST)) != 0))
- state->base = lp_ldap_machine_suffix();
+ state->base = lp_ldap_machine_suffix(talloc_tos());
else
- state->base = lp_ldap_suffix();
+ state->base = lp_ldap_suffix(talloc_tos());
state->acct_flags = acct_flags;
state->base = talloc_strdup(search, state->base);
@@ -4746,7 +4746,7 @@ static bool ldapsam_search_grouptype(struct pdb_methods *methods,
state->connection = ldap_state->smbldap_state;
- state->base = talloc_strdup(search, lp_ldap_suffix());
+ state->base = lp_ldap_suffix(search);
state->connection = ldap_state->smbldap_state;
state->scope = LDAP_SCOPE_SUBTREE;
state->filter = talloc_asprintf(search, "(&(objectclass=%s)"
@@ -5345,9 +5345,9 @@ static NTSTATUS ldapsam_create_user(struct pdb_methods *my_methods,
}
if (is_machine) {
- dn = talloc_asprintf(tmp_ctx, "uid=%s,%s", escape_name, lp_ldap_machine_suffix ());
+ dn = talloc_asprintf(tmp_ctx, "uid=%s,%s", escape_name, lp_ldap_machine_suffix (talloc_tos()));
} else {
- dn = talloc_asprintf(tmp_ctx, "uid=%s,%s", escape_name, lp_ldap_user_suffix ());
+ dn = talloc_asprintf(tmp_ctx, "uid=%s,%s", escape_name, lp_ldap_user_suffix (talloc_tos()));
}
SAFE_FREE(escape_name);
@@ -5610,7 +5610,7 @@ static NTSTATUS ldapsam_create_dom_group(struct pdb_methods *my_methods,
return NT_STATUS_NO_MEMORY;
}
- dn = talloc_asprintf(tmp_ctx, "cn=%s,%s", escape_name, lp_ldap_group_suffix());
+ dn = talloc_asprintf(tmp_ctx, "cn=%s,%s", escape_name, lp_ldap_group_suffix(talloc_tos()));
SAFE_FREE(escape_name);
diff --git a/source3/passdb/pdb_ldap_util.c b/source3/passdb/pdb_ldap_util.c
index 4c86201fb0..522c64fb5d 100644
--- a/source3/passdb/pdb_ldap_util.c
+++ b/source3/passdb/pdb_ldap_util.c
@@ -53,7 +53,7 @@ static NTSTATUS add_new_domain_account_policies(struct smbldap_state *ldap_state
if (asprintf(&dn, "%s=%s,%s",
get_attr_key2string(dominfo_attr_list, LDAP_ATTR_DOMAIN),
- escape_domain_name, lp_ldap_suffix()) < 0) {
+ escape_domain_name, lp_ldap_suffix(talloc_tos())) < 0) {
SAFE_FREE(escape_domain_name);
return NT_STATUS_NO_MEMORY;
}
@@ -174,7 +174,7 @@ static NTSTATUS add_new_domain_info(struct smbldap_state *ldap_state,
if (asprintf(&dn, "%s=%s,%s",
get_attr_key2string(dominfo_attr_list, LDAP_ATTR_DOMAIN),
- escape_domain_name, lp_ldap_suffix()) < 0) {
+ escape_domain_name, lp_ldap_suffix(talloc_tos())) < 0) {
SAFE_FREE(escape_domain_name);
return NT_STATUS_NO_MEMORY;
}
@@ -285,7 +285,7 @@ NTSTATUS smbldap_search_domain_info(struct smbldap_state *ldap_state,
if (rc != LDAP_SUCCESS) {
DEBUG(2,("smbldap_search_domain_info: Problem during LDAPsearch: %s\n", ldap_err2string (rc)));
- DEBUG(2,("smbldap_search_domain_info: Query was: %s, %s\n", lp_ldap_suffix(), filter));
+ DEBUG(2,("smbldap_search_domain_info: Query was: %s, %s\n", lp_ldap_suffix(talloc_tos()), filter));
goto failed;
}
diff --git a/source3/passdb/pdb_smbpasswd.c b/source3/passdb/pdb_smbpasswd.c
index 99b275de40..0703ea4607 100644
--- a/source3/passdb/pdb_smbpasswd.c
+++ b/source3/passdb/pdb_smbpasswd.c
@@ -1448,7 +1448,7 @@ static NTSTATUS smbpasswd_rename_sam_account (struct pdb_methods *my_methods,
TALLOC_CTX *ctx = talloc_tos();
NTSTATUS ret = NT_STATUS_UNSUCCESSFUL;
- if (!*(lp_renameuser_script()))
+ if (!*(lp_renameuser_script(talloc_tos())))
goto done;
if ( !(new_acct = samu_new( NULL )) ) {
@@ -1468,8 +1468,7 @@ static NTSTATUS smbpasswd_rename_sam_account (struct pdb_methods *my_methods,
interim_account = True;
/* rename the posix user */
- rename_script = talloc_strdup(ctx,
- lp_renameuser_script());
+ rename_script = lp_renameuser_script(ctx);
if (!rename_script) {
ret = NT_STATUS_NO_MEMORY;
goto done;
diff --git a/source3/passdb/pdb_tdb.c b/source3/passdb/pdb_tdb.c
index 8b923d6cd8..e0b6261eb9 100644
--- a/source3/passdb/pdb_tdb.c
+++ b/source3/passdb/pdb_tdb.c
@@ -991,7 +991,7 @@ static NTSTATUS tdbsam_rename_sam_account(struct pdb_methods *my_methods,
return NT_STATUS_NO_MEMORY;
}
- rename_script = talloc_strdup(new_acct, lp_renameuser_script());
+ rename_script = lp_renameuser_script(new_acct);
if (!rename_script) {
TALLOC_FREE(new_acct);
return NT_STATUS_NO_MEMORY;
diff --git a/source3/passdb/secrets.c b/source3/passdb/secrets.c
index 83d3e72059..dff855cce6 100644
--- a/source3/passdb/secrets.c
+++ b/source3/passdb/secrets.c
@@ -332,7 +332,7 @@ bool fetch_ldap_pw(char **dn, char** pw)
char *key = NULL;
size_t size = 0;
- *dn = smb_xstrdup(lp_ldap_admin_dn());
+ *dn = smb_xstrdup(lp_ldap_admin_dn(talloc_tos()));
if (asprintf(&key, "%s/%s", SECRETS_LDAP_BIND_PW, *dn) < 0) {
SAFE_FREE(*dn);