1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-27 22:50:26 +03:00

smbdotconf: mark "ldap suffix" with constant="1"

Due to the use of append_ldap_suffix() where Globals.ldap_suffix was used
directly in the dependent options like "ldap group suffix", we can just mark
this option as const thereby removing substitution from "ldap suffix".

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
Ralph Boehme 2019-11-05 09:46:21 +01:00 committed by Stefan Metzmacher
parent 050c28364a
commit ca2e49fe42
4 changed files with 22 additions and 21 deletions

View File

@ -1,6 +1,7 @@
<samba:parameter name="ldap suffix"
context="G"
type="string"
constant="1"
xmlns:samba="http://www.samba.org/samba/DTD/samba-doc">
<description>
<para>Specifies the base for all ldap suffixes and for storing the sambaDomain object.</para>

View File

@ -1689,7 +1689,7 @@ int smbldap_search_suffix (struct smbldap_state *ldap_state,
const char *filter, const char **search_attr,
LDAPMessage ** result)
{
return smbldap_search(ldap_state, lp_ldap_suffix(talloc_tos()),
return smbldap_search(ldap_state, lp_ldap_suffix(),
LDAP_SCOPE_SUBTREE,
filter, search_attr, 0, result);
}

View File

@ -193,9 +193,9 @@ static NTSTATUS ldapsam_get_seq_num(struct pdb_methods *my_methods, time_t *seq_
if (!smbldap_has_naming_context(
smbldap_get_ldap(ldap_state->smbldap_state),
lp_ldap_suffix(talloc_tos()))) {
lp_ldap_suffix())) {
DEBUG(3,("ldapsam_get_seq_num: DIT not configured to hold %s "
"as top-level namingContext\n", lp_ldap_suffix(talloc_tos())));
"as top-level namingContext\n", lp_ldap_suffix()));
return ntstatus;
}
@ -218,7 +218,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(talloc_tos()));
"cn=syncrepl%d,%s", rid, lp_ldap_suffix());
if (!suffix) {
ntstatus = NT_STATUS_NO_MEMORY;
goto done;
@ -230,7 +230,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(talloc_tos()));
"cn=ldapsync,%s", lp_ldap_suffix());
if (!suffix) {
ntstatus = NT_STATUS_NO_MEMORY;
@ -2374,7 +2374,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 (talloc_tos()), scope,
lp_ldap_suffix(), scope,
filter, attr_list, 0, result);
TALLOC_FREE(attr_list);
@ -2709,7 +2709,7 @@ static NTSTATUS ldapsam_enum_group_members(struct pdb_methods *methods,
goto done;
}
rc = smbldap_search(conn, lp_ldap_suffix(talloc_tos()),
rc = smbldap_search(conn, lp_ldap_suffix(),
LDAP_SCOPE_SUBTREE, filter, id_attrs, 0,
&result);
@ -2777,7 +2777,7 @@ static NTSTATUS ldapsam_enum_group_members(struct pdb_methods *methods,
goto done;
}
rc = smbldap_search(conn, lp_ldap_suffix(talloc_tos()),
rc = smbldap_search(conn, lp_ldap_suffix(),
LDAP_SCOPE_SUBTREE, filter, sid_attrs, 0,
&result);
@ -2833,7 +2833,7 @@ static NTSTATUS ldapsam_enum_group_members(struct pdb_methods *methods,
LDAP_OBJ_SAMBASAMACCOUNT,
gidstr);
rc = smbldap_search(conn, lp_ldap_suffix(talloc_tos()),
rc = smbldap_search(conn, lp_ldap_suffix(),
LDAP_SCOPE_SUBTREE, filter, sid_attrs, 0,
&result);
@ -2921,7 +2921,7 @@ static NTSTATUS ldapsam_enum_group_memberships(struct pdb_methods *methods,
goto done;
}
rc = smbldap_search(conn, lp_ldap_suffix(talloc_tos()),
rc = smbldap_search(conn, lp_ldap_suffix(),
LDAP_SCOPE_SUBTREE, filter, attrs, 0, &result);
if (rc != LDAP_SUCCESS)
@ -2970,7 +2970,7 @@ static NTSTATUS ldapsam_enum_group_memberships(struct pdb_methods *methods,
goto done;
}
rc = smbldap_search(conn, lp_ldap_suffix(talloc_tos()),
rc = smbldap_search(conn, lp_ldap_suffix(),
LDAP_SCOPE_SUBTREE, filter, attrs, 0, &result);
if (rc != LDAP_SUCCESS)
@ -3159,7 +3159,7 @@ static NTSTATUS ldapsam_add_group_mapping_entry(struct pdb_methods *methods,
goto done;
}
rc = smbldap_search(ldap_state->smbldap_state, lp_ldap_suffix(talloc_tos()),
rc = smbldap_search(ldap_state->smbldap_state, lp_ldap_suffix(),
LDAP_SCOPE_SUBTREE, filter, attrs, True, &msg);
smbldap_talloc_autofree_ldapmsg(mem_ctx, msg);
@ -3460,7 +3460,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(talloc_tos()),
rc = smbldap_search(ldap_state->smbldap_state, lp_ldap_suffix(),
LDAP_SCOPE_SUBTREE, filter,
attr_list, 0, &ldap_state->result);
TALLOC_FREE(attr_list);
@ -3469,7 +3469,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(talloc_tos()), filter));
lp_ldap_suffix(), filter));
ldap_msgfree(ldap_state->result);
ldap_state->result = NULL;
TALLOC_FREE(filter);
@ -3898,7 +3898,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(talloc_tos()),
rc = smbldap_search(ldap_state->smbldap_state, lp_ldap_suffix(),
LDAP_SCOPE_SUBTREE, filter, attrs, 0, &result);
if (rc != LDAP_SUCCESS) {
return NT_STATUS_UNSUCCESSFUL;
@ -4281,7 +4281,7 @@ static NTSTATUS ldapsam_lookup_rids(struct pdb_methods *methods,
}
rc = smbldap_search(ldap_state->smbldap_state,
lp_ldap_suffix(talloc_tos()),
lp_ldap_suffix(),
LDAP_SCOPE_SUBTREE, filter, ldap_attrs, 0,
&msg);
smbldap_talloc_autofree_ldapmsg(mem_ctx, msg);
@ -4720,7 +4720,7 @@ static bool ldapsam_search_users(struct pdb_methods *methods,
((acct_flags & (ACB_WSTRUST|ACB_SVRTRUST|ACB_DOMTRUST)) != 0))
state->base = lp_ldap_machine_suffix(talloc_tos());
else
state->base = lp_ldap_suffix(talloc_tos());
state->base = lp_ldap_suffix();
state->acct_flags = acct_flags;
state->base = talloc_strdup(search, state->base);
@ -4889,7 +4889,7 @@ static bool ldapsam_search_grouptype(struct pdb_methods *methods,
state->connection = ldap_state->smbldap_state;
state->base = lp_ldap_suffix(search);
state->base = lp_ldap_suffix();
state->connection = ldap_state->smbldap_state;
state->scope = LDAP_SCOPE_SUBTREE;
state->filter = talloc_asprintf(search, "(&(objectclass=%s)"

View File

@ -54,7 +54,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(talloc_tos())) < 0) {
escape_domain_name, lp_ldap_suffix()) < 0) {
SAFE_FREE(escape_domain_name);
return NT_STATUS_NO_MEMORY;
}
@ -176,7 +176,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(talloc_tos())) < 0) {
escape_domain_name, lp_ldap_suffix()) < 0) {
SAFE_FREE(escape_domain_name);
return NT_STATUS_NO_MEMORY;
}
@ -286,7 +286,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(talloc_tos()), filter));
DEBUG(2,("smbldap_search_domain_info: Query was: %s, %s\n", lp_ldap_suffix(), filter));
goto failed;
}