Changeset 745 for trunk/server/libcli/auth/ntlm_check.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/libcli/auth/ntlm_check.c
r414 r745 5 5 Copyright (C) Gerald Carter 2003 6 6 Copyright (C) Luke Kenneth Casson Leighton 1996-2000 7 7 8 8 This program is free software; you can redistribute it and/or modify 9 9 it under the terms of the GNU General Public License as published by 10 10 the Free Software Foundation; either version 3 of the License, or 11 11 (at your option) any later version. 12 12 13 13 This program is distributed in the hope that it will be useful, 14 14 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 16 GNU General Public License for more details. 17 17 18 18 You should have received a copy of the GNU General Public License 19 19 along with this program. If not, see <http://www.gnu.org/licenses/>. … … 37 37 /* Finish the encryption of part_passwd. */ 38 38 uint8_t p24[24]; 39 39 40 40 if (part_passwd == NULL) { 41 41 DEBUG(10,("No password set - DISALLOWING access\n")); … … 43 43 return false; 44 44 } 45 45 46 46 if (sec_blob->length != 8) { 47 47 DEBUG(0, ("smb_pwd_check_ntlmv1: incorrect challenge size (%lu)\n", … … 49 49 return false; 50 50 } 51 51 52 52 if (nt_response->length != 24) { 53 53 DEBUG(0, ("smb_pwd_check_ntlmv1: incorrect password length (%lu)\n", … … 57 57 58 58 SMBOWFencrypt(part_passwd, sec_blob->data, p24); 59 59 60 60 #if DEBUG_PASSWORD 61 61 DEBUG(100,("Part password (P16) was |\n")); … … 107 107 return false; 108 108 } 109 109 110 110 if (ntv2_response->length < 24) { 111 111 /* We MUST have more than 16 bytes, or the stuff below will go … … 181 181 return false; 182 182 } 183 183 184 184 if (ntv2_response->length < 24) { 185 185 /* We MUST have more than 16 bytes, or the stuff below will go … … 219 219 220 220 NTSTATUS hash_password_check(TALLOC_CTX *mem_ctx, 221 221 bool lanman_auth, 222 222 const struct samr_Password *client_lanman, 223 223 const struct samr_Password *client_nt, … … 282 282 283 283 NTSTATUS ntlm_password_check(TALLOC_CTX *mem_ctx, 284 285 284 bool lanman_auth, 285 bool ntlm_auth, 286 286 uint32_t logon_parameters, 287 287 const DATA_BLOB *challenge, … … 319 319 username)); 320 320 mdfour(client_nt.hash, nt_response->data, nt_response->length); 321 321 322 322 if (lm_response->length && 323 323 (convert_string_talloc(mem_ctx, CH_DOS, CH_UNIX, … … 344 344 (unsigned long)nt_response->length, username)); 345 345 } 346 346 347 347 if (nt_response->length > 24 && stored_nt) { 348 348 /* We have the NT MD4 hash challenge available - see if we can … … 362 362 return NT_STATUS_OK; 363 363 } 364 364 365 365 DEBUG(4,("ntlm_password_check: Checking NTLMv2 password with uppercased version of domain [%s]\n", client_domain)); 366 366 if (smb_pwd_check_ntlmv2(mem_ctx, … … 376 376 return NT_STATUS_OK; 377 377 } 378 378 379 379 DEBUG(4,("ntlm_password_check: Checking NTLMv2 password without a domain\n")); 380 380 if (smb_pwd_check_ntlmv2(mem_ctx, … … 404 404 /* The LM session key for this response is not very secure, 405 405 so use it only if we otherwise allow LM authentication */ 406 406 407 407 if (lanman_auth && stored_lanman) { 408 408 *lm_sess_key = data_blob_talloc(mem_ctx, stored_lanman->hash, MIN(8, user_sess_key->length)); … … 417 417 DEBUG(2,("ntlm_password_check: NTLMv1 passwords NOT PERMITTED for user %s\n", 418 418 username)); 419 /* no return, bec ouse we might pick up LMv2 in the LM field */420 } 421 } 422 419 /* no return, because we might pick up LMv2 in the LM field */ 420 } 421 } 422 423 423 if (lm_response->length == 0) { 424 424 DEBUG(3,("ntlm_password_check: NEITHER LanMan nor NT password supplied for user %s\n", … … 426 426 return NT_STATUS_WRONG_PASSWORD; 427 427 } 428 428 429 429 if (lm_response->length < 24) { 430 430 DEBUG(2,("ntlm_password_check: invalid LanMan password length (%lu) for user %s\n", … … 432 432 return NT_STATUS_WRONG_PASSWORD; 433 433 } 434 434 435 435 if (!lanman_auth) { 436 436 DEBUG(3,("ntlm_password_check: Lanman passwords NOT PERMITTED for user %s\n", … … 462 462 } 463 463 } 464 464 465 465 if (!stored_nt) { 466 466 DEBUG(4,("ntlm_password_check: LM password check failed for user, no NT password %s\n",username)); 467 467 return NT_STATUS_WRONG_PASSWORD; 468 468 } 469 469 470 470 /* This is for 'LMv2' authentication. almost NTLMv2 but limited to 24 bytes. 471 471 - related to Win9X, legacy NAS pass-though authentication … … 500 500 return NT_STATUS_OK; 501 501 } 502 502 503 503 DEBUG(4,("ntlm_password_check: Checking LMv2 password with upper-cased version of domain %s\n", client_domain)); 504 504 if (smb_pwd_check_ntlmv2(mem_ctx, … … 530 530 return NT_STATUS_OK; 531 531 } 532 532 533 533 DEBUG(4,("ntlm_password_check: Checking LMv2 password without a domain\n")); 534 534 if (smb_pwd_check_ntlmv2(mem_ctx,
Note:
See TracChangeset
for help on using the changeset viewer.