commit - 7a9e735b5a74ad7ea5765c877c77589159874b7d
commit + fd3bb074b1599bb655945a9979ba082181d4006e
blob - f86abeed2b6015b64df0d587d269dd831c7c1521
blob + 32eda3d20c62bbb4441bdb111146376cc3652467
--- gotwebd/gotwebd.c
+++ gotwebd/gotwebd.c
int no_action = 0;
int server_proc = 0;
const char *conffile = GOTWEBD_CONF;
+ const char *username = GOTWEBD_DEFAULT_USER;
const char *argv0;
if ((argv0 = argv[0]) == NULL)
if (geteuid())
fatalx("need root privileges");
- pw = getpwnam(GOTWEBD_USER);
+ if (env->user)
+ username = env->user;
+ pw = getpwnam(username);
if (pw == NULL)
- fatalx("unknown user %s", GOTWEBD_USER);
+ fatalx("unknown user %s", username);
env->pw = pw;
log_init(env->gotwebd_debug, LOG_DAEMON);
blob - 89f71710e8a0c0843273917b078dba8ab9a9b945
blob + eeebc610744523f4541a4d40fe150fcf56088e7c
--- gotwebd/gotwebd.conf.5
+++ gotwebd/gotwebd.conf.5
.Xr chroot 2
environment of
.Xr httpd 8 .
-If not specified then
-.Pa /var/www
-will be used.
+If not specified, it defaults to
+.Pa /var/www ,
+the home directory of the www user.
.It Ic listen on Ar address Ic port Ar number
Configure an address and port for incoming FastCGI connections.
Valid
Run the specified number of server processes.
.Xr gotwebd 8
runs 3 server processes by default.
+.It Ic user Ar user
+Set the
+.Ar user
+which will run
+.Xr gotwebd 8 .
+If not specified, the user www will be used.
.El
.Pp
If no
blob - 55aa40d54946310b204bf2c3690e25f707cf817a
blob + 54d00805fd26e7a6b11e21510aad032bf7d9e1bc
--- gotwebd/gotwebd.h
+++ gotwebd/gotwebd.h
/* GOTWEBD DEFAULTS */
#define GOTWEBD_CONF "/etc/gotwebd.conf"
-#define GOTWEBD_USER "www"
+#ifndef GOTWEBD_DEFAULT_USER
+#define GOTWEBD_DEFAULT_USER "www"
+#endif
#define GOTWEBD_MAXDESCRSZ 1024
#define GOTWEBD_MAXCLONEURLSZ 1024
struct socketlist sockets;
struct addresslist addresses;
+ char *user;
const char *gotwebd_conffile;
int gotwebd_debug;
blob - ecb032f388f7b7cc0fc108ff69a4320c3a76283e
blob + 4c081b06b19f4927f374ee0ed69e3f67cd69e416
--- gotwebd/parse.y
+++ gotwebd/parse.y
%token MAX_REPOS_DISPLAY REPOS_PATH MAX_COMMITS_DISPLAY ON ERROR
%token SHOW_SITE_OWNER SHOW_REPO_CLONEURL PORT PREFORK RESPECT_EXPORTOK
%token SERVER CHROOT CUSTOM_CSS SOCKET
-%token SUMMARY_COMMITS_DISPLAY SUMMARY_TAGS_DISPLAY
+%token SUMMARY_COMMITS_DISPLAY SUMMARY_TAGS_DISPLAY USER
%token <v.string> STRING
%token <v.number> NUMBER
}
free($4);
}
+ | USER STRING {
+ if (gotwebd->user != NULL)
+ yyerror("user already specified");
+ free(gotwebd->user);
+ gotwebd->user = $2;
+ }
;
server : SERVER STRING {
{ "socket", SOCKET },
{ "summary_commits_display", SUMMARY_COMMITS_DISPLAY },
{ "summary_tags_display", SUMMARY_TAGS_DISPLAY },
+ { "user", USER },
};
const struct keywords *p;