1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-15 05:57:49 +03:00

s3:smbpasswd: Use cmdline_messaging_context

smbpasswd does not use POPT_CREDENTIALS. Call cmdline_messaging_context
to initialize a messaging_context with proper error checking before
calling lp_load_global.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13465

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
(cherry picked from commit 29fd2c2e5ad3c2d44f3629c6b7b4139772fe350c)
This commit is contained in:
Christof Schmitt 2018-08-20 15:38:33 -07:00 committed by Karolin Seeger
parent 8251e95c1a
commit 49f962f515
2 changed files with 6 additions and 15 deletions

View File

@ -23,6 +23,7 @@
#include "../lib/util/util_pw.h"
#include "libsmb/proto.h"
#include "passdb.h"
#include "cmdline_contexts.h"
/*
* Next two lines needed for SunOS and don't
@ -196,6 +197,8 @@ static int process_options(int argc, char **argv, int local_flags)
usage();
}
cmdline_messaging_context(configfile);
if (!lp_load_global(configfile)) {
fprintf(stderr, "Can't load %s - run testparm to debug it\n",
configfile);
@ -614,7 +617,6 @@ 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;
@ -632,19 +634,6 @@ int main(int argc, char **argv)
setup_logging("smbpasswd", DEBUG_STDERR);
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;
}
}
/*
* Set the machine NETBIOS name if not already
* set from the config file.

View File

@ -37,7 +37,9 @@ bld.SAMBA3_BINARY('smbpasswd',
smbconf
pdb
PASSWD_UTIL
PASSCHANGE''')
PASSCHANGE
cmdline_contexts
''')
bld.SAMBA3_BINARY('pdbedit',
source='pdbedit.c',