dovecot-2.0-sslstream: master: Drop trailing '/' from services' ...

dovecot at dovecot.org dovecot at dovecot.org
Sat Feb 13 02:55:18 EET 2010


details:   http://hg.dovecot.org/dovecot-2.0-sslstream/rev/64bbf4296220
changeset: 10114:64bbf4296220
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Oct 20 19:23:34 2009 -0400
description:
master: Drop trailing '/' from services' chroot directory.

diffstat:

1 file changed, 7 insertions(+)
src/master/service-process.c |    7 +++++++

diffs (24 lines):

diff -r c80eb856a742 -r 64bbf4296220 src/master/service-process.c
--- 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 @@ drop_privileges(struct service *service)
 {
 	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 @@ drop_privileges(struct service *service)
 	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) {


More information about the dovecot-cvs mailing list