summaryrefslogtreecommitdiff
path: root/source3/rpc_parse/parse_net.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2001-07-10 17:02:02 +0000
committerAndrew Bartlett <abartlet@samba.org>2001-07-10 17:02:02 +0000
commite4b6f641e8590b385672e12f4a2829c69e2d33aa (patch)
tree076872ef154e69c2aa61685d4a6a9dbd0c623822 /source3/rpc_parse/parse_net.c
parent973a78c2db1e15fc0a88b15d8857a8d7cf46a140 (diff)
downloadsamba-e4b6f641e8590b385672e12f4a2829c69e2d33aa.tar.gz
samba-e4b6f641e8590b385672e12f4a2829c69e2d33aa.tar.bz2
samba-e4b6f641e8590b385672e12f4a2829c69e2d33aa.zip
This fixes security=domain, which has been broke since the big charset
changeover. For my own sainity I have created a new function to fill out both the header and buffer for a string in an RPC struct. This DOES NOT take a length argument, only the actual string to be placed. The RPC code is currently littered with code that does init_uni_hdr() followed immidiatly by init_unistr2(), and often the length argument is wrong. (It was for the code I changed, even before the charset stuff). Another bug where we made strings AT LEAST MAX_UNICODE_LEN long hid this bug. This works for loopback connections to Samba, and can't be any more broke than it was before :-). (We had double and revese conversions, fun...). In particular this makes us multibyte complient. In any case, if there are no objections I will slowly convert other bits of code to the same system. (This used to be commit cf1d1cd9d6362f6e32ed9c2f6d2f6f25c47705ad)
Diffstat (limited to 'source3/rpc_parse/parse_net.c')
-rw-r--r--source3/rpc_parse/parse_net.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c
index d7253a53fd..35890c2f27 100644
--- a/source3/rpc_parse/parse_net.c
+++ b/source3/rpc_parse/parse_net.c
@@ -5,6 +5,7 @@
* Copyright (C) Andrew Tridgell 1992-1997,
* Copyright (C) Luke Kenneth Casson Leighton 1996-1997,
* Copyright (C) Paul Ashton 1997.
+ * Copyright (C) Andrew Bartlett 2001.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -983,9 +984,6 @@ void init_id_info2(NET_ID_INFO_2 *id, char *domain_name,
unsigned char *lm_chal_resp,
unsigned char *nt_chal_resp)
{
- int len_domain_name = strlen(domain_name);
- int len_user_name = strlen(user_name );
- int len_wksta_name = strlen(wksta_name );
int nt_chal_resp_len = ((nt_chal_resp != NULL) ? 24 : 0);
int lm_chal_resp_len = ((lm_chal_resp != NULL) ? 24 : 0);
unsigned char lm_owf[24];
@@ -995,14 +993,9 @@ void init_id_info2(NET_ID_INFO_2 *id, char *domain_name,
id->ptr_id_info2 = 1;
- init_uni_hdr(&id->hdr_domain_name, len_domain_name);
-
id->param_ctrl = param_ctrl;
init_logon_id(&id->logon_id, log_id_low, log_id_high);
- init_uni_hdr(&id->hdr_user_name, len_user_name);
- init_uni_hdr(&id->hdr_wksta_name, len_wksta_name);
-
if (nt_chal_resp) {
/* oops. can only send what-ever-it-is direct */
memcpy(nt_owf, nt_chal_resp, 24);
@@ -1018,9 +1011,9 @@ void init_id_info2(NET_ID_INFO_2 *id, char *domain_name,
init_str_hdr(&id->hdr_nt_chal_resp, 24, nt_chal_resp_len, (nt_chal_resp != NULL) ? 1 : 0);
init_str_hdr(&id->hdr_lm_chal_resp, 24, lm_chal_resp_len, (lm_chal_resp != NULL) ? 1 : 0);
- init_unistr2(&id->uni_domain_name, domain_name, len_domain_name);
- init_unistr2(&id->uni_user_name, user_name, len_user_name);
- init_unistr2(&id->uni_wksta_name, wksta_name, len_wksta_name);
+ init_unistr2_and_hdr(&id->uni_domain_name, &id->hdr_domain_name, domain_name);
+ init_unistr2_and_hdr(&id->uni_user_name, &id->hdr_user_name, user_name);
+ init_unistr2_and_hdr(&id->uni_wksta_name, &id->hdr_wksta_name, wksta_name);
init_string2(&id->nt_chal_resp, (char *)nt_chal_resp, nt_chal_resp_len);
init_string2(&id->lm_chal_resp, (char *)lm_chal_resp, lm_chal_resp_len);