[PATCH] smbpasswd can't be executed as user to change the password
Andreas Schneider
asn at samba.org
Fri Aug 18 07:51:58 UTC 2017
Hi,
the attached patch fixes the issue for master and 4.7.
Review and push appreciated.
Thanks,
Andreas
--
Andreas Schneider GPG-ID: CC014E3D
Samba Team asn at samba.org
www.samba.org
-------------- next part --------------
>From 960ffdac126c1a2ef9ac2babbda3a871db16b89b Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Fri, 18 Aug 2017 09:41:36 +0200
Subject: [PATCH] s3:utils: Allow to run smbpasswd as user
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12974
Signed-off-by: Andreas Schneider <asn at samba.org>
---
source3/utils/smbpasswd.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/source3/utils/smbpasswd.c b/source3/utils/smbpasswd.c
index aa6b857a258..ae9862606f1 100644
--- a/source3/utils/smbpasswd.c
+++ b/source3/utils/smbpasswd.c
@@ -586,6 +586,7 @@ static int process_nonroot(int local_flags)
int main(int argc, char **argv)
{
TALLOC_CTX *frame = talloc_stackframe();
+ struct messaging_context *msg_ctx = NULL;
int local_flags = 0;
int ret;
@@ -603,8 +604,17 @@ int main(int argc, char **argv)
setup_logging("smbpasswd", DEBUG_STDERR);
- if (server_messaging_context() == NULL) {
- return 1;
+ msg_ctx = server_messaging_context();
+ if (msg_ctx == NULL) {
+ if (geteuid() != 0) {
+ DBG_NOTICE("Unable to initialize messaging context. "
+ "Must be root to do that.\n");
+ } else {
+ fprintf(stderr,
+ "smbpasswd is not able to initialize the "
+ "messaging context!\n");
+ return 1;
+ }
}
/*
--
2.14.0
More information about the samba-technical
mailing list