diff -Nur smeserver-horde-1.0.0.old/root/etc/e-smith/templates/usr/share/horde/config/hooks.local.php/100classhook smeserver-horde-1.0.0/root/etc/e-smith/templates/usr/share/horde/config/hooks.local.php/100classhook --- smeserver-horde-1.0.0.old/root/etc/e-smith/templates/usr/share/horde/config/hooks.local.php/100classhook 1969-12-31 19:00:00.000000000 -0500 +++ smeserver-horde-1.0.0/root/etc/e-smith/templates/usr/share/horde/config/hooks.local.php/100classhook 2020-03-26 12:04:46.111166633 -0400 @@ -0,0 +1,3 @@ +class Horde_Hooks +\{ + diff -Nur smeserver-horde-1.0.0.old/root/etc/e-smith/templates/usr/share/horde/config/hooks.local.php/100Username smeserver-horde-1.0.0/root/etc/e-smith/templates/usr/share/horde/config/hooks.local.php/100Username --- smeserver-horde-1.0.0.old/root/etc/e-smith/templates/usr/share/horde/config/hooks.local.php/100Username 2016-06-05 23:22:10.000000000 -0400 +++ smeserver-horde-1.0.0/root/etc/e-smith/templates/usr/share/horde/config/hooks.local.php/100Username 1969-12-31 19:00:00.000000000 -0500 @@ -1,38 +0,0 @@ -//100Username -{ -$OUT =<<'HERE'; -class Horde_Hooks -\{ - public function preauthenticate($userId, $credentials) - \{ - return array( - 'userId' => Horde_String::lower($userId), - 'credentials' => $credentials - ); - - \} - - public function authusername($userId, $toHorde) - \{ - // Example #1: Append the virtual domain to the username. - // ex. $HTTP_HOST = 'mail.mydomain.com', $userId = 'myname' returns: - // 'myname@mydomain.com' - $vdomain = getenv('HTTP_HOST'); - preg_match('/[^.]+\.[^.]+$/', $vdomain, $matches); - $vdomain = $matches[0]; - if ($userId == 'adminremoveuser') \{ - return $userId; - \} else \{ - if ($toHorde) \{ - return $userId . '@' . $vdomain; - \} else \{ - return (substr($userId, -strlen($vdomain)) == $vdomain) - ? substr($userId, 0, -strlen($vdomain)-1) - : $userId; - \} - \} - \} -\} - -HERE -} diff -Nur smeserver-horde-1.0.0.old/root/etc/e-smith/templates/usr/share/horde/config/hooks.local.php/150preauthenticate smeserver-horde-1.0.0/root/etc/e-smith/templates/usr/share/horde/config/hooks.local.php/150preauthenticate --- smeserver-horde-1.0.0.old/root/etc/e-smith/templates/usr/share/horde/config/hooks.local.php/150preauthenticate 1969-12-31 19:00:00.000000000 -0500 +++ smeserver-horde-1.0.0/root/etc/e-smith/templates/usr/share/horde/config/hooks.local.php/150preauthenticate 2020-03-26 23:46:56.152716961 -0400 @@ -0,0 +1,12 @@ + public function preauthenticate($userId, $credentials) + \{ + # here we filter out @domain.com from login, this will allow someone to still login if they use their full email + # this would be a good place to add an array pseudonyms => user to convert the userID from a list of pseudo: + # $translate = array("jenifer@domain1.net" => "jenny" , "jd"=> "johndavros") + # $userId = ( $translate[$userId] ? translate[$userId] : $userId); + $userId = (strpos($userId, '@')? substr($userId, 0, strpos($userId, '@')) : $userId ); + return array( + 'userId' => Horde_String::lower($userId), + 'credentials' => $credentials); + \} + diff -Nur smeserver-horde-1.0.0.old/root/etc/e-smith/templates/usr/share/horde/config/hooks.local.php/200authusername smeserver-horde-1.0.0/root/etc/e-smith/templates/usr/share/horde/config/hooks.local.php/200authusername --- smeserver-horde-1.0.0.old/root/etc/e-smith/templates/usr/share/horde/config/hooks.local.php/200authusername 1969-12-31 19:00:00.000000000 -0500 +++ smeserver-horde-1.0.0/root/etc/e-smith/templates/usr/share/horde/config/hooks.local.php/200authusername 2020-03-26 23:46:11.035507484 -0400 @@ -0,0 +1,7 @@ + public function authusername($userId, $toHorde) + \{ + # we only want a userid as login for horde and smeserver imap + $userId = (strpos($userId, '@')? substr($userId, 0, strpos($userId, '@')) : $userId ); + return ltrim(rtrim(Horde_String::lower($userId))) ; + \} + diff -Nur smeserver-horde-1.0.0.old/root/etc/e-smith/templates/usr/share/horde/config/hooks.local.php/300pref_init smeserver-horde-1.0.0/root/etc/e-smith/templates/usr/share/horde/config/hooks.local.php/300pref_init --- smeserver-horde-1.0.0.old/root/etc/e-smith/templates/usr/share/horde/config/hooks.local.php/300pref_init 1969-12-31 19:00:00.000000000 -0500 +++ smeserver-horde-1.0.0/root/etc/e-smith/templates/usr/share/horde/config/hooks.local.php/300pref_init 2020-03-26 23:44:24.779659047 -0400 @@ -0,0 +1,65 @@ + public function prefs_init($pref, $value, $username, $scope_ob) + \{ + if (is_null($username)) \{ // not logged in + return $value; + \} + # get the virtualhost + $vdomain = getenv('HTTP_HOST'); + # if it is an ip, let's use the Primary domain + if (filter_var($vdomain, FILTER_VALIDATE_IP)) \{ + $vdomain = "{$DomainName}"; + \} else\{ # else filter the virtual domain to remove unwanted parts +{ + my @filtered = split /[;,: ]/, $horde{SubdomainFilter} || "www,mail,webmail"; + $OUT .= " \$patterns = array();\n"; + foreach my $filter (sort @filtered) + { + $OUT .= " array_push(\$patterns,'|^$filter\\.|i');\n"; + } +} + $vdomain = preg_replace($patterns, '', $vdomain); + \} + $vdomain = Horde_String::lower($vdomain); +{ # override to Primary Domain + my $UsePrimary = $horde{ForcePrimaryDomain} || "disabled"; + $OUT .= ($UsePrimary eq "enabled") ? " \$vdomain = $DomainName;" : " # ForcePrimaryDomain disabled\n # \$vdomain = $DomainName;" ; + + my $basedn = esmith::util::ldapBase ($DomainName); + $OUT .= " \$ldapServer = 'localhost'; + \$ldapPort = '389'; + \$searchBase = 'ou=Users,$basedn'; + \$ds = \@ldap_connect(\$ldapServer, \$ldapPort); + if (\@ldap_bind(\$ds )) { + \$searchResult = \@ldap_search(\$ds, \$searchBase, 'uid=' . \$username); + } + \$information = \@ldap_get_entries(\$ds, \$searchResult);"; + +} + + switch ($pref) \{ + + case 'default_share' : + if (is_null($username)) \{ + return $value; + \} + return $username; + + case 'from_addr': + if($value == '') \{ + $value = "$username@$vdomain"; + \} + return $value; + case 'fullname': + if($value == '') \{ + $value = "$username"; + \} + if (($information['count'] > 0) && ($information[0]['displayname'][0] != '') ) \{ + $value = $information[0]['displayname'][0]; + \} else \{ + $value = "$username"; + \} + return $value; + \} + + \} + diff -Nur smeserver-horde-1.0.0.old/root/etc/e-smith/templates/usr/share/horde/config/hooks.local.php/999classhook smeserver-horde-1.0.0/root/etc/e-smith/templates/usr/share/horde/config/hooks.local.php/999classhook --- smeserver-horde-1.0.0.old/root/etc/e-smith/templates/usr/share/horde/config/hooks.local.php/999classhook 1969-12-31 19:00:00.000000000 -0500 +++ smeserver-horde-1.0.0/root/etc/e-smith/templates/usr/share/horde/config/hooks.local.php/999classhook 2020-03-26 12:04:58.173497885 -0400 @@ -0,0 +1 @@ +\} diff -Nur smeserver-horde-1.0.0.old/root/etc/e-smith/templates/usr/share/horde/config/prefs.local.php/101newpref.php smeserver-horde-1.0.0/root/etc/e-smith/templates/usr/share/horde/config/prefs.local.php/101newpref.php --- smeserver-horde-1.0.0.old/root/etc/e-smith/templates/usr/share/horde/config/prefs.local.php/101newpref.php 1969-12-31 19:00:00.000000000 -0500 +++ smeserver-horde-1.0.0/root/etc/e-smith/templates/usr/share/horde/config/prefs.local.php/101newpref.php 2020-03-27 00:36:48.651000000 -0400 @@ -0,0 +1,4 @@ +$_prefs['id']['value'] = 'Default Identity'; +$_prefs['fullname']['hook'] = true; +$_prefs['from_addr']['hook'] = true; +