[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Tue Nov 18 13:46:03 MST 2014


The branch, master has been updated
       via  1d6016d lib: Add proper {} to tcopy_passwd
       via  35cd5f7 lib: Use talloc_pooled_object in tcopy_passwd
      from  7f377cf ctdb-scripts: Fix stack dumping when debugging hung scripts

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 1d6016df5ccef235279521088eb13dc262f25277
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Nov 18 10:37:15 2014 +0100

    lib: Add proper {} to tcopy_passwd
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Tue Nov 18 21:45:40 CET 2014 on sn-devel-104

commit 35cd5f783e27f04914421740254905dfcf3f7106
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Nov 18 10:36:50 2014 +0100

    lib: Use talloc_pooled_object in tcopy_passwd
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 lib/util/util_pw.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/util/util_pw.c b/lib/util/util_pw.c
index ab3808f..dae3a69 100644
--- a/lib/util/util_pw.c
+++ b/lib/util/util_pw.c
@@ -31,10 +31,20 @@
 struct passwd *tcopy_passwd(TALLOC_CTX *mem_ctx,
 			    const struct passwd *from)
 {
-	struct passwd *ret = talloc_zero(mem_ctx, struct passwd);
+	struct passwd *ret;
+	size_t len = 0;
 
-	if (ret == NULL)
+	len += strlen(from->pw_name)+1;
+	len += strlen(from->pw_passwd)+1;
+	len += strlen(from->pw_gecos)+1;
+	len += strlen(from->pw_dir)+1;
+	len += strlen(from->pw_shell)+1;
+
+	ret = talloc_pooled_object(mem_ctx, struct passwd, 5, len);
+
+	if (ret == NULL) {
 		return NULL;
+	}
 
 	ret->pw_name = talloc_strdup(ret, from->pw_name);
 	ret->pw_passwd = talloc_strdup(ret, from->pw_passwd);


-- 
Samba Shared Repository


More information about the samba-cvs mailing list