summaryrefslogtreecommitdiff
path: root/source3/nmbd
diff options
context:
space:
mode:
Diffstat (limited to 'source3/nmbd')
-rw-r--r--source3/nmbd/asyncdns.c19
-rw-r--r--source3/nmbd/nmbd.c9
-rw-r--r--source3/nmbd/nmbd_processlogon.c3
-rw-r--r--source3/nmbd/nmbd_synclists.c2
4 files changed, 24 insertions, 9 deletions
diff --git a/source3/nmbd/asyncdns.c b/source3/nmbd/asyncdns.c
index 33c1cb6cb1..5e5565991e 100644
--- a/source3/nmbd/asyncdns.c
+++ b/source3/nmbd/asyncdns.c
@@ -87,8 +87,13 @@ static void asyncdns_process(void)
DEBUGLEVEL = -1;
while (1) {
- if (read_data(fd_in, (char *)&r, sizeof(r), NULL) != sizeof(r))
+ NTSTATUS status;
+
+ status = read_data(fd_in, (char *)&r, sizeof(r));
+
+ if (!NT_STATUS_IS_OK(status)) {
break;
+ }
pull_ascii_nstring( qname, sizeof(qname), r.name.name);
r.result.s_addr = interpret_addr(qname);
@@ -194,7 +199,7 @@ void run_dns_queue(void)
struct query_record r;
struct packet_struct *p, *p2;
struct name_record *namerec;
- int size;
+ NTSTATUS status;
if (fd_in == -1)
return;
@@ -208,11 +213,11 @@ void run_dns_queue(void)
start_async_dns();
}
- if ((size=read_data(fd_in, (char *)&r, sizeof(r), NULL)) != sizeof(r)) {
- if (size) {
- DEBUG(0,("Incomplete DNS answer from child!\n"));
- fd_in = -1;
- }
+ status = read_data(fd_in, (char *)&r, sizeof(r));
+
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(0, ("read from child failed: %s\n", nt_errstr(status)));
+ fd_in = -1;
BlockSignals(True, SIGTERM);
return;
}
diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c
index 344831ddca..378b6f3dbe 100644
--- a/source3/nmbd/nmbd.c
+++ b/source3/nmbd/nmbd.c
@@ -676,11 +676,18 @@ static bool open_sockets(bool isdaemon, int port)
ClientNMB = 0;
}
+ if (ClientNMB == -1) {
+ return false;
+ }
+
ClientDGRAM = open_socket_in(SOCK_DGRAM, DGRAM_PORT,
3, &ss,
true);
- if (ClientNMB == -1) {
+ if (ClientDGRAM == -1) {
+ if (ClientNMB != 0) {
+ close(ClientNMB);
+ }
return false;
}
diff --git a/source3/nmbd/nmbd_processlogon.c b/source3/nmbd/nmbd_processlogon.c
index 0ff0afd12d..10833e8089 100644
--- a/source3/nmbd/nmbd_processlogon.c
+++ b/source3/nmbd/nmbd_processlogon.c
@@ -399,6 +399,7 @@ reporting %s domain %s 0x%x ntversion=%x lm_nt token=%x lm_20 token=%x\n",
char *component, *dc, *q1;
char *q_orig = q;
int str_offset;
+ char *saveptr;
domain = get_mydnsdomname(talloc_tos());
if (!domain) {
@@ -444,7 +445,7 @@ reporting %s domain %s 0x%x ntversion=%x lm_nt token=%x lm_20 token=%x\n",
str_offset = q - q_orig;
dc = domain;
q1 = q;
- while ((component = strtok(dc, "."))) {
+ while ((component = strtok_r(dc, ".", &saveptr)) != NULL) {
dc = NULL;
if (sizeof(outbuf) - PTR_DIFF(q, outbuf) < 1) {
return;
diff --git a/source3/nmbd/nmbd_synclists.c b/source3/nmbd/nmbd_synclists.c
index 147df68a69..5a2f5c46b4 100644
--- a/source3/nmbd/nmbd_synclists.c
+++ b/source3/nmbd/nmbd_synclists.c
@@ -81,12 +81,14 @@ static void sync_child(char *name, int nm_type,
}
if (!cli_set_port(cli, 139)) {
+ cli_shutdown(cli);
return;
}
in_addr_to_sockaddr_storage(&ss, ip);
status = cli_connect(cli, name, &ss);
if (!NT_STATUS_IS_OK(status)) {
+ cli_shutdown(cli);
return;
}