winbindd_ads: use the reconnect methods instead of the rpc methods directly
authorMichael Adam <obnox@samba.org>
Fri, 21 Nov 2008 23:42:54 +0000 (00:42 +0100)
committerMichael Adam <obnox@samba.org>
Fri, 21 Nov 2008 23:42:54 +0000 (00:42 +0100)
Some of the ads methods just point to the rpc methods.
This makes winbindd_ads use the reconnect methods instead of
calling the rpc methods directly in order to prevent
negative cache entries for e.g. name_to_sid, when the dc
has closed the connection without sending a reset.

Michael

source/nsswitch/winbindd_ads.c

index 01f9413750296bc20b4d7954a2a20853d7b9ef92..8cb5f396a7b4d651725b1a4234420c0c66e384af 100644 (file)
@@ -390,6 +390,46 @@ static NTSTATUS enum_local_groups(struct winbindd_domain *domain,
        return NT_STATUS_OK;
 }
 
+/* convert a single name to a sid in a domain - use rpc methods */
+static NTSTATUS name_to_sid(struct winbindd_domain *domain,
+                           TALLOC_CTX *mem_ctx,
+                           const char *domain_name,
+                           const char *name,
+                           DOM_SID *sid,
+                           enum lsa_SidType *type)
+{
+       return reconnect_methods.name_to_sid(domain, mem_ctx,
+                                            domain_name, name,
+                                            sid, type);
+}
+
+/* convert a domain SID to a user or group name - use rpc methods */
+static NTSTATUS sid_to_name(struct winbindd_domain *domain,
+                           TALLOC_CTX *mem_ctx,
+                           const DOM_SID *sid,
+                           char **domain_name,
+                           char **name,
+                           enum lsa_SidType *type)
+{
+       return reconnect_methods.sid_to_name(domain, mem_ctx, sid,
+                                            domain_name, name, type);
+}
+
+/* convert a list of rids to names - use rpc methods */
+static NTSTATUS rids_to_names(struct winbindd_domain *domain,
+                             TALLOC_CTX *mem_ctx,
+                             const DOM_SID *sid,
+                             uint32 *rids,
+                             size_t num_rids,
+                             char **domain_name,
+                             char ***names,
+                             enum lsa_SidType **types)
+{
+       return reconnect_methods.rids_to_names(domain, mem_ctx, sid,
+                                              rids, num_rids,
+                                              domain_name, names, types);
+}
+
 /* convert a DN to a name, SID and name type 
    this might become a major speed bottleneck if groups have
    lots of users, in which case we could cache the results
@@ -831,6 +871,18 @@ done:
        return status;
 }
 
+/* Lookup aliases a user is member of - use rpc methods */
+static NTSTATUS lookup_useraliases(struct winbindd_domain *domain,
+                                  TALLOC_CTX *mem_ctx,
+                                  uint32 num_sids, const DOM_SID *sids,
+                                  uint32 *num_aliases, uint32 **alias_rids)
+{
+       return reconnect_methods.lookup_useraliases(domain, mem_ctx,
+                                                   num_sids, sids,
+                                                   num_aliases,
+                                                   alias_rids);
+}
+
 /*
   find the members of a group, given a group rid and domain
  */
@@ -1035,6 +1087,22 @@ static NTSTATUS sequence_number(struct winbindd_domain *domain, uint32 *seq)
        return ads_ntstatus(rc);
 }
 
+/* find the lockout policy of a domain - use rpc methods */
+static NTSTATUS lockout_policy(struct winbindd_domain *domain,
+                              TALLOC_CTX *mem_ctx,
+                              SAM_UNK_INFO_12 *policy)
+{
+       return reconnect_methods.lockout_policy(domain, mem_ctx, policy);
+}
+
+/* find the password policy of a domain - use rpc methods */
+static NTSTATUS password_policy(struct winbindd_domain *domain,
+                               TALLOC_CTX *mem_ctx,
+                               SAM_UNK_INFO_1 *policy)
+{
+       return reconnect_methods.password_policy(domain, mem_ctx, policy);
+}
+
 /* get a list of trusted domains */
 static NTSTATUS trusted_domains(struct winbindd_domain *domain,
                                TALLOC_CTX *mem_ctx,
@@ -1113,16 +1181,16 @@ struct winbindd_methods ads_methods = {
        query_user_list,
        enum_dom_groups,
        enum_local_groups,
-       msrpc_name_to_sid,
-       msrpc_sid_to_name,
-       msrpc_rids_to_names,
+       name_to_sid,
+       sid_to_name,
+       rids_to_names,
        query_user,
        lookup_usergroups,
-       msrpc_lookup_useraliases,
+       lookup_useraliases,
        lookup_groupmem,
        sequence_number,
-       msrpc_lockout_policy,
-       msrpc_password_policy,
+       lockout_policy,
+       password_policy,
        trusted_domains,
 };