diff options
author | Jeremy Allison <jra@samba.org> | 2004-03-13 02:16:26 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2004-03-13 02:16:26 +0000 |
commit | 9a699d74efbcbbb8607c7dea2734d7acb3478896 (patch) | |
tree | 4011e11c2e25b3073f10ab9486ac884702639330 /source3/nmbd/nmbd_browsesync.c | |
parent | e4a01b392c518d3706d86d4938ac85707fe275e6 (diff) | |
download | samba-9a699d74efbcbbb8607c7dea2734d7acb3478896.tar.gz samba-9a699d74efbcbbb8607c7dea2734d7acb3478896.tar.bz2 samba-9a699d74efbcbbb8607c7dea2734d7acb3478896.zip |
Modified fix for bugid #784. Based on a patch from moriyama@miraclelinux.com (MORIYAMA Masayuki).
Don't use nstrings to hold workgroup and netbios names. The problem with them is that MB netbios
and workgroup names in unix charset (particularly utf8) may be up to 3x bigger than the name
when represented in dos charset (ie. cp932). So go back to using fstrings for these but
translate into nstrings (ie. 16 byte length values) for transport on the wire.
Jeremy.
(This used to be commit 128dec9ae68fd357550de2649d54056ca4fc65cf)
Diffstat (limited to 'source3/nmbd/nmbd_browsesync.c')
-rw-r--r-- | source3/nmbd/nmbd_browsesync.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/source3/nmbd/nmbd_browsesync.c b/source3/nmbd/nmbd_browsesync.c index 6cde88651f..454c349767 100644 --- a/source3/nmbd/nmbd_browsesync.c +++ b/source3/nmbd/nmbd_browsesync.c @@ -146,7 +146,7 @@ As a local master browser, do a sync with a domain master browser. static void sync_with_dmb(struct work_record *work) { - nstring dmb_name; + fstring dmb_name; if( DEBUGLVL( 2 ) ) { dbgtext( "sync_with_dmb:\n" ); @@ -156,7 +156,7 @@ static void sync_with_dmb(struct work_record *work) dbgtext( "for workgroup %s\n", work->work_group ); } - pull_ascii_nstring(dmb_name, work->dmb_name.name); + pull_ascii_nstring(dmb_name, sizeof(fstring), work->dmb_name.name); sync_browse_lists(work, dmb_name, work->dmb_name.name_type, work->dmb_addr, False, True); } @@ -197,11 +197,11 @@ static void domain_master_node_status_success(struct subnet_record *subrec, p += 1; while (numnames--) { - nstring qname; + fstring qname; uint16 nb_flags; int name_type; - pull_ascii_nstring(qname, p); + pull_ascii_nstring(qname, sizeof(qname), p); name_type = CVAL(p,15); nb_flags = get_nb_flags(&p[16]); trim_char(qname,'\0',' '); @@ -278,9 +278,9 @@ static void find_domain_master_name_query_success(struct subnet_record *subrec, struct nmb_name nmbname; struct userdata_struct *userdata; size_t size = sizeof(struct userdata_struct) + sizeof(fstring)+1; - nstring qname; + fstring qname; - pull_ascii_nstring(qname, q_name->name); + pull_ascii_nstring(qname, sizeof(qname), q_name->name); if( !(work = find_workgroup_on_subnet(subrec, qname)) ) { if( DEBUGLVL( 0 ) ) { dbgtext( "find_domain_master_name_query_success:\n" ); @@ -420,11 +420,11 @@ static void get_domain_master_name_node_status_success(struct subnet_record *sub p += 1; while (numnames--) { - nstring qname; + fstring qname; uint16 nb_flags; int name_type; - pull_ascii_nstring(qname, p); + pull_ascii_nstring(qname, sizeof(qname), p); name_type = CVAL(p,15); nb_flags = get_nb_flags(&p[16]); trim_char(qname,'\0',' '); @@ -460,7 +460,7 @@ static void get_domain_master_name_node_status_success(struct subnet_record *sub return; /* remember who the master is */ - nstrcpy(work->local_master_browser_name, server_name); + fstrcpy(work->local_master_browser_name, server_name); make_nmb_name(&nmbname, server_name, 0x20); work->dmb_name = nmbname; work->dmb_addr = from_ip; @@ -647,7 +647,7 @@ void sync_all_dmbs(time_t t) /* sync with a probability of 1/count */ for (work=unicast_subnet->workgrouplist; work; work = work->next) { if (strncmp(lp_workgroup(), work->work_group, sizeof(nstring))) { - nstring dmb_name; + fstring dmb_name; if (((unsigned)sys_random()) % count != 0) continue; @@ -662,7 +662,7 @@ void sync_all_dmbs(time_t t) 0x20); } - pull_ascii_nstring(dmb_name, work->dmb_name.name); + pull_ascii_nstring(dmb_name, sizeof(dmb_name), work->dmb_name.name); DEBUG(3,("Initiating DMB<->DMB sync with %s(%s)\n", dmb_name, inet_ntoa(work->dmb_addr))); |