summaryrefslogtreecommitdiff
path: root/source3/nmbd/nmbd_synclists.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2000-10-07 01:15:07 +0000
committerJeremy Allison <jra@samba.org>2000-10-07 01:15:07 +0000
commit8582d426467e715a912ef06c13bdbbdeb9000739 (patch)
treef6b8f91facd78b9ce725ef1be2bc0cae0c2d78f3 /source3/nmbd/nmbd_synclists.c
parent5d4f5cdddc23819bfab0961a013ed5593b2b2d30 (diff)
downloadsamba-8582d426467e715a912ef06c13bdbbdeb9000739.tar.gz
samba-8582d426467e715a912ef06c13bdbbdeb9000739.tar.bz2
samba-8582d426467e715a912ef06c13bdbbdeb9000739.zip
Ensure browse.dat is written and read in UNIX character set format.
Jeremy. (This used to be commit 279d0ec656b03f9266e38b013f16b69e7571c0d5)
Diffstat (limited to 'source3/nmbd/nmbd_synclists.c')
-rw-r--r--source3/nmbd/nmbd_synclists.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/source3/nmbd/nmbd_synclists.c b/source3/nmbd/nmbd_synclists.c
index b69a9959c2..7d10250325 100644
--- a/source3/nmbd/nmbd_synclists.c
+++ b/source3/nmbd/nmbd_synclists.c
@@ -49,13 +49,13 @@ static FILE *fp;
/*******************************************************************
This is the NetServerEnum callback.
+ Note sname and comment are in UNIX codepage format.
******************************************************************/
static void callback(const char *sname, uint32 stype, const char *comment)
{
fprintf(fp,"\"%s\" %08X \"%s\"\n", sname, stype, comment);
}
-
/*******************************************************************
Synchronise browse lists with another browse server.
Log in on the remote server's SMB port to their IPC$ service,
@@ -67,6 +67,7 @@ static void sync_child(char *name, int nm_type,
char *fname)
{
extern fstring local_machine;
+ fstring unix_workgroup;
static struct cli_state cli;
uint32 local_type = local ? SV_TYPE_LOCAL_LIST_ONLY : 0;
struct nmb_name called, calling;
@@ -101,14 +102,20 @@ static void sync_child(char *name, int nm_type,
return;
}
+ /* 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, cli.server_domain?cli.server_domain:workgroup,
+ cli_NetServerEnum(&cli, unix_workgroup,
local_type|SV_TYPE_DOMAIN_ENUM,
callback);
/* Now fetch a server list. */
if (servers) {
- cli_NetServerEnum(&cli, workgroup,
+ 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);
}
@@ -248,6 +255,9 @@ 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))) {