mirror of
https://github.com/clearlinux/uwsgi.git
synced 2026-09-08 14:41:55 +00:00
allow non-numeric uid and gid
This commit is contained in:
@@ -2741,9 +2741,29 @@ void manage_opt(int i, char *optarg) {
|
||||
break;
|
||||
case LONG_ARGS_GID:
|
||||
uwsgi.gid = atoi(optarg);
|
||||
if (!uwsgi.gid) {
|
||||
struct group *ugroup = getgrnam(optarg);
|
||||
if (ugroup) {
|
||||
uwsgi.gid = ugroup->gr_gid ;
|
||||
}
|
||||
else {
|
||||
uwsgi_log("group %s not found.\n", optarg);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case LONG_ARGS_UID:
|
||||
uwsgi.uid = atoi(optarg);
|
||||
if (!uwsgi.uid) {
|
||||
struct passwd *upasswd = getpwnam(optarg);
|
||||
if (upasswd) {
|
||||
uwsgi.uid = upasswd->pw_uid ;
|
||||
}
|
||||
else {
|
||||
uwsgi_log("user %s not found.\n", optarg);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case LONG_ARGS_BINARY_PATH:
|
||||
uwsgi.binary_path = optarg;
|
||||
|
||||
Reference in New Issue
Block a user