s3-winbindd: add cm_connect_lsat().
authorGünther Deschner <gd@samba.org>
Wed, 28 Nov 2012 15:57:24 +0000 (16:57 +0100)
committerAndreas Schneider <asn@samba.org>
Fri, 30 Nov 2012 10:49:34 +0000 (11:49 +0100)
Guenther

Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
source3/winbindd/winbindd_cm.c
source3/winbindd/winbindd_proto.h

index 57027eb04db49cb12a10de772ec10987f8e1252e..33eeb320df2f7a107f814d3a34e8215c6e727134 100644 (file)
@@ -2564,6 +2564,37 @@ NTSTATUS cm_connect_lsa(struct winbindd_domain *domain, TALLOC_CTX *mem_ctx,
        return result;
 }
 
+/****************************************************************************
+Open a LSA connection to a DC, suiteable for LSA lookup calls.
+****************************************************************************/
+
+NTSTATUS cm_connect_lsat(struct winbindd_domain *domain,
+                        TALLOC_CTX *mem_ctx,
+                        struct rpc_pipe_client **cli,
+                        struct policy_handle *lsa_policy)
+{
+       NTSTATUS status;
+
+       if (domain->can_do_ncacn_ip_tcp) {
+               status = cm_connect_lsa_tcp(domain, mem_ctx, cli);
+               if (NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED) ||
+                   NT_STATUS_EQUAL(status, NT_STATUS_RPC_SEC_PKG_ERROR) ||
+                   NT_STATUS_EQUAL(status, NT_STATUS_NETWORK_ACCESS_DENIED)) {
+                       invalidate_cm_connection(&domain->conn);
+                       status = cm_connect_lsa_tcp(domain, mem_ctx, cli);
+               }
+               if (!NT_STATUS_IS_OK(status)) {
+                       return status;
+               }
+
+               return NT_STATUS_OK;
+       }
+
+       status = cm_connect_lsa(domain, mem_ctx, cli, lsa_policy);
+
+       return status;
+}
+
 /****************************************************************************
  Open the netlogon pipe to this DC. Use schannel if specified in client conf.
  session key stored in conn->netlogon_pipe->dc->sess_key.
index bf8dbf77b16b6e5ce097de0a741cec775ff5588d..b4f0852ac3f14da5b3fd9360c2deafbfb8774811 100644 (file)
@@ -163,6 +163,10 @@ NTSTATUS cm_connect_lsa(struct winbindd_domain *domain, TALLOC_CTX *mem_ctx,
 NTSTATUS cm_connect_lsa_tcp(struct winbindd_domain *domain,
                            TALLOC_CTX *mem_ctx,
                            struct rpc_pipe_client **cli);
+NTSTATUS cm_connect_lsat(struct winbindd_domain *domain,
+                        TALLOC_CTX *mem_ctx,
+                        struct rpc_pipe_client **cli,
+                        struct policy_handle *lsa_policy);
 NTSTATUS cm_connect_netlogon(struct winbindd_domain *domain,
                             struct rpc_pipe_client **cli);
 bool fetch_current_dc_from_gencache(TALLOC_CTX *mem_ctx,