Changeset 746 for vendor/current/libcli
- Timestamp:
- Nov 27, 2012, 4:56:06 PM (13 years ago)
- Location:
- vendor/current/libcli
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/libcli/auth/credentials.c
r740 r746 70 70 unsigned char zero[4], tmp[16]; 71 71 HMACMD5Context ctx; 72 struct MD5Contextmd5;72 MD5_CTX md5; 73 73 74 74 ZERO_STRUCT(creds->session_key); -
vendor/current/libcli/auth/ntlm_check.c
r740 r746 88 88 const DATA_BLOB *sec_blob, 89 89 const char *user, const char *domain, 90 bool upper_case_domain, /* should the domain be transformed into upper case? */91 90 DATA_BLOB *user_sess_key) 92 91 { … … 123 122 */ 124 123 125 if (!ntv2_owf_gen(part_passwd, user, domain, upper_case_domain,kr)) {124 if (!ntv2_owf_gen(part_passwd, user, domain, kr)) { 126 125 return false; 127 126 } … … 162 161 const DATA_BLOB *sec_blob, 163 162 const char *user, const char *domain, 164 bool upper_case_domain, /* should the domain be transformed into upper case? */165 163 DATA_BLOB *user_sess_key) 166 164 { … … 193 191 client_key_data = data_blob_talloc(mem_ctx, ntv2_response->data+16, ntv2_response->length-16); 194 192 195 if (!ntv2_owf_gen(part_passwd, user, domain, upper_case_domain,kr)) {193 if (!ntv2_owf_gen(part_passwd, user, domain, kr)) { 196 194 return false; 197 195 } … … 298 296 const static uint8_t zeros[8]; 299 297 DATA_BLOB tmp_sess_key; 298 const char *upper_client_domain = NULL; 299 300 if (client_domain != NULL) { 301 upper_client_domain = talloc_strdup_upper(mem_ctx, client_domain); 302 if (upper_client_domain == NULL) { 303 return NT_STATUS_NO_MEMORY; 304 } 305 } 300 306 301 307 if (stored_nt == NULL) { … … 349 355 use it 350 356 */ 351 DEBUG(4,("ntlm_password_check: Checking NTLMv2 password with domain [%s]\n", client_domain)); 357 DEBUG(4,("ntlm_password_check: Checking NTLMv2 password with domain [%s]\n", 358 client_domain ? client_domain : "<NULL>")); 352 359 if (smb_pwd_check_ntlmv2(mem_ctx, 353 360 nt_response, … … 355 362 client_username, 356 363 client_domain, 357 false,358 364 user_sess_key)) { 359 365 if (user_sess_key->length) { … … 363 369 } 364 370 365 DEBUG(4,("ntlm_password_check: Checking NTLMv2 password with uppercased version of domain [%s]\n", client_domain)); 371 DEBUG(4,("ntlm_password_check: Checking NTLMv2 password with uppercased version of domain [%s]\n", 372 upper_client_domain ? upper_client_domain : "<NULL>")); 366 373 if (smb_pwd_check_ntlmv2(mem_ctx, 367 374 nt_response, 368 375 stored_nt->hash, challenge, 369 376 client_username, 370 client_domain, 371 true, 377 upper_client_domain, 372 378 user_sess_key)) { 373 379 if (user_sess_key->length) { … … 383 389 client_username, 384 390 "", 385 false,386 391 user_sess_key)) { 387 392 if (user_sess_key->length) { … … 471 476 - related to Win9X, legacy NAS pass-though authentication 472 477 */ 473 DEBUG(4,("ntlm_password_check: Checking LMv2 password with domain %s\n", client_domain)); 478 DEBUG(4,("ntlm_password_check: Checking LMv2 password with domain %s\n", 479 client_domain ? client_domain : "<NULL>")); 474 480 if (smb_pwd_check_ntlmv2(mem_ctx, 475 481 lm_response, … … 477 483 client_username, 478 484 client_domain, 479 false,480 485 &tmp_sess_key)) { 481 486 if (nt_response->length > 24) { … … 489 494 client_username, 490 495 client_domain, 491 false,492 496 user_sess_key); 493 497 } else { … … 501 505 } 502 506 503 DEBUG(4,("ntlm_password_check: Checking LMv2 password with upper-cased version of domain %s\n", client_domain)); 507 DEBUG(4,("ntlm_password_check: Checking LMv2 password with upper-cased version of domain %s\n", 508 upper_client_domain ? upper_client_domain : "<NULL>")); 504 509 if (smb_pwd_check_ntlmv2(mem_ctx, 505 510 lm_response, 506 511 stored_nt->hash, challenge, 507 512 client_username, 508 client_domain, 509 true, 513 upper_client_domain, 510 514 &tmp_sess_key)) { 511 515 if (nt_response->length > 24) { … … 518 522 stored_nt->hash, challenge, 519 523 client_username, 520 client_domain, 521 true, 524 upper_client_domain, 522 525 user_sess_key); 523 526 } else { … … 537 540 client_username, 538 541 "", 539 false,540 542 &tmp_sess_key)) { 541 543 if (nt_response->length > 24) { … … 549 551 client_username, 550 552 "", 551 false,552 553 user_sess_key); 553 554 } else { -
vendor/current/libcli/auth/ntlmssp_server.c
r740 r746 360 360 if (ntlmssp_state->neg_flags & NTLMSSP_NEGOTIATE_NTLM2) { 361 361 if (ntlmssp_state->nt_resp.length == 24 && ntlmssp_state->lm_resp.length == 24) { 362 struct MD5Contextmd5_session_nonce_ctx;362 MD5_CTX md5_session_nonce_ctx; 363 363 state->doing_ntlm2 = true; 364 364 -
vendor/current/libcli/auth/ntlmssp_sign.c
r740 r746 52 52 const char *constant) 53 53 { 54 struct MD5Contextctx3;54 MD5_CTX ctx3; 55 55 MD5Init(&ctx3); 56 56 MD5Update(&ctx3, session_key.data, session_key.length); -
vendor/current/libcli/auth/proto.h
r740 r746 110 110 bool ntv2_owf_gen(const uint8_t owf[16], 111 111 const char *user_in, const char *domain_in, 112 bool upper_case_domain, /* Transform the domain into UPPER case */113 112 uint8_t kr_buf[16]); 114 113 void SMBOWFencrypt(const uint8_t passwd[16], const uint8_t *c8, uint8_t p24[24]); -
vendor/current/libcli/auth/schannel_sign.c
r740 r746 111 111 uint8_t packet_digest[16]; 112 112 static const uint8_t zeros[4]; 113 struct MD5Contextctx;113 MD5_CTX ctx; 114 114 115 115 MD5Init(&ctx); -
vendor/current/libcli/auth/smbencrypt.c
r740 r746 100 100 void E_md5hash(const uint8_t salt[16], const uint8_t nthash[16], uint8_t hash_out[16]) 101 101 { 102 struct MD5Contexttctx;102 MD5_CTX tctx; 103 103 MD5Init(&tctx); 104 104 MD5Update(&tctx, salt, 16); … … 169 169 bool ntv2_owf_gen(const uint8_t owf[16], 170 170 const char *user_in, const char *domain_in, 171 bool upper_case_domain, /* Transform the domain into UPPER case */172 171 uint8_t kr_buf[16]) 173 172 { … … 197 196 talloc_free(mem_ctx); 198 197 return false; 199 }200 201 if (upper_case_domain) {202 domain_in = strupper_talloc(mem_ctx, domain_in);203 if (domain_in == NULL) {204 talloc_free(mem_ctx);205 return false;206 }207 198 } 208 199 … … 475 466 This prevents username swapping during the auth exchange 476 467 */ 477 if (!ntv2_owf_gen(nt_hash, user, domain, true,ntlm_v2_hash)) {468 if (!ntv2_owf_gen(nt_hash, user, domain, ntlm_v2_hash)) { 478 469 return false; 479 470 } … … 624 615 void encode_or_decode_arc4_passwd_buffer(unsigned char pw_buf[532], const DATA_BLOB *psession_key) 625 616 { 626 struct MD5Contexttctx;617 MD5_CTX tctx; 627 618 unsigned char key_out[16]; 628 619 … … 704 695 { 705 696 uint8_t buffer[516]; 706 struct MD5Contextctx;697 MD5_CTX ctx; 707 698 struct wkssvc_PasswordBuffer *my_pwd_buf = NULL; 708 699 DATA_BLOB confounded_session_key; … … 742 733 { 743 734 uint8_t buffer[516]; 744 struct MD5Contextctx;735 MD5_CTX ctx; 745 736 size_t pwd_len; 746 737 -
vendor/current/libcli/cldap/cldap.c
r740 r746 274 274 DLIST_REMOVE(c->searches.list, search); 275 275 276 if (!cldap_recvfrom_setup(c)) { 277 goto nomem; 278 } 276 cldap_recvfrom_setup(c); 279 277 280 278 tevent_req_done(search->req); 281 talloc_free(in);282 279 return true; 283 280 … … 287 284 status = map_nt_error_from_unix(in->recv_errno); 288 285 nterror: 286 TALLOC_FREE(in); 289 287 /* in connected mode the first pending search gets the error */ 290 288 if (!c->connected) { … … 295 293 goto done; 296 294 } 295 cldap_recvfrom_setup(c); 297 296 tevent_req_nterror(c->searches.list->req, status); 297 return true; 298 298 done: 299 talloc_free(in);299 TALLOC_FREE(in); 300 300 return false; 301 301 } … … 314 314 NTSTATUS status; 315 315 int ret; 316 const char *fam = NULL; 317 318 if (local_addr == NULL && remote_addr == NULL) { 319 return NT_STATUS_INVALID_PARAMETER_MIX; 320 } 321 322 if (remote_addr) { 323 bool is_ipv4; 324 bool is_ipv6; 325 326 is_ipv4 = tsocket_address_is_inet(remote_addr, "ipv4"); 327 is_ipv6 = tsocket_address_is_inet(remote_addr, "ipv6"); 328 329 if (is_ipv4) { 330 fam = "ipv4"; 331 } else if (is_ipv6) { 332 fam = "ipv6"; 333 } else { 334 return NT_STATUS_INVALID_ADDRESS; 335 } 336 } 316 337 317 338 c = talloc_zero(mem_ctx, struct cldap_socket); … … 330 351 331 352 if (!local_addr) { 332 /* we use ipv4 here instead of ip, as otherwise we end 333 up with a PF_INET6 socket, and sendto() for ipv4 334 addresses will fail. That breaks cldap name 335 resolution for winbind to IPv4 hosts. */ 336 ret = tsocket_address_inet_from_strings(c, "ipv4", 353 /* 354 * Here we know the address family of the remote address. 355 */ 356 if (fam == NULL) { 357 return NT_STATUS_INVALID_PARAMETER_MIX; 358 } 359 360 ret = tsocket_address_inet_from_strings(c, fam, 337 361 NULL, 0, 338 362 &any); -
vendor/current/libcli/drsuapi/repl_decrypt.c
r740 r746 40 40 DATA_BLOB enc_buffer; 41 41 42 struct MD5Contextmd5;42 MD5_CTX md5; 43 43 uint8_t _enc_key[16]; 44 44 DATA_BLOB enc_key; … … 199 199 DATA_BLOB confounder; 200 200 201 struct MD5Contextmd5;201 MD5_CTX md5; 202 202 uint8_t _enc_key[16]; 203 203 DATA_BLOB enc_key; -
vendor/current/libcli/netlogon/ndr_netlogon.c
r740 r746 54 54 struct ndr_push *_ndr_sid; 55 55 uint32_t _flags_save_DATA_BLOB = ndr->flags; 56 ndr->flags &= ~LIBNDR_FLAG_NOALIGN; 56 57 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN4); 57 58 NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->_pad)); … … 99 100 uint32_t _flags_save_DATA_BLOB = ndr->flags; 100 101 struct ndr_pull *_ndr_sid; 102 ndr->flags &= ~LIBNDR_FLAG_NOALIGN; 101 103 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_ALIGN4); 102 104 NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->_pad)); -
vendor/current/libcli/security/access_check.c
r740 r746 159 159 uint32_t i; 160 160 uint32_t bits_remaining; 161 uint32_t explicitly_denied_bits = 0; 161 162 162 163 *access_granted = access_desired; … … 178 179 } 179 180 180 /* s3 had this with #if 0 previously. To be sure the merge 181 doesn't change any behaviour, we have the above #if check 182 on _SAMBA_BUILD_. */ 183 if (access_desired & SEC_FLAG_SYSTEM_SECURITY) { 181 /* the owner always gets SEC_STD_WRITE_DAC and SEC_STD_READ_CONTROL */ 182 if ((bits_remaining & (SEC_STD_WRITE_DAC|SEC_STD_READ_CONTROL)) && 183 security_token_has_sid(token, sd->owner_sid)) { 184 bits_remaining &= ~(SEC_STD_WRITE_DAC|SEC_STD_READ_CONTROL); 185 } 186 187 /* a NULL dacl allows access */ 188 if ((sd->type & SEC_DESC_DACL_PRESENT) && sd->dacl == NULL) { 189 *access_granted = access_desired; 190 return NT_STATUS_OK; 191 } 192 193 if (sd->dacl == NULL) { 194 goto done; 195 } 196 197 /* check each ace in turn. */ 198 for (i=0; bits_remaining && i < sd->dacl->num_aces; i++) { 199 struct security_ace *ace = &sd->dacl->aces[i]; 200 201 if (ace->flags & SEC_ACE_FLAG_INHERIT_ONLY) { 202 continue; 203 } 204 205 if (!security_token_has_sid(token, &ace->trustee)) { 206 continue; 207 } 208 209 switch (ace->type) { 210 case SEC_ACE_TYPE_ACCESS_ALLOWED: 211 bits_remaining &= ~ace->access_mask; 212 break; 213 case SEC_ACE_TYPE_ACCESS_DENIED: 214 case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT: 215 explicitly_denied_bits |= (bits_remaining & ace->access_mask); 216 break; 217 default: /* Other ACE types not handled/supported */ 218 break; 219 } 220 } 221 222 bits_remaining |= explicitly_denied_bits; 223 224 /* 225 * We check privileges here because they override even DENY entries. 226 */ 227 228 /* Does the user have the privilege to gain SEC_PRIV_SECURITY? */ 229 if (bits_remaining & SEC_FLAG_SYSTEM_SECURITY) { 184 230 if (security_token_has_privilege(token, SEC_PRIV_SECURITY)) { 185 231 bits_remaining &= ~SEC_FLAG_SYSTEM_SECURITY; … … 189 235 } 190 236 191 /* the owner always gets SEC_STD_WRITE_DAC and SEC_STD_READ_CONTROL */192 if ((bits_remaining & (SEC_STD_WRITE_DAC|SEC_STD_READ_CONTROL)) &&193 security_token_has_sid(token, sd->owner_sid)) {194 bits_remaining &= ~(SEC_STD_WRITE_DAC|SEC_STD_READ_CONTROL);195 }196 197 237 /* TODO: remove this, as it is file server specific */ 198 238 if ((bits_remaining & SEC_RIGHTS_PRIV_RESTORE) && … … 205 245 } 206 246 207 /* a NULL dacl allows access */ 208 if ((sd->type & SEC_DESC_DACL_PRESENT) && sd->dacl == NULL) { 209 *access_granted = access_desired; 210 return NT_STATUS_OK; 211 } 212 213 if (sd->dacl == NULL) { 214 goto done; 215 } 216 217 /* check each ace in turn. */ 218 for (i=0; bits_remaining && i < sd->dacl->num_aces; i++) { 219 struct security_ace *ace = &sd->dacl->aces[i]; 220 221 if (ace->flags & SEC_ACE_FLAG_INHERIT_ONLY) { 222 continue; 223 } 224 225 if (!security_token_has_sid(token, &ace->trustee)) { 226 continue; 227 } 228 229 switch (ace->type) { 230 case SEC_ACE_TYPE_ACCESS_ALLOWED: 231 bits_remaining &= ~ace->access_mask; 232 break; 233 case SEC_ACE_TYPE_ACCESS_DENIED: 234 case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT: 235 if (bits_remaining & ace->access_mask) { 236 return NT_STATUS_ACCESS_DENIED; 237 } 238 break; 239 default: /* Other ACE types not handled/supported */ 240 break; 241 } 247 if ((bits_remaining & SEC_STD_WRITE_OWNER) && 248 security_token_has_privilege(token, SEC_PRIV_TAKE_OWNERSHIP)) { 249 bits_remaining &= ~(SEC_STD_WRITE_OWNER); 242 250 } 243 251 -
vendor/current/libcli/smb/smb2_constants.h
r740 r746 26 26 #define SMB2_HDR_PROTOCOL_ID 0x00 27 27 #define SMB2_HDR_LENGTH 0x04 28 #define SMB2_HDR_EPOCH 0x06 28 #define SMB2_HDR_CREDIT_CHARGE 0x06 29 #define SMB2_HDR_EPOCH SMB2_HDR_CREDIT_CHARGE /* TODO: remove this */ 29 30 #define SMB2_HDR_STATUS 0x08 30 31 #define SMB2_HDR_OPCODE 0x0c -
vendor/current/libcli/smb/smb2_create_blob.c
r414 r746 60 60 if ((next & 0x7) != 0 || 61 61 next > remaining || 62 name_offset < 16 || 63 name_offset > remaining || 64 name_length != 4 || /* windows enforces this */ 62 name_offset != 16 || 63 name_length < 4 || 65 64 name_offset + name_length > remaining || 66 data_offset < name_offset + name_length || 67 data_offset > remaining || 68 data_offset + (uint64_t)data_length > remaining) { 65 (data_offset & 0x7) != 0 || 66 (data_offset && (data_offset < name_offset + name_length)) || 67 (data_offset > remaining) || 68 (data_offset + (uint64_t)data_length > remaining)) { 69 69 return NT_STATUS_INVALID_PARAMETER; 70 70 } … … 106 106 uint32_t ofs = buffer->length; 107 107 size_t tag_length = strlen(blob->tag); 108 uint8_t pad = smb2_create_blob_padding(blob->data.length+tag_length, 4); 109 110 if (!data_blob_realloc(mem_ctx, buffer, 111 buffer->length + 0x14 + tag_length + blob->data.length + pad)) 108 size_t blob_offset = 0; 109 size_t blob_pad = 0; 110 size_t next_offset = 0; 111 size_t next_pad = 0; 112 bool ok; 113 114 blob_offset = 0x10 + tag_length; 115 blob_pad = smb2_create_blob_padding(blob_offset, 8); 116 next_offset = blob_offset + blob_pad + blob->data.length; 117 if (!last) { 118 next_pad = smb2_create_blob_padding(next_offset, 8); 119 } 120 121 ok = data_blob_realloc(mem_ctx, buffer, 122 buffer->length + next_offset + next_pad); 123 if (!ok) { 112 124 return NT_STATUS_NO_MEMORY; 125 } 113 126 114 127 if (last) { 115 128 SIVAL(buffer->data, ofs+0x00, 0); 116 129 } else { 117 SIVAL(buffer->data, ofs+0x00, 0x14 + tag_length + blob->data.length +pad);130 SIVAL(buffer->data, ofs+0x00, next_offset + next_pad); 118 131 } 119 132 SSVAL(buffer->data, ofs+0x04, 0x10); /* offset of tag */ 120 133 SIVAL(buffer->data, ofs+0x06, tag_length); /* tag length */ 121 SSVAL(buffer->data, ofs+0x0A, 0x14 + tag_length); /* offset of data */134 SSVAL(buffer->data, ofs+0x0A, blob_offset + blob_pad); /* offset of data */ 122 135 SIVAL(buffer->data, ofs+0x0C, blob->data.length); 123 136 memcpy(buffer->data+ofs+0x10, blob->tag, tag_length); 124 SIVAL(buffer->data, ofs+0x10+tag_length, 0); /* pad? */ 125 memcpy(buffer->data+ofs+0x14+tag_length, blob->data.data, blob->data.length); 126 memset(buffer->data+ofs+0x14+tag_length+blob->data.length, 0, pad); 137 if (blob_pad > 0) { 138 memset(buffer->data+ofs+blob_offset, 0, blob_pad); 139 blob_offset += blob_pad; 140 } 141 memcpy(buffer->data+ofs+blob_offset, blob->data.data, blob->data.length); 142 if (next_pad > 0) { 143 memset(buffer->data+ofs+next_offset, 0, next_pad); 144 next_offset += next_pad; 145 } 127 146 128 147 return NT_STATUS_OK;
Note:
See TracChangeset
for help on using the changeset viewer.