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_become_dmb.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_become_dmb.c')
-rw-r--r-- | source3/nmbd/nmbd_become_dmb.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/source3/nmbd/nmbd_become_dmb.c b/source3/nmbd/nmbd_become_dmb.c index 46d37fbb81..c9b0a22580 100644 --- a/source3/nmbd/nmbd_become_dmb.c +++ b/source3/nmbd/nmbd_become_dmb.c @@ -37,11 +37,11 @@ static void become_domain_master_fail(struct subnet_record *subrec, struct response_record *rrec, struct nmb_name *fail_name) { - nstring failname; + fstring failname; struct work_record *work; struct server_record *servrec; - pull_ascii_nstring(failname, fail_name->name); + pull_ascii_nstring(failname, sizeof(failname), fail_name->name); work = find_workgroup_on_subnet(subrec, failname); if(!work) { DEBUG(0,("become_domain_master_fail: Error - cannot find \ @@ -80,11 +80,11 @@ static void become_domain_master_stage2(struct subnet_record *subrec, uint16 nb_flags, int ttl, struct in_addr registered_ip) { - nstring regname; + fstring regname; struct work_record *work; struct server_record *servrec; - pull_ascii_nstring(regname, registered_name->name); + pull_ascii_nstring(regname, sizeof(regname), registered_name->name); work = find_workgroup_on_subnet( subrec, regname); if(!work) { @@ -200,8 +200,8 @@ static void become_domain_master_query_success(struct subnet_record *subrec, struct nmb_name *nmbname, struct in_addr ip, struct res_rec *rrec) { - nstring name; - pull_ascii_nstring(name, nmbname->name); + fstring name; + pull_ascii_nstring(name, sizeof(name), nmbname->name); /* If the given ip is not ours, then we can't become a domain controler as the name is already registered. @@ -241,7 +241,7 @@ static void become_domain_master_query_fail(struct subnet_record *subrec, struct response_record *rrec, struct nmb_name *question_name, int fail_code) { - nstring name; + fstring name; /* If the query was unicast, and the error is not NAM_ERR (name didn't exist), then this is a failure. Otherwise, not finding the name is what we want. */ @@ -254,7 +254,7 @@ querying WINS server for name %s.\n", } /* Otherwise - not having the name allows us to register it. */ - pull_ascii_nstring(name, question_name->name); + pull_ascii_nstring(name, sizeof(name), question_name->name); become_domain_master_stage1(subrec, name); } |