From d496758d8f858bbe6b0337c6329063ee72daf2d3 Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Sun, 16 Mar 2008 08:59:21 -0400
Subject: [PATCH] Fixed a bug when maildirs are created.

---
 server/plugins-available/mail_plugin.inc.php |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/server/plugins-available/mail_plugin.inc.php b/server/plugins-available/mail_plugin.inc.php
index edc2483..1c7195d 100644
--- a/server/plugins-available/mail_plugin.inc.php
+++ b/server/plugins-available/mail_plugin.inc.php
@@ -67,9 +67,10 @@
 		
 		// Create the maildir, if it does not exist
 		if(!is_dir($data['new']['maildir'])) {
-			exec('mkdir -p '.escapeshellcmd($data['new']['maildir']));
-			exec('maildirmake '.escapeshellcmd($data['new']['maildir']));
-			exec('chown '.$mail_config['mailuser_name'].':'.$mail_config['mailuser_group'].' '.escapeshellcmd($data['new']['maildir']));
+			exec("su -c 'mkdir -p ".escapeshellcmd($data['new']['maildir'])."' ".$mail_config['mailuser_name']);
+			exec("su -c 'maildirmake ".escapeshellcmd($data['new']['maildir'])."' ".$mail_config['mailuser_name']);
+			//exec('maildirmake '.escapeshellcmd($data['new']['maildir']));
+			exec('chown -R '.$mail_config['mailuser_name'].':'.$mail_config['mailuser_group'].' '.escapeshellcmd($data['new']['maildir']));
 			$app->log('Created Maildir: '.$data['new']['maildir'],LOGLEVEL_DEBUG);
 		}
 	}

--
Gitblit v1.9.1