[PATCH] Two small cleanups

Ralph Böhme slow at samba.org
Thu Mar 16 09:56:17 UTC 2017


Hi!

Attached are two small cleanups for winbindd.

Please review & push if happy. Thanks!

Cheerio!
-slow
-------------- next part --------------
From efee360e51b6db31ada1c184ab3a83402f6c63a4 Mon Sep 17 00:00:00 2001
From: Ralph Boehme <slow at samba.org>
Date: Thu, 16 Mar 2017 09:32:55 +0100
Subject: [PATCH 1/2] winbindd: use NULL for pointer check in get_cache()

Signed-off-by: Ralph Boehme <slow at samba.org>
---
 source3/winbindd/winbindd_cache.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/source3/winbindd/winbindd_cache.c b/source3/winbindd/winbindd_cache.c
index bafeb9b..f0c19fb 100644
--- a/source3/winbindd/winbindd_cache.c
+++ b/source3/winbindd/winbindd_cache.c
@@ -162,7 +162,7 @@ static struct winbind_cache *get_cache(struct winbindd_domain *domain)
 	   --jerry
 	 */
 
-	if (!domain->backend) {
+	if (domain->backend == NULL) {
 #ifdef HAVE_ADS
 		struct winbindd_domain *our_domain = domain;
 
-- 
2.9.3


From e234fc02c113e96335ac9a3068c2854f25eefecd Mon Sep 17 00:00:00 2001
From: Ralph Boehme <slow at samba.org>
Date: Thu, 16 Mar 2017 10:36:14 +0100
Subject: [PATCH 2/2] winbindd: untangle reconnect_methods vs
 reconnect_ads_methods

No change in behaviour. The previous logic just seemed a bit clumsy
because of the ifdefs.

Signed-off-by: Ralph Boehme <slow at samba.org>
---
 source3/winbindd/winbindd_cache.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/source3/winbindd/winbindd_cache.c b/source3/winbindd/winbindd_cache.c
index f0c19fb..0ef7c16 100644
--- a/source3/winbindd/winbindd_cache.c
+++ b/source3/winbindd/winbindd_cache.c
@@ -162,8 +162,8 @@ static struct winbind_cache *get_cache(struct winbindd_domain *domain)
 	   --jerry
 	 */
 
-	if (domain->backend == NULL) {
 #ifdef HAVE_ADS
+	if (domain->backend == NULL) {
 		struct winbindd_domain *our_domain = domain;
 
 		/* find our domain first so we can figure out if we 
@@ -177,13 +177,13 @@ static struct winbind_cache *get_cache(struct winbindd_domain *domain)
 		    && !lp_winbind_rpc_only()) {
 			DEBUG(5,("get_cache: Setting ADS methods for domain %s\n", domain->name));
 			domain->backend = &reconnect_ads_methods;
-		} else {
-#endif	/* HAVE_ADS */
-			DEBUG(5,("get_cache: Setting MS-RPC methods for domain %s\n", domain->name));
-			domain->backend = &reconnect_methods;
-#ifdef HAVE_ADS
 		}
+	}
 #endif	/* HAVE_ADS */
+
+	if (domain->backend == NULL) {
+		DEBUG(5,("get_cache: Setting MS-RPC methods for domain %s\n", domain->name));
+		domain->backend = &reconnect_methods;
 	}
 
 	if (ret)
-- 
2.9.3



More information about the samba-technical mailing list