[PATCH] Force the gecos of the user to a fixed value.

Jelmer Vernooij jelmer at samba.org
Tue May 14 09:14:18 MDT 2013


On Tue, May 14, 2013 at 08:01:55AM -0700, Matthieu Patou wrote:
> On 05/14/2013 06:49 AM, Jelmer Vernooij wrote:
> >On Tue, May 14, 2013 at 06:43:28AM -0700, Matthieu Patou wrote:
> >>Can someone review and push this patch ?
> >Looks good to me. Feel free to push with my Reviewed-By. It would be nice to add a comment
> >saying why this behaviour is there.
> I'm not sure I get your point here, or do you mean copying the
> message from the commit as a comment where I did my modifications ?
I mean just adding a comment above the if statement you added, e.g.:

# Unlike passwd, we don't support empty GECOS fields in SamDB, so ensure that
# it has some contents.
if gecos is None or len(gecos) == 0:
	gecos = "Foo GECOS"

Cheers,

Jelmer

> 
> Matthieu.
> >> From 663e53b899c19696b7da607e520e14cadf719031 Mon Sep 17 00:00:00 2001
> >>From: Matthieu Patou <mat at matws.net>
> >>Date: Tue, 14 May 2013 06:20:18 -0700
> >>Subject: [PATCH] Force the gecos of the user to a fixed value.
> >>
> >>When --gecos is not specified samba-tool user add will try to read the
> >>gecos field from a getpw call. And if user's GECOS is empty (like the
> >>build user on sn-devel-104) then the test will fail because we can't add
> >>an empty gecos.
> >>
> >>Signed-off-by: Matthieu Patou <mat at matws.net>
> >>---
> >>  python/samba/tests/samba_tool/user.py |    6 +++++-
> >>  1 file changed, 5 insertions(+), 1 deletion(-)
> >>
> >>diff --git a/python/samba/tests/samba_tool/user.py b/python/samba/tests/samba_tool/user.py
> >>index 89fa22b..7983b10 100644
> >>--- a/python/samba/tests/samba_tool/user.py
> >>+++ b/python/samba/tests/samba_tool/user.py
> >>@@ -212,12 +212,15 @@ class UserCmdTestCase(SambaToolCmdTest):
> >>              self.skipTest("Skipping getpwent test, current EUID not found in NSS")
> >>              return
> >>+        gecos = u[4]
> >>+        if (gecos is None or len(gecos) == 0):
> >>+            gecos = "Foo GECOS"
> >The extra parentheses aren't necessary here and generally frowned upon in python code.
> >
> >Jelmer
> 
> 
> -- 
> Matthieu Patou
> Samba Team
> http://samba.org
> 

-- 


More information about the samba-technical mailing list