From 64172d82fcf1762a8bc938282919f9e3bd39675d Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Wed, 14 Feb 2001 05:34:50 +0000 Subject: Merge of i18n fixes from appliance branch. Samba can now talk to a network with a PDC that has international netbios name and domain name. There's still quite a bit of i18n stuff to fix though... (This used to be commit 79045bd72ace9144e7dd73785b1d10a71b0d15aa) --- source3/include/proto.h | 2 +- source3/libsmb/cliconnect.c | 7 ++++--- source3/libsmb/namequery.c | 2 ++ source3/passdb/secrets.c | 13 ++++++++++--- source3/rpc_client/cli_login.c | 9 ++++----- source3/rpc_client/cli_netlogon.c | 29 +++++++++++++++++------------ source3/rpc_server/srv_wkssvc.c | 4 ++-- source3/smbd/reply.c | 7 +++++-- 8 files changed, 45 insertions(+), 28 deletions(-) diff --git a/source3/include/proto.h b/source3/include/proto.h index 9e0ab60c24..eba05a2780 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -49,7 +49,7 @@ uint32 crc32_calc_buffer( char *buffer, uint32 count); /*The following definitions come from lib/debug.c */ -char* debug_classname_from_index(int idx); +char* debug_classname_from_index(int ndx); int debug_lookup_classname(char* classname); BOOL debug_parse_params(char **params, int *debuglevel_class); BOOL debug_parse_levels(char *params_str); diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c index 3e41ec8296..96bf06d0ac 100644 --- a/source3/libsmb/cliconnect.c +++ b/source3/libsmb/cliconnect.c @@ -43,9 +43,9 @@ prots[] = /**************************************************************************** - Send a session setup. The username is in UNIX character format and must be - converted to DOS codepage format before sending. If the password is in - plaintext, the same should be done. + Send a session setup. The username and workgroup is in UNIX character + format and must be converted to DOS codepage format before sending. If the + password is in plaintext, the same should be done. ****************************************************************************/ BOOL cli_session_setup(struct cli_state *cli, @@ -166,6 +166,7 @@ BOOL cli_session_setup(struct cli_state *cli, strupper(p); p = skip_string(p,1); pstrcpy(p,workgroup); + unix_to_dos(p,True); strupper(p); p = skip_string(p,1); pstrcpy(p,"Unix");p = skip_string(p,1); diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c index 173fe12bcb..3e4855b037 100644 --- a/source3/libsmb/namequery.c +++ b/source3/libsmb/namequery.c @@ -184,6 +184,8 @@ BOOL name_status_find(int type, struct in_addr to_ip, char *name) StrnCpy(name, status[i].name, 15); + dos_to_unix(name, True); + free(status); return True; } diff --git a/source3/passdb/secrets.c b/source3/passdb/secrets.c index 9591474861..bfa1ed98ca 100644 --- a/source3/passdb/secrets.c +++ b/source3/passdb/secrets.c @@ -123,8 +123,14 @@ form a key for fetching a domain trust password char *trust_keystr(char *domain) { static fstring keystr; - slprintf(keystr,sizeof(keystr),"%s/%s", SECRETS_MACHINE_ACCT_PASS, domain); - dos_to_unix(keystr, True); /* Convert key to unix-codepage */ + fstring dos_domain; + + fstrcpy(dos_domain, domain); + unix_to_dos(dos_domain, True); + + slprintf(keystr,sizeof(keystr),"%s/%s", + SECRETS_MACHINE_ACCT_PASS, dos_domain); + return keystr; } @@ -138,7 +144,8 @@ BOOL secrets_fetch_trust_account_password(char *domain, uint8 ret_pwd[16], struct machine_acct_pass *pass; size_t size; - if (!(pass = secrets_fetch(trust_keystr(domain), &size)) || size != sizeof(*pass)) + if (!(pass = secrets_fetch(trust_keystr(domain), &size)) || + size != sizeof(*pass)) return False; if (pass_last_set_time) *pass_last_set_time = pass->mod_time; diff --git a/source3/rpc_client/cli_login.c b/source3/rpc_client/cli_login.c index 205ccc7a24..6600fac162 100644 --- a/source3/rpc_client/cli_login.c +++ b/source3/rpc_client/cli_login.c @@ -161,15 +161,14 @@ BOOL cli_nt_login_network(struct cli_state *cli, char *domain, char *username, NET_ID_INFO_CTR *ctr, NET_USER_INFO_3 *user_info3) { DEBUG(5,("cli_nt_login_network: %d\n", __LINE__)); - /* indicate a "network" login */ ctr->switch_value = NET_LOGON_TYPE; /* Create the structure needed for SAM logon. */ - init_id_info2(&ctr->auth.id2, domain, 0, - smb_userid_low, 0, - username, cli->clnt_name_slash, - (uchar *)lm_chal, (uchar *)lm_chal_resp, (uchar *)nt_chal_resp); + init_id_info2(&ctr->auth.id2, domain, 0, smb_userid_low, 0, + username, dos_to_unix(cli->clnt_name_slash, False), + (uchar *)lm_chal, (uchar *)lm_chal_resp, + (uchar *)nt_chal_resp); /* Send client sam-logon request - update credentials on success. */ return cli_net_sam_logon(cli, ctr, user_info3); diff --git a/source3/rpc_client/cli_netlogon.c b/source3/rpc_client/cli_netlogon.c index 3e24e74a59..209b38c4fa 100644 --- a/source3/rpc_client/cli_netlogon.c +++ b/source3/rpc_client/cli_netlogon.c @@ -73,7 +73,8 @@ 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, cli->srv_name_slash, status_level); + init_q_logon_ctrl2(&q_l, unix_to_dos(cli->srv_name_slash,False), + status_level); /* turn parameters into data stream */ if(!net_io_q_logon_ctrl2("", &q_l, &buf, 0)) { @@ -131,12 +132,12 @@ BOOL cli_net_auth2(struct cli_state *cli, uint16 sec_chan, /* create and send a MSRPC command with api NET_AUTH2 */ DEBUG(4,("cli_net_auth2: srv:%s acct:%s sc:%x mc: %s chal %s neg: %x\n", - cli->srv_name_slash, cli->mach_acct, sec_chan, global_myname, - credstr(cli->clnt_cred.challenge.data), neg_flags)); + cli->srv_name_slash, cli->mach_acct, sec_chan, global_myname, + credstr(cli->clnt_cred.challenge.data), neg_flags)); /* store the parameters */ - init_q_auth_2(&q_a, cli->srv_name_slash, cli->mach_acct, sec_chan, global_myname, - &cli->clnt_cred.challenge, neg_flags); + init_q_auth_2(&q_a, unix_to_dos(cli->srv_name_slash,False), cli->mach_acct, + sec_chan, global_myname, &cli->clnt_cred.challenge, neg_flags); /* turn parameters into data stream */ if(!net_io_q_auth_2("", &q_a, &buf, 0)) { @@ -224,7 +225,8 @@ 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, cli->srv_name_slash, global_myname, clnt_chal); + init_q_req_chal(&q_c, unix_to_dos(cli->srv_name_slash,False), + global_myname, clnt_chal); /* turn parameters into data stream */ if(!net_io_q_req_chal("", &q_c, &buf, 0)) { @@ -289,8 +291,9 @@ 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, cli->srv_name_slash, cli->mach_acct, sec_chan_type, - global_myname, &new_clnt_cred, (char *)hashed_mach_pwd); + init_q_srv_pwset(&q_s, unix_to_dos(cli->srv_name_slash,False), + cli->mach_acct, sec_chan_type, global_myname, + &new_clnt_cred, (char *)hashed_mach_pwd); /* turn parameters into data stream */ if(!net_io_q_srv_pwset("", &q_s, &buf, 0)) { @@ -365,8 +368,9 @@ BOOL cli_net_sam_logon(struct cli_state *cli, NET_ID_INFO_CTR *ctr, /* store the parameters */ q_s.validation_level = validation_level; - init_sam_info(&q_s.sam_id, cli->srv_name_slash, global_myname, - &new_clnt_cred, &dummy_rtn_creds, ctr->switch_value, ctr); + init_sam_info(&q_s.sam_id, unix_to_dos(cli->srv_name_slash,False), + global_myname, &new_clnt_cred, &dummy_rtn_creds, + ctr->switch_value, ctr); /* turn parameters into data stream */ if(!net_io_q_sam_logon("", &q_s, &buf, 0)) { @@ -451,8 +455,9 @@ 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, cli->srv_name_slash, global_myname, - &new_clnt_cred, &dummy_rtn_creds, ctr->switch_value, ctr); + init_sam_info(&q_s.sam_id, unix_to_dos(cli->srv_name_slash,False), + global_myname, &new_clnt_cred, &dummy_rtn_creds, + ctr->switch_value, ctr); /* turn parameters into data stream */ if(!net_io_q_sam_logoff("", &q_s, &buf, 0)) { diff --git a/source3/rpc_server/srv_wkssvc.c b/source3/rpc_server/srv_wkssvc.c index 21e4f933f2..d1e0c8e8eb 100644 --- a/source3/rpc_server/srv_wkssvc.c +++ b/source3/rpc_server/srv_wkssvc.c @@ -40,14 +40,14 @@ static void create_wks_info_100(WKS_INFO_100 *inf) pstrcpy (my_name, global_myname); strupper(my_name); - pstrcpy (domain , lp_workgroup()); + pstrcpy (domain, lp_workgroup()); strupper(domain); init_wks_info_100(inf, 0x000001f4, /* platform id info */ lp_major_announce_version(), lp_minor_announce_version(), - my_name, domain); + my_name, unix_to_dos(domain,False)); } /******************************************************************* diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 2d205543fb..e1feb921f5 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -900,7 +900,10 @@ int reply_sesssetup_and_X(connection_struct *conn, char *inbuf,char *outbuf,int that */ if (!sys_getpwnam(user)) { pstring user2; - slprintf(user2,sizeof(user2),"%s%s%s", dos_to_unix(domain,False), lp_winbind_separator(), user); + + slprintf(user2,sizeof(user2),"%s%s%s", dos_to_unix(domain,False), + lp_winbind_separator(), user); + if (sys_getpwnam(user2)) { DEBUG(3,("Using unix username %s\n", user2)); pstrcpy(user, user2); @@ -1018,7 +1021,7 @@ int reply_sesssetup_and_X(connection_struct *conn, char *inbuf,char *outbuf,int p = smb_buf(outbuf); pstrcpy(p,"Unix"); p = skip_string(p,1); pstrcpy(p,"Samba "); pstrcat(p,VERSION); p = skip_string(p,1); - pstrcpy(p,global_myworkgroup); p = skip_string(p,1); + pstrcpy(p,global_myworkgroup); unix_to_dos(p, True); p = skip_string(p,1); set_message(outbuf,3,PTR_DIFF(p,smb_buf(outbuf)),False); /* perhaps grab OS version here?? */ } -- cgit