sudo = $config['sudo']; $this->perl_base = $config['perl_scripts']; $this->object = $object; switch ($this->object) { case _MBOX_: $this->object = '$mailbox->mailbox_backend'; break; case _SYS_: $this->object = '$backend->system_backend'; break; case _SPAM_: $this->object = '$spam->spam_backend'; break; case _IMAP_: $this->object = '$imap->imap_backend'; break; } /** * * What is the state of safe_mode in php.ini? We act accordingly here * to ensure it all works... * **/ if ( ini_get('safe_mode') ) { $this->whoami = shell_exec('whoami'); $this->hostname = shell_exec('echo $HOSTNAME'); $this->exec = sprintf('%s -l',$this->sudo); $this->exec = shell_exec($this->exec); $this->exec_dir = str_replace('/sudo','',$this->sudo); $this->safe_mode_exec_dir = ini_get('safe_mode_exec_dir'); if ( !preg_match("#$this->exec_dir#",$this->safe_mode_exec_dir) ) { report_error(CRITICAL_MESSAGE,sprintf("Error 6446: The 'safe_mode' parameter is enabled in php.ini. This is fine. However, it appears that you have not set 'safe_mode_exec_dir' to include %s. Please correct this, restart apache and try again.",$this->exec_dir),NULL,__FILE__,__LINE__); } if ( !($this->visudo = $this->exec) ) { report_error(CRITICAL_MESSAGE,"Error 6447: Something is wrong with sudo. Are you sure you have defined the correct path?",NULL,__FILE__,__LINE__); } } else { $this->whoami = `whoami`; $this->hostname = `echo \$HOSTNAME`; $this->exec = sprintf('%s -l',$this->sudo); $this->exec = `$this->exec`; if ( !($this->visudo = $this->exec) ) { report_error(CRITICAL_MESSAGE,sprintf('Error 6448: Could not execute "%s". Please ensure sudo is installed and located in the PHP environment path.',$exec),NULL,__FILE__,__LINE__); } } if ( !($this->get_version_info[SUDO] === DISABLE) ) { $this->visudo = str_replace("\n","",$this->visudo); $this->whoami = str_replace("\n","",$this->whoami); $this->hostname = str_replace("\n","",$this->hostname); $this->hostname = !empty($this->hostname) ? $this->hostname : 'localhost'; if ( !preg_match("#$this->whoami(.*?)\(root\)[[:space:]]NOPASSWD:[[:space:]]$this->perl_base#",$this->visudo) ) { $this->sudo_config = sprintf("",$this->hostname,$this->whoami,$this->perl_base); report_error(CRITICAL_MESSAGE,sprintf('Error 6449: Sudo is not configured correctly. Using "visudo" from the command line, please verify the following is in your sudoers file:

%s

If the above syntax does not appear in sudoers, simply copy and paste the syntax into sudoers, save and exit and this message will disappear. Remember, you must use "visudo" to modify sudoers and NOT nano, vi nor any other text editor.',$this->sudo_config),NULL,__FILE__,__LINE__); } } else { report_error(CRITICAL_MESSAGE,sprintf("Error 6450: %s could not be initialized. Sudo may not be not configured correctly. Please check the %sSudo HOWTO%s for more details.",$this->obj,'',''),NULL,__FILE__,__LINE__); } return ( TRUE ); } } ?>