diff options
author | Ralph Boehme <slow@samba.org> | 2019-11-05 09:46:21 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2019-11-27 10:25:36 +0000 |
commit | ca2e49fe42087678f971bde26ca05c91fb6f95b3 (patch) | |
tree | 92a17ca2ba48afdf2a18eb2db9a52b0607b43f61 | |
parent | 050c28364aa1b476d33ea726ecb6cbd9d26af5d8 (diff) | |
download | samba-ca2e49fe42087678f971bde26ca05c91fb6f95b3.tar.gz |
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>
-rw-r--r-- | docs-xml/smbdotconf/ldap/ldapsuffix.xml | 1 | ||||
-rw-r--r-- | source3/lib/smbldap.c | 2 | ||||
-rw-r--r-- | source3/passdb/pdb_ldap.c | 34 | ||||
-rw-r--r-- | source3/passdb/pdb_ldap_util.c | 6 |
4 files changed, 22 insertions, 21 deletions
diff --git a/docs-xml/smbdotconf/ldap/ldapsuffix.xml b/docs-xml/smbdotconf/ldap/ldapsuffix.xml index aeff0dd6f9b..0ecb9c79222 100644 --- a/docs-xml/smbdotconf/ldap/ldapsuffix.xml +++ b/docs-xml/smbdotconf/ldap/ldapsuffix.xml @@ -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> diff --git a/source3/lib/smbldap.c b/source3/lib/smbldap.c index 7a96714ad1a..34c841f9243 100644 --- a/source3/lib/smbldap.c +++ b/source3/lib/smbldap.c @@ -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); } diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c index 2aeb62af3c0..36b4aa61fd4 100644 --- a/source3/passdb/pdb_ldap.c +++ b/source3/passdb/pdb_ldap.c @@ -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)" diff --git a/source3/passdb/pdb_ldap_util.c b/source3/passdb/pdb_ldap_util.c index f9e6cbbc3a9..6fac6e209c3 100644 --- a/source3/passdb/pdb_ldap_util.c +++ b/source3/passdb/pdb_ldap_util.c @@ -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; } |