1
0
mirror of https://github.com/samba-team/samba.git synced 2025-12-12 12:23:50 +03:00

r26429: Avoid use of global_smb_iconv_convenience.

This commit is contained in:
Jelmer Vernooij
2007-12-13 22:46:09 +01:00
committed by Stefan Metzmacher
parent 5a3a851dc7
commit d37136b7ab
39 changed files with 176 additions and 138 deletions

View File

@@ -28,6 +28,7 @@
#include "lib/crypto/crypto.h"
#include "libcli/auth/libcli_auth.h"
#include "pstring.h"
#include "param/param.h"
/*
This implements the X/Open SMB password encryption
@@ -67,7 +68,7 @@ _PUBLIC_ bool E_md4hash(const char *passwd, uint8_t p16[16])
int len;
void *wpwd;
len = push_ucs2_talloc(NULL, global_smb_iconv_convenience, &wpwd, passwd);
len = push_ucs2_talloc(NULL, lp_iconv_convenience(global_loadparm), &wpwd, passwd);
if (len < 2) {
/* We don't want to return fixed data, as most callers
* don't check */
@@ -97,7 +98,7 @@ _PUBLIC_ bool E_deshash(const char *passwd, uint8_t p16[16])
ZERO_STRUCT(dospwd);
/* Password must be converted to DOS charset - null terminated, uppercase. */
push_string(global_smb_iconv_convenience, dospwd, passwd, sizeof(dospwd), STR_ASCII|STR_UPPER|STR_TERMINATE);
push_string(lp_iconv_convenience(global_loadparm), dospwd, passwd, sizeof(dospwd), STR_ASCII|STR_UPPER|STR_TERMINATE);
/* Only the fisrt 14 chars are considered, password need not be null terminated. */
E_P16((const uint8_t *)dospwd, p16);
@@ -150,14 +151,14 @@ bool ntv2_owf_gen(const uint8_t owf[16],
}
}
user_byte_len = push_ucs2_talloc(mem_ctx, global_smb_iconv_convenience, &user, user_in);
user_byte_len = push_ucs2_talloc(mem_ctx, lp_iconv_convenience(global_loadparm), &user, user_in);
if (user_byte_len == (ssize_t)-1) {
DEBUG(0, ("push_uss2_talloc() for user returned -1 (probably talloc() failure)\n"));
talloc_free(mem_ctx);
return false;
}
domain_byte_len = push_ucs2_talloc(mem_ctx, global_smb_iconv_convenience, &domain, domain_in);
domain_byte_len = push_ucs2_talloc(mem_ctx, lp_iconv_convenience(global_loadparm), &domain, domain_in);
if (domain_byte_len == (ssize_t)-1) {
DEBUG(0, ("push_ucs2_talloc() for domain returned -1 (probably talloc() failure)\n"));
talloc_free(mem_ctx);
@@ -468,7 +469,7 @@ bool encode_pw_buffer(uint8_t buffer[516], const char *password, int string_flag
/* the incoming buffer can be any alignment. */
string_flags |= STR_NOALIGN;
new_pw_len = push_string(global_smb_iconv_convenience, new_pw,
new_pw_len = push_string(lp_iconv_convenience(global_loadparm), new_pw,
password,
sizeof(new_pw), string_flags);
@@ -521,7 +522,7 @@ bool decode_pw_buffer(uint8_t in_buffer[516], char *new_pwrd,
}
/* decode into the return buffer. Buffer length supplied */
*new_pw_len = pull_string(global_smb_iconv_convenience, new_pwrd, &in_buffer[512 - byte_len], new_pwrd_size,
*new_pw_len = pull_string(lp_iconv_convenience(global_loadparm), new_pwrd, &in_buffer[512 - byte_len], new_pwrd_size,
byte_len, string_flags);
#ifdef DEBUG_PASSWORD