]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbdotconf: mark "ldap suffix" with constant="1"
authorRalph Boehme <slow@samba.org>
Tue, 5 Nov 2019 08:46:21 +0000 (09:46 +0100)
committerStefan Metzmacher <metze@samba.org>
Wed, 27 Nov 2019 10:25:36 +0000 (10:25 +0000)
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>
docs-xml/smbdotconf/ldap/ldapsuffix.xml
source3/lib/smbldap.c
source3/passdb/pdb_ldap.c
source3/passdb/pdb_ldap_util.c

index aeff0dd6f9bd21ee064de0f6523486f5d60d0167..0ecb9c7922280fcdac6f94bb005d1c478d997bea 100644 (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>
index 7a96714ad1a1b795b34fd08cd2e93171cc184534..34c841f92434753096747cbd0488b598ca0f10b3 100644 (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);
 }
index 2aeb62af3c0702510e8853cc2a3a9c64d777b8ea..36b4aa61fd44f668c79807379a85f00c7e81fb35 100644 (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)"
index f9e6cbbc3a9dc189e5f4470582b306a765a91143..6fac6e209c3b8d1061251f13287e6bea019a6236 100644 (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;
        }