changeset: 17:70a4a8c34a78
tag: tip
user: garbeam_AT_gmail.com
date: Sun Jun 26 10:51:42 2011 +0100
files: config.def.h quark.c
description:
applied rransom's quark patch for FreeBSD compliance, thanks
diff -r d982c42802b4 -r 70a4a8c34a78 config.def.h
--- a/config.def.h Wed Feb 16 20:29:55 2011 +0000
+++ b/config.def.h Sun Jun 26 10:51:42 2011 +0100
@@ -1,14 +1,14 @@
/* quark configuration */
-static const char servername[] = "127.0.0.1";
-static const char serverport[] = "80";
-static const char docroot[] = ".";
-static const char docindex[] = "index.html";
-static const char user[] = "nobody";
-static const char group[] = "nogroup";
-static const char cgi_dir[] = "/var/www/werc-dev/bin";
-static const char cgi_script[] = "./werc.rc";
-static const int cgi_mode = 0;
+static const char servername[] = "127.0.0.1";
+static const char serverport[] = "80";
+static const char docroot[] = ".";
+static const char docindex[] = "index.html";
+static const char *user = "nobody";
+static const char *group = "nogroup";
+static const char cgi_dir[] = "/var/www/werc-dev/bin";
+static const char cgi_script[] = "./werc.rc";
+static const int cgi_mode = 0;
static const MimeType servermimes[] = {
{ "html", "text/html; charset=UTF-8" },
diff -r d982c42802b4 -r 70a4a8c34a78 quark.c
--- a/quark.c Wed Feb 16 20:29:55 2011 +0000
+++ b/quark.c Sun Jun 26 10:51:42 2011 +0100
@@ -522,10 +522,12 @@
die("usage: quark [-v]\n");
/* sanity checks */
- if(!(upwd = getpwnam(user)))
- die("error: invalid user %s\n", user);
- if(!(gpwd = getgrnam(group)))
- die("error: invalid group %s\n", group);
+ if(user)
+ if(!(upwd = getpwnam(user)))
+ die("error: invalid user %s\n", user);
+ if(group)
+ if(!(gpwd = getgrnam(group)))
+ die("error: invalid group %s\n", group);
signal(SIGCHLD, sighandler);
signal(SIGHUP, sighandler);
@@ -573,10 +575,12 @@
if(chroot(".") == -1)
die("error: chroot .: %s\n", strerror(errno));
- if(setgid(gpwd->gr_gid) == -1)
- die("error: cannot set group id\n");
- if(setuid(upwd->pw_uid) == -1)
- die("error: cannot set user id\n");
+ if(gpwd)
+ if(setgid(gpwd->gr_gid) == -1)
+ die("error: cannot set group id\n");
+ if(upwd)
+ if(setuid(upwd->pw_uid) == -1)
+ die("error: cannot set user id\n");
if(getuid() == 0)
die("error: won't run with root permissions, choose another user\n");
Received on Sun Jun 26 2011 - 11:51:46 CEST
This archive was generated by hypermail 2.2.0 : Sun Jun 26 2011 - 12:00:07 CEST