diff --git a/README b/README index 826f81b..f48cf5c 100644 --- a/README +++ b/README @@ -45,6 +45,7 @@ Command line options: -nr Disable root user checking (for debugging) -np Disable HAproxy proxy protocol -nx Disable execution of gophermaps and scripts + -nu Disable personal gopherspaces -d Debug output in syslog and /server-status -v Display version number and build date diff --git a/gophernicus.c b/gophernicus.c index 38c0a2b..eb6e020 100644 --- a/gophernicus.c +++ b/gophernicus.c @@ -228,7 +228,8 @@ void selector_to_path(state *st) #ifdef HAVE_PASSWD /* Virtual userdir (~user -> /home/user/public_gopher)? */ - if (*(st->user_dir) && sstrncmp(st->req_selector, "/~") == MATCH) { + if (st->opt_personal_spaces && *(st->user_dir) && + sstrncmp(st->req_selector, "/~") == MATCH) { /* Parse userdir login name & path */; sstrlcpy(buf, st->req_selector + 2); @@ -464,6 +465,7 @@ void init_state(state *st) st->opt_root = TRUE; st->opt_proxy = TRUE; st->opt_exec = TRUE; + st->opt_personal_spaces = TRUE; st->debug = FALSE; /* Load default suffix -> filetype mappings */ diff --git a/gophernicus.h b/gophernicus.h index 770646d..649b918 100644 --- a/gophernicus.h +++ b/gophernicus.h @@ -360,6 +360,7 @@ typedef struct { char opt_root; char opt_proxy; char opt_exec; + char opt_personal_spaces; char debug; } state; diff --git a/menu.c b/menu.c index 9e959d3..fa0d34f 100644 --- a/menu.c +++ b/menu.c @@ -343,7 +343,7 @@ int gophermap(state *st, char *mapfile, int depth) if (type == '.') return QUIT; /* Print a list of users with public_gopher */ - if (type == '~') { + if (type == '~' && st->opt_personal_spaces) { #ifdef HAVE_PASSWD userlist(st); #endif diff --git a/options.c b/options.c index dbd3c44..734141e 100644 --- a/options.c +++ b/options.c @@ -145,6 +145,7 @@ void parse_args(state *st, int argc, char *argv[]) if (*optarg == 'r') { st->opt_root = FALSE; break; } if (*optarg == 'p') { st->opt_proxy = FALSE; break; } if (*optarg == 'x') { st->opt_exec = FALSE; break; } + if (*optarg == 'u') { st->opt_personal_spaces = FALSE; break; } break; case 'd': st->debug = TRUE; break;