summaryrefslogtreecommitdiff
path: root/source3/nmbd/nmbd_packets.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2004-03-13 02:16:21 +0000
committerJeremy Allison <jra@samba.org>2004-03-13 02:16:21 +0000
commit6b9dbbcd249360fb9acd61d6900baccf621c9cce (patch)
tree612e870056d4060da62d02ed05f38f1d99cd620d /source3/nmbd/nmbd_packets.c
parentfd2d4f87d440f24df0adc4cc29f22051536b0dee (diff)
downloadsamba-6b9dbbcd249360fb9acd61d6900baccf621c9cce.tar.gz
samba-6b9dbbcd249360fb9acd61d6900baccf621c9cce.tar.bz2
samba-6b9dbbcd249360fb9acd61d6900baccf621c9cce.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 b4ea493599ab414f7828b83f40a5a8b43479ff64)
Diffstat (limited to 'source3/nmbd/nmbd_packets.c')
-rw-r--r--source3/nmbd/nmbd_packets.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/source3/nmbd/nmbd_packets.c b/source3/nmbd/nmbd_packets.c
index c318689fd1..b5cbaab00b 100644
--- a/source3/nmbd/nmbd_packets.c
+++ b/source3/nmbd/nmbd_packets.c
@@ -1034,7 +1034,7 @@ static void process_browse_packet(struct packet_struct *p, char *buf,int len)
int command = CVAL(buf,0);
struct subnet_record *subrec = find_subnet_for_dgram_browse_packet(p);
char scope[64];
- nstring src_name;
+ fstring src_name;
/* Drop the packet if it's a different NetBIOS scope, or the source is from one of our names. */
pull_ascii(scope, dgram->dest_name.scope, 64, 64, STR_TERMINATE);
@@ -1044,7 +1044,7 @@ mismatch with our scope (%s).\n", inet_ntoa(p->ip), scope, global_scope()));
return;
}
- pull_ascii_nstring(src_name, dgram->source_name.name);
+ pull_ascii_nstring(src_name, sizeof(src_name), dgram->source_name.name);
if (is_myname(src_name)) {
DEBUG(0,("process_browse_packet: Discarding datagram from IP %s. Source name \
%s is one of our names !\n", inet_ntoa(p->ip), nmb_namestr(&dgram->source_name)));
@@ -1121,7 +1121,7 @@ static void process_lanman_packet(struct packet_struct *p, char *buf,int len)
int command = SVAL(buf,0);
struct subnet_record *subrec = find_subnet_for_dgram_browse_packet(p);
char scope[64];
- nstring src_name;
+ fstring src_name;
/* Drop the packet if it's a different NetBIOS scope, or the source is from one of our names. */
@@ -1132,7 +1132,7 @@ mismatch with our scope (%s).\n", inet_ntoa(p->ip), scope, global_scope()));
return;
}
- pull_ascii_nstring(src_name, dgram->source_name.name);
+ pull_ascii_nstring(src_name, sizeof(src_name), dgram->source_name.name);
if (is_myname(src_name)) {
DEBUG(0,("process_lanman_packet: Discarding datagram from IP %s. Source name \
%s is one of our names !\n", inet_ntoa(p->ip), nmb_namestr(&dgram->source_name)));