make directory listing a run-time flag

remove const in the config.h since it can be changed at run-time now.
This commit is contained in:
Hiltjo Posthuma 2017-06-27 23:17:44 +02:00 committed by Laslo Hunhold
parent 434f2b3067
commit c369738fa4
3 changed files with 14 additions and 2 deletions

View file

@ -2,7 +2,7 @@ static const char *host = "localhost";
static const char *port = "80"; static const char *port = "80";
static const char *servedir = "."; static const char *servedir = ".";
static const char *docindex = "index.html"; static const char *docindex = "index.html";
static const int listdirs = 1; static int listdirs = 1;
static const char *user = "nobody"; static const char *user = "nobody";
static const char *group = "nogroup"; static const char *group = "nogroup";
static const int maxnprocs = 512; static const int maxnprocs = 512;

View file

@ -15,6 +15,8 @@
.Op Fl U Ar udsocket .Op Fl U Ar udsocket
.Oc .Oc
.Op Fl d Ar dir .Op Fl d Ar dir
.Op Fl l
.Op Fl L
.Op Fl u Ar user .Op Fl u Ar user
.Op Fl g Ar group .Op Fl g Ar group
.Sh DESCRIPTION .Sh DESCRIPTION
@ -27,6 +29,10 @@ UNIX-domain sockets.
Serve Serve
.Ar dir .Ar dir
after chrooting into it. after chrooting into it.
.It Fl l
Disable directory listing.
.It Fl L
Enable directory listing.
.It Fl g Ar group .It Fl g Ar group
Set group ID to the ID of Set group ID to the ID of
.Ar group .Ar group

View file

@ -857,7 +857,7 @@ static void
usage(void) usage(void)
{ {
die("usage: %s [-v] [[[-h host] [-p port]] | [-U udsocket]] " die("usage: %s [-v] [[[-h host] [-p port]] | [-U udsocket]] "
"[-d dir] [-u user] [-g group]\n", argv0); "[-d dir] [-l] [-L] [-u user] [-g group]\n", argv0);
} }
int int
@ -879,6 +879,12 @@ main(int argc, char *argv[])
case 'h': case 'h':
host = EARGF(usage()); host = EARGF(usage());
break; break;
case 'l':
listdirs = 0;
break;
case 'L':
listdirs = 1;
break;
case 'p': case 'p':
port = EARGF(usage()); port = EARGF(usage());
break; break;