Author: jelmer Date: 2008-01-03 17:22:04 +0000 (Thu, 03 Jan 2008) New Revision: 26652
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=26652 Log: msrpc_parse/msrpc_gen: Add iconv_convenience argument. Modified: branches/SAMBA_4_0/ branches/SAMBA_4_0/source/auth/ntlmssp/ntlmssp.c branches/SAMBA_4_0/source/auth/ntlmssp/ntlmssp_client.c branches/SAMBA_4_0/source/auth/ntlmssp/ntlmssp_parse.c branches/SAMBA_4_0/source/auth/ntlmssp/ntlmssp_server.c branches/SAMBA_4_0/source/auth/ntlmssp/ntlmssp_sign.c branches/SAMBA_4_0/source/libcli/auth/smbencrypt.c Changeset: Property changes on: branches/SAMBA_4_0 ___________________________________________________________________ Name: bzr:revision-info ...skipped... Name: bzr:revision-id:v3-trunk0 ...skipped... Modified: branches/SAMBA_4_0/source/auth/ntlmssp/ntlmssp.c =================================================================== --- branches/SAMBA_4_0/source/auth/ntlmssp/ntlmssp.c 2008-01-03 17:21:58 UTC (rev 26651) +++ branches/SAMBA_4_0/source/auth/ntlmssp/ntlmssp.c 2008-01-03 17:22:04 UTC (rev 26652) @@ -157,6 +157,7 @@ } } else { if (!msrpc_parse(gensec_ntlmssp_state, + lp_iconv_convenience(gensec_security->lp_ctx), &input, "Cd", "NTLMSSP", &ntlmssp_command)) { Modified: branches/SAMBA_4_0/source/auth/ntlmssp/ntlmssp_client.c =================================================================== --- branches/SAMBA_4_0/source/auth/ntlmssp/ntlmssp_client.c 2008-01-03 17:21:58 UTC (rev 26651) +++ branches/SAMBA_4_0/source/auth/ntlmssp/ntlmssp_client.c 2008-01-03 17:22:04 UTC (rev 26652) @@ -62,6 +62,7 @@ /* generate the ntlmssp negotiate packet */ msrpc_gen(out_mem_ctx, + lp_iconv_convenience(gensec_security->lp_ctx), out, "CddAA", "NTLMSSP", NTLMSSP_NEGOTIATE, @@ -111,6 +112,7 @@ } if (!msrpc_parse(mem_ctx, + lp_iconv_convenience(gensec_security->lp_ctx), &in, "CdBd", "NTLMSSP", &ntlmssp_command, @@ -148,6 +150,7 @@ } if (!msrpc_parse(mem_ctx, + lp_iconv_convenience(gensec_security->lp_ctx), &in, chal_parse_string, "NTLMSSP", &ntlmssp_command, @@ -244,6 +247,7 @@ /* 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, Modified: branches/SAMBA_4_0/source/auth/ntlmssp/ntlmssp_parse.c =================================================================== --- branches/SAMBA_4_0/source/auth/ntlmssp/ntlmssp_parse.c 2008-01-03 17:21:58 UTC (rev 26651) +++ branches/SAMBA_4_0/source/auth/ntlmssp/ntlmssp_parse.c 2008-01-03 17:22:04 UTC (rev 26652) @@ -41,7 +41,9 @@ 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; @@ -65,7 +67,7 @@ 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; } @@ -76,7 +78,7 @@ 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; } @@ -88,7 +90,7 @@ 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; } @@ -199,7 +201,9 @@ 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; @@ -244,7 +248,7 @@ } 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)) { @@ -279,7 +283,7 @@ } 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)) { @@ -344,7 +348,7 @@ 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); Modified: branches/SAMBA_4_0/source/auth/ntlmssp/ntlmssp_server.c =================================================================== --- branches/SAMBA_4_0/source/auth/ntlmssp/ntlmssp_server.c 2008-01-03 17:21:58 UTC (rev 26651) +++ branches/SAMBA_4_0/source/auth/ntlmssp/ntlmssp_server.c 2008-01-03 17:22:04 UTC (rev 26652) @@ -136,7 +136,9 @@ #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)) { @@ -201,6 +203,7 @@ } 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, @@ -221,6 +224,7 @@ } msrpc_gen(out_mem_ctx, + lp_iconv_convenience(gensec_security->lp_ctx), out, gen_string, "NTLMSSP", NTLMSSP_CHALLENGE, @@ -278,6 +282,7 @@ /* 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, @@ -304,6 +309,7 @@ /* 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, Modified: branches/SAMBA_4_0/source/auth/ntlmssp/ntlmssp_sign.c =================================================================== --- branches/SAMBA_4_0/source/auth/ntlmssp/ntlmssp_sign.c 2008-01-03 17:21:58 UTC (rev 26651) +++ branches/SAMBA_4_0/source/auth/ntlmssp/ntlmssp_sign.c 2008-01-03 17:22:04 UTC (rev 26652) @@ -26,6 +26,7 @@ #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" @@ -117,7 +118,9 @@ } 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++; @@ -244,7 +247,9 @@ } 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; } Modified: branches/SAMBA_4_0/source/libcli/auth/smbencrypt.c =================================================================== --- branches/SAMBA_4_0/source/libcli/auth/smbencrypt.c 2008-01-03 17:21:58 UTC (rev 26651) +++ branches/SAMBA_4_0/source/libcli/auth/smbencrypt.c 2008-01-03 17:22:04 UTC (rev 26652) @@ -299,7 +299,8 @@ { 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, ""); @@ -321,7 +322,7 @@ /* 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 */