}
} else {
if (!msrpc_parse(gensec_ntlmssp_state,
+ lp_iconv_convenience(gensec_security->lp_ctx),
&input, "Cd",
"NTLMSSP",
&ntlmssp_command)) {
/* generate the ntlmssp negotiate packet */
msrpc_gen(out_mem_ctx,
+ lp_iconv_convenience(gensec_security->lp_ctx),
out, "CddAA",
"NTLMSSP",
NTLMSSP_NEGOTIATE,
}
if (!msrpc_parse(mem_ctx,
+ lp_iconv_convenience(gensec_security->lp_ctx),
&in, "CdBd",
"NTLMSSP",
&ntlmssp_command,
}
if (!msrpc_parse(mem_ctx,
+ lp_iconv_convenience(gensec_security->lp_ctx),
&in, chal_parse_string,
"NTLMSSP",
&ntlmssp_command,
/* this generates the actual auth packet */
if (!msrpc_gen(mem_ctx,
+ lp_iconv_convenience(gensec_security->lp_ctx),
out, auth_gen_string,
"NTLMSSP",
NTLMSSP_AUTH,
d = word (4 bytes)
C = constant ascii string
*/
-bool msrpc_gen(TALLOC_CTX *mem_ctx, DATA_BLOB *blob,
+bool msrpc_gen(TALLOC_CTX *mem_ctx,
+ struct smb_iconv_convenience *iconv_convenience,
+ DATA_BLOB *blob,
const char *format, ...)
{
int i;
case 'U':
s = va_arg(ap, char *);
head_size += 8;
- n = push_ucs2_talloc(pointers, lp_iconv_convenience(global_loadparm), (void **)&pointers[i].data, s);
+ n = push_ucs2_talloc(pointers, iconv_convenience, (void **)&pointers[i].data, s);
if (n == -1) {
return false;
}
case 'A':
s = va_arg(ap, char *);
head_size += 8;
- n = push_ascii_talloc(pointers, lp_iconv_convenience(global_loadparm), (char **)&pointers[i].data, s);
+ n = push_ascii_talloc(pointers, iconv_convenience, (char **)&pointers[i].data, s);
if (n == -1) {
return false;
}
n = va_arg(ap, int);
intargs[i] = n;
s = va_arg(ap, char *);
- n = push_ucs2_talloc(pointers, lp_iconv_convenience(global_loadparm), (void **)&pointers[i].data, s);
+ n = push_ucs2_talloc(pointers, iconv_convenience, (void **)&pointers[i].data, s);
if (n == -1) {
return false;
}
C = constant ascii string
*/
-bool msrpc_parse(TALLOC_CTX *mem_ctx, const DATA_BLOB *blob,
+bool msrpc_parse(TALLOC_CTX *mem_ctx,
+ struct smb_iconv_convenience *iconv_convenience,
+ const DATA_BLOB *blob,
const char *format, ...)
{
int i;
}
if (0 < len1) {
- pull_string(lp_iconv_convenience(global_loadparm), p, blob->data + ptr, p_len,
+ pull_string(iconv_convenience, p, blob->data + ptr, p_len,
len1, STR_UNICODE|STR_NOALIGN);
(*ps) = talloc_strdup(mem_ctx, p);
if (!(*ps)) {
}
if (0 < len1) {
- pull_string(lp_iconv_convenience(global_loadparm), p, blob->data + ptr, p_len,
+ pull_string(iconv_convenience, p, blob->data + ptr, p_len,
len1, STR_ASCII|STR_NOALIGN);
(*ps) = talloc_strdup(mem_ctx, p);
if (!(*ps)) {
goto cleanup;
}
- head_ofs += pull_string(lp_iconv_convenience(global_loadparm), p,
+ head_ofs += pull_string(iconv_convenience, p,
blob->data+head_ofs, p_len,
blob->length - head_ofs,
STR_ASCII|STR_TERMINATE);
#endif
if (in.length) {
- if ((in.length < 16) || !msrpc_parse(out_mem_ctx, &in, "Cdd",
+ if ((in.length < 16) || !msrpc_parse(out_mem_ctx,
+ lp_iconv_convenience(gensec_security->lp_ctx),
+ &in, "Cdd",
"NTLMSSP",
&ntlmssp_command,
&neg_flags)) {
}
msrpc_gen(out_mem_ctx,
+ lp_iconv_convenience(gensec_security->lp_ctx),
&struct_blob, "aaaaa",
NTLMSSP_NAME_TYPE_DOMAIN, target_name,
NTLMSSP_NAME_TYPE_SERVER, gensec_ntlmssp_state->server_name,
}
msrpc_gen(out_mem_ctx,
+ lp_iconv_convenience(gensec_security->lp_ctx),
out, gen_string,
"NTLMSSP",
NTLMSSP_CHALLENGE,
/* now the NTLMSSP encoded auth hashes */
if (!msrpc_parse(gensec_ntlmssp_state,
+ lp_iconv_convenience(gensec_ntlmssp_state->gensec_security->lp_ctx),
&request, parse_string,
"NTLMSSP",
&ntlmssp_command,
/* now the NTLMSSP encoded auth hashes */
if (!msrpc_parse(gensec_ntlmssp_state,
+ lp_iconv_convenience(gensec_ntlmssp_state->gensec_security->lp_ctx),
&request, parse_string,
"NTLMSSP",
&ntlmssp_command,
#include "lib/crypto/crypto.h"
#include "auth/credentials/credentials.h"
#include "auth/gensec/gensec.h"
+#include "param/param.h"
#define CLI_SIGN "session key to client-to-server signing key magic constant"
#define CLI_SEAL "session key to client-to-server sealing key magic constant"
} else {
uint32_t crc;
crc = crc32_calc_buffer(data, length);
- if (!msrpc_gen(sig_mem_ctx, sig, "dddd", NTLMSSP_SIGN_VERSION, 0, crc, gensec_ntlmssp_state->crypt.ntlm.seq_num)) {
+ if (!msrpc_gen(sig_mem_ctx,
+ lp_iconv_convenience(gensec_ntlmssp_state->gensec_security->lp_ctx),
+ sig, "dddd", NTLMSSP_SIGN_VERSION, 0, crc, gensec_ntlmssp_state->crypt.ntlm.seq_num)) {
return NT_STATUS_NO_MEMORY;
}
gensec_ntlmssp_state->crypt.ntlm.seq_num++;
} else {
uint32_t crc;
crc = crc32_calc_buffer(data, length);
- if (!msrpc_gen(sig_mem_ctx, sig, "dddd", NTLMSSP_SIGN_VERSION, 0, crc, gensec_ntlmssp_state->crypt.ntlm.seq_num)) {
+ if (!msrpc_gen(sig_mem_ctx,
+ lp_iconv_convenience(gensec_security->lp_ctx),
+ sig, "dddd", NTLMSSP_SIGN_VERSION, 0, crc, gensec_ntlmssp_state->crypt.ntlm.seq_num)) {
return NT_STATUS_NO_MEMORY;
}
{
DATA_BLOB names_blob = data_blob_talloc(mem_ctx, NULL, 0);
- msrpc_gen(mem_ctx, &names_blob, "aaa",
+ msrpc_gen(mem_ctx, lp_iconv_convenience(global_loadparm), &names_blob,
+ "aaa",
NTLMSSP_NAME_TYPE_DOMAIN, domain,
NTLMSSP_NAME_TYPE_SERVER, hostname,
0, "");
/* See http://www.ubiqx.org/cifs/SMB.html#SMB.8.5 */
- msrpc_gen(mem_ctx, &response, "ddbbdb",
+ msrpc_gen(mem_ctx, NULL, &response, "ddbbdb",
0x00000101, /* Header */
0, /* 'Reserved' */
long_date, 8, /* Timestamp */