if ($GLOBALS["VERBOSE"]) { ini_set('html_errors', 0); ini_set('display_errors', 1); ini_set('error_reporting', E_ALL); } } if ($argv[1] == "--count") { Autocount(); die; } if ($argv[1] == "--davfs") { davfs(); die; } if ($argv[1] == "--default") { autofs_default(); die; } $ldap = new clladp(); $suffix = "dc=organizations,{$ldap->suffix}"; $filter = "(&(ObjectClass=SharedFolders)(SharedFolderList=*))"; $attr = array("gidNumber"); $sr = @ldap_search($ldap->ldap_connection, $suffix, $filter, $attr); $hash = ldap_get_entries($ldap->ldap_connection, $sr); for ($i = 0; $i < $hash["count"]; $i++) { $gpid = $hash[$i][strtolower("gidNumber")][0]; $auto = new autofs(); $auto->AutofsSharedDir($gpid); } function Autocount() {
function Checks() { $GLOBALS["NORELOAD"] = true; $unix = new unix(); if (!is_file("/usr/lib/x86_64-linux-gnu/autofs/lookup_ldap.so")) { build_progress_rs("{install} autofs-ldap", 15); $unix->DEBIAN_INSTALL_PACKAGE("autofs-ldap"); } if (!is_file("/usr/lib/x86_64-linux-gnu/autofs/lookup_ldap.so")) { build_progress_rs("{install} autofs-ldap {failed}", 110); return; } if (!$unix->is_socket("/var/run/slapd/slapd.sock")) { build_progress_rs("{restarting_service} OpenLDAP", 15); system("/etc/init.d/slapd restart"); } else { if ($GLOBALS["PROGRESS"]) { build_progress_rs("{restarting_service} OpenLDAP", 15); system("/etc/init.d/slapd restart"); } } $curlftpfs = $unix->find_program("curlftpfs"); $fusermount = $unix->find_program("fusermount"); if (is_file($curlftpfs)) { if (!is_file("/sbin/mount.curl")) { build_progress_rs("/sbin/mount.curl", 15); $curlftpfsZ[] = "#! /bin/sh"; $curlftpfsZ[] = "{$curlftpfs} \$1 \$2 -o \$5,disable_eprt"; $curlftpfsZ[] = ""; @file_put_contents("/sbin/mount.curl", @implode("\n", $curlftpfsZ)); @chmod("/sbin/mount.curl", 0755); } if (!is_file("/sbin/umount.curl")) { build_progress_rs("/sbin/umount.curl", 15); $curlftpfsZ = array(); $curlftpfsZ[] = "#! /bin/sh"; $curlftpfsZ[] = "{$fusermount} -u \$1"; $curlftpfsZ[] = ""; @file_put_contents("/sbin/umount.curl", @implode("\n", $curlftpfsZ)); @chmod("/sbin/umount.curl", 0755); } } $ldap = new clladp(); $data = "<?xml version=\"1.0\" ?>\n <autofs_ldap_sasl_conf\n usetls=\"no\"\n tlsrequired=\"no\"\n authrequired=\"yes\"\n authtype=\"PLAIN\"\n user=\"{$ldap->ldap_admin}\"\n secret=\"{$ldap->ldap_password}\"\n />"; @file_put_contents("/etc/autofs_ldap_auth.conf", $data); if (is_file("/etc/autofs_ldap_auth.conf")) { @chmod("/etc/autofs_ldap_auth.conf", 0600); @chown("/etc/autofs_ldap_auth.conf", "root"); @chgrp("/etc/autofs_ldap_auth.conf", "root"); } build_progress_rs("{checking_configuration}", 15); $auto = new autofs(); build_progress_rs("{checking_configuration}", 20); autofs_default(); build_progress_rs("{checking_configuration}", 25); Autocount(); build_progress_rs("{checking_configuration}", 30); davfs(); }