# HG changeset patch # User Dan Fuhry # Date 1361647565 18000 # Node ID f68fdcc18df935962155f5d960d1c85f9fc3fdf5 # Parent cdd708efa505d93331ec36dc6e7d5087b11ba669 Started on the database diff -r cdd708efa505 -r f68fdcc18df9 make-sso --- a/make-sso Fri Jan 18 19:59:50 2013 -0500 +++ b/make-sso Sat Feb 23 14:26:05 2013 -0500 @@ -1,6 +1,8 @@ #!/bin/bash set -e +cd "`dirname $0`" + . resources/functions cat <prepare($sql, array(PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY)); + return $st; +} + +db_setup(); diff -r cdd708efa505 -r f68fdcc18df9 packages/ssoinabox-webui/root/usr/local/share/ssoinabox/htdocs/includes/functions.php --- a/packages/ssoinabox-webui/root/usr/local/share/ssoinabox/htdocs/includes/functions.php Fri Jan 18 19:59:50 2013 -0500 +++ b/packages/ssoinabox-webui/root/usr/local/share/ssoinabox/htdocs/includes/functions.php Sat Feb 23 14:26:05 2013 -0500 @@ -34,7 +34,7 @@ function load_credentials() { $config = yaml_parse_file("/usr/local/etc/ssoinabox/webcreds.yml"); - $keys = array('LDAP_BASEDN', 'UID_MIN', 'GID_MIN', 'ldap_server', 'ldap_manager', 'ldap_user_basedn', 'ldap_group_basedn', 'kerberos_admin', 'PHONE_EXT_MIN', 'hmac_secret'); + $keys = array('LDAP_BASEDN', 'UID_MIN', 'GID_MIN', 'ldap_server', 'ldap_manager', 'ldap_user_basedn', 'ldap_group_basedn', 'kerberos_admin', 'PHONE_EXT_MIN', 'hmac_secret', 'mysql'); foreach ( $keys as $key ) { diff -r cdd708efa505 -r f68fdcc18df9 packages/ssoinabox-webui/root/usr/local/share/ssoinabox/htdocs/includes/ldap.php --- a/packages/ssoinabox-webui/root/usr/local/share/ssoinabox/htdocs/includes/ldap.php Fri Jan 18 19:59:50 2013 -0500 +++ b/packages/ssoinabox-webui/root/usr/local/share/ssoinabox/htdocs/includes/ldap.php Sat Feb 23 14:26:05 2013 -0500 @@ -62,13 +62,17 @@ { global $_ldapconn, $ldap_user_basedn; + static $cache = array(); + if ( isset($cache[$username]) ) + return $cache[$username]; + $search_filter = sprintf("(&(uid=%s)(objectClass=posixAccount))", ldap_escape($username)); $search_result = ldap_search($_ldapconn, $ldap_user_basedn, $search_filter); if ( ldap_count_entries($_ldapconn, $search_result) !== 1 ) return false; - return ldap_array_cleanup(ldap_get_attributes($_ldapconn, ldap_first_entry($_ldapconn, $search_result))); + return $cache[$username] = ldap_array_cleanup(ldap_get_attributes($_ldapconn, ldap_first_entry($_ldapconn, $search_result))); } function ldap_get_group($group) diff -r cdd708efa505 -r f68fdcc18df9 packages/ssoinabox-webui/root/usr/local/share/ssoinabox/htdocs/includes/starthere.php --- a/packages/ssoinabox-webui/root/usr/local/share/ssoinabox/htdocs/includes/starthere.php Fri Jan 18 19:59:50 2013 -0500 +++ b/packages/ssoinabox-webui/root/usr/local/share/ssoinabox/htdocs/includes/starthere.php Sat Feb 23 14:26:05 2013 -0500 @@ -7,9 +7,14 @@ // define root directory define('ACCOUNTS', dirname(dirname(__FILE__)) . '/'); +// setup error handling policies +ini_set('display_errors', 'on'); +error_reporting(E_ALL | E_STRICT | E_DEPRECATED); + // include required files require_once(ACCOUNTS . 'includes/functions.php'); load_credentials(); +require_once(ACCOUNTS . 'includes/db.php'); require_once(ACCOUNTS . 'includes/smarty/Smarty.class.php'); require_once(ACCOUNTS . 'includes/template-wrapper.php'); require_once(ACCOUNTS . 'includes/ldap.php');