Merged default tip
authorDan Fuhry <dan@enanocms.org>
Sat, 23 Feb 2013 14:26:38 -0500
changeset 9 f4bf6556fb9f
parent 8 f68fdcc18df9 (current diff)
parent 7 faf6f7941e8f (diff)
Merged
make-sso
--- a/make-sso	Sat Feb 23 14:26:05 2013 -0500
+++ b/make-sso	Sat Feb 23 14:26:38 2013 -0500
@@ -152,11 +152,11 @@
 
 # seeds /dev/random rather nicely...
 screen -dmS hasher sh -c "find /usr/lib/ /usr/share/ -print0 -type f | xargs -0 -n1 sha1sum"
-if [ -f /etc/krb5kdc/principal ]; then
-	rm -fv /etc/krb5kdc/principal \
-			/etc/krb5kdc/principal.kadm5 \
-			/etc/krb5kdc/principal.kadm5.lock \
-			/etc/krb5kdc/principal.ok
+if [ -f /var/lib/krb5kdc/principal ]; then
+	rm -fv /var/lib/krb5kdc/principal \
+			/var/lib/krb5kdc/principal.kadm5 \
+			/var/lib/krb5kdc/principal.kadm5.lock \
+			/var/lib/krb5kdc/principal.ok
 fi
 echo -en "${stash_pw}\n${stash_pw}\n" | kdb5_util create -s
 
--- a/packages/ssoinabox-webui/root/usr/local/share/ssoinabox/htdocs/includes/templates/header.tpl	Sat Feb 23 14:26:05 2013 -0500
+++ b/packages/ssoinabox-webui/root/usr/local/share/ssoinabox/htdocs/includes/templates/header.tpl	Sat Feb 23 14:26:38 2013 -0500
@@ -5,7 +5,7 @@
 		<title>{$title} &bull; SSO-in-a-Box Control Panel</title>
 		<link rel="stylesheet" type="text/css" href="/res/bootstrap/css/bootstrap.min.css" />
 		<link rel="stylesheet" type="text/css" href="/res/ssoinabox.css" />
-		<link rel="stylesheet" type="text/css" href="/res/tablesorter/themes/blue/style.css" />
+		<link rel="stylesheet" type="text/css" href="/res/tablesorter/themes/bootstrap/style.css" />
 		<script type="text/javascript" src="/res/jquery.min.js"></script>
 		<script type="text/javascript" src="/res/bootstrap/js/bootstrap.min.js"></script>
 		<script type="text/javascript" src="/res/tablesorter/jquery.tablesorter.js"></script>
--- a/packages/ssoinabox-webui/root/usr/local/share/ssoinabox/htdocs/includes/templates/my-account.tpl	Sat Feb 23 14:26:05 2013 -0500
+++ b/packages/ssoinabox-webui/root/usr/local/share/ssoinabox/htdocs/includes/templates/my-account.tpl	Sat Feb 23 14:26:38 2013 -0500
@@ -26,7 +26,7 @@
 	<div class="control-group">
 		<label class="control-label">E-mail address:</label>
 		<div class="controls">
-			<input type="text" name="mail" value="{if isset($userinfo['mail'])}{$userinfo['mail']|escape:'html'}{/if}" />
+			<input type="text" name="mail" value="{if isset($userinfo['mail'])}{$userinfo['mail'][0]|escape:'html'}{/if}" />
 			<p>Enter an e-mail address if you want to be able to use password recovery.</p>
 		</div>
 	</div>
--- a/packages/ssoinabox-webui/root/usr/local/share/ssoinabox/htdocs/index.php	Sat Feb 23 14:26:05 2013 -0500
+++ b/packages/ssoinabox-webui/root/usr/local/share/ssoinabox/htdocs/index.php	Sat Feb 23 14:26:38 2013 -0500
@@ -42,10 +42,36 @@
 		break;
 	case 'profile-update':
 		// header('Content-type: text/plain'); print_r(!empty($_POST['sshPublicKey']) ? $_POST['sshPublicKey'] : array()); exit;
-		$result = ldap_mod_replace($_ldapconn, ldap_make_user_dn($_SERVER['REMOTE_USER']), array(
-				'mail' => array($_POST['mail'])
-				, 'sshPublicKey' => !empty($_POST['sshPublicKey']) ? array_unique($_POST['sshPublicKey']) : array()
-			));
+		$ui = ldap_get_user($_SERVER['REMOTE_USER']);
+		
+		foreach ( array('mail', 'sshPublicKey') as $field )
+		{
+			if ( empty($_POST[$field]) && empty($ui[$field]) )
+			{
+				// both empty, do nothing
+			}
+			else if ( empty($_POST[$field]) && !empty($ui[$field]) )
+			{
+				// POST empty, database not. Delete attr.
+				$result = ldap_mod_del($_ldapconn, ldap_make_user_dn($_SERVER['REMOTE_USER']), array(
+						$field => array()
+					));
+			}
+			else if ( !empty($_POST[$field]) && empty($ui[$field]) )
+			{
+				// POST filled, database empty. Add attr.
+				$result = ldap_mod_add($_ldapconn, ldap_make_user_dn($_SERVER['REMOTE_USER']), array(
+						$field => is_array($_POST[$field]) ? array_unique($_POST[$field]) : array($_POST[$field])
+					));
+			}
+			else if ( !empty($_POST[$field]) && !empty($ui[$field]) )
+			{
+				// POST and database filled. Replace attr.
+				$result = ldap_mod_replace($_ldapconn, ldap_make_user_dn($_SERVER['REMOTE_USER']), array(
+						$field => is_array($_POST[$field]) ? array_unique($_POST[$field]) : array($_POST[$field])
+					));
+			}
+		}
 		
 		if ( $result || ldap_error($_ldapconn) === 'Success' )
 		{
Binary file packages/ssoinabox-webui/root/usr/local/share/ssoinabox/htdocs/res/tablesorter/themes/bootstrap/asc.gif has changed
Binary file packages/ssoinabox-webui/root/usr/local/share/ssoinabox/htdocs/res/tablesorter/themes/bootstrap/bg.gif has changed
Binary file packages/ssoinabox-webui/root/usr/local/share/ssoinabox/htdocs/res/tablesorter/themes/bootstrap/desc.gif has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/packages/ssoinabox-webui/root/usr/local/share/ssoinabox/htdocs/res/tablesorter/themes/bootstrap/style.css	Sat Feb 23 14:26:38 2013 -0500
@@ -0,0 +1,14 @@
+/* tables */
+
+table.tablesorter thead tr .header {
+	background-image: url(bg.gif);
+	background-repeat: no-repeat;
+	background-position: center right;
+	cursor: pointer;
+}
+table.tablesorter thead tr .headerSortUp {
+	background-image: url(asc.gif);
+}
+table.tablesorter thead tr .headerSortDown {
+	background-image: url(desc.gif);
+}
--- a/resources/functions	Sat Feb 23 14:26:05 2013 -0500
+++ b/resources/functions	Sat Feb 23 14:26:38 2013 -0500
@@ -257,8 +257,8 @@
 
 [realms]
 	$krb5_realm = {
-		database_name = /etc/krb5kdc/principal
-		key_stash_file = /etc/krb5kdc/.k5.$krb5_realm
+		database_name = /var/lib/krb5kdc/principal
+		key_stash_file = /etc/krb5kdc/stash
 	}
 
 EOF