ported uid/gid to new api

This commit is contained in:
roberto@oneiric64
2012-01-29 07:59:56 +01:00
parent de6cc04685
commit 58a67df534
2 changed files with 18 additions and 2 deletions
+16 -2
View File
@@ -149,9 +149,9 @@ static struct uwsgi_option uwsgi_base_options[] = {
{"pidfile", required_argument, 0, "create pidfile (before privileges drop)", uwsgi_opt_set_str, &uwsgi.pidfile,0},
{"pidfile2", required_argument, 0, "create pidfile (after privileges drop)", uwsgi_opt_set_str, &uwsgi.pidfile2,0},
{"chroot", required_argument, 0, "chroot() to the specified directory", uwsgi_opt_set_str, &uwsgi.chroot,0},
{"uid", required_argument, 0, "setuid to the specified user/uid", uwsgi_opt_set_uid, NULL, 0},
{"gid", required_argument, 0, "setgid to the specified group/gid", uwsgi_opt_set_gid, NULL, 0},
/*
{"gid", required_argument, 0, LONG_ARGS_GID,0},
{"uid", required_argument, 0, LONG_ARGS_UID,0},
#ifdef UWSGI_CAP
{"cap", required_argument,0, LONG_ARGS_CAP,0},
#endif
@@ -3295,6 +3295,20 @@ void uwsgi_opt_add_spooler(char *opt, char *directory, void *none) {
}
void uwsgi_opt_set_uid(char *opt, char *value, void *none) {
uwsgi.uid = atoi(value);
if (!uwsgi.uid)
uwsgi.uidname = value;
}
void uwsgi_opt_set_gid(char *opt, char *value, void *none) {
uwsgi.gid = atoi(value);
if (!uwsgi.gid)
uwsgi.gidname = value;
}
void uwsgi_opt_load_plugin(char *opt, char *value, void *none) {
char *p = strtok(uwsgi_concat2(value, ""), ",");
while (p != NULL) {
+2
View File
@@ -2508,6 +2508,8 @@ void uwsgi_opt_load_yml(char *, char *, void *);
void uwsgi_opt_set_umask(char *, char *, void *);
void uwsgi_opt_add_spooler(char *, char *, void *);
void uwsgi_opt_set_uid(char *, char *, void *);
void uwsgi_opt_set_gid(char *, char *, void *);
#ifdef UWSGI_AS_SHARED_LIBRARY
int uwsgi_init(int, char **, char **);