1
0
mirror of https://github.com/gophernicus/gophernicus.git synced 2024-06-16 06:25:23 +00:00

Add -nu flag to disable personal spaces.

This commit is contained in:
Edd Barrett 2019-03-04 22:10:26 +00:00
parent b7b0f17a0a
commit 519c15a069
5 changed files with 7 additions and 2 deletions

1
README
View File

@ -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

View File

@ -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 */

View File

@ -360,6 +360,7 @@ typedef struct {
char opt_root;
char opt_proxy;
char opt_exec;
char opt_personal_spaces;
char debug;
} state;

2
menu.c
View File

@ -341,7 +341,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

View File

@ -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;