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_wbc.c

    r414 r745  
    3939
    4040#include "includes.h"
     41#include "auth.h"
     42#include "nsswitch/libwbclient/wbclient.h"
    4143
    4244#undef DBGC_CLASS
     
    4850                                       void *my_private_data,
    4951                                       TALLOC_CTX *mem_ctx,
    50                                        const auth_usersupplied_info *user_info,
    51                                        auth_serversupplied_info **server_info)
     52                                       const struct auth_usersupplied_info *user_info,
     53                                       struct auth_serversupplied_info **server_info)
    5254{
    5355        NTSTATUS nt_status;
     
    6062                return NT_STATUS_INVALID_PARAMETER;
    6163        }
     64
     65        ZERO_STRUCT(params);
     66
    6267        /* Send off request */
    6368
    64         params.account_name     = user_info->smb_name;
    65         params.domain_name      = user_info->domain;
    66         params.workstation_name = user_info->wksta_name;
     69        DEBUG(10, ("Check auth for: [%s]", user_info->mapped.account_name));
     70
     71        params.account_name     = user_info->client.account_name;
     72        params.domain_name      = user_info->mapped.domain_name;
     73        params.workstation_name = user_info->workstation_name;
    6774
    6875        params.flags            = 0;
     
    7077
    7178        /* Handle plaintext */
    72         if (!user_info->encrypted) {
     79        switch (user_info->password_state) {
     80        case AUTH_PASSWORD_PLAIN:
     81        {
    7382                DEBUG(3,("Checking plaintext password for %s.\n",
    74                          user_info->internal_username));
     83                         user_info->mapped.account_name));
    7584                params.level = WBC_AUTH_USER_LEVEL_PLAIN;
    7685
    77                 params.password.plaintext = (char *)user_info->plaintext_password.data;
    78         } else {
     86                params.password.plaintext = user_info->password.plaintext;
     87                break;
     88        }
     89        case AUTH_PASSWORD_RESPONSE:
     90        case AUTH_PASSWORD_HASH:
     91        {
    7992                DEBUG(3,("Checking encrypted password for %s.\n",
    80                          user_info->internal_username));
     93                         user_info->mapped.account_name));
    8194                params.level = WBC_AUTH_USER_LEVEL_RESPONSE;
    8295
     
    8598                    sizeof(params.password.response.challenge));
    8699
    87                 params.password.response.nt_length = user_info->nt_resp.length;
    88                 params.password.response.nt_data = user_info->nt_resp.data;
    89                 params.password.response.lm_length = user_info->lm_resp.length;
    90                 params.password.response.lm_data = user_info->lm_resp.data;
     100                if (user_info->password.response.nt.length != 0) {
     101                        params.password.response.nt_length =
     102                                user_info->password.response.nt.length;
     103                        params.password.response.nt_data =
     104                                user_info->password.response.nt.data;
     105                }
     106                if (user_info->password.response.lanman.length != 0) {
     107                        params.password.response.lm_length =
     108                                user_info->password.response.lanman.length;
     109                        params.password.response.lm_data =
     110                                user_info->password.response.lanman.data;
     111                }
     112                break;
     113        }
     114        default:
     115                DEBUG(0,("user_info constructed for user '%s' was invalid - password_state=%u invalid.\n",user_info->mapped.account_name, user_info->password_state));
     116                return NT_STATUS_INTERNAL_ERROR;
     117#if 0 /* If ever implemented in libwbclient */
     118        case AUTH_PASSWORD_HASH:
     119        {
     120                DEBUG(3,("Checking logon (hash) password for %s.\n",
     121                         user_info->mapped.account_name));
     122                params.level = WBC_AUTH_USER_LEVEL_HASH;
    91123
     124                if (user_info->password.hash.nt) {
     125                        memcpy(params.password.hash.nt_hash, user_info->password.hash.nt, sizeof(* user_info->password.hash.nt));
     126                } else {
     127                        memset(params.password.hash.nt_hash, '\0', sizeof(params.password.hash.nt_hash));
     128                }
     129
     130                if (user_info->password.hash.lanman) {
     131                        memcpy(params.password.hash.lm_hash, user_info->password.hash.lanman, sizeof(* user_info->password.hash.lanman));
     132                } else {
     133                        memset(params.password.hash.lm_hash, '\0', sizeof(params.password.hash.lm_hash));
     134                }
     135
     136        }
     137#endif
    92138        }
    93139
     
    119165
    120166        nt_status = make_server_info_wbcAuthUserInfo(mem_ctx,
    121                                                      user_info->smb_name,
    122                                                      user_info->domain,
     167                                                     user_info->client.account_name,
     168                                                     user_info->mapped.domain_name,
    123169                                                     info, server_info);
    124170        wbcFreeMemory(info);
     
    135181static NTSTATUS auth_init_wbc(struct auth_context *auth_context, const char *param, auth_methods **auth_method)
    136182{
    137         if (!make_auth_methods(auth_context, auth_method)) {
     183        struct auth_methods *result;
     184
     185        result = TALLOC_ZERO_P(auth_context, struct auth_methods);
     186        if (result == NULL) {
    138187                return NT_STATUS_NO_MEMORY;
    139188        }
     189        result->name = "wbc";
     190        result->auth = check_wbc_security;
    140191
    141         (*auth_method)->name = "wbc";
    142         (*auth_method)->auth = check_wbc_security;
    143 
     192        *auth_method = result;
    144193        return NT_STATUS_OK;
    145194}
Note: See TracChangeset for help on using the changeset viewer.