1 |
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 |
2 |
--- 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 |
3 |
+++ 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 |
4 |
@@ -0,0 +1,3 @@ |
5 |
+class Horde_Hooks |
6 |
+\{ |
7 |
+ |
8 |
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 |
9 |
--- 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 |
10 |
+++ 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 |
11 |
@@ -1,38 +0,0 @@ |
12 |
-//100Username |
13 |
-{ |
14 |
-$OUT =<<'HERE'; |
15 |
-class Horde_Hooks |
16 |
-\{ |
17 |
- public function preauthenticate($userId, $credentials) |
18 |
- \{ |
19 |
- return array( |
20 |
- 'userId' => Horde_String::lower($userId), |
21 |
- 'credentials' => $credentials |
22 |
- ); |
23 |
- |
24 |
- \} |
25 |
- |
26 |
- public function authusername($userId, $toHorde) |
27 |
- \{ |
28 |
- // Example #1: Append the virtual domain to the username. |
29 |
- // ex. $HTTP_HOST = 'mail.mydomain.com', $userId = 'myname' returns: |
30 |
- // 'myname@mydomain.com' |
31 |
- $vdomain = getenv('HTTP_HOST'); |
32 |
- preg_match('/[^.]+\.[^.]+$/', $vdomain, $matches); |
33 |
- $vdomain = $matches[0]; |
34 |
- if ($userId == 'adminremoveuser') \{ |
35 |
- return $userId; |
36 |
- \} else \{ |
37 |
- if ($toHorde) \{ |
38 |
- return $userId . '@' . $vdomain; |
39 |
- \} else \{ |
40 |
- return (substr($userId, -strlen($vdomain)) == $vdomain) |
41 |
- ? substr($userId, 0, -strlen($vdomain)-1) |
42 |
- : $userId; |
43 |
- \} |
44 |
- \} |
45 |
- \} |
46 |
-\} |
47 |
- |
48 |
-HERE |
49 |
-} |
50 |
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 |
51 |
--- 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 |
52 |
+++ 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 |
53 |
@@ -0,0 +1,12 @@ |
54 |
+ public function preauthenticate($userId, $credentials) |
55 |
+ \{ |
56 |
+ # here we filter out @domain.com from login, this will allow someone to still login if they use their full email |
57 |
+ # this would be a good place to add an array pseudonyms => user to convert the userID from a list of pseudo: |
58 |
+ # $translate = array("jenifer@domain1.net" => "jenny" , "jd"=> "johndavros") |
59 |
+ # $userId = ( $translate[$userId] ? translate[$userId] : $userId); |
60 |
+ $userId = (strpos($userId, '@')? substr($userId, 0, strpos($userId, '@')) : $userId ); |
61 |
+ return array( |
62 |
+ 'userId' => Horde_String::lower($userId), |
63 |
+ 'credentials' => $credentials); |
64 |
+ \} |
65 |
+ |
66 |
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 |
67 |
--- 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 |
68 |
+++ 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 |
69 |
@@ -0,0 +1,7 @@ |
70 |
+ public function authusername($userId, $toHorde) |
71 |
+ \{ |
72 |
+ # we only want a userid as login for horde and smeserver imap |
73 |
+ $userId = (strpos($userId, '@')? substr($userId, 0, strpos($userId, '@')) : $userId ); |
74 |
+ return ltrim(rtrim(Horde_String::lower($userId))) ; |
75 |
+ \} |
76 |
+ |
77 |
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 |
78 |
--- 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 |
79 |
+++ 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 |
80 |
@@ -0,0 +1,65 @@ |
81 |
+ public function prefs_init($pref, $value, $username, $scope_ob) |
82 |
+ \{ |
83 |
+ if (is_null($username)) \{ // not logged in |
84 |
+ return $value; |
85 |
+ \} |
86 |
+ # get the virtualhost |
87 |
+ $vdomain = getenv('HTTP_HOST'); |
88 |
+ # if it is an ip, let's use the Primary domain |
89 |
+ if (filter_var($vdomain, FILTER_VALIDATE_IP)) \{ |
90 |
+ $vdomain = "{$DomainName}"; |
91 |
+ \} else\{ # else filter the virtual domain to remove unwanted parts |
92 |
+{ |
93 |
+ my @filtered = split /[;,: ]/, $horde{SubdomainFilter} || "www,mail,webmail"; |
94 |
+ $OUT .= " \$patterns = array();\n"; |
95 |
+ foreach my $filter (sort @filtered) |
96 |
+ { |
97 |
+ $OUT .= " array_push(\$patterns,'|^$filter\\.|i');\n"; |
98 |
+ } |
99 |
+} |
100 |
+ $vdomain = preg_replace($patterns, '', $vdomain); |
101 |
+ \} |
102 |
+ $vdomain = Horde_String::lower($vdomain); |
103 |
+{ # override to Primary Domain |
104 |
+ my $UsePrimary = $horde{ForcePrimaryDomain} || "disabled"; |
105 |
+ $OUT .= ($UsePrimary eq "enabled") ? " \$vdomain = $DomainName;" : " # ForcePrimaryDomain disabled\n # \$vdomain = $DomainName;" ; |
106 |
+ |
107 |
+ my $basedn = esmith::util::ldapBase ($DomainName); |
108 |
+ $OUT .= " \$ldapServer = 'localhost'; |
109 |
+ \$ldapPort = '389'; |
110 |
+ \$searchBase = 'ou=Users,$basedn'; |
111 |
+ \$ds = \@ldap_connect(\$ldapServer, \$ldapPort); |
112 |
+ if (\@ldap_bind(\$ds )) { |
113 |
+ \$searchResult = \@ldap_search(\$ds, \$searchBase, 'uid=' . \$username); |
114 |
+ } |
115 |
+ \$information = \@ldap_get_entries(\$ds, \$searchResult);"; |
116 |
+ |
117 |
+} |
118 |
+ |
119 |
+ switch ($pref) \{ |
120 |
+ |
121 |
+ case 'default_share' : |
122 |
+ if (is_null($username)) \{ |
123 |
+ return $value; |
124 |
+ \} |
125 |
+ return $username; |
126 |
+ |
127 |
+ case 'from_addr': |
128 |
+ if($value == '') \{ |
129 |
+ $value = "$username@$vdomain"; |
130 |
+ \} |
131 |
+ return $value; |
132 |
+ case 'fullname': |
133 |
+ if($value == '') \{ |
134 |
+ $value = "$username"; |
135 |
+ \} |
136 |
+ if (($information['count'] > 0) && ($information[0]['displayname'][0] != '') ) \{ |
137 |
+ $value = $information[0]['displayname'][0]; |
138 |
+ \} else \{ |
139 |
+ $value = "$username"; |
140 |
+ \} |
141 |
+ return $value; |
142 |
+ \} |
143 |
+ |
144 |
+ \} |
145 |
+ |
146 |
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 |
147 |
--- 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 |
148 |
+++ 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 |
149 |
@@ -0,0 +1 @@ |
150 |
+\} |
151 |
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 |
152 |
--- 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 |
153 |
+++ 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 |
154 |
@@ -0,0 +1,4 @@ |
155 |
+$_prefs['id']['value'] = 'Default Identity'; |
156 |
+$_prefs['fullname']['hook'] = true; |
157 |
+$_prefs['from_addr']['hook'] = true; |
158 |
+ |