ini_set('error_reporting', E_ALL); ini_set('error_prepend_string', null); ini_set('error_append_string', null); } if (preg_match("#--reload#", implode(" ", $argv))) { $GLOBALS["RELOAD"] = true; } if (preg_match("#--force#", implode(" ", $argv))) { $GLOBALS["FORCE"] = true; } if ($argv[1] == "--build") { build(); exit; } if ($argv[1] == "--fsck") { fsck(); exit; } function build() { @unlink("/etc/greyhole.conf"); if (!checkdb()) { echo "Starting......: " . date("H:i:s") . " Checking database failed\n"; return; } @mkdir("/var/spool/greyhole", 0777, true); shell_exec("/bin/chmod 777 /var/spool/greyhole >/dev/null 2>&1"); $sock = new sockets(); $EnableGreyHoleDebug = $sock->GET_INFO("EnableGreyHoleDebug"); if (!is_numeric($EnableGreyHoleDebug)) { $EnableGreyHoleDebug = 0;
die; } if ($argv[1] == '--init') { SafeBoxUSer($argv[2]); die; } if ($argv[1] == '--umount') { SafeBoxUmount($argv[2]); die; } if ($argv[1] == '--open') { crypt_open($argv[2]); die; } if ($argv[1] == '--fsck') { fsck($argv[2]); die; } function crypt_open($uid) { $unix = new unix(); $safe = new safebox($uid); $mapper = "/dev/mapper/{$uid}"; _CryptOpen($safe->crypted_filepath, $safe->CryptedHomeSize); } function SyncSafeBoxes() { $ldap = new clladp(); $pattern = "(&(objectclass=UserArticaClass)(CryptedHome=TRUE))"; $dn = "dc=organizations,{$ldap->suffix}"; $filters = array("uid", "CryptedHomePassword", "homeDirectory");