Mercurial > dovecot > core-2.2
changeset 10113:64bbf4296220 HEAD
master: Drop trailing '/' from services' chroot directory.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 20 Oct 2009 19:23:34 -0400 |
parents | c80eb856a742 |
children | f08cf2a07907 |
files | src/master/service-process.c |
diffstat | 1 files changed, 7 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/master/service-process.c Tue Oct 20 19:20:42 2009 -0400 +++ b/src/master/service-process.c Tue Oct 20 19:23:34 2009 -0400 @@ -134,6 +134,7 @@ { struct restrict_access_settings rset; bool disallow_root; + unsigned int len; if (service->vsz_limit != 0) restrict_process_size(service->vsz_limit, -1U); @@ -144,6 +145,12 @@ rset.privileged_gid = service->privileged_gid; rset.chroot_dir = *service->set->chroot == '\0' ? NULL : service->set->chroot; + if (rset.chroot_dir != NULL) { + /* drop trailing / if it exists */ + len = strlen(rset.chroot_dir); + if (rset.chroot_dir[len-1] == '/') + rset.chroot_dir = t_strndup(rset.chroot_dir, len-1); + } rset.extra_groups = service->extra_gids; if (service->set->drop_priv_before_exec) {