mirror of
https://github.com/samba-team/samba.git
synced 2025-02-09 09:57:48 +03:00
Merge from HEAD:
- remove useless #else - signed/unsigned fixes - use an fstring for LM hash buffer. Andrew Bartlett
This commit is contained in:
parent
6dd474d845
commit
c0fb53c31f
@ -57,8 +57,6 @@ static void sig_cld_leave_status(int signum)
|
|||||||
|
|
||||||
#if !defined(HAVE_SIGACTION)
|
#if !defined(HAVE_SIGACTION)
|
||||||
CatchSignal(SIGCLD, sig_cld_leave_status);
|
CatchSignal(SIGCLD, sig_cld_leave_status);
|
||||||
#else
|
|
||||||
;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,13 +73,14 @@ void E_md4hash(const char *passwd, uchar p16[16])
|
|||||||
|
|
||||||
void E_deshash(const char *passwd, uchar p16[16])
|
void E_deshash(const char *passwd, uchar p16[16])
|
||||||
{
|
{
|
||||||
uchar dospwd[15]; /* Password must not be > 14 chars long. */
|
fstring dospwd;
|
||||||
ZERO_STRUCT(dospwd);
|
ZERO_STRUCT(dospwd);
|
||||||
ZERO_STRUCTP(p16);
|
ZERO_STRUCTP(p16);
|
||||||
|
|
||||||
/* Password must be converted to DOS charset - null terminated, uppercase. */
|
/* Password must be converted to DOS charset - null terminated, uppercase. */
|
||||||
push_ascii(dospwd, (const char *)passwd, sizeof(dospwd), STR_UPPER|STR_TERMINATE);
|
push_ascii(dospwd, (const char *)passwd, sizeof(dospwd), STR_UPPER|STR_TERMINATE);
|
||||||
|
|
||||||
|
/* Only the fisrt 14 chars are considered, password need not be null terminated. */
|
||||||
E_P16(dospwd, p16);
|
E_P16(dospwd, p16);
|
||||||
|
|
||||||
ZERO_STRUCT(dospwd);
|
ZERO_STRUCT(dospwd);
|
||||||
@ -122,33 +123,33 @@ BOOL ntv2_owf_gen(const uchar owf[16],
|
|||||||
smb_ucs2_t *user;
|
smb_ucs2_t *user;
|
||||||
smb_ucs2_t *domain;
|
smb_ucs2_t *domain;
|
||||||
|
|
||||||
int user_byte_len;
|
size_t user_byte_len;
|
||||||
int domain_byte_len;
|
size_t domain_byte_len;
|
||||||
|
|
||||||
HMACMD5Context ctx;
|
HMACMD5Context ctx;
|
||||||
|
|
||||||
user_byte_len = push_ucs2_allocate(&user, user_in);
|
user_byte_len = push_ucs2_allocate(&user, user_in);
|
||||||
if (user_byte_len < 0) {
|
if (user_byte_len == (size_t)-1) {
|
||||||
DEBUG(0, ("push_ucs2_allocate() for user returned %d (probably malloc() failure)\n", user_byte_len));
|
DEBUG(0, ("push_uss2_allocate() for user returned -1 (probably malloc() failure)\n"));
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
|
|
||||||
domain_byte_len = push_ucs2_allocate(&domain, domain_in);
|
domain_byte_len = push_ucs2_allocate(&domain, domain_in);
|
||||||
if (domain_byte_len < 0) {
|
if (domain_byte_len == (size_t)-1) {
|
||||||
DEBUG(0, ("push_ucs2_allocate() for domain returned %d (probably malloc() failure)\n", domain_byte_len));
|
DEBUG(0, ("push_uss2_allocate() for domain returned -1 (probably malloc() failure)\n"));
|
||||||
return False;
|
return False;
|
||||||
}
|
}
|
||||||
|
|
||||||
strupper_w(user);
|
strupper_w(user);
|
||||||
strupper_w(domain);
|
strupper_w(domain);
|
||||||
|
|
||||||
|
SMB_ASSERT(user_byte_len >= 2);
|
||||||
|
SMB_ASSERT(domain_byte_len >= 2);
|
||||||
|
|
||||||
/* We don't want null termination */
|
/* We don't want null termination */
|
||||||
user_byte_len = user_byte_len - 2;
|
user_byte_len = user_byte_len - 2;
|
||||||
domain_byte_len = domain_byte_len - 2;
|
domain_byte_len = domain_byte_len - 2;
|
||||||
|
|
||||||
SMB_ASSERT(user_byte_len >= 0);
|
|
||||||
SMB_ASSERT(domain_byte_len >= 0);
|
|
||||||
|
|
||||||
hmac_md5_init_limK_to_64(owf, 16, &ctx);
|
hmac_md5_init_limK_to_64(owf, 16, &ctx);
|
||||||
hmac_md5_update((const unsigned char *)user, user_byte_len, &ctx);
|
hmac_md5_update((const unsigned char *)user, user_byte_len, &ctx);
|
||||||
hmac_md5_update((const unsigned char *)domain, domain_byte_len, &ctx);
|
hmac_md5_update((const unsigned char *)domain, domain_byte_len, &ctx);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user