winbindd: Replace calls to domain->methods
authorChristof Schmitt <cs@samba.org>
Fri, 7 Oct 2016 23:31:40 +0000 (16:31 -0700)
committerJeremy Allison <jra@samba.org>
Tue, 11 Oct 2016 18:15:25 +0000 (20:15 +0200)
domain->methods is always set to cache_methods; call those functions
directly instead of going through the indirection.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/winbindd/winbindd_dual.c
source3/winbindd/winbindd_dual_srv.c
source3/winbindd/winbindd_misc.c
source3/winbindd/winbindd_pam.c

index c16b94e2be3459189be989939a5d01f5c1782839..c389e0013ad26ed465a7e976c5e32fd38556a79f 100644 (file)
@@ -939,7 +939,6 @@ static void account_lockout_policy_handler(struct tevent_context *ctx,
        struct winbindd_child *child =
                (struct winbindd_child *)private_data;
        TALLOC_CTX *mem_ctx = NULL;
-       struct winbindd_methods *methods;
        struct samr_DomInfo12 lockout_policy;
        NTSTATUS result;
 
@@ -955,13 +954,12 @@ static void account_lockout_policy_handler(struct tevent_context *ctx,
                return;         
        }
 
-       methods = child->domain->methods;
-
        mem_ctx = talloc_init("account_lockout_policy_handler ctx");
        if (!mem_ctx) {
                result = NT_STATUS_NO_MEMORY;
        } else {
-               result = methods->lockout_policy(child->domain, mem_ctx, &lockout_policy);
+               result = wb_cache_lockout_policy(child->domain, mem_ctx,
+                                                &lockout_policy);
        }
        TALLOC_FREE(mem_ctx);
 
index aed2781bd4c150c0d7864dc55300b1fb1714a258..4a581d33e0daf6466cfb0bef334205e5c10ca49b 100644 (file)
@@ -62,8 +62,8 @@ NTSTATUS _wbint_LookupSid(struct pipes_struct *p, struct wbint_LookupSid *r)
                return NT_STATUS_REQUEST_NOT_ACCEPTED;
        }
 
-       status = domain->methods->sid_to_name(domain, p->mem_ctx, r->in.sid,
-                                             &dom_name, &name, &type);
+       status = wb_cache_sid_to_name(domain, p->mem_ctx, r->in.sid,
+                                     &dom_name, &name, &type);
        reset_cm_connection_on_error(domain, status);
        if (!NT_STATUS_IS_OK(status)) {
                return status;
@@ -111,9 +111,9 @@ NTSTATUS _wbint_LookupName(struct pipes_struct *p, struct wbint_LookupName *r)
                return NT_STATUS_REQUEST_NOT_ACCEPTED;
        }
 
-       status = domain->methods->name_to_sid(
-               domain, p->mem_ctx, r->in.domain, r->in.name, r->in.flags,
-               r->out.sid, r->out.type);
+       status = wb_cache_name_to_sid(domain, p->mem_ctx, r->in.domain,
+                                     r->in.name, r->in.flags,
+                                     r->out.sid, r->out.type);
        reset_cm_connection_on_error(domain, status);
        return status;
 }
@@ -276,8 +276,8 @@ NTSTATUS _wbint_QueryUser(struct pipes_struct *p, struct wbint_QueryUser *r)
                return NT_STATUS_REQUEST_NOT_ACCEPTED;
        }
 
-       status = domain->methods->query_user(domain, p->mem_ctx, r->in.sid,
-                                            r->out.info);
+       status = wb_cache_query_user(domain, p->mem_ctx, r->in.sid,
+                                    r->out.info);
        reset_cm_connection_on_error(domain, status);
        return status;
 }
@@ -292,9 +292,11 @@ NTSTATUS _wbint_LookupUserAliases(struct pipes_struct *p,
                return NT_STATUS_REQUEST_NOT_ACCEPTED;
        }
 
-       status = domain->methods->lookup_useraliases(
-               domain, p->mem_ctx, r->in.sids->num_sids, r->in.sids->sids,
-               &r->out.rids->num_rids, &r->out.rids->rids);
+       status = wb_cache_lookup_useraliases(domain, p->mem_ctx,
+                                            r->in.sids->num_sids,
+                                            r->in.sids->sids,
+                                            &r->out.rids->num_rids,
+                                            &r->out.rids->rids);
        reset_cm_connection_on_error(domain, status);
        return status;
 }
@@ -309,9 +311,9 @@ NTSTATUS _wbint_LookupUserGroups(struct pipes_struct *p,
                return NT_STATUS_REQUEST_NOT_ACCEPTED;
        }
 
-       status = domain->methods->lookup_usergroups(
-               domain, p->mem_ctx, r->in.sid,
-               &r->out.sids->num_sids, &r->out.sids->sids);
+       status = wb_cache_lookup_usergroups(domain, p->mem_ctx, r->in.sid,
+                                           &r->out.sids->num_sids,
+                                           &r->out.sids->sids);
        reset_cm_connection_on_error(domain, status);
        return status;
 }
@@ -326,7 +328,7 @@ NTSTATUS _wbint_QuerySequenceNumber(struct pipes_struct *p,
                return NT_STATUS_REQUEST_NOT_ACCEPTED;
        }
 
-       status = domain->methods->sequence_number(domain, r->out.sequence);
+       status = wb_cache_sequence_number(domain, r->out.sequence);
        reset_cm_connection_on_error(domain, status);
        return status;
 }
@@ -345,9 +347,9 @@ NTSTATUS _wbint_LookupGroupMembers(struct pipes_struct *p,
                return NT_STATUS_REQUEST_NOT_ACCEPTED;
        }
 
