Exemple #1
0
function reconfigure(){
	if($GLOBALS["VERBOSE"]){writelogs("starting reconfigure()",__FUNCTION__,__FILE__,__LINE__);}
	$unix=new unix();
	$sock=new sockets();
	if($GLOBALS["VERBOSE"]){writelogs("->clladp()",__FUNCTION__,__FILE__,__LINE__);}
	$ldap=new clladp();
	$smbpasswd=$unix->find_program("smbpasswd");
	if($GLOBALS["VERBOSE"]){writelogs("smbpasswd=$smbpasswd -->samba()",__FUNCTION__,__FILE__,__LINE__);}
	$samba=new samba();
	$net=$unix->LOCATE_NET_BIN_PATH();	
	$ldap_passwd=$ldap->ldap_password;
	$EnableSambaActiveDirectory=$sock->GET_INFO("EnableSambaActiveDirectory");
	$EnableSambaRemoteLDAP=$sock->GET_INFO("EnableSambaRemoteLDAP");
	
	if($EnableSambaRemoteLDAP==1){
		$SambaRemoteLDAPInfos=unserialize(base64_decode($sock->GET_INFO("SambaRemoteLDAPInfos")));
		$ldap_passwd=$SambaRemoteLDAPInfos["user_dn_password"];
	}
	

	
	if($EnableSambaActiveDirectory==1){activedirectory();}
	CheckFilesAndDirectories();
	FixsambaDomainName();
	echo "Starting......: Samba building main configuration...\n";
	@file_put_contents("/etc/samba/smb.conf",$samba->BuildConfig());
	
	shell_exec("$smbpasswd -w $ldap_passwd");

	SambaAudit();
	fixEtcHosts();
	
	$master_password=$samba->GetAdminPassword("administrator");
	$SambaEnableEditPosixExtension=$sock->GET_INFO("SambaEnableEditPosixExtension");
	if($SambaEnableEditPosixExtension==1){
		$cmd="$net idmap secret {$samba->main_array["global"]["workgroup"]} \"$ldap_passwd\" >/dev/null 2>&1 &";
		shell_exec($cmd);
		$cmd="$net idmap secret alloc \"$ldap_passwd\" >/dev/null 2>&1 &";
		shell_exec($cmd);
	}
	
	if($EnableSambaActiveDirectory==1){kinit();}
	$unix->THREAD_COMMAND_SET(LOCATE_PHP5_BIN2()." ".__FILE__." --check-dirs");
	$unix->THREAD_COMMAND_SET("/usr/share/artica-postfix/bin/artica-install --samba-reconfigure");
	reload();
	
	
	}
Exemple #2
0
function reconfigure()
{
    $unix = new unix();
    $sock = new sockets();
    $EnableSambaActiveDirectory = $sock->GET_INFO("EnableSambaActiveDirectory");
    if ($EnableSambaActiveDirectory == 1) {
        activedirectory();
    }
    CheckExistentDirectories();
    $samba = new samba();
    @file_put_contents("/etc/samba/smb.conf", $samba->BuildConfig());
    if (!is_file("/var/lib/samba/usershares/data")) {
        @mkdir("/var/lib/samba/usershares", null, true);
        @file_put_contents("/var/lib/samba/usershares/data", "#");
    }
    SambaAudit();
    ParseHomeDirectories();
    $samba = new samba();
    $net = $unix->find_program("net");
    $master_password = $samba->GetAdminPassword("administrator");
    $SambaEnableEditPosixExtension = $sock->GET_INFO("SambaEnableEditPosixExtension");
    if ($SambaEnableEditPosixExtension == 1) {
        $cmd = "{$net} idmap secret {$samba->main_array["global"]["workgroup"]} {$master_password} >/dev/null 2>&1 &";
        shell_exec($cmd);
        $cmd = "{$net} idmap secret alloc {$master_password} >/dev/null 2>&1 &";
    }
    if ($EnableSambaActiveDirectory == 1) {
        kinit();
    }
    shell_exec("/usr/share/artica-postfix/bin/artica-install --samba-reconfigure >/dev/null 2>&1");
}