[PATCH] Some cleanups
Volker Lendecke
Volker.Lendecke at SerNet.DE
Fri Jan 5 12:23:11 UTC 2018
Hi!
Review appreciated!
Thanks, Volker
--
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de
-------------- next part --------------
From 84684ac5aa12ebcecd8f31890f5702843a437c6a Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Thu, 4 Jan 2018 21:06:02 +0100
Subject: [PATCH 1/3] samba: Only use async signal-safe functions in signal
handler
Otherwise shutdown can hang
Signed-off-by: Volker Lendecke <vl at samba.org>
---
source4/smbd/server.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/source4/smbd/server.c b/source4/smbd/server.c
index f650d80e873..adee3887d98 100644
--- a/source4/smbd/server.c
+++ b/source4/smbd/server.c
@@ -133,12 +133,10 @@ static void sig_term(int sig)
* We're the process group leader, send
* SIGTERM to our process group.
*/
- DBG_ERR("SIGTERM: killing children\n");
kill(-getpgrp(), SIGTERM);
}
#endif
- DBG_ERR("Exiting pid %d on SIGTERM\n", (int)getpid());
- exit(127);
+ _exit(127);
}
static void sigterm_signal_handler(struct tevent_context *ev,
--
2.11.0
From 6f714ee7efe1a91c79f3f056d42a69e4e2ee24cb Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Thu, 4 Jan 2018 21:26:58 +0100
Subject: [PATCH 2/3] dnscli: Make a few functions static
We might want to use the tcp flavor in the future in the forwarder for a
single, persistent TCP connection. Then we can easily re-publish it.
Signed-off-by: Volker Lendecke <vl at samba.org>
---
libcli/dns/dns.c | 36 ++++++++++++++++++------------------
libcli/dns/libdns.h | 38 --------------------------------------
2 files changed, 18 insertions(+), 56 deletions(-)
diff --git a/libcli/dns/dns.c b/libcli/dns/dns.c
index 6404cb8aa40..c30de2d4add 100644
--- a/libcli/dns/dns.c
+++ b/libcli/dns/dns.c
@@ -45,11 +45,11 @@ struct dns_udp_request_state {
static void dns_udp_request_get_reply(struct tevent_req *subreq);
static void dns_udp_request_done(struct tevent_req *subreq);
-struct tevent_req *dns_udp_request_send(TALLOC_CTX *mem_ctx,
- struct tevent_context *ev,
- const char *server_addr_string,
- const uint8_t *query,
- size_t query_len)
+static struct tevent_req *dns_udp_request_send(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ const char *server_addr_string,
+ const uint8_t *query,
+ size_t query_len)
{
struct tevent_req *req, *subreq;
struct dns_udp_request_state *state;
@@ -158,10 +158,10 @@ static void dns_udp_request_done(struct tevent_req *subreq)
tevent_req_done(req);
}
-int dns_udp_request_recv(struct tevent_req *req,
- TALLOC_CTX *mem_ctx,
- uint8_t **reply,
- size_t *reply_len)
+static int dns_udp_request_recv(struct tevent_req *req,
+ TALLOC_CTX *mem_ctx,
+ uint8_t **reply,
+ size_t *reply_len)
{
struct dns_udp_request_state *state = tevent_req_data(req,
struct dns_udp_request_state);
@@ -201,11 +201,11 @@ static int dns_tcp_request_next_vector(struct tstream_context *stream,
size_t *_count);
static void dns_tcp_request_received(struct tevent_req *subreq);
-struct tevent_req *dns_tcp_request_send(TALLOC_CTX *mem_ctx,
- struct tevent_context *ev,
- const char *server_addr_string,
- const uint8_t *query,
- size_t query_len)
+static struct tevent_req *dns_tcp_request_send(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ const char *server_addr_string,
+ const uint8_t *query,
+ size_t query_len)
{
struct tevent_req *req, *subreq;
struct dns_tcp_request_state *state;
@@ -377,10 +377,10 @@ static void dns_tcp_request_received(struct tevent_req *subreq)
tevent_req_done(req);
}
-int dns_tcp_request_recv(struct tevent_req *req,
- TALLOC_CTX *mem_ctx,
- uint8_t **reply,
- size_t *reply_len)
+static int dns_tcp_request_recv(struct tevent_req *req,
+ TALLOC_CTX *mem_ctx,
+ uint8_t **reply,
+ size_t *reply_len)
{
struct dns_tcp_request_state *state = tevent_req_data(
req, struct dns_tcp_request_state);
diff --git a/libcli/dns/libdns.h b/libcli/dns/libdns.h
index 1b7c404f6b7..15ca257c0b3 100644
--- a/libcli/dns/libdns.h
+++ b/libcli/dns/libdns.h
@@ -26,44 +26,6 @@
#include "lib/util/time.h"
#include "librpc/gen_ndr/dns.h"
-/** Send an dns request to a dns server using UDP
- *
- *@param mem_ctx talloc memory context to use
- *@param ev tevent context to use
- *@param server_address address of the server as a string
- *@param query dns query to send
- *@param query_len length of the query
- *@return tevent_req with the active request or NULL on out-of-memory
- */
-struct tevent_req *dns_udp_request_send(TALLOC_CTX *mem_ctx,
- struct tevent_context *ev,
- const char *server_address,
- const uint8_t *query,
- size_t query_len);
-
-/** Get the dns response from a dns server via UDP
- *
- *@param req tevent_req struct returned from dns_udp_request_send
- *@param mem_ctx talloc memory context to use for the reply string
- *@param reply buffer that will be allocated and filled with the dns reply
- *@param reply_len length of the reply buffer
- *@return 0/errno
- */
-int dns_udp_request_recv(struct tevent_req *req,
- TALLOC_CTX *mem_ctx,
- uint8_t **reply,
- size_t *reply_len);
-
-struct tevent_req *dns_tcp_request_send(TALLOC_CTX *mem_ctx,
- struct tevent_context *ev,
- const char *server_addr_string,
- const uint8_t *query,
- size_t query_len);
-int dns_tcp_request_recv(struct tevent_req *req,
- TALLOC_CTX *mem_ctx,
- uint8_t **reply,
- size_t *reply_len);
-
/*
* DNS request with fallback to TCP on truncation
*/
--
2.11.0
From 2e15c5a7eb8815bd95a92def2a938b13c99e52fb Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Fri, 5 Jan 2018 10:45:41 +0100
Subject: [PATCH 3/3] tests: The pthreadpooltests do not need a full
environment
Makes "make test TESTS=pthreadpool" faster
Signed-off-by: Volker Lendecke <vl at samba.org>
---
source3/selftest/tests.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py
index 34de4be230b..6fa0ad23ce2 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -334,11 +334,11 @@ plantestsuite("samba3.blackbox.testparm", "nt4_dc:local",
"$LOCAL_PATH"])
plantestsuite(
- "samba3.pthreadpool", "nt4_dc",
+ "samba3.pthreadpool", "none",
[os.path.join(samba3srcdir, "script/tests/test_pthreadpool.sh")])
if with_pthreadpool and have_ldwrap:
- plantestsuite("samba3.pthreadpool_cmocka", "nt4_dc",
+ plantestsuite("samba3.pthreadpool_cmocka", "none",
[os.path.join(bindir(), "pthreadpooltest_cmocka")])
plantestsuite("samba3.async_req", "nt4_dc",
--
2.11.0
More information about the samba-technical
mailing list