Ignore:
Timestamp:
Nov 27, 2012, 4:43:17 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: updated trunk to 3.6.0

Location:
trunk/server
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/server

  • trunk/server/source3/auth/auth_winbind.c

    r414 r745  
    66   Copyright (C) Tim Potter 2000
    77   Copyright (C) Andrew Bartlett 2001 - 2002
    8    
     8
    99   This program is free software; you can redistribute it and/or modify
    1010   it under the terms of the GNU General Public License as published by
    1111   the Free Software Foundation; either version 3 of the License, or
    1212   (at your option) any later version.
    13    
     13
    1414   This program is distributed in the hope that it will be useful,
    1515   but WITHOUT ANY WARRANTY; without even the implied warranty of
    1616   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1717   GNU General Public License for more details.
    18    
     18
    1919   You should have received a copy of the GNU General Public License
    2020   along with this program.  If not, see <http://www.gnu.org/licenses/>.
     
    2222
    2323#include "includes.h"
     24#include "auth.h"
     25#include "nsswitch/libwbclient/wbclient.h"
    2426
    2527#undef DBGC_CLASS
     
    3133                                       void *my_private_data,
    3234                                       TALLOC_CTX *mem_ctx,
    33                                        const auth_usersupplied_info *user_info,
    34                                        auth_serversupplied_info **server_info)
     35                                       const struct auth_usersupplied_info *user_info,
     36                                       struct auth_serversupplied_info **server_info)
    3537{
    3638        NTSTATUS nt_status;
     
    4042        struct wbcAuthErrorInfo *err = NULL;
    4143
     44        ZERO_STRUCT(params);
     45
    4246        if (!user_info) {
    4347                return NT_STATUS_INVALID_PARAMETER;
    4448        }
    4549
     50        DEBUG(10, ("Check auth for: [%s]\n", user_info->mapped.account_name));
     51
    4652        if (!auth_context) {
    4753                DEBUG(3,("Password for user %s cannot be checked because we have no auth_info to get the challenge from.\n",
    48                          user_info->internal_username));
     54                         user_info->mapped.account_name));
    4955                return NT_STATUS_INVALID_PARAMETER;
    5056        }               
    5157
    52         if (strequal(user_info->domain, get_global_sam_name())) {
     58        if (strequal(user_info->mapped.domain_name, get_global_sam_name())) {
    5359                DEBUG(3,("check_winbind_security: Not using winbind, requested domain [%s] was for this SAM.\n",
    54                         user_info->domain));
     60                        user_info->mapped.domain_name));
    5561                return NT_STATUS_NOT_IMPLEMENTED;
    5662        }
     
    5864        /* Send off request */
    5965
    60         params.account_name     = user_info->smb_name;
    61         params.domain_name      = user_info->domain;
    62         params.workstation_name = user_info->wksta_name;
     66        params.account_name     = user_info->client.account_name;
     67        params.domain_name      = user_info->mapped.domain_name;
     68        params.workstation_name = user_info->workstation_name;
    6369
    6470        params.flags            = 0;
     
    7177               sizeof(params.password.response.challenge));
    7278
    73         params.password.response.nt_length      = user_info->nt_resp.length;
    74         params.password.response.nt_data        = user_info->nt_resp.data;
    75         params.password.response.lm_length      = user_info->lm_resp.length;
    76         params.password.response.lm_data        = user_info->lm_resp.data;
     79        if (user_info->password.response.nt.length != 0) {
     80                params.password.response.nt_length =
     81                        user_info->password.response.nt.length;
     82                params.password.response.nt_data =
     83                        user_info->password.response.nt.data;
     84        }
     85        if (user_info->password.response.lanman.length != 0) {
     86                params.password.response.lm_length =
     87                        user_info->password.response.lanman.length;
     88                params.password.response.lm_data =
     89                        user_info->password.response.lanman.data;
     90        }
    7791
    7892        /* we are contacting the privileged pipe */
     
    97111                        return auth_method->auth(auth_context, auth_method->private_data,
    98112                                mem_ctx, user_info, server_info);
    99                 else
    100                         /* log an error since this should not happen */
    101                         DEBUG(0,("check_winbind_security: ERROR!  my_private_data == NULL!\n"));
     113                return NT_STATUS_LOGON_FAILURE;
    102114        }
    103115
     
    113125
    114126        nt_status = make_server_info_wbcAuthUserInfo(mem_ctx,
    115                                                      user_info->smb_name,
    116                                                      user_info->domain,
     127                                                     user_info->client.account_name,
     128                                                     user_info->mapped.domain_name,
    117129                                                     info, server_info);
    118130        wbcFreeMemory(info);
     
    129141static NTSTATUS auth_init_winbind(struct auth_context *auth_context, const char *param, auth_methods **auth_method)
    130142{
    131         if (!make_auth_methods(auth_context, auth_method)) {
     143        struct auth_methods *result;
     144
     145        result = TALLOC_ZERO_P(auth_context, struct auth_methods);
     146        if (result == NULL) {
    132147                return NT_STATUS_NO_MEMORY;
    133148        }
    134 
    135         (*auth_method)->name = "winbind";
    136         (*auth_method)->auth = check_winbind_security;
     149        result->name = "winbind";
     150        result->auth = check_winbind_security;
    137151
    138152        if (param && *param) {
     
    143157                        return NT_STATUS_UNSUCCESSFUL;
    144158                }
    145                 (*auth_method)->private_data = (void *)priv;
     159                result->private_data = (void *)priv;
    146160        }
     161
     162        *auth_method = result;
    147163        return NT_STATUS_OK;
    148164}
Note: See TracChangeset for help on using the changeset viewer.