summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2002-12-28 01:23:38 +0000
committerJeremy Allison <jra@samba.org>2002-12-28 01:23:38 +0000
commite114e03d3ffe87e29cea3d35232f9527cffb01bf (patch)
treeff44a6c18ce486705a83161a179da9204812fe4b
parentdf7b562de25ccd35ed72ea0e429c41133001739f (diff)
downloadsamba-e114e03d3ffe87e29cea3d35232f9527cffb01bf.tar.gz
samba-e114e03d3ffe87e29cea3d35232f9527cffb01bf.tar.bz2
samba-e114e03d3ffe87e29cea3d35232f9527cffb01bf.zip
Patch for coredump with missing arg from "Bradley W. Langhorst" <brad@langhorst.com>
Jeremy. (This used to be commit 0958a2ae73345aff42d6cf8ebc248e463949a3ff)
-rw-r--r--source3/utils/pdbedit.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/source3/utils/pdbedit.c b/source3/utils/pdbedit.c
index 6a019e73d7..e4e3d1fcd6 100644
--- a/source3/utils/pdbedit.c
+++ b/source3/utils/pdbedit.c
@@ -495,7 +495,14 @@ int main (int argc, char **argv)
poptGetArg(pc); /* Drop argv[0], the program name */
if (user_name == NULL) {
- user_name = strdup(poptGetArg(pc));
+ if (poptPeekArg(pc) == NULL) {
+ fprintf(stderr, "Can't use pdbedit without a username\n");
+ poptPrintHelp(pc, stderr, 0);
+ exit(1);
+ } else {
+ /*Don't try to duplicate a null string */
+ user_name = strdup(poptGetArg(pc));
+ }
}
if (!lp_load(dyn_CONFIGFILE,True,False,False)) {