summaryrefslogtreecommitdiff
path: root/source3/nmbd
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2001-07-04 07:15:53 +0000
committerAndrew Tridgell <tridge@samba.org>2001-07-04 07:15:53 +0000
commit87fbb7092b8f8b2f0db0f361c3d625e19de57cd9 (patch)
tree3c302f710cbaa03e3c0d46549e8982771b12b8a5 /source3/nmbd
parent9e9e73303ec10a64bd744b9b33f4e6cd7d394f03 (diff)
downloadsamba-87fbb7092b8f8b2f0db0f361c3d625e19de57cd9.tar.gz
samba-87fbb7092b8f8b2f0db0f361c3d625e19de57cd9.tar.bz2
samba-87fbb7092b8f8b2f0db0f361c3d625e19de57cd9.zip
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)
Diffstat (limited to 'source3/nmbd')
-rw-r--r--source3/nmbd/nmbd.c4
-rw-r--r--source3/nmbd/nmbd_processlogon.c8
-rw-r--r--source3/nmbd/nmbd_sendannounce.c17
-rw-r--r--source3/nmbd/nmbd_synclists.c5
4 files changed, 11 insertions, 23 deletions
diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c
index 8a6bf383d1..ca9d04d768 100644
--- a/source3/nmbd/nmbd.c
+++ b/source3/nmbd/nmbd.c
@@ -682,8 +682,6 @@ static void usage(char *pname)
slprintf(debugf, sizeof(debugf)-1, "%s/log.nmbd", LOGFILEBASE);
setup_logging( argv[0], False );
- charset_initialise();
-
#ifdef LMHOSTSFILE
pstrcpy( host_file, LMHOSTSFILE );
#endif
@@ -783,8 +781,6 @@ static void usage(char *pname)
if ( !reload_nmbd_services(False) )
return(-1);
- codepage_initialise(lp_client_code_page());
-
if(!init_structs())
return -1;
diff --git a/source3/nmbd/nmbd_processlogon.c b/source3/nmbd/nmbd_processlogon.c
index 5e554ceae2..3e4591c0cf 100644
--- a/source3/nmbd/nmbd_processlogon.c
+++ b/source3/nmbd/nmbd_processlogon.c
@@ -163,7 +163,6 @@ logons are not enabled.\n", inet_ntoa(p->ip) ));
q += dos_PutUniCode(q, my_name, sizeof(pstring), True); /* PDC name */
q += dos_PutUniCode(q, global_myworkgroup,sizeof(pstring), True); /* Domain name*/
-
SIVAL(q, 0, 1); /* our nt version */
SSVAL(q, 4, 0xffff); /* our lmnttoken */
SSVAL(q, 6, 0xffff); /* our lm20token */
@@ -192,6 +191,7 @@ reporting %s domain %s 0x%x ntversion=%x lm_nt token=%x lm_20 token=%x\n",
case SAMLOGON:
{
char *q = buf + 2;
+ fstring asccomp;
q += 2;
unicomp = q;
@@ -236,15 +236,15 @@ reporting %s domain %s 0x%x ntversion=%x lm_nt token=%x lm_20 token=%x\n",
* database. If it isn't then we let smbd send an appropriate error.
* Let's ignore the SID.
*/
-
- pstrcpy(ascuser, dos_unistr(uniuser));
+ pull_ucs2_pstring(ascuser, uniuser);
+ pull_ucs2_fstring(asccomp, unicomp);
DEBUG(3,("process_logon_packet: SAMLOGON user %s\n", ascuser));
fstrcpy(reply_name,"\\\\"); /* Here it wants \\LOGONSERVER. */
fstrcpy(reply_name+2,my_name);
DEBUG(3,("process_logon_packet: SAMLOGON request from %s(%s) for %s, returning logon svr %s domain %s code %x token=%x\n",
- dos_unistr(unicomp),inet_ntoa(p->ip), ascuser, reply_name, global_myworkgroup,
+ asccomp,inet_ntoa(p->ip), ascuser, reply_name, global_myworkgroup,
SAMLOGON_R ,lmnttoken));
/* Construct reply. */
diff --git a/source3/nmbd/nmbd_sendannounce.c b/source3/nmbd/nmbd_sendannounce.c
index 87115a1eb0..eb5839253b 100644
--- a/source3/nmbd/nmbd_sendannounce.c
+++ b/source3/nmbd/nmbd_sendannounce.c
@@ -80,9 +80,7 @@ to subnet %s\n", work->work_group, subrec->subnet_name));
CVAL(p,0) = work->token; /* (local) Unique workgroup token id. */
p++;
- StrnCpy(p,global_myname,15);
- strupper(p);
- p = skip_string(p,1);
+ p += push_string(NULL, p+1, global_myname, 15, STR_ASCII|STR_UPPER|STR_TERMINATE);
send_mailslot(False, BROWSE_MAILSLOT, outbuf,PTR_DIFF(p,outbuf),
global_myname, 0x0, work->work_group,0x1e, subrec->bcast_ip,
@@ -110,8 +108,7 @@ static void send_announcement(struct subnet_record *subrec, int announce_type,
CVAL(p,0) = updatecount;
SIVAL(p,1,announce_interval*1000); /* Milliseconds - despite the spec. */
- StrnCpy(p+5,server_name,15);
- strupper(p+5);
+ push_string(NULL, p+5, server_name, 15, STR_ASCII|STR_UPPER|STR_TERMINATE);
CVAL(p,21) = lp_major_announce_version(); /* Major version. */
CVAL(p,22) = lp_minor_announce_version(); /* Minor version. */
@@ -121,9 +118,7 @@ static void send_announcement(struct subnet_record *subrec, int announce_type,
SSVAL(p,27,BROWSER_ELECTION_VERSION);
SSVAL(p,29,BROWSER_CONSTANT); /* Browse signature. */
- pstrcpy(p+31,server_comment);
- p += 31;
- p = skip_string(p,1);
+ p += 31 + push_string(NULL, p+31, server_comment, -1, STR_ASCII|STR_TERMINATE);
send_mailslot(False,BROWSE_MAILSLOT, outbuf, PTR_DIFF(p,outbuf),
from_name, 0x0, to_name, to_type, to_ip, subrec->myip,
@@ -151,11 +146,13 @@ static void send_lm_announcement(struct subnet_record *subrec, int announce_type
SSVAL(p,8,announce_interval); /* In seconds - according to spec. */
p += 10;
- StrnCpy(p,server_name,15);
+ /*StrnCpy(p,server_name,15);
strupper(p);
p = skip_string(p,1);
pstrcpy(p,server_comment);
- p = skip_string(p,1);
+ p = skip_string(p,1);*/
+ p += push_string(NULL, p, server_name, 15, STR_ASCII|STR_UPPER|STR_TERMINATE);
+ p += push_string(NULL, p, server_comment, sizeof(pstring)-15, STR_ASCII|STR_UPPER|STR_TERMINATE);
send_mailslot(False,LANMAN_MAILSLOT, outbuf, PTR_DIFF(p,outbuf),
from_name, 0x0, to_name, to_type, to_ip, subrec->myip,
diff --git a/source3/nmbd/nmbd_synclists.c b/source3/nmbd/nmbd_synclists.c
index 23cbc01b88..29462685b0 100644
--- a/source3/nmbd/nmbd_synclists.c
+++ b/source3/nmbd/nmbd_synclists.c
@@ -103,7 +103,6 @@ static void sync_child(char *name, int nm_type,
/* All the cli_XX functions take UNIX character set. */
fstrcpy(unix_workgroup, cli.server_domain?cli.server_domain:workgroup);
- dos_to_unix(unix_workgroup, True);
/* Fetch a workgroup list. */
cli_NetServerEnum(&cli, unix_workgroup,
@@ -113,7 +112,6 @@ static void sync_child(char *name, int nm_type,
/* Now fetch a server list. */
if (servers) {
fstrcpy(unix_workgroup, workgroup);
- dos_to_unix(unix_workgroup, True);
cli_NetServerEnum(&cli, unix_workgroup,
local?SV_TYPE_LOCAL_LIST_ONLY:SV_TYPE_ALL,
callback, NULL);
@@ -254,9 +252,6 @@ static void complete_sync(struct sync_record *s)
ptr = line;
- /* The line is written in UNIX character set. Convert to DOS codepage. */
- unix_to_dos(line,True);
-
if (!next_token(&ptr,server,NULL,sizeof(server)) ||
!next_token(&ptr,type_str,NULL, sizeof(type_str)) ||
!next_token(&ptr,comment,NULL, sizeof(comment))) {