summaryrefslogtreecommitdiff
path: root/gpsd.c
diff options
context:
space:
mode:
Diffstat (limited to 'gpsd.c')
-rw-r--r--gpsd.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/gpsd.c b/gpsd.c
index 692f8589..4d7c27d2 100644
--- a/gpsd.c
+++ b/gpsd.c
@@ -1374,17 +1374,18 @@ int main(int argc, char *argv[])
(void)chmod(argv[i], stb.st_mode|S_IRGRP|S_IWGRP);
/*
* Drop privileges. Up to now we've been running as root. Instead,
- * set the user ID to 'nobody' and the group ID to the owning group
- * of a prototypical TTY device. This limits the scope of any
- * compromises in the code. It requires that all GPS devices have
- * their group read/write permissions set.
+ * set the user ID to 'nobody' (or whatever the --enable-gpsd-user
+ * is) and the group ID to the owning group of a prototypical TTY
+ * device. This limits the scope of any compromises in the code.
+ * It requires that all GPS devices have their group read/write
+ * permissions set.
*/
if ((optind<argc&&stat(argv[optind], &stb)==0)||stat(PROTO_TTY,&stb)==0) {
gpsd_report(LOG_PROG, "changing to group %d\n", stb.st_gid);
if (setgid(stb.st_gid) != 0)
gpsd_report(LOG_ERROR, "setgid() failed, errno %s\n", strerror(errno));
}
- pw = getpwnam("nobody");
+ pw = getpwnam( GPSD_USER );
if (pw)
(void)seteuid(pw->pw_uid);
}