Skip to content
Snippets Groups Projects
Commit 16f5f904 authored by Pavel Kácha's avatar Pavel Kácha
Browse files

Allow warden_filer to also accept textual usernames/groupnames on uid/gid

parent 5cb6ef8e
No related branches found
No related tags found
No related merge requests found
...@@ -470,6 +470,18 @@ def get_configs(): ...@@ -470,6 +470,18 @@ def get_configs():
def get_uid_gid(str_id, get_nam_func):
if str_id:
try:
id = int(str_id)
except ValueError:
id = get_nam_func(str_id)[2]
else:
id = None
return id
if __name__ == "__main__": if __name__ == "__main__":
args = get_args() args = get_args()
...@@ -482,12 +494,17 @@ if __name__ == "__main__": ...@@ -482,12 +494,17 @@ if __name__ == "__main__":
try: try:
if args.daemon: if args.daemon:
from pwd import getpwnam
from grp import getgrnam
uid = get_uid_gid(fconfig.get("uid"), getpwnam)
gid = get_uid_gid(fconfig.get("gid"), getgrnam)
daemonize( daemonize(
work_dir = fconfig.get("work_dir", "."), work_dir = fconfig.get("work_dir", "."),
chroot_dir = fconfig.get("chroot_dir"), chroot_dir = fconfig.get("chroot_dir"),
umask = fconfig.get("umask"), umask = fconfig.get("umask"),
uid = fconfig.get("uid"), uid = uid,
gid = fconfig.get("gid"), gid = gid,
pidfile = args.pid_file, pidfile = args.pid_file,
files_preserve = get_logger_files(wclient.logger), files_preserve = get_logger_files(wclient.logger),
signals = { signals = {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment