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
    die;
}
if ($argv[1] == '--fix-lmhost') {
    fix_lmhosts();
    die;
}
if ($argv[1] == '--fix-HideUnwriteableFiles') {
    fix_hide_unwriteable_files();
    die;
}
$users = new usersMenus();
if (!$users->SAMBA_INSTALLED) {
    echo "Samba is not installed\n";
    die;
}
FixsambaDomainName();
function FixsambaDomainName()
{
    $smb = new samba();
    $workgroup = $smb->main_array["global"]["workgroup"];
    $smb->CleanAllDomains($workgroup);
}
function ParseHomeDirectories()
{
    $ldap = new clladp();
    $attr = array("homeDirectory", "uid", "dn");
    $pattern = "(&(objectclass=sambaSamAccount)(uid=*))";
    $sock = new sockets();
    if (trim($profile_path) == null) {
        $profile_path = "/home/export/profile";
    }