-       status = domain->methods->lookup_groupmem(
-               domain, p->mem_ctx, r->in.sid, r->in.type,
-               &num_names, &sid_mem, &names, &name_types);
+       status = wb_cache_lookup_groupmem(domain, p->mem_ctx, r->in.sid,
+                                         r->in.type, &num_names, &sid_mem,
+                                         &names, &name_types);
        reset_cm_connection_on_error(domain, status);
        if (!NT_STATUS_IS_OK(status)) {
                return status;
@@ -380,9 +382,9 @@ NTSTATUS _wbint_QueryUserList(struct pipes_struct *p,
                return NT_STATUS_REQUEST_NOT_ACCEPTED;
        }
 
-       status = domain->methods->query_user_list(
-               domain, p->mem_ctx, &r->out.users->num_userinfos,
-               &r->out.users->userinfos);
+       status = wb_cache_query_user_list(domain, p->mem_ctx,
+                                         &r->out.users->num_userinfos,
+                                         &r->out.users->userinfos);
        reset_cm_connection_on_error(domain, status);
        return status;
 }
@@ -426,18 +428,18 @@ NTSTATUS _wbint_QueryGroupList(struct pipes_struct *p,
        }
 
        if (include_local_groups) {
-               status = domain->methods->enum_local_groups(domain, talloc_tos(),
-                                                           &num_local_groups,
-                                                           &local_groups);
+               status = wb_cache_enum_local_groups(domain, talloc_tos(),
+                                                   &num_local_groups,
+                                                   &local_groups);
                reset_cm_connection_on_error(domain, status);
                if (!NT_STATUS_IS_OK(status)) {
                        return status;
                }
        }
 
-       status = domain->methods->enum_dom_groups(domain, talloc_tos(),
-                                                 &num_dom_groups,
-                                                 &dom_groups);
+       status = wb_cache_enum_dom_groups(domain, talloc_tos(),
+                                         &num_dom_groups,
+                                         &dom_groups);
        reset_cm_connection_on_error(domain, status);
        if (!NT_STATUS_IS_OK(status)) {
                return status;
@@ -611,9 +613,9 @@ NTSTATUS _wbint_LookupRids(struct pipes_struct *p, struct wbint_LookupRids *r)
                return NT_STATUS_REQUEST_NOT_ACCEPTED;
        }
 
-       status = domain->methods->rids_to_names(
-               domain, talloc_tos(), r->in.domain_sid, r->in.rids->rids,
-               r->in.rids->num_rids, &domain_name, &names, &types);
+       status = wb_cache_rids_to_names(domain, talloc_tos(), r->in.domain_sid,
+                                       r->in.rids->rids, r->in.rids->num_rids,
+                                       &domain_name, &names, &types);
        reset_cm_connection_on_error(domain, status);
        if (!NT_STATUS_IS_OK(status)) {
                return status;
index fab41a14d0d88af473039f3250a0b4a58474fa6d..12c5faa6b487fd8e55626955b3d4389731665bf6 100644 (file)
@@ -160,8 +160,7 @@ enum winbindd_result winbindd_dual_list_trusted_domains(struct winbindd_domain *
        DEBUG(3, ("[%5lu]: list trusted domains\n",
                  (unsigned long)state->pid));
 
-       result = domain->methods->trusted_domains(domain, state->mem_ctx,
-                                                 &trusts);
+       result = wb_cache_trusted_domains(domain, state->mem_ctx, &trusts);
 
        if (!NT_STATUS_IS_OK(result)) {
                DEBUG(3, ("winbindd_dual_list_trusted_domains: trusted_domains returned %s\n",
index 8456876b20efd8e178f597e936694d5fa4de3c0b..9433ad17b2b5e7ea3d5167a7d9c4b3138db17536 100644 (file)
@@ -402,7 +402,6 @@ static NTSTATUS fillup_password_policy(struct winbindd_domain *domain,
                                       struct winbindd_response *response)
 {
        TALLOC_CTX *frame = talloc_stackframe();
-       struct winbindd_methods *methods;
        NTSTATUS status;
        struct samr_DomInfo1 password_policy;
 
@@ -413,9 +412,8 @@ static NTSTATUS fillup_password_policy(struct winbindd_domain *domain,
                goto done;
        }
 
-       methods = domain->methods;
-
-       status = methods->password_policy(domain, talloc_tos(), &password_policy);
+       status = wb_cache_password_policy(domain, talloc_tos(),
+                                         &password_policy);
        if (NT_STATUS_IS_ERR(status)) {
                goto done;
        }
@@ -431,15 +429,12 @@ static NTSTATUS get_max_bad_attempts_from_lockout_policy(struct winbindd_domain
                                                         TALLOC_CTX *mem_ctx,
                                                         uint16_t *lockout_threshold)
 {
-       struct winbindd_methods *methods;
        NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
        struct samr_DomInfo12 lockout_policy;
 
        *lockout_threshold = 0;
 
-       methods = domain->methods;
-
-       status = methods->lockout_policy(domain, mem_ctx, &lockout_policy);
+       status = wb_cache_lockout_policy(domain, mem_ctx, &lockout_policy);
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }
@@ -453,15 +448,12 @@ static NTSTATUS get_pwd_properties(struct winbindd_domain *domain,
                                   TALLOC_CTX *mem_ctx,
                                   uint32_t *password_properties)
 {
-       struct winbindd_methods *methods;
        NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
        struct samr_DomInfo1 password_policy;
 
        *password_properties = 0;
 
-       methods = domain->methods;
-
-       status = methods->password_policy(domain, mem_ctx, &password_policy);
+       status = wb_cache_password_policy(domain, mem_ctx, &password_policy);
        if (NT_STATUS_IS_ERR(status)) {
                return status;
        }