summaryrefslogtreecommitdiff
path: root/source3/nmbd
diff options
context:
space:
mode:
Diffstat (limited to 'source3/nmbd')
-rw-r--r--source3/nmbd/nmbd.c5
-rw-r--r--source3/nmbd/nmbd_packets.c20
-rw-r--r--source3/nmbd/nmbd_proto.h2
3 files changed, 27 insertions, 0 deletions
diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c
index 30bbeaadee..eaa5055998 100644
--- a/source3/nmbd/nmbd.c
+++ b/source3/nmbd/nmbd.c
@@ -1017,6 +1017,11 @@ static bool open_sockets(bool isdaemon, int port)
exit(1);
}
+ if (!nmbd_init_packet_server()) {
+ kill_async_dns_child();
+ exit(1);
+ }
+
TALLOC_FREE(frame);
process();
diff --git a/source3/nmbd/nmbd_packets.c b/source3/nmbd/nmbd_packets.c
index 1e72c18888..ec5225a5ec 100644
--- a/source3/nmbd/nmbd_packets.c
+++ b/source3/nmbd/nmbd_packets.c
@@ -31,6 +31,22 @@ extern int num_response_packets;
bool rescan_listen_set = False;
+static struct nb_packet_server *packet_server;
+
+bool nmbd_init_packet_server(void)
+{
+ NTSTATUS status;
+
+ status = nb_packet_server_create(NULL, nmbd_event_context(), 0,
+ &packet_server);
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(0, ("ERROR: nb_packet_server_create failed: %s\n",
+ nt_errstr(status)));
+ return false;
+ }
+ return true;
+}
+
/*******************************************************************
The global packet linked-list. Incoming entries are
@@ -1204,6 +1220,7 @@ static void process_dgram(struct packet_struct *p)
/* If we aren't listening to the destination name then ignore the packet */
if (!listening(p,&dgram->dest_name)) {
+ nb_packet_dispatch(packet_server, p);
unexpected_packet(p);
DEBUG(5,("process_dgram: ignoring dgram packet sent to name %s from %s\n",
nmb_namestr(&dgram->dest_name), inet_ntoa(p->ip)));
@@ -1211,6 +1228,7 @@ static void process_dgram(struct packet_struct *p)
}
if (dgram->header.msg_type != 0x10 && dgram->header.msg_type != 0x11 && dgram->header.msg_type != 0x12) {
+ nb_packet_dispatch(packet_server, p);
unexpected_packet(p);
/* Don't process error packets etc yet */
DEBUG(5,("process_dgram: ignoring dgram packet sent to name %s from IP %s as it is \
@@ -1297,6 +1315,7 @@ packet sent to name %s from IP %s\n",
return;
}
+ nb_packet_dispatch(packet_server, p);
unexpected_packet(p);
}
@@ -1417,6 +1436,7 @@ static struct subnet_record *find_subnet_for_nmb_packet( struct packet_struct *p
if(rrec == NULL) {
DEBUG(3,("find_subnet_for_nmb_packet: response record not found for response id %hu\n",
nmb->header.name_trn_id));
+ nb_packet_dispatch(packet_server, p);
unexpected_packet(p);
return NULL;
}
diff --git a/source3/nmbd/nmbd_proto.h b/source3/nmbd/nmbd_proto.h
index e90a90ee7f..b58ca41e5a 100644
--- a/source3/nmbd/nmbd_proto.h
+++ b/source3/nmbd/nmbd_proto.h
@@ -173,6 +173,8 @@ bool node_status(struct subnet_record *subrec, struct nmb_name *nmbname,
/* The following definitions come from nmbd/nmbd_packets.c */
+bool nmbd_init_packet_server(void);
+
uint16 get_nb_flags(char *buf);
void set_nb_flags(char *buf, uint16 nb_flags);
struct response_record *queue_register_name( struct subnet_record *subrec,