[PATCH] minor winbind3 patches

Volker Lendecke Volker.Lendecke at SerNet.DE
Tue Feb 4 03:31:30 MST 2014


Hi!

Review & push would be 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 0c820ee148a3ce192bccdf4e23588ab093e82f32 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Thu, 30 Jan 2014 13:37:01 +0000
Subject: [PATCH 1/3] winbind3: Fix a comment typo

Signed-off-by: Volker Lendecke <vl at samba.org>
---
 source3/winbindd/wb_getpwsid.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/source3/winbindd/wb_getpwsid.c b/source3/winbindd/wb_getpwsid.c
index df8b0f2..9e41bca 100644
--- a/source3/winbindd/wb_getpwsid.c
+++ b/source3/winbindd/wb_getpwsid.c
@@ -72,7 +72,7 @@ static void wb_getpwsid_queryuser_done(struct tevent_req *subreq)
 	    && (state->userinfo->acct_name[0] != '\0'))
 	{
 		/*
-		 * QueryUser got us a name, let's got directly to the
+		 * QueryUser got us a name, let's go directly to the
 		 * fill_pwent step
 		 */
 		subreq = wb_fill_pwent_send(state, state->ev, state->userinfo,
-- 
1.8.1.2


From 444c9e6847bebc9bd10a6ca408711e4b84c951b4 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Thu, 30 Jan 2014 14:17:35 +0000
Subject: [PATCH 2/3] winbind3: Use fstrcpy

Signed-off-by: Volker Lendecke <vl at samba.org>
---
 source3/winbindd/wb_fill_pwent.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/source3/winbindd/wb_fill_pwent.c b/source3/winbindd/wb_fill_pwent.c
index cd0ca50..359946f 100644
--- a/source3/winbindd/wb_fill_pwent.c
+++ b/source3/winbindd/wb_fill_pwent.c
@@ -238,7 +238,7 @@ static bool fillup_pw_field(const char *lp_template,
 	if (!templ)
 		return False;
 
-	strlcpy(out, templ, sizeof(fstring));
+	fstrcpy(out, templ);
 	TALLOC_FREE(templ);
 
 	return True;
-- 
1.8.1.2


From 47c21cb6828708dd20c17f1f69b5ca6a73d323b6 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Thu, 30 Jan 2014 14:24:06 +0000
Subject: [PATCH 3/3] winbind3: Simplify fillup_pw_field

---
 source3/winbindd/wb_fill_pwent.c | 29 ++++++++++++++---------------
 1 file changed, 14 insertions(+), 15 deletions(-)

diff --git a/source3/winbindd/wb_fill_pwent.c b/source3/winbindd/wb_fill_pwent.c
index 359946f..c1f83e5 100644
--- a/source3/winbindd/wb_fill_pwent.c
+++ b/source3/winbindd/wb_fill_pwent.c
@@ -214,32 +214,31 @@ static bool fillup_pw_field(const char *lp_template,
 			    const char *in,
 			    fstring out)
 {
-	char *templ;
+	const char *templ;
+	char *result;
 
 	if (out == NULL)
 		return False;
 
-	/* The substitution of %U and %D in the 'template
-	   homedir' is done by talloc_sub_specified() below.
-	   If we have an in string (which means the value has already
-	   been set in the nss_info backend), then use that.
-	   Otherwise use the template value passed in. */
+	templ = lp_template;
 
 	if ((in != NULL) && (in[0] != '\0') && (lp_security() == SEC_ADS)) {
-		templ = talloc_sub_specified(talloc_tos(), in,
-					     username, grpname, domname,
-					     uid, gid);
-	} else {
-		templ = talloc_sub_specified(talloc_tos(), lp_template,
-					     username, grpname, domname,
-					     uid, gid);
+		/*
+		 * The backend has already filled in the required value. Use
+		 * that instead of the template.
+		 */
+		templ = in;
 	}
 
-	if (!templ)
+	result = talloc_sub_specified(talloc_tos(), templ,
+				      username, grpname, domname,
+				      uid, gid);
+	if (result == NULL) {
 		return False;
+	}
 
 	fstrcpy(out, templ);
-	TALLOC_FREE(templ);
+	TALLOC_FREE(result);
 
 	return True;
 
-- 
1.8.1.2



More information about the samba-technical mailing list