Merge of i18n fixes from appliance branch. Samba can now talk to a network
authorTim Potter <tpot@samba.org>
Wed, 14 Feb 2001 05:34:50 +0000 (05:34 +0000)
committerTim Potter <tpot@samba.org>
Wed, 14 Feb 2001 05:34:50 +0000 (05:34 +0000)
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
source3/libsmb/cliconnect.c
source3/libsmb/namequery.c
source3/passdb/secrets.c
source3/rpc_client/cli_login.c
source3/rpc_client/cli_netlogon.c
source3/rpc_server/srv_wkssvc.c
source3/smbd/reply.c

index 9e0ab60c24e83d006c50c1d8c3dcc948125e0612..eba05a27806fc4154c187e03c36976b473817b92 100644 (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);
index 3e41ec82960c40f5dcecee9452d01eaa80dc776a..96bf06d0ac72130b32493401e046d9beca869480 100644 (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);
index 173fe12bcbc3e511573ab5ead47af1e2eb2fd8d9..3e4855b0373e99bb0ca9f00f1fdcc9e9bc26a4e3 100644 (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;
 }
index 9591474861a8d652c49b714ac15e68bf177fa62f..bfa1ed98cadc4cf1da043f6d24cf1fde58a13835 100644 (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;
index 205ccc7a248ed4d0acf4100770485f55d482a2cf..6600fac162be41ccf92ea5e7787ea746fe463e43 100644 (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);
index 3e24e74a5901fbf9d604da20554f2964d72b7c0a..209b38c4fa73c396d6adaf7cc5c789fd0bc507c9 100644 (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)) {
index 21e4f933f27af1b0a162ea4248a933196f0d0a58..d1e0c8e8eb84b88022c4d515672eb36a33f112cc 100644 (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));
 }
 
 /*******************************************************************
index 2d205543fbaf465f0f42c5029f1c7b5e00edf3f9..e1feb921f5c309a94d12cc7c48c7057595f04122 100644 (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?? */
   }