Fix some type-punned warnings
[samba.git] / source3 / winbindd / winbindd_cm.c
index ed0a33a5f22cc9610734551616716d6f0d15c27f..396a30377fc7a1a37e6d36659516f869dbb67ae1 100644 (file)
@@ -60,6 +60,7 @@
 
 #include "includes.h"
 #include "winbindd.h"
+#include "../libcli/auth/libcli_auth.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_WINBIND
@@ -768,7 +769,8 @@ static NTSTATUS cm_prepare_connection(const struct winbindd_domain *domain,
        struct sockaddr peeraddr;
        socklen_t peeraddr_len;
 
-       struct sockaddr_in *peeraddr_in = (struct sockaddr_in *)&peeraddr;
+       struct sockaddr_in *peeraddr_in =
+               (struct sockaddr_in *)(void *)&peeraddr;
 
        DEBUG(10,("cm_prepare_connection: connecting to DC %s for domain %s\n",
                controller, domain->name ));
@@ -1039,7 +1041,9 @@ static bool add_one_dc_unique(TALLOC_CTX *mem_ctx, const char *domain_name,
 
        /* Make sure there's no duplicates in the list */
        for (i=0; i<*num; i++)
-               if (sockaddr_equal((struct sockaddr *)&(*dcs)[i].ss, (struct sockaddr *)pss))
+               if (sockaddr_equal(
+                           (struct sockaddr *)(void *)&(*dcs)[i].ss,
+                           (struct sockaddr *)(void *)pss))
                        return False;
 
        *dcs = TALLOC_REALLOC_ARRAY(mem_ctx, *dcs, struct dc_name_ip, (*num)+1);
@@ -1851,7 +1855,7 @@ no_dssetup:
        }
 
        result = rpccli_lsa_open_policy2(cli, mem_ctx, True, 
-                                        SEC_RIGHTS_MAXIMUM_ALLOWED, &pol);
+                                        SEC_FLAG_MAXIMUM_ALLOWED, &pol);
 
        if (NT_STATUS_IS_OK(result)) {
                /* This particular query is exactly what Win2k clients use 
@@ -1893,7 +1897,7 @@ no_dssetup:
                domain->active_directory = False;
 
                result = rpccli_lsa_open_policy(cli, mem_ctx, True, 
-                                               SEC_RIGHTS_MAXIMUM_ALLOWED,
+                                               SEC_FLAG_MAXIMUM_ALLOWED,
                                                &pol);
 
                if (!NT_STATUS_IS_OK(result)) {
@@ -1963,8 +1967,8 @@ static void set_dc_type_and_flags( struct winbindd_domain *domain )
 /**********************************************************************
 ***********************************************************************/
 
-static bool cm_get_schannel_dcinfo(struct winbindd_domain *domain,
-                                  struct dcinfo **ppdc)
+static bool cm_get_schannel_creds(struct winbindd_domain *domain,
+                                  struct netlogon_creds_CredentialState **ppdc)
 {
        NTSTATUS result;
        struct rpc_pipe_client *netlogon_pipe;
@@ -1978,7 +1982,7 @@ static bool cm_get_schannel_dcinfo(struct winbindd_domain *domain,
                return False;
        }
 
-       /* Return a pointer to the struct dcinfo from the
+       /* Return a pointer to the struct netlogon_creds_CredentialState from the
           netlogon pipe. */
 
        if (!domain->conn.netlogon_pipe->dc) {
@@ -1994,7 +1998,7 @@ NTSTATUS cm_connect_sam(struct winbindd_domain *domain, TALLOC_CTX *mem_ctx,
 {
        struct winbindd_cm_conn *conn;
        NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
-       struct dcinfo *p_dcinfo;
+       struct netlogon_creds_CredentialState *p_creds;
        char *machine_password = NULL;
        char *machine_account = NULL;
        char *domain_name = NULL;
@@ -2067,7 +2071,7 @@ NTSTATUS cm_connect_sam(struct winbindd_domain *domain, TALLOC_CTX *mem_ctx,
 
        result = rpccli_samr_Connect2(conn->samr_pipe, mem_ctx,
                                      conn->samr_pipe->desthost,
-                                     SEC_RIGHTS_MAXIMUM_ALLOWED,
+                                     SEC_FLAG_MAXIMUM_ALLOWED,
                                      &conn->sam_connect_handle);
        if (NT_STATUS_IS_OK(result)) {
                goto open_domain;
@@ -2081,7 +2085,7 @@ NTSTATUS cm_connect_sam(struct winbindd_domain *domain, TALLOC_CTX *mem_ctx,
 
        /* Fall back to schannel if it's a W2K pre-SP1 box. */
 
-       if (!cm_get_schannel_dcinfo(domain, &p_dcinfo)) {
+       if (!cm_get_schannel_creds(domain, &p_creds)) {
                /* If this call fails - conn->cli can now be NULL ! */
                DEBUG(10, ("cm_connect_sam: Could not get schannel auth info "
                           "for domain %s, trying anon\n", domain->name));
@@ -2089,7 +2093,7 @@ NTSTATUS cm_connect_sam(struct winbindd_domain *domain, TALLOC_CTX *mem_ctx,
        }
        result = cli_rpc_pipe_open_schannel_with_key
                (conn->cli, &ndr_table_samr.syntax_id, PIPE_AUTH_LEVEL_PRIVACY,
-                domain->name, p_dcinfo, &conn->samr_pipe);
+                domain->name, &p_creds, &conn->samr_pipe);
 
        if (!NT_STATUS_IS_OK(result)) {
                DEBUG(10,("cm_connect_sam: failed to connect to SAMR pipe for "
@@ -2102,7 +2106,7 @@ NTSTATUS cm_connect_sam(struct winbindd_domain *domain, TALLOC_CTX *mem_ctx,
 
        result = rpccli_samr_Connect2(conn->samr_pipe, mem_ctx,
                                      conn->samr_pipe->desthost,
-                                     SEC_RIGHTS_MAXIMUM_ALLOWED,
+                                     SEC_FLAG_MAXIMUM_ALLOWED,
                                      &conn->sam_connect_handle);
        if (NT_STATUS_IS_OK(result)) {
                goto open_domain;
@@ -2124,7 +2128,7 @@ NTSTATUS cm_connect_sam(struct winbindd_domain *domain, TALLOC_CTX *mem_ctx,
 
        result = rpccli_samr_Connect2(conn->samr_pipe, mem_ctx,
                                      conn->samr_pipe->desthost,
-                                     SEC_RIGHTS_MAXIMUM_ALLOWED,
+                                     SEC_FLAG_MAXIMUM_ALLOWED,
                                      &conn->sam_connect_handle);
        if (!NT_STATUS_IS_OK(result)) {
                DEBUG(10,("cm_connect_sam: rpccli_samr_Connect2 failed "
@@ -2137,7 +2141,7 @@ NTSTATUS cm_connect_sam(struct winbindd_domain *domain, TALLOC_CTX *mem_ctx,
        result = rpccli_samr_OpenDomain(conn->samr_pipe,
                                        mem_ctx,
                                        &conn->sam_connect_handle,
-                                       SEC_RIGHTS_MAXIMUM_ALLOWED,
+                                       SEC_FLAG_MAXIMUM_ALLOWED,
                                        &domain->sid,
                                        &conn->sam_domain_handle);
 
@@ -2160,7 +2164,7 @@ NTSTATUS cm_connect_lsa(struct winbindd_domain *domain, TALLOC_CTX *mem_ctx,
 {
        struct winbindd_cm_conn *conn;
        NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
-       struct dcinfo *p_dcinfo;
+       struct netlogon_creds_CredentialState *p_creds;
 
        result = init_dc_connection(domain);
        if (!NT_STATUS_IS_OK(result))
@@ -2202,7 +2206,7 @@ NTSTATUS cm_connect_lsa(struct winbindd_domain *domain, TALLOC_CTX *mem_ctx,
                  domain->name, conn->cli->domain, conn->cli->user_name ));
 
        result = rpccli_lsa_open_policy(conn->lsa_pipe, mem_ctx, True,
-                                       SEC_RIGHTS_MAXIMUM_ALLOWED,
+                                       SEC_FLAG_MAXIMUM_ALLOWED,
                                        &conn->lsa_policy);
        if (NT_STATUS_IS_OK(result)) {
                goto done;
@@ -2217,7 +2221,7 @@ NTSTATUS cm_connect_lsa(struct winbindd_domain *domain, TALLOC_CTX *mem_ctx,
 
        /* Fall back to schannel if it's a W2K pre-SP1 box. */
 
-       if (!cm_get_schannel_dcinfo(domain, &p_dcinfo)) {
+       if (!cm_get_schannel_creds(domain, &p_creds)) {
                /* If this call fails - conn->cli can now be NULL ! */
                DEBUG(10, ("cm_connect_lsa: Could not get schannel auth info "
                           "for domain %s, trying anon\n", domain->name));
@@ -2226,7 +2230,7 @@ NTSTATUS cm_connect_lsa(struct winbindd_domain *domain, TALLOC_CTX *mem_ctx,
        result = cli_rpc_pipe_open_schannel_with_key
                (conn->cli, &ndr_table_lsarpc.syntax_id,
                 PIPE_AUTH_LEVEL_PRIVACY,
-                domain->name, p_dcinfo, &conn->lsa_pipe);
+                domain->name, &p_creds, &conn->lsa_pipe);
 
        if (!NT_STATUS_IS_OK(result)) {
                DEBUG(10,("cm_connect_lsa: failed to connect to LSA pipe for "
@@ -2238,7 +2242,7 @@ NTSTATUS cm_connect_lsa(struct winbindd_domain *domain, TALLOC_CTX *mem_ctx,
                  "schannel.\n", domain->name ));
 
        result = rpccli_lsa_open_policy(conn->lsa_pipe, mem_ctx, True,
-                                       SEC_RIGHTS_MAXIMUM_ALLOWED,
+                                       SEC_FLAG_MAXIMUM_ALLOWED,
                                        &conn->lsa_policy);
        if (NT_STATUS_IS_OK(result)) {
                goto done;
@@ -2260,7 +2264,7 @@ NTSTATUS cm_connect_lsa(struct winbindd_domain *domain, TALLOC_CTX *mem_ctx,
        }
 
        result = rpccli_lsa_open_policy(conn->lsa_pipe, mem_ctx, True,
-                                       SEC_RIGHTS_MAXIMUM_ALLOWED,
+                                       SEC_FLAG_MAXIMUM_ALLOWED,
                                        &conn->lsa_policy);
  done:
        if (!NT_STATUS_IS_OK(result)) {
@@ -2372,7 +2376,7 @@ NTSTATUS cm_connect_netlogon(struct winbindd_domain *domain,
 
        result = cli_rpc_pipe_open_schannel_with_key(
                conn->cli, &ndr_table_netlogon.syntax_id,
-               PIPE_AUTH_LEVEL_PRIVACY, domain->name, netlogon_pipe->dc,
+               PIPE_AUTH_LEVEL_PRIVACY, domain->name, &netlogon_pipe->dc,
                &conn->netlogon_pipe);
 
        /* We can now close the initial netlogon pipe. */