Skip to content

Commit 1e5a2ea

Browse files
bostrtFelipe Zimmerle
authored andcommitted
Add usage to help output. Tell user when no database name was provided. SpiderLabs#14
1 parent b1b6b24 commit 1e5a2ea

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

modsec-sdbm-util.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ int remove_key (apr_pool_t *pool, apr_sdbm_t *db, const char *key_str)
370370

371371
void help (void) {
372372

373-
p("\n modsec-sdbm-util %s\n\n", VERSION);
373+
p("\n Usage: modsec-sdbm-util [nkxsdahvurD] <database-name>\n\n");
374374

375375
p("This utility was created in order to make easy the maintenance of the SDBM files\n");
376376
p("which stores ModSecurity persistent collections.\n\n");
@@ -458,6 +458,12 @@ int main (int argc, char **argv)
458458
return 0;
459459
}
460460

461+
if (optind == argc) {
462+
printf ("No database name was provided.\n");
463+
help();
464+
return 0;
465+
}
466+
461467
apr_initialize();
462468
/* atexit(apr_terminate()); */
463469

0 commit comments

Comments
 (0)