1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

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 79045bd72a)
This commit is contained in:
Tim Potter 2001-02-14 05:34:50 +00:00
parent da20d4e5df
commit 64172d82fc
8 changed files with 45 additions and 28 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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;
}

View File

@ -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;

View File

@ -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);

View File

@ -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)) {

View File

@ -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));
}
/*******************************************************************

View File

@ -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?? */
}