From 87fbb7092b8f8b2f0db0f361c3d625e19de57cd9 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 4 Jul 2001 07:15:53 +0000 Subject: The big character set handling changeover! This commit gets rid of all our old codepage handling and replaces it with iconv. All internal strings in Samba are now in "unix" charset, which may be multi-byte. See internals.doc and my posting to samba-technical for a more complete explanation. (This used to be commit debb471267960e56005a741817ebd227ecfc512a) --- source3/rpc_client/cli_login.c | 9 +++------ source3/rpc_client/cli_lsarpc.c | 8 ++------ source3/rpc_client/cli_netlogon.c | 12 ++++++------ source3/rpc_client/cli_reg.c | 9 +++++---- 4 files changed, 16 insertions(+), 22 deletions(-) (limited to 'source3/rpc_client') diff --git a/source3/rpc_client/cli_login.c b/source3/rpc_client/cli_login.c index aaf4fe17aa..f46aa7b08f 100644 --- a/source3/rpc_client/cli_login.c +++ b/source3/rpc_client/cli_login.c @@ -165,14 +165,11 @@ BOOL cli_nt_login_network(struct cli_state *cli, char *domain, char *username, /* indicate a "network" login */ ctr->switch_value = NET_LOGON_TYPE; - fstrcpy(dos_wksta_name, cli->clnt_name_slash); - unix_to_dos(dos_wksta_name, True); + clistr_pull(cli, dos_wksta_name, cli->clnt_name_slash, sizeof(dos_wksta_name), 0, STR_TERMINATE); - fstrcpy(dos_username, username); - unix_to_dos(dos_username, True); + clistr_pull(cli, dos_username, username, sizeof(dos_username), 0, STR_TERMINATE); - fstrcpy(dos_domain, domain); - unix_to_dos(dos_domain, True); + clistr_pull(cli, dos_domain, username, sizeof(dos_domain), 0, STR_TERMINATE); /* Create the structure needed for SAM logon. */ init_id_info2(&ctr->auth.id2, dos_domain, 0, smb_userid_low, 0, diff --git a/source3/rpc_client/cli_lsarpc.c b/source3/rpc_client/cli_lsarpc.c index c4e55c3749..96d77ab3cf 100644 --- a/source3/rpc_client/cli_lsarpc.c +++ b/source3/rpc_client/cli_lsarpc.c @@ -164,18 +164,14 @@ BOOL do_lsa_query_info_pol(struct cli_state *cli, switch (r_q.info_class) { case 3: if (r_q.dom.id3.buffer_dom_name != 0) { - char *dom_name = dos_unistrn2(r_q.dom.id3.uni_domain_name.buffer, - r_q.dom.id3.uni_domain_name.uni_str_len); - fstrcpy(domain_name, dom_name); + rpcstr_pull(domain_name, r_q.dom.id3.uni_domain_name.buffer, sizeof(domain_name), r_q.dom.id3.uni_domain_name.uni_str_len*2, 0); } if (r_q.dom.id3.buffer_dom_sid != 0) *domain_sid = r_q.dom.id3.dom_sid.sid; break; case 5: if (r_q.dom.id5.buffer_dom_name != 0) { - char *dom_name = dos_unistrn2(r_q.dom.id5.uni_domain_name.buffer, - r_q.dom.id5.uni_domain_name.uni_str_len); - fstrcpy(domain_name, dom_name); + rpcstr_pull(domain_name, r_q.dom.id5.uni_domain_name.buffer, sizeof(domain_name), r_q.dom.id5.uni_domain_name.uni_str_len*2, 0); } if (r_q.dom.id5.buffer_dom_sid != 0) *domain_sid = r_q.dom.id5.dom_sid.sid; diff --git a/source3/rpc_client/cli_netlogon.c b/source3/rpc_client/cli_netlogon.c index 2c9d38166d..5b96c8300f 100644 --- a/source3/rpc_client/cli_netlogon.c +++ b/source3/rpc_client/cli_netlogon.c @@ -73,7 +73,7 @@ BOOL cli_net_logon_ctrl2(struct cli_state *cli, uint32 status_level) global_myname, status_level)); /* store the parameters */ - init_q_logon_ctrl2(&q_l, unix_to_dos(cli->srv_name_slash,False), + init_q_logon_ctrl2(&q_l, cli->srv_name_slash, status_level); /* turn parameters into data stream */ @@ -136,7 +136,7 @@ BOOL cli_net_auth2(struct cli_state *cli, uint16 sec_chan, credstr(cli->clnt_cred.challenge.data), neg_flags)); /* store the parameters */ - init_q_auth_2(&q_a, unix_to_dos(cli->srv_name_slash,False), cli->mach_acct, + init_q_auth_2(&q_a, cli->srv_name_slash, cli->mach_acct, sec_chan, global_myname, &cli->clnt_cred.challenge, neg_flags); /* turn parameters into data stream */ @@ -225,7 +225,7 @@ BOOL cli_net_req_chal(struct cli_state *cli, DOM_CHAL *clnt_chal, DOM_CHAL *srv_ cli->desthost, global_myname, credstr(clnt_chal->data))); /* store the parameters */ - init_q_req_chal(&q_c, unix_to_dos(cli->srv_name_slash,False), + init_q_req_chal(&q_c, cli->srv_name_slash, global_myname, clnt_chal); /* turn parameters into data stream */ @@ -291,7 +291,7 @@ BOOL cli_net_srv_pwset(struct cli_state *cli, uint8 hashed_mach_pwd[16]) credstr(new_clnt_cred.challenge.data), new_clnt_cred.timestamp.time)); /* store the parameters */ - init_q_srv_pwset(&q_s, unix_to_dos(cli->srv_name_slash,False), + init_q_srv_pwset(&q_s, cli->srv_name_slash, cli->mach_acct, sec_chan_type, global_myname, &new_clnt_cred, (char *)hashed_mach_pwd); @@ -369,7 +369,7 @@ static uint32 cli_net_sam_logon_internal(struct cli_state *cli, NET_ID_INFO_CTR /* store the parameters */ q_s.validation_level = validation_level; - init_sam_info(&q_s.sam_id, unix_to_dos(cli->srv_name_slash,False), + init_sam_info(&q_s.sam_id, cli->srv_name_slash, global_myname, &new_clnt_cred, &dummy_rtn_creds, ctr->switch_value, ctr); @@ -506,7 +506,7 @@ BOOL cli_net_sam_logoff(struct cli_state *cli, NET_ID_INFO_CTR *ctr) memset(&dummy_rtn_creds, '\0', sizeof(dummy_rtn_creds)); - init_sam_info(&q_s.sam_id, unix_to_dos(cli->srv_name_slash,False), + init_sam_info(&q_s.sam_id, cli->srv_name_slash, global_myname, &new_clnt_cred, &dummy_rtn_creds, ctr->switch_value, ctr); diff --git a/source3/rpc_client/cli_reg.c b/source3/rpc_client/cli_reg.c index dc547801df..2e71d5a18f 100644 --- a/source3/rpc_client/cli_reg.c +++ b/source3/rpc_client/cli_reg.c @@ -311,7 +311,7 @@ BOOL do_reg_query_key(struct cli_state *cli, POLICY_HND *hnd, } *class_len = r_o.hdr_class.uni_max_len; - fstrcpy(class, dos_unistr2_to_str(&r_o.uni_class)); + rpcstr_pull(class, &r_o.uni_class, -1, -1, 0); *num_subkeys = r_o.num_subkeys ; *max_subkeylen = r_o.max_subkeylen ; *max_subkeysize = r_o.max_subkeysize; @@ -438,7 +438,8 @@ BOOL do_reg_query_info(struct cli_state *cli, POLICY_HND *hnd, return False; } - fstrcpy(key_value, dos_buffer2_to_str(r_o.uni_val)); + /*fstrcpy(key_value, dos_buffer2_to_str(r_o.uni_val));*/ + rpcstr_pull(key_value, r_o.uni_val->buffer, sizeof(fstring), r_o.uni_val->buf_len, 0); *key_type = r_o.type; prs_mem_free(&rbuf); @@ -819,7 +820,7 @@ BOOL do_reg_enum_key(struct cli_state *cli, POLICY_HND *hnd, (*unk_1) = r_o.unknown_1; (*unk_2) = r_o.unknown_2; - fstrcpy(key_name, dos_unistr2(r_o.key_name.str.buffer)); + rpcstr_pull(key_name, r_o.key_name.str.buffer, -1, -1, 0); (*mod_time) = nt_time_to_unix(&r_o.time); prs_mem_free(&rbuf); @@ -942,7 +943,7 @@ BOOL do_reg_enum_val(struct cli_state *cli, POLICY_HND *hnd, } (*val_type) = r_o.type; - fstrcpy(val_name, dos_unistr2_to_str(&r_o.uni_name)); + rpcstr_pull(val_name, &r_o.uni_name, -1, -1, 0); prs_mem_free(&rbuf); -- cgit