r23779: Change from v2 or later to v3 or later.
[gd/samba/.git] / source3 / auth / auth_winbind.c
index 2c584f54c2ee2f029dcb74b92764c3cb038c6ecb..d6af08c71627ad6413f865c8894d179306d8ec36 100644 (file)
@@ -8,7 +8,7 @@
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
@@ -32,7 +32,7 @@ static NTSTATUS get_info3_from_ndr(TALLOC_CTX *mem_ctx, struct winbindd_response
        size_t len = response->length - sizeof(struct winbindd_response);
        prs_struct ps;
        if (len > 0) {
-               info3_ndr = response->extra_data.data;
+               info3_ndr = (uint8 *)response->extra_data.data;
                if (!prs_init(&ps, len, mem_ctx, UNMARSHALL)) {
                        return NT_STATUS_NO_MEMORY;
                }
@@ -108,11 +108,13 @@ static NTSTATUS check_winbind_security(const struct auth_context *auth_context,
 
        /* we are contacting the privileged pipe */
        become_root();
-       result = winbindd_request_response(WINBINDD_PAM_AUTH_CRAP, &request, &response);
+       result = winbindd_priv_request_response(WINBINDD_PAM_AUTH_CRAP,
+                                               &request, &response);
        unbecome_root();
 
        if ( result == NSS_STATUS_UNAVAIL )  {
-               struct auth_methods *auth_method = my_private_data;
+               struct auth_methods *auth_method =
+                       (struct auth_methods *)my_private_data;
 
                if ( auth_method )
                        return auth_method->auth(auth_context, auth_method->private_data, 
@@ -132,6 +134,9 @@ static NTSTATUS check_winbind_security(const struct auth_context *auth_context,
                                        server_info, &info3); 
                        }
                        
+                       if (NT_STATUS_IS_OK(nt_status)) {
+                               (*server_info)->was_mapped |= user_info->was_mapped;
+                       }
                }
        } else if (NT_STATUS_IS_OK(nt_status)) {
                nt_status = NT_STATUS_NO_LOGON_SERVERS;
@@ -154,10 +159,11 @@ static NTSTATUS auth_init_winbind(struct auth_context *auth_context, const char
        if (param && *param) {
                /* we load the 'fallback' module - if winbind isn't here, call this
                   module */
-               if (!load_auth_module(auth_context, param, (auth_methods **)&(*auth_method)->private_data)) {
+               auth_methods *priv;
+               if (!load_auth_module(auth_context, param, &priv)) {
                        return NT_STATUS_UNSUCCESSFUL;
                }
-               
+               (*auth_method)->private_data = (void *)priv;
        }
        return NT_STATUS_OK;
 }