The Samba-Bugzilla – Attachment 15203 Details for
Bug 13975
Fixup tcopy_passwd() to also copy the pw_comment field
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
Also copy pw_comment in tcopy_passwd()
lib-util-tcopy-passwd-pw_comment.patches.txt (text/plain), 1.76 KB, created by
Stefan Behrens
on 2019-05-29 13:54:55 UTC
(
hide
)
Description:
Also copy pw_comment in tcopy_passwd()
Filename:
MIME Type:
Creator:
Stefan Behrens
Created:
2019-05-29 13:54:55 UTC
Size:
1.76 KB
patch
obsolete
>From c8c6829e0b167c85fc804b2559a643232a36f9fa Mon Sep 17 00:00:00 2001 >From: Stefan Behrens <sbehrens@giantdisaster.de> >Date: Wed, 27 Mar 2019 11:26:09 +0100 >Subject: [PATCH] lib/util: Fixup tcopy_passwd() to also copy the pw_comment > field > >This change isn't needed by the Samba code itself but by a passdb >module of mine. This module makes use of the comment field and >requires that the copy of a passwd structure includes the pw_comment >field. And I see no reason why all fields of the passwd structure >are copied except for pw_comment. > >Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de> >--- > lib/util/util_pw.c | 12 +++++++++++- > 1 file changed, 11 insertions(+), 1 deletion(-) > >diff --git a/lib/util/util_pw.c b/lib/util/util_pw.c >index 8035de4392c3..62e6e1e36a64 100644 >--- a/lib/util/util_pw.c >+++ b/lib/util/util_pw.c >@@ -34,14 +34,21 @@ struct passwd *tcopy_passwd(TALLOC_CTX *mem_ctx, > { > struct passwd *ret; > size_t len = 0; >+ unsigned int num_subobjs; > > 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; >+ if (from->pw_comment != NULL) { >+ len += strlen(from->pw_comment)+1; >+ num_subobjs = 6; >+ } else { >+ num_subobjs = 5; >+ } > >- ret = talloc_pooled_object(mem_ctx, struct passwd, 5, len); >+ ret = talloc_pooled_object(mem_ctx, struct passwd, num_subobjs, len); > > if (ret == NULL) { > return NULL; >@@ -54,6 +61,9 @@ struct passwd *tcopy_passwd(TALLOC_CTX *mem_ctx, > ret->pw_gecos = talloc_strdup(ret, from->pw_gecos); > ret->pw_dir = talloc_strdup(ret, from->pw_dir); > ret->pw_shell = talloc_strdup(ret, from->pw_shell); >+ if (from->pw_comment != NULL) { >+ ret->pw_comment = talloc_strdup(ret, from->pw_comment); >+ } > > return ret; > } >-- >2.19.2 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 13975
: 15203