[PATCH] Few cleanups
Volker Lendecke
Volker.Lendecke at SerNet.DE
Fri Jun 15 13:00:19 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 9af3c0792541c118f85a750175d5889b5dd39651 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Fri, 18 May 2018 14:47:24 +0200
Subject: [PATCH 1/7] winbindd: Align integer types in for loops
Iterate over the same type as the loop limit
Signed-off-by: Volker Lendecke <vl at samba.org>
---
source3/winbindd/winbindd_util.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/source3/winbindd/winbindd_util.c b/source3/winbindd/winbindd_util.c
index 9707574723b..71735edf9c7 100644
--- a/source3/winbindd/winbindd_util.c
+++ b/source3/winbindd/winbindd_util.c
@@ -602,7 +602,7 @@ static void rescan_forest_root_trusts( void )
{
struct winbindd_tdc_domain *dom_list = NULL;
size_t num_trusts = 0;
- int i;
+ size_t i;
NTSTATUS status;
/* The only transitive trusts supported by Windows 2003 AD are
@@ -679,7 +679,7 @@ static void rescan_forest_trusts( void )
struct winbindd_domain *d = NULL;
struct winbindd_tdc_domain *dom_list = NULL;
size_t num_trusts = 0;
- int i;
+ size_t i;
NTSTATUS status;
/* The only transitive trusts supported by Windows 2003 AD are
--
2.17.1
From f7d7d793232517fc7689ded59163331e362b07fc Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Fri, 18 May 2018 16:15:06 +0200
Subject: [PATCH 2/7] winbindd: Use is_domain_offline() where appropriate
That if-condition is precisely covered by the helper routine
Signed-off-by: Volker Lendecke <vl at samba.org>
---
source3/winbindd/winbindd_cache.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/source3/winbindd/winbindd_cache.c b/source3/winbindd/winbindd_cache.c
index 2778e27374f..af67aa3b0cf 100644
--- a/source3/winbindd/winbindd_cache.c
+++ b/source3/winbindd/winbindd_cache.c
@@ -1123,7 +1123,7 @@ do_query:
/* If its not in cache and we are offline, then fail */
- if ( get_global_winbindd_state_offline() || !domain->online ) {
+ if (is_domain_offline(domain)) {
DEBUG(8,("resolve_username_to_alias: rejecting query "
"in offline mode\n"));
return NT_STATUS_NOT_FOUND;
@@ -1203,7 +1203,7 @@ do_query:
/* If its not in cache and we are offline, then fail */
- if ( get_global_winbindd_state_offline() || !domain->online ) {
+ if (is_domain_offline(domain)) {
DEBUG(8,("resolve_alias_to_username: rejecting query "
"in offline mode\n"));
return NT_STATUS_NOT_FOUND;
--
2.17.1
From 448b8242a0f636b6ef30b2a1bbb16a175c0ce4c9 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Sat, 19 May 2018 18:31:17 +0200
Subject: [PATCH 3/7] winbindd: Do an early TALLOC_FREE
Leave the if-block without leaking
Signed-off-by: Volker Lendecke <vl at samba.org>
---
source3/winbindd/winbindd_ping_dc.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/source3/winbindd/winbindd_ping_dc.c b/source3/winbindd/winbindd_ping_dc.c
index c1a0a7b0ec6..374781902fd 100644
--- a/source3/winbindd/winbindd_ping_dc.c
+++ b/source3/winbindd/winbindd_ping_dc.c
@@ -70,6 +70,8 @@ struct tevent_req *winbindd_ping_dc_send(TALLOC_CTX *mem_ctx,
}
state->dcname = talloc_asprintf(state, "%s.%s", h, d);
+ TALLOC_FREE(h);
+
if (tevent_req_nomem(state->dcname, req)) {
return tevent_req_post(req, ev);
}
--
2.17.1
From 9777a773a5a4352a65e812ba5246c4f69ce88b1f Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Sat, 19 May 2018 18:39:36 +0200
Subject: [PATCH 4/7] winbindd: Add a missing NULL check
Signed-off-by: Volker Lendecke <vl at samba.org>
---
source3/winbindd/winbindd_ping_dc.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/source3/winbindd/winbindd_ping_dc.c b/source3/winbindd/winbindd_ping_dc.c
index 374781902fd..8000493db45 100644
--- a/source3/winbindd/winbindd_ping_dc.c
+++ b/source3/winbindd/winbindd_ping_dc.c
@@ -129,6 +129,9 @@ NTSTATUS winbindd_ping_dc_recv(struct tevent_req *req,
if (state->dcname) {
presp->extra_data.data = talloc_strdup(presp, state->dcname);
+ if (presp->extra_data.data == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
presp->length += strlen((char *)presp->extra_data.data) + 1;
}
--
2.17.1
From 294834319c18ab59b38a727b22728ec2e21b6f4b Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Sat, 19 May 2018 18:40:44 +0200
Subject: [PATCH 5/7] winbindd: Fix winbindd_ping_dc_recv
tevent_req_simple_recv_ntstatus is only for the one-liner without any
additional functionality.
Signed-off-by: Volker Lendecke <vl at samba.org>
---
source3/winbindd/winbindd_ping_dc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/source3/winbindd/winbindd_ping_dc.c b/source3/winbindd/winbindd_ping_dc.c
index 8000493db45..8f56a9e8a77 100644
--- a/source3/winbindd/winbindd_ping_dc.c
+++ b/source3/winbindd/winbindd_ping_dc.c
@@ -135,5 +135,6 @@ NTSTATUS winbindd_ping_dc_recv(struct tevent_req *req,
presp->length += strlen((char *)presp->extra_data.data) + 1;
}
- return tevent_req_simple_recv_ntstatus(req);
+ tevent_req_received(req);
+ return NT_STATUS_OK;
}
--
2.17.1
From 626eabe91cc2789b0dfd7e68a89359b946a93ce2 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Thu, 14 Jun 2018 16:47:26 +0200
Subject: [PATCH 6/7] dsdb: Fix a typo
Signed-off-by: Volker Lendecke <vl at samba.org>
---
source4/dsdb/dns/dns_update.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/source4/dsdb/dns/dns_update.c b/source4/dsdb/dns/dns_update.c
index 0655673be1b..9385b35a43e 100644
--- a/source4/dsdb/dns/dns_update.c
+++ b/source4/dsdb/dns/dns_update.c
@@ -1,5 +1,5 @@
/*
- Unix SMB/CIFS mplementation.
+ Unix SMB/CIFS Implementation.
DNS update service
--
2.17.1
From 697379561008aee97abbb12ef83f8ec8b41473aa Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Fri, 15 Jun 2018 14:56:57 +0200
Subject: [PATCH 7/7] addns: Fix a typo
Signed-off-by: Volker Lendecke <vl at samba.org>
---
lib/addns/dnsgss.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/addns/dnsgss.c b/lib/addns/dnsgss.c
index fd1af7ec5ba..a446da670f7 100644
--- a/lib/addns/dnsgss.c
+++ b/lib/addns/dnsgss.c
@@ -131,7 +131,7 @@ static DNS_ERROR dns_negotiate_gss_ctx_int( TALLOC_CTX *mem_ctx,
/* Windows 2000 DNS is broken and requires the
TKEY payload in the Answer section instead
- of the Additional seciton like Windows 2003 */
+ of the Additional section like Windows 2003 */
if ( srv_type == DNS_SRV_WIN2000 ) {
err = dns_add_rrec(req, rec, &req->num_answers,
--
2.17.1
More information about the samba-technical
mailing list