summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorSamba Release Account <samba-bugs@samba.org>1997-06-02 19:51:56 +0000
committerSamba Release Account <samba-bugs@samba.org>1997-06-02 19:51:56 +0000
commit094f7ce427dba7299c8b08c695812d191e382d06 (patch)
treedc4c5a61e08f89192b4b9f856a0008d36946c6ca /source3
parent7be4b90f260a3b982da5ce39b632d5d5babd104a (diff)
downloadsamba-094f7ce427dba7299c8b08c695812d191e382d06.tar.gz
samba-094f7ce427dba7299c8b08c695812d191e382d06.tar.bz2
samba-094f7ce427dba7299c8b08c695812d191e382d06.zip
nameannounce.c: Made sure recurse flag set correctly.
namedbname.c: Made sure wins.dat updated when list changes. Changed to returning 255.255.255.255 when 1e name queried. namepacket.c: Made sure recurse flags set correctly. nameserv.c: Made sure recurse flags set correctly. nameservreply.c: Made send_name_response() static, Made sure recurse flags set correctly. Changed to returning 255.255.255.255 when 1e name queried. proto.h: Removed send_name_response(). Jeremy jallison@whistle.com (This used to be commit 4e9fd24f65971bbbda5f76499e5d14f90eef8038)
Diffstat (limited to 'source3')
-rw-r--r--source3/include/proto.h4
-rw-r--r--source3/nameannounce.c4
-rw-r--r--source3/namedbname.c13
-rw-r--r--source3/namepacket.c10
-rw-r--r--source3/nameserv.c6
-rw-r--r--source3/nameservreply.c70
6 files changed, 52 insertions, 55 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index e6d39c3a3f..2b30b7174e 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -496,10 +496,6 @@ void add_name_respond(struct subnet_record *d, int fd, struct in_addr from_ip,
struct nmb_name *name,
int nb_flags, int ttl, struct in_addr register_ip,
BOOL new_owner, struct in_addr reply_to_ip);
-void send_name_response(int fd, struct in_addr from_ip,
- int name_trn_id, int opcode, BOOL success, BOOL recurse,
- struct nmb_name *reply_name, int nb_flags, int ttl,
- struct in_addr ip);
void reply_name_release(struct packet_struct *p);
void reply_name_reg(struct packet_struct *p);
void reply_name_status(struct packet_struct *p);
diff --git a/source3/nameannounce.c b/source3/nameannounce.c
index b1d13ce7ac..899fcd7e3b 100644
--- a/source3/nameannounce.c
+++ b/source3/nameannounce.c
@@ -234,7 +234,7 @@ void announce_server(struct subnet_record *d, struct work_record *work,
NAME_QUERY_ANNOUNCE_HOST,
work->work_group,0x1b,0,ttl*1000,
server_type,name,comment,
- False, False, ipzero, d->bcast_ip);
+ False, True, ipzero, d->bcast_ip);
}
else
{
@@ -472,7 +472,7 @@ workgroup %s\n", am_master, work->work_group));
NMB_QUERY,NAME_QUERY_DOM_SRV_CHK,
name, type, 0,0,0,
work->work_group,NULL,
- False, False, ipzero, ipzero);
+ False, True, ipzero, ipzero);
}
else if(lp_wins_support())
{
diff --git a/source3/namedbname.c b/source3/namedbname.c
index 7d91b6e045..06e23b0a78 100644
--- a/source3/namedbname.c
+++ b/source3/namedbname.c
@@ -36,6 +36,7 @@ extern int DEBUGLEVEL;
extern pstring scope;
extern struct in_addr ipzero;
extern struct in_addr wins_ip;
+extern BOOL updatedlists;
extern struct subnet_record *subnetlist;
@@ -111,6 +112,9 @@ static void add_name(struct subnet_record *d, struct name_record *n)
n2->next = n;
n->next = NULL;
n->prev = n2;
+
+ if(d == wins_subnet)
+ updatedlists = True;
}
@@ -133,6 +137,9 @@ void remove_name(struct subnet_record *d, struct name_record *n)
if (nlist->prev) nlist->prev->next = nlist->next;
free(nlist);
}
+
+ if(d == wins_subnet)
+ updatedlists = True;
}
@@ -460,12 +467,6 @@ struct name_record *add_netbios_entry(struct subnet_record *d,
}
}
- if(type == 0x1e)
- {
- /* Add all 1e names as address 255.255.255.255 */
- ip = *interpret_addr2("255.255.255.255");
- }
-
n = (struct name_record *)malloc(sizeof(*n));
if (!n) return(NULL);
diff --git a/source3/namepacket.c b/source3/namepacket.c
index 418155bbd8..55b525d6c5 100644
--- a/source3/namepacket.c
+++ b/source3/namepacket.c
@@ -194,7 +194,6 @@ void reply_netbios_packet(struct packet_struct *p1,int trn_id,
struct nmb_packet *nmb = &p.packet.nmb;
struct res_rec answers;
char *packet_type = "unknown";
- BOOL recursion_desired = False;
p = *p1;
@@ -203,31 +202,26 @@ void reply_netbios_packet(struct packet_struct *p1,int trn_id,
case NMB_STATUS:
{
packet_type = "nmb_status";
- recursion_desired = True;
break;
}
case NMB_QUERY:
{
packet_type = "nmb_query";
- recursion_desired = True;
break;
}
case NMB_REG:
{
packet_type = "nmb_reg";
- recursion_desired = True;
break;
}
case NMB_REL:
{
packet_type = "nmb_rel";
- recursion_desired = False;
break;
}
case NMB_WAIT_ACK:
{
packet_type = "nmb_wack";
- recursion_desired = False;
break;
}
default:
@@ -246,8 +240,8 @@ void reply_netbios_packet(struct packet_struct *p1,int trn_id,
nmb->header.opcode = opcode;
nmb->header.response = True;
nmb->header.nm_flags.bcast = False;
- nmb->header.nm_flags.recursion_available = recurse;
- nmb->header.nm_flags.recursion_desired = recursion_desired;
+ nmb->header.nm_flags.recursion_available = (lp_wins_support() ? True : False );
+ nmb->header.nm_flags.recursion_desired = (lp_wins_support() ? recurse : False );
nmb->header.nm_flags.trunc = False;
nmb->header.nm_flags.authoritative = True;
diff --git a/source3/nameserv.c b/source3/nameserv.c
index aba7ddadb6..f1b34482c8 100644
--- a/source3/nameserv.c
+++ b/source3/nameserv.c
@@ -115,7 +115,7 @@ void remove_name_entry(struct subnet_record *d, char *name,int type, BOOL direct
/* local interface: release them on the network */
queue_netbios_packet(d,ClientNMB,NMB_REL,NAME_RELEASE,
name, type, 0, 0,0,NULL,NULL,
- True, True, d->bcast_ip, d->bcast_ip);
+ True, False, d->bcast_ip, d->bcast_ip);
}
}
@@ -191,7 +191,7 @@ void add_my_name_entry(struct subnet_record *d,char *name,int type,int nb_flags,
queue_netbios_packet(d,ClientNMB,
re_reg ? NMB_REG_REFRESH : NMB_REG, NAME_REGISTER,
name, type, nb_flags, GET_TTL(0),0,NULL,NULL,
- True, True, d->bcast_ip, ipzero);
+ True, False, d->bcast_ip, ipzero);
}
}
}
@@ -273,7 +273,7 @@ on workgroup %s\n", myworkgroup));
queue_netbios_pkt_wins(ClientNMB,NMB_QUERY,NAME_QUERY_DOMAIN,
myworkgroup, 0x1b,
0, 0,0,NULL,NULL,
- False, False, ipzero, ipzero);
+ False, True, ipzero, ipzero);
}
}
else
diff --git a/source3/nameservreply.c b/source3/nameservreply.c
index 9f7b3da70b..db517dff82 100644
--- a/source3/nameservreply.c
+++ b/source3/nameservreply.c
@@ -38,30 +38,10 @@ extern int DEBUGLEVEL;
extern struct in_addr wins_ip;
-
-/****************************************************************************
- add a netbios entry. respond to the (possibly new) owner.
- **************************************************************************/
-void add_name_respond(struct subnet_record *d, int fd, struct in_addr from_ip,
- uint16 response_id,
- struct nmb_name *name,
- int nb_flags, int ttl, struct in_addr register_ip,
- BOOL new_owner, struct in_addr reply_to_ip)
-{
- /* register the old or the new owners' ip */
- add_netbios_entry(d,name->name,name->name_type,
- nb_flags,ttl,REGISTER,register_ip,False,True);
-
- /* reply yes or no to the host that requested the name */
- send_name_response(fd,from_ip, response_id, NMB_REG,
- new_owner, True,
- name, nb_flags, ttl, reply_to_ip);
-}
-
/****************************************************************************
send a registration / release response: pos/neg
**************************************************************************/
-void send_name_response(int fd, struct in_addr from_ip,
+static void send_name_response(int fd, struct in_addr from_ip,
int name_trn_id, int opcode, BOOL success, BOOL recurse,
struct nmb_name *reply_name, int nb_flags, int ttl,
struct in_addr ip)
@@ -99,6 +79,25 @@ void send_name_response(int fd, struct in_addr from_ip,
rdata, 6);
}
+/****************************************************************************
+ add a netbios entry. respond to the (possibly new) owner.
+ **************************************************************************/
+void add_name_respond(struct subnet_record *d, int fd, struct in_addr from_ip,
+ uint16 response_id,
+ struct nmb_name *name,
+ int nb_flags, int ttl, struct in_addr register_ip,
+ BOOL new_owner, struct in_addr reply_to_ip)
+{
+ /* register the old or the new owners' ip */
+ add_netbios_entry(d,name->name,name->name_type,
+ nb_flags,ttl,REGISTER,register_ip,False,True);
+
+ /* reply yes or no to the host that requested the name */
+ send_name_response(fd,from_ip, response_id, NMB_REG,
+ new_owner, False,
+ name, nb_flags, ttl, reply_to_ip);
+}
+
/****************************************************************************
reply to a name release
@@ -150,7 +149,7 @@ void reply_name_release(struct packet_struct *p)
/* Send a NAME RELEASE RESPONSE (pos/neg) see rfc1002.txt 4.2.10-11 */
send_name_response(p->fd,p->ip, nmb->header.name_trn_id, NMB_REL,
- success, False,
+ success, nmb->header.nm_flags.recursion_desired,
&nmb->question.question_name, nb_flags, 0, ip);
}
@@ -193,7 +192,7 @@ void reply_name_reg(struct packet_struct *p)
{
/* apparently we should return 255.255.255.255 for group queries
(email from MS) */
- ip = wins_ip;
+ ip = *interpret_addr2("255.255.255.255");
}
if (!(d = find_req_subnet(p->ip, bcast)))
@@ -298,10 +297,10 @@ void reply_name_reg(struct packet_struct *p)
/* initiate some enquiries to the current owner. */
queue_netbios_packet(d,ClientNMB,NMB_QUERY,
- NAME_REGISTER_CHALLENGE,
- reply_name->name,reply_name->name_type,
- nb_flags,0,0,NULL,NULL,
- False, False, n->ip_flgs[0].ip, p->ip);
+ NAME_REGISTER_CHALLENGE,
+ reply_name->name,reply_name->name_type,
+ nb_flags,0,0,NULL,NULL,
+ False, False, n->ip_flgs[0].ip, p->ip);
}
else
{
@@ -310,8 +309,8 @@ void reply_name_reg(struct packet_struct *p)
*/
send_name_response(p->fd,p->ip, nmb->header.name_trn_id, NMB_REG,
- success, True,
- reply_name, nb_flags, ttl, ip);
+ success, nmb->header.nm_flags.recursion_desired,
+ reply_name, nb_flags, ttl, ip);
}
}
@@ -540,7 +539,7 @@ void reply_name_query(struct packet_struct *p)
success = False;
}
- if (!bcast && name_type == 0x1d)
+ if (!bcast && (name_type == 0x1d) && lp_wins_support())
{
/* see WINS manager HELP - 'How WINS Handles Special Names' */
/* a WINS query (unicasted) for a 0x1d name must always return False */
@@ -585,8 +584,8 @@ void reply_name_query(struct packet_struct *p)
{
/* never reply with a negative response to broadcast queries */
return;
- }
- }
+ }
+ }
/* name is directed query, or it's self, or it's a Domain Master type
name, or we're replying on behalf of a caller because they are on a
@@ -608,6 +607,13 @@ void reply_name_query(struct packet_struct *p)
/* if the IP is 0 then substitute my IP */
if (zero_ip(retip)) retip = *iface_ip(p->ip);
+ /* SPECIAL CASE... If we are a WINS server and the request is explicitly
+ *to* the WINS server and the name type is WORKGROUP<0x1e> we should
+ respond with the local broadcast address 255.255.255.255.
+ */
+ if(!bcast && (name_type == 0x1e) && lp_wins_support())
+ retip = *interpret_addr2("255.255.255.255");
+
if (success)
{
rcode = 0;