The Samba-Bugzilla – Attachment 17147 Details for
Bug 14900
Regression: Samba 4.15.2 on macOS segfaults intermittently during strcpy in tdbsam_getsampwnam
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
possible patch for testing
bug-14900.txt (text/plain), 1.47 KB, created by
Volker Lendecke
on 2022-02-03 12:22:24 UTC
(
hide
)
Description:
possible patch for testing
Filename:
MIME Type:
Creator:
Volker Lendecke
Created:
2022-02-03 12:22:24 UTC
Size:
1.47 KB
patch
obsolete
>From 67468168b8fd2eb7635cc2a017c1748375378b91 Mon Sep 17 00:00:00 2001 >From: Volker Lendecke <vl@samba.org> >Date: Thu, 3 Feb 2022 13:20:11 +0100 >Subject: [PATCH] smbd: Safeguards for getpwuid > >Attempt to fix > >Bug: https://bugzilla.samba.org/show_bug.cgi?id=14900 >Signed-off-by: Volker Lendecke <vl@samba.org> >--- > source3/passdb/pdb_interface.c | 14 ++++++++++++-- > 1 file changed, 12 insertions(+), 2 deletions(-) > >diff --git a/source3/passdb/pdb_interface.c b/source3/passdb/pdb_interface.c >index 3c4499a4459..b83cef1de37 100644 >--- a/source3/passdb/pdb_interface.c >+++ b/source3/passdb/pdb_interface.c >@@ -1402,6 +1402,7 @@ static bool pdb_default_uid_to_sid(struct pdb_methods *methods, uid_t uid, > { > struct samu *sampw = NULL; > struct passwd *unix_pw; >+ fstring pw_name = { 0 }; > bool ret; > > unix_pw = getpwuid( uid ); >@@ -1412,14 +1413,23 @@ static bool pdb_default_uid_to_sid(struct pdb_methods *methods, uid_t uid, > return False; > } > >+ if (unix_pw->pw_name == NULL) { >+ DBG_DEBUG("No pw_name for uid %d\n", (int)uid); >+ return false; >+ } >+ >+ /* >+ * Make a copy, "unix_pw" might go away soon. >+ */ >+ fstrcpy(pw_name, unix_pw->pw_name); >+ > if ( !(sampw = samu_new( NULL )) ) { > DEBUG(0,("pdb_default_uid_to_sid: samu_new() failed!\n")); > return False; > } > > become_root(); >- ret = NT_STATUS_IS_OK( >- methods->getsampwnam(methods, sampw, unix_pw->pw_name )); >+ ret = NT_STATUS_IS_OK(methods->getsampwnam(methods, sampw, pw_name)); > unbecome_root(); > > if (!ret) { >-- >2.25.1 >
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 14900
:
16989
|
17147
|
17165