summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2002-12-28 01:23:34 +0000
committerJeremy Allison <jra@samba.org>2002-12-28 01:23:34 +0000
commit10c50fb5800b0ba11b52bce1c7a1a7d0de48a79f (patch)
treef90ae6261701c0d6782e08adb5e65d42e4351b57
parentb3c3701c0762e535a788b2328cfc212594c978c8 (diff)
downloadsamba-10c50fb5800b0ba11b52bce1c7a1a7d0de48a79f.tar.gz
samba-10c50fb5800b0ba11b52bce1c7a1a7d0de48a79f.tar.xz
samba-10c50fb5800b0ba11b52bce1c7a1a7d0de48a79f.zip
Patch for coredump with missing arg from "Bradley W. Langhorst" <brad@langhorst.com>
Jeremy. (This used to be commit 5914c38a54fcfdb007352b152dc2206708d59af6)
-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 45a63c4b64..773af7c79a 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 = 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)) {