From 9fdc1363bec6ae9a0a0f9a37130b98a92ebe8ce2 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 27 Aug 2003 01:25:01 +0000 Subject: Fix the character set handling properly in nmbd. Also fix bug where iconv wasn't re-initialised on reading of "charset" parameters. This caused workgroup name to be set incorrectly if it contained an extended character. Jeremy. (This used to be commit 84ae44678a6c59c999bc1023fdd9b7ad87f4ec18) --- source3/nmbd/nmbd_synclists.c | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'source3/nmbd/nmbd_synclists.c') diff --git a/source3/nmbd/nmbd_synclists.c b/source3/nmbd/nmbd_synclists.c index b9952fb446..337c2f9468 100644 --- a/source3/nmbd/nmbd_synclists.c +++ b/source3/nmbd/nmbd_synclists.c @@ -47,6 +47,7 @@ static XFILE *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, void *state) { @@ -58,6 +59,7 @@ static void callback(const char *sname, uint32 stype, Log in on the remote server's SMB port to their IPC$ service, do a NetServerEnum and record the results in fname ******************************************************************/ + static void sync_child(char *name, int nm_type, char *workgroup, struct in_addr ip, BOOL local, BOOL servers, @@ -78,10 +80,9 @@ static void sync_child(char *name, int nm_type, } make_nmb_name(&calling, local_machine, 0x0); - make_nmb_name(&called , name , nm_type); + make_nmb_name(&called , name, nm_type); - if (!cli_session_request(&cli, &calling, &called)) - { + if (!cli_session_request(&cli, &calling, &called)) { cli_shutdown(&cli); return; } @@ -120,12 +121,12 @@ static void sync_child(char *name, int nm_type, cli_shutdown(&cli); } - /******************************************************************* initialise a browse sync with another browse server. Log in on the remote server's SMB port to their IPC$ service, do a NetServerEnum and record the results ******************************************************************/ + void sync_browse_lists(struct work_record *work, char *name, int nm_type, struct in_addr ip, BOOL local, BOOL servers) @@ -182,8 +183,9 @@ done: } /********************************************************************** -handle one line from a completed sync file + Handle one line from a completed sync file. **********************************************************************/ + static void complete_one(struct sync_record *s, char *sname, uint32 stype, char *comment) { @@ -235,10 +237,10 @@ static void complete_one(struct sync_record *s, create_server_on_workgroup(work, sname,stype, lp_max_ttl(), comment); } - /********************************************************************** -read the completed sync info - **********************************************************************/ + Read the completed sync info. +**********************************************************************/ + static void complete_sync(struct sync_record *s) { XFILE *f; @@ -251,11 +253,13 @@ static void complete_sync(struct sync_record *s) f = x_fopen(s->fname,O_RDONLY, 0); - if (!f) return; + if (!f) + return; while (!x_feof(f)) { - if (!fgets_slash(line,sizeof(pstring),f)) continue; + if (!fgets_slash(line,sizeof(pstring),f)) + continue; ptr = line; @@ -281,8 +285,9 @@ static void complete_sync(struct sync_record *s) } /********************************************************************** -check for completion of any of the child processes - **********************************************************************/ + Check for completion of any of the child processes. +**********************************************************************/ + void sync_check_completion(void) { struct sync_record *s, *next; -- cgit