Changeset 745 for trunk/server/source3/auth/auth_wbc.c
- Timestamp:
- Nov 27, 2012, 4:43:17 PM (13 years ago)
- Location:
- trunk/server
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/server
- Property svn:mergeinfo changed
/vendor/current merged: 581,587,591,594,597,600,615,618,740
- Property svn:mergeinfo changed
-
trunk/server/source3/auth/auth_wbc.c
r414 r745 39 39 40 40 #include "includes.h" 41 #include "auth.h" 42 #include "nsswitch/libwbclient/wbclient.h" 41 43 42 44 #undef DBGC_CLASS … … 48 50 void *my_private_data, 49 51 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) 52 54 { 53 55 NTSTATUS nt_status; … … 60 62 return NT_STATUS_INVALID_PARAMETER; 61 63 } 64 65 ZERO_STRUCT(params); 66 62 67 /* Send off request */ 63 68 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; 67 74 68 75 params.flags = 0; … … 70 77 71 78 /* Handle plaintext */ 72 if (!user_info->encrypted) { 79 switch (user_info->password_state) { 80 case AUTH_PASSWORD_PLAIN: 81 { 73 82 DEBUG(3,("Checking plaintext password for %s.\n", 74 user_info-> internal_username));83 user_info->mapped.account_name)); 75 84 params.level = WBC_AUTH_USER_LEVEL_PLAIN; 76 85 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 { 79 92 DEBUG(3,("Checking encrypted password for %s.\n", 80 user_info-> internal_username));93 user_info->mapped.account_name)); 81 94 params.level = WBC_AUTH_USER_LEVEL_RESPONSE; 82 95 … … 85 98 sizeof(params.password.response.challenge)); 86 99 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; 91 123 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 92 138 } 93 139 … … 119 165 120 166 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, 123 169 info, server_info); 124 170 wbcFreeMemory(info); … … 135 181 static NTSTATUS auth_init_wbc(struct auth_context *auth_context, const char *param, auth_methods **auth_method) 136 182 { 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) { 138 187 return NT_STATUS_NO_MEMORY; 139 188 } 189 result->name = "wbc"; 190 result->auth = check_wbc_security; 140 191 141 (*auth_method)->name = "wbc"; 142 (*auth_method)->auth = check_wbc_security; 143 192 *auth_method = result; 144 193 return NT_STATUS_OK; 145 194 }
Note:
See TracChangeset
for help on using the changeset viewer.