1 |
jcrisp |
1.1 |
diff -ruN smeserver-manager-0.1.0.old/createlinks smeserver-manager-0.1.0/createlinks |
2 |
|
|
--- smeserver-manager-0.1.0.old/createlinks 2018-02-06 14:28:22.162000847 +0100 |
3 |
|
|
+++ smeserver-manager-0.1.0/createlinks 2018-02-15 23:05:44.000000000 +0100 |
4 |
|
|
@@ -2,4 +2,9 @@ |
5 |
|
|
|
6 |
|
|
use esmith::Build::CreateLinks qw(:all); |
7 |
|
|
|
8 |
|
|
+#-------------------------------------------------- |
9 |
|
|
+# functions for manager panel |
10 |
|
|
+#-------------------------------------------------- |
11 |
|
|
+my $panel = "manager2"; |
12 |
|
|
|
13 |
|
|
+# panel_link("wbl", $panel); |
14 |
|
|
diff -ruN smeserver-manager-0.1.0.old/root/etc/e-smith/web/panels/manager2/cgi-bin/templates/_black.html.ep smeserver-manager-0.1.0/root/etc/e-smith/web/panels/manager2/cgi-bin/templates/_black.html.ep |
15 |
|
|
--- smeserver-manager-0.1.0.old/root/etc/e-smith/web/panels/manager2/cgi-bin/templates/_black.html.ep 1970-01-01 01:00:00.000000000 +0100 |
16 |
|
|
+++ smeserver-manager-0.1.0/root/etc/e-smith/web/panels/manager2/cgi-bin/templates/_black.html.ep 2018-02-15 23:05:44.000000000 +0100 |
17 |
|
|
@@ -0,0 +1,49 @@ |
18 |
|
|
+<section class="content"> |
19 |
|
|
+<div> |
20 |
|
|
+ <p>Returned Values</p> |
21 |
|
|
+ First line is from returned from list: |
22 |
|
|
+ <%= $listR %> |
23 |
|
|
+ <br /> |
24 |
|
|
+</div> |
25 |
|
|
+<br /> |
26 |
|
|
+ |
27 |
|
|
+<div> |
28 |
|
|
+ Form starts here |
29 |
|
|
+ <br /> |
30 |
|
|
+ |
31 |
|
|
+<table> |
32 |
|
|
+<tbody> |
33 |
|
|
+<tr> |
34 |
|
|
+ |
35 |
|
|
+<form name="list" action="" method="POST"> |
36 |
|
|
+ |
37 |
|
|
+ |
38 |
|
|
+<b>Blacklist helo</b> |
39 |
|
|
+<br /> |
40 |
|
|
+%= text_area story => (cols => 40) => begin |
41 |
|
|
+% for (@{ stash('badhelo') }) { |
42 |
|
|
+%= $_ |
43 |
|
|
+% } |
44 |
|
|
+%end |
45 |
|
|
+<br /> |
46 |
|
|
+ |
47 |
|
|
+<b>Blacklist helo</b> |
48 |
|
|
+<br /> |
49 |
|
|
+%= text_area story => (cols => 40) => begin |
50 |
|
|
+% for (@{ stash('badmailfrom') }) { |
51 |
|
|
+%= $_ |
52 |
|
|
+% } |
53 |
|
|
+%end |
54 |
|
|
+<br /> |
55 |
|
|
+<input type="submit" value="Submit"> |
56 |
|
|
+</form> |
57 |
|
|
+ |
58 |
|
|
+</tr> |
59 |
|
|
+</tbody> |
60 |
|
|
+</table> |
61 |
|
|
+ |
62 |
|
|
+<br /> |
63 |
|
|
+<br /> |
64 |
|
|
+ |
65 |
|
|
+</div> |
66 |
|
|
+</section><!-- /.content --> |
67 |
|
|
\ No newline at end of file |
68 |
|
|
diff -ruN smeserver-manager-0.1.0.old/root/etc/e-smith/web/panels/manager2/cgi-bin/templates/_choice.html.ep smeserver-manager-0.1.0/root/etc/e-smith/web/panels/manager2/cgi-bin/templates/_choice.html.ep |
69 |
|
|
--- smeserver-manager-0.1.0.old/root/etc/e-smith/web/panels/manager2/cgi-bin/templates/_choice.html.ep 1970-01-01 01:00:00.000000000 +0100 |
70 |
|
|
+++ smeserver-manager-0.1.0/root/etc/e-smith/web/panels/manager2/cgi-bin/templates/_choice.html.ep 2018-02-15 23:05:44.000000000 +0100 |
71 |
|
|
@@ -0,0 +1,20 @@ |
72 |
|
|
+<section class="content"> |
73 |
|
|
+ |
74 |
|
|
+<div> |
75 |
|
|
+ |
76 |
|
|
+%#Some Form Buttons |
77 |
|
|
+%#= button_to Test => 'http://home.reetspetit.net/' |
78 |
|
|
+%#= button_to Remove => './wbl.cgi' |
79 |
|
|
+ |
80 |
|
|
+<form name="choice" action="" method="POST"> |
81 |
|
|
+ |
82 |
|
|
+Test dropbown list |
83 |
|
|
+<div> |
84 |
|
|
+<%= select_field 'list' => [ @{ stash('list') }], id=> 'dropdown' %> |
85 |
|
|
+</div> |
86 |
|
|
+<br /> |
87 |
|
|
+ |
88 |
|
|
+<input type="submit" value="Submit"> |
89 |
|
|
+</form> |
90 |
|
|
+</div> |
91 |
|
|
+</section><!-- /.content --> |
92 |
|
|
\ No newline at end of file |
93 |
|
|
diff -ruN smeserver-manager-0.1.0.old/root/etc/e-smith/web/panels/manager2/cgi-bin/templates/main.html.ep smeserver-manager-0.1.0/root/etc/e-smith/web/panels/manager2/cgi-bin/templates/main.html.ep |
94 |
|
|
--- smeserver-manager-0.1.0.old/root/etc/e-smith/web/panels/manager2/cgi-bin/templates/main.html.ep 1970-01-01 01:00:00.000000000 +0100 |
95 |
|
|
+++ smeserver-manager-0.1.0/root/etc/e-smith/web/panels/manager2/cgi-bin/templates/main.html.ep 2018-02-15 23:05:44.000000000 +0100 |
96 |
|
|
@@ -0,0 +1,395 @@ |
97 |
|
|
+<!DOCTYPE html> |
98 |
|
|
+<!-- |
99 |
|
|
+This is a starter template page. Use this page to start your new project from |
100 |
|
|
+scratch. This page gets rid of all links and provides the needed markup only. |
101 |
|
|
+--> |
102 |
|
|
+<html> |
103 |
|
|
+<head> |
104 |
|
|
+ <meta charset="utf-8"> |
105 |
|
|
+ <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
106 |
|
|
+ <title>Server Manager</title> |
107 |
|
|
+ <!-- Tell the browser to be responsive to screen width --> |
108 |
|
|
+ <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"> |
109 |
|
|
+ <link rel="stylesheet" href="../bower_components/bootstrap/dist/css/bootstrap.min.css"> |
110 |
|
|
+ <!-- Font Awesome --> |
111 |
|
|
+ <link rel="stylesheet" href="../bower_components/font-awesome/css/font-awesome.min.css"> |
112 |
|
|
+ <!-- Ionicons --> |
113 |
|
|
+ <link rel="stylesheet" href="../bower_components/Ionicons/css/ionicons.min.css"> |
114 |
|
|
+ <!-- Theme style --> |
115 |
|
|
+ <link rel="stylesheet" href="../dist/css/AdminLTE.min.css"> |
116 |
|
|
+ <!-- AdminLTE Skins. We have chosen the skin-blue for this starter |
117 |
|
|
+ page. However, you can choose any other skin. Make sure you |
118 |
|
|
+ apply the skin class to the body tag so the changes take effect. --> |
119 |
|
|
+ <!--<link rel="stylesheet" href="dist/css/skins/skin-blue.min.css">--> |
120 |
|
|
+ <link rel="stylesheet" href="../dist/css/skins/koozali.css"> |
121 |
|
|
+ |
122 |
|
|
+ <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries --> |
123 |
|
|
+ <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> |
124 |
|
|
+ <!--[if lt IE 9]> |
125 |
|
|
+ <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script> |
126 |
|
|
+ <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> |
127 |
|
|
+ <![endif]--> |
128 |
|
|
+ |
129 |
|
|
+ <!-- Google Font --> |
130 |
|
|
+ <link rel="stylesheet" |
131 |
|
|
+ href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic"> |
132 |
|
|
+</head> |
133 |
|
|
+<!-- |
134 |
|
|
+BODY TAG OPTIONS: |
135 |
|
|
+================= |
136 |
|
|
+Apply one or more of the following classes to get the |
137 |
|
|
+desired effect |
138 |
|
|
+|---------------------------------------------------------| |
139 |
|
|
+| SKINS | skin-blue | |
140 |
|
|
+| | skin-black | |
141 |
|
|
+| | skin-purple | |
142 |
|
|
+| | skin-yellow | |
143 |
|
|
+| | skin-red | |
144 |
|
|
+| | skin-green | |
145 |
|
|
+|---------------------------------------------------------| |
146 |
|
|
+|LAYOUT OPTIONS | fixed | |
147 |
|
|
+| | layout-boxed | |
148 |
|
|
+| | layout-top-nav | |
149 |
|
|
+| | sidebar-collapse | |
150 |
|
|
+| | sidebar-mini | |
151 |
|
|
+|---------------------------------------------------------| |
152 |
|
|
+--> |
153 |
|
|
+<body class="hold-transition skin-blue sidebar-mini"> |
154 |
|
|
+<div class="wrapper"> |
155 |
|
|
+ |
156 |
|
|
+ <!-- Main Header --> |
157 |
|
|
+ <header class="main-header"> |
158 |
|
|
+ |
159 |
|
|
+ <!-- Logo --> |
160 |
|
|
+ <a href="" class="logo"> |
161 |
|
|
+ <!-- mini logo for sidebar mini 50x50 pixels --> |
162 |
|
|
+ <span class="logo-mini"><b>SME</b></span> |
163 |
|
|
+ <!-- logo for regular state and mobile devices --> |
164 |
|
|
+ <span class="logo-lg"><b>Koozali</b> SME Server</span> |
165 |
|
|
+ </a> |
166 |
|
|
+ |
167 |
|
|
+ <!-- Header Navbar --> |
168 |
|
|
+ <nav class="navbar navbar-static-top" role="navigation"> |
169 |
|
|
+ <!-- Sidebar toggle button--> |
170 |
|
|
+ <a href="#" class="sidebar-toggle" data-toggle="push-menu" role="button"> |
171 |
|
|
+ <span class="sr-only">Toggle navigation</span> |
172 |
|
|
+ </a> |
173 |
|
|
+ <!-- Navbar Right Menu --> |
174 |
|
|
+ <div class="navbar-custom-menu"> |
175 |
|
|
+ <ul class="nav navbar-nav"> |
176 |
|
|
+ <!-- Messages: style can be found in dropdown.less--> |
177 |
|
|
+ <li class="dropdown messages-menu"> |
178 |
|
|
+ <!-- Menu toggle button --> |
179 |
|
|
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown"> |
180 |
|
|
+ <i class="fa fa-envelope-o"></i> |
181 |
|
|
+ <span class="label label-success"></span> |
182 |
|
|
+ </a> |
183 |
|
|
+ <ul class="dropdown-menu"> |
184 |
|
|
+ <li class="header">You have no new messages</li> |
185 |
|
|
+ <li> |
186 |
|
|
+ <!-- inner menu: contains the messages --> |
187 |
|
|
+ <ul class="menu"> |
188 |
|
|
+ <li><!-- start message --> |
189 |
|
|
+ |
190 |
|
|
+ <!-- end message --> |
191 |
|
|
+ </ul> |
192 |
|
|
+ <!-- /.menu --> |
193 |
|
|
+ </li> |
194 |
|
|
+ <li class="footer"><a href="#">See All Messages</a></li> |
195 |
|
|
+ </ul> |
196 |
|
|
+ </li> |
197 |
|
|
+ <!-- /.messages-menu --> |
198 |
|
|
+ |
199 |
|
|
+ <!-- Notifications Menu --> |
200 |
|
|
+ <li class="dropdown notifications-menu"> |
201 |
|
|
+ <!-- Menu toggle button --> |
202 |
|
|
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown"> |
203 |
|
|
+ <i class="fa fa-bell-o"></i> |
204 |
|
|
+ <span class="label label-warning"></span> |
205 |
|
|
+ </a> |
206 |
|
|
+ <ul class="dropdown-menu"> |
207 |
|
|
+ <li class="header">You have no new notifications</li> |
208 |
|
|
+ <li> |
209 |
|
|
+ <!-- Inner Menu: contains the notifications --> |
210 |
|
|
+ <ul class="menu"> |
211 |
|
|
+ <!-- end notification --> |
212 |
|
|
+ </ul> |
213 |
|
|
+ </li> |
214 |
|
|
+ <li class="footer"><a href="#">View all</a></li> |
215 |
|
|
+ </ul> |
216 |
|
|
+ </li> |
217 |
|
|
+ <!-- Tasks Menu --> |
218 |
|
|
+ <li class="dropdown tasks-menu"> |
219 |
|
|
+ <!-- Menu Toggle Button --> |
220 |
|
|
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown"> |
221 |
|
|
+ <i class="fa fa-flag-o"></i> |
222 |
|
|
+ <span class="label label-danger"></span> |
223 |
|
|
+ </a> |
224 |
|
|
+ <ul class="dropdown-menu"> |
225 |
|
|
+ <li class="header">You have no tasks</li> |
226 |
|
|
+ <li> |
227 |
|
|
+ <!-- Inner menu: contains the tasks --> |
228 |
|
|
+ </li> |
229 |
|
|
+ <li class="footer"> |
230 |
|
|
+ <a href="#">View all tasks</a> |
231 |
|
|
+ </li> |
232 |
|
|
+ </ul> |
233 |
|
|
+ </li> |
234 |
|
|
+ <!-- User Account Menu --> |
235 |
|
|
+ <li class="dropdown user user-menu"> |
236 |
|
|
+ <!-- Menu Toggle Button --> |
237 |
|
|
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown"> |
238 |
|
|
+ <!-- The user image in the navbar--> |
239 |
|
|
+ <img src="dist/img/user.png" class="user-image" alt="User Image"> |
240 |
|
|
+ <!-- hidden-xs hides the username on small devices so only the image appears. --> |
241 |
|
|
+ <span class="hidden-xs">Admin</span> |
242 |
|
|
+ </a> |
243 |
|
|
+ <ul class="dropdown-menu"> |
244 |
|
|
+ <!-- The user image in the menu --> |
245 |
|
|
+ <li class="user-header"> |
246 |
|
|
+ <img src="dist/img/user.png" class="img-circle" alt="User Image"> |
247 |
|
|
+ |
248 |
|
|
+ <p> |
249 |
|
|
+ Admin |
250 |
|
|
+ <small>SME Server Admin Account</small> |
251 |
|
|
+ </p> |
252 |
|
|
+ </li> |
253 |
|
|
+ <!-- Menu Body --> |
254 |
|
|
+ <li class="user-body"> |
255 |
|
|
+ <div class="row"> |
256 |
|
|
+ <div class="col-xs-4 text-center"> |
257 |
|
|
+ <a href="#">Followers</a> |
258 |
|
|
+ </div> |
259 |
|
|
+ <div class="col-xs-4 text-center"> |
260 |
|
|
+ <a href="#">Sales</a> |
261 |
|
|
+ </div> |
262 |
|
|
+ <div class="col-xs-4 text-center"> |
263 |
|
|
+ <a href="#">Friends</a> |
264 |
|
|
+ </div> |
265 |
|
|
+ </div> |
266 |
|
|
+ <!-- /.row --> |
267 |
|
|
+ </li> |
268 |
|
|
+ <!-- Menu Footer--> |
269 |
|
|
+ <li class="user-footer"> |
270 |
|
|
+ <div class="pull-left"> |
271 |
|
|
+ <a href="#" class="btn btn-default btn-flat">Profile</a> |
272 |
|
|
+ </div> |
273 |
|
|
+ <div class="pull-right"> |
274 |
|
|
+ <a href="#" class="btn btn-default btn-flat">Sign out</a> |
275 |
|
|
+ </div> |
276 |
|
|
+ </li> |
277 |
|
|
+ </ul> |
278 |
|
|
+ </li> |
279 |
|
|
+ <!-- Control Sidebar Toggle Button --> |
280 |
|
|
+ <li> |
281 |
|
|
+ <a href="#" data-toggle="control-sidebar"><i class="fa fa-gears"></i></a> |
282 |
|
|
+ </li> |
283 |
|
|
+ </ul> |
284 |
|
|
+ </div> |
285 |
|
|
+ </nav> |
286 |
|
|
+ </header> |
287 |
|
|
+ <!-- Left side column. contains the logo and sidebar --> |
288 |
|
|
+ <aside class="main-sidebar"> |
289 |
|
|
+ |
290 |
|
|
+ <!-- sidebar: style can be found in sidebar.less --> |
291 |
|
|
+ <section class="sidebar"> |
292 |
|
|
+ |
293 |
|
|
+ <!-- search form (Optional) --> |
294 |
|
|
+ <form action="#" method="get" class="sidebar-form"> |
295 |
|
|
+ <div class="input-group"> |
296 |
|
|
+ <input type="text" name="q" class="form-control" placeholder="Search..."> |
297 |
|
|
+ <span class="input-group-btn"> |
298 |
|
|
+ <button type="submit" name="search" id="search-btn" class="btn btn-flat"><i class="fa fa-search"></i> |
299 |
|
|
+ </button> |
300 |
|
|
+ </span> |
301 |
|
|
+ </div> |
302 |
|
|
+ </form> |
303 |
|
|
+ <!-- /.search form --> |
304 |
|
|
+ <section> |
305 |
|
|
+ <!-- Sidebar Menu --> |
306 |
|
|
+ <ul class="sidebar-menu" data-widget="tree"> |
307 |
|
|
+ <li class="treeview"> |
308 |
|
|
+ <a href="#"><i class="fa fa-users"></i> <span>Collaboration</span> |
309 |
|
|
+ <span class="pull-right-container"> |
310 |
|
|
+ <i class="fa fa-angle-left pull-right"></i> |
311 |
|
|
+ </span> |
312 |
|
|
+ </a> |
313 |
|
|
+ <ul class="treeview-menu"> |
314 |
|
|
+ <li class="active"><a href="#"><span>Users</span></a></li> |
315 |
|
|
+ <li class="active"><a href="#"><span>Groups</span></a></li> |
316 |
|
|
+ <li class="active"><a href="#"><span>Quotas</span></a></li> |
317 |
|
|
+ <li class="active"><a href="#"><span>Pseudonyms</span></a></li> |
318 |
|
|
+ <li class="active"><a href="#"><span>Information bays</span></a></li> |
319 |
|
|
+ <li class="active"><a href="#"><span>Git repositories</span></a></li> |
320 |
|
|
+ <li class="active"><a href="#"><span>User vacations</span></a></li> |
321 |
|
|
+ </ul> |
322 |
|
|
+ </li> |
323 |
|
|
+ |
324 |
|
|
+ <li class="treeview"> |
325 |
|
|
+ <a href="#"><i class="fa fa-server"></i> <span>Administration</span> |
326 |
|
|
+ <span class="pull-right-container"> |
327 |
|
|
+ <i class="fa fa-angle-left pull-right"></i> |
328 |
|
|
+ </span> |
329 |
|
|
+ </a> |
330 |
|
|
+ <ul class="treeview-menu"> |
331 |
|
|
+ <li><a href="#">Sme9admin</a></li> |
332 |
|
|
+ <li><a href="#">System Monitor</a></li> |
333 |
|
|
+ <li><a href="#">Backup or restore</a></li> |
334 |
|
|
+ <li><a href="#">Disk usage report</a></li> |
335 |
|
|
+ <li><a href="#">SARG reports</a></li> |
336 |
|
|
+ <li><a href="#">View log files</a></li> |
337 |
|
|
+ <li><a href="#">Mail log file analysis</a></li> |
338 |
|
|
+ <li><a href="#">Reboot or shutdown</a></li> |
339 |
|
|
+ <li><a href="#">Domain pseudonyms</a></li> |
340 |
|
|
+ <li><a href="#">System Monitor</a></li> |
341 |
|
|
+ </ul> |
342 |
|
|
+ </li> |
343 |
|
|
+ |
344 |
|
|
+ <li class="treeview"> |
345 |
|
|
+ <a href="#"><i class="fa fa-user-secret"></i> <span>Security</span> |
346 |
|
|
+ <span class="pull-right-container"> |
347 |
|
|
+ <i class="fa fa-angle-left pull-right"></i> |
348 |
|
|
+ </span> |
349 |
|
|
+ </a> |
350 |
|
|
+ <ul class="treeview-menu"> |
351 |
|
|
+ <li><a href="#">User Panel Access</a></li> |
352 |
|
|
+ <li><a href="#">Certificate Management</a></li> |
353 |
|
|
+ <li><a href="#">Remote access</a></li> |
354 |
|
|
+ <li><a href="#">SSH Denyhosts</a></li> |
355 |
|
|
+ <li><a href="#">Local networks</a></li> |
356 |
|
|
+ <li><a href="#">Port forwarding</a></li> |
357 |
|
|
+ <li><a href="#">Proxy settings</a></li> |
358 |
|
|
+ </ul> |
359 |
|
|
+ </li> |
360 |
|
|
+ |
361 |
|
|
+ <li class="treeview"> |
362 |
|
|
+ <a href="#"><i class="fa fa-cogs"></i> <span>Configuration</span> |
363 |
|
|
+ <span class="pull-right-container"> |
364 |
|
|
+ <i class="fa fa-angle-left pull-right"></i> |
365 |
|
|
+ </span> |
366 |
|
|
+ </a> |
367 |
|
|
+ <ul class="treeview-menu"> |
368 |
|
|
+ <li><a href="#">PHP-SCL Versions</a></li> |
369 |
|
|
+ <li><a href="#">DHCP Manager</a></li> |
370 |
|
|
+ <li><a href="#">Software installer</a></li> |
371 |
|
|
+ <li><a href="#">Date and time</a></li> |
372 |
|
|
+ <li><a href="#">Workgroup</a></li> |
373 |
|
|
+ <li><a href="#">Directory</a></li> |
374 |
|
|
+ <li><a href="#">Printers</a></li> |
375 |
|
|
+ <li><a href="#">Hostnames and addresses</a></li> |
376 |
|
|
+ <li><a href="#">Domains</a></li> |
377 |
|
|
+ <li><a href="#">E-mail</a></li> |
378 |
|
|
+ <li><a href="#">E-mail Management</a></li> |
379 |
|
|
+ <li><a href="#">E-mail WBL</a></li> |
380 |
|
|
+ <li><a href="#">Antivirus (ClamAV)</a></li> |
381 |
|
|
+ <li><a href="#">Review configuration</a></li> |
382 |
|
|
+ <li><a href="#">Crontab Manager</a></li> |
383 |
|
|
+ <li><a href="#">Thin Clients</a></li> |
384 |
|
|
+ </ul> |
385 |
|
|
+ </li> |
386 |
|
|
+ |
387 |
|
|
+ <li class="treeview"> |
388 |
|
|
+ <a href="#"><i class="fa fa-address-book"></i> <span>Miscellaneous</span> |
389 |
|
|
+ <span class="pull-right-container"> |
390 |
|
|
+ <i class="fa fa-angle-left pull-right"></i> |
391 |
|
|
+ </span> |
392 |
|
|
+ </a> |
393 |
|
|
+ <ul class="treeview-menu"> |
394 |
|
|
+ <li><a href="#">Support and licensing</a></li> |
395 |
|
|
+ <li><a href="#">Create starter web site</a></li> |
396 |
|
|
+ <li><a href="#">Report a bug</a></li> |
397 |
|
|
+ </ul> |
398 |
|
|
+ </li> |
399 |
|
|
+ </ul> |
400 |
|
|
+ </ul> |
401 |
|
|
+ <!-- /.sidebar-menu --> |
402 |
|
|
+ </section> |
403 |
|
|
+ <!-- /.sidebar --> |
404 |
|
|
+ </aside> |
405 |
|
|
+ |
406 |
|
|
+ <!-- Content Wrapper. Contains page content --> |
407 |
|
|
+ <div class="content-wrapper"> |
408 |
|
|
+ <!-- Content Header (Page header) --> |
409 |
|
|
+ <section class="content-header"> |
410 |
|
|
+ <h1> |
411 |
|
|
+ Server-Manager |
412 |
|
|
+ <small>Control panel</small> |
413 |
|
|
+ </h1> |
414 |
|
|
+ <ol class="breadcrumb"> |
415 |
|
|
+ <li><a href="#"><i class="fa fa-dashboard"></i> Level</a></li> |
416 |
|
|
+ <li class="active">Here</li> |
417 |
|
|
+ </ol> |
418 |
|
|
+ </section> |
419 |
|
|
+ |
420 |
|
|
+ <!-- Main content --> |
421 |
|
|
+ <section class="content container-fluid"> |
422 |
|
|
+ |
423 |
|
|
+ <!-------------------------- |
424 |
|
|
+ | Your Page Content Here | |
425 |
|
|
+ --------------------------> |
426 |
|
|
+ |
427 |
|
|
+ <%= include $contentVar %> |
428 |
|
|
+ </section> |
429 |
|
|
+ <!-- /.content --> |
430 |
|
|
+ </div> |
431 |
|
|
+ <!-- /.content-wrapper --> |
432 |
|
|
+ |
433 |
|
|
+ <!-- Main Footer --> |
434 |
|
|
+ <footer class="main-footer"> |
435 |
|
|
+ <!-- To the right --> |
436 |
|
|
+ <div class="pull-right hidden-xs"> |
437 |
|
|
+ Anything you want |
438 |
|
|
+ </div> |
439 |
|
|
+ <!-- Default to the left --> |
440 |
|
|
+ <strong>Copyright © 2018 <a href="http://www.koozali.org/">The Koozali Foundation</a>.</strong> All rights reserved. |
441 |
|
|
+ </footer> |
442 |
|
|
+ |
443 |
|
|
+ |
444 |
|
|
+ |
445 |
|
|
+ </div> |
446 |
|
|
+ <!-- /.tab-pane --> |
447 |
|
|
+ <!-- Stats tab content --> |
448 |
|
|
+ <div class="tab-pane" id="control-sidebar-stats-tab">Stats Tab Content</div> |
449 |
|
|
+ <!-- /.tab-pane --> |
450 |
|
|
+ <!-- Settings tab content --> |
451 |
|
|
+ <div class="tab-pane" id="control-sidebar-settings-tab"> |
452 |
|
|
+ <form method="post"> |
453 |
|
|
+ <h3 class="control-sidebar-heading">General Settings</h3> |
454 |
|
|
+ |
455 |
|
|
+ <div class="form-group"> |
456 |
|
|
+ <label class="control-sidebar-subheading"> |
457 |
|
|
+ Report panel usage |
458 |
|
|
+ <input type="checkbox" class="pull-right"> |
459 |
|
|
+ </label> |
460 |
|
|
+ |
461 |
|
|
+ <p> |
462 |
|
|
+ Some information about this general settings option |
463 |
|
|
+ </p> |
464 |
|
|
+ </div> |
465 |
|
|
+ <!-- /.form-group --> |
466 |
|
|
+ </form> |
467 |
|
|
+ </div> |
468 |
|
|
+ <!-- /.tab-pane --> |
469 |
|
|
+ </div> |
470 |
|
|
+ </aside> |
471 |
|
|
+ <!-- /.control-sidebar --> |
472 |
|
|
+ <!-- Add the sidebar's background. This div must be placed |
473 |
|
|
+ immediately after the control sidebar --> |
474 |
|
|
+ <div class="control-sidebar-bg"></div> |
475 |
|
|
+</div> |
476 |
|
|
+<!-- ./wrapper --> |
477 |
|
|
+ |
478 |
|
|
+<!-- REQUIRED JS SCRIPTS --> |
479 |
|
|
+ |
480 |
|
|
+<!-- jQuery 3 --> |
481 |
|
|
+<script src="../bower_components/jquery/dist/jquery.min.js"></script> |
482 |
|
|
+<!-- Bootstrap 3.3.7 --> |
483 |
|
|
+<script src="../bower_components/bootstrap/dist/js/bootstrap.min.js"></script> |
484 |
|
|
+<!-- AdminLTE App --> |
485 |
|
|
+<script src="../dist/js/adminlte.min.js"></script> |
486 |
|
|
+ |
487 |
|
|
+<!-- Optionally, you can add Slimscroll and FastClick plugins. |
488 |
|
|
+ Both of these plugins are recommended to enhance the |
489 |
|
|
+ user experience. --> |
490 |
|
|
+</body> |
491 |
|
|
+</html> |
492 |
|
|
diff -ruN smeserver-manager-0.1.0.old/root/etc/e-smith/web/panels/manager2/cgi-bin/templates/_rbl.html.ep smeserver-manager-0.1.0/root/etc/e-smith/web/panels/manager2/cgi-bin/templates/_rbl.html.ep |
493 |
|
|
--- smeserver-manager-0.1.0.old/root/etc/e-smith/web/panels/manager2/cgi-bin/templates/_rbl.html.ep 1970-01-01 01:00:00.000000000 +0100 |
494 |
|
|
+++ smeserver-manager-0.1.0/root/etc/e-smith/web/panels/manager2/cgi-bin/templates/_rbl.html.ep 2018-02-15 23:05:44.000000000 +0100 |
495 |
|
|
@@ -0,0 +1,93 @@ |
496 |
|
|
+<section class="content"> |
497 |
|
|
+<div> |
498 |
|
|
+ |
499 |
|
|
+ <p>Returned Values</p> |
500 |
|
|
+ First line is from returned from list: |
501 |
|
|
+ <%= $listR %> |
502 |
|
|
+ <br /> |
503 |
|
|
+</div> |
504 |
|
|
+<br /> |
505 |
|
|
+<div> |
506 |
|
|
+ Form starts here |
507 |
|
|
+ <br /> |
508 |
|
|
+ <br /> |
509 |
|
|
+ |
510 |
|
|
+No idea how to set the radio button to the correct status. |
511 |
|
|
+We could use a dropdown Enabled/Disabled instead |
512 |
|
|
+<br /> |
513 |
|
|
+<br /> |
514 |
|
|
+ |
515 |
|
|
+<b>DNSBL</b> |
516 |
|
|
+<br /> |
517 |
|
|
+% param dnsbl => 'disabled' unless $dnsbl eq 'enabled'; |
518 |
|
|
+<%= radio_button 'dnsbl' => 'enabled' %> Enabled |
519 |
|
|
+<%= radio_button 'dnsbl' => 'disabled' %> Disabled |
520 |
|
|
+ |
521 |
|
|
+<br /> |
522 |
|
|
+<br /> |
523 |
|
|
+ |
524 |
|
|
+<b>RHSBL</b> |
525 |
|
|
+<br /> |
526 |
|
|
+% param rhsbl => 'disabled' unless $dnsbl eq 'enabled'; |
527 |
|
|
+<%= radio_button 'rhsbl' => 'enabled' %> Enabled |
528 |
|
|
+<%= radio_button 'rhsbl' => 'disabled' %> Disabled |
529 |
|
|
+ |
530 |
|
|
+<br /> |
531 |
|
|
+<br /> |
532 |
|
|
+ |
533 |
|
|
+<b>URI BL</b> |
534 |
|
|
+<br /> |
535 |
|
|
+% param uribl => 'disabled' unless $dnsbl eq 'enabled'; |
536 |
|
|
+<%= radio_button 'uribl' => 'enabled' %> Enabled |
537 |
|
|
+<%= radio_button 'uribl' => 'disabled' %> Disabled |
538 |
|
|
+ |
539 |
|
|
+<br /> |
540 |
|
|
+<br /> |
541 |
|
|
+ |
542 |
|
|
+<form name="list" action="" method="POST"> |
543 |
|
|
+ |
544 |
|
|
+<table> |
545 |
|
|
+<tbody> |
546 |
|
|
+<tr> |
547 |
|
|
+<b>RBL List</b> |
548 |
|
|
+<br /> |
549 |
|
|
+%= text_area story => (cols => 40) => begin |
550 |
|
|
+% for (@{ stash('rbllist') }) { |
551 |
|
|
+%= $_ |
552 |
|
|
+% } |
553 |
|
|
+%end |
554 |
|
|
+<br /> |
555 |
|
|
+<tr /> |
556 |
|
|
+ |
557 |
|
|
+<tr> |
558 |
|
|
+<b>SBL List</b> |
559 |
|
|
+<br /> |
560 |
|
|
+%= text_area story => (cols => 40) => begin |
561 |
|
|
+% for (@{ stash('sbllist') }) { |
562 |
|
|
+%= $_ |
563 |
|
|
+% } |
564 |
|
|
+%end |
565 |
|
|
+<br /> |
566 |
|
|
+ |
567 |
|
|
+<b>URL List</b> |
568 |
|
|
+<br /> |
569 |
|
|
+%= text_area story => (cols => 40) => begin |
570 |
|
|
+% for (@{ stash('ubllist') }) { |
571 |
|
|
+%= $_ |
572 |
|
|
+% } |
573 |
|
|
+%end |
574 |
|
|
+<br /> |
575 |
|
|
+ |
576 |
|
|
+</tr> |
577 |
|
|
+</tbody> |
578 |
|
|
+</table> |
579 |
|
|
+ |
580 |
|
|
+<input type="submit" value="Submit"> |
581 |
|
|
+</form> |
582 |
|
|
+ |
583 |
|
|
+<br /> |
584 |
|
|
+<br /> |
585 |
|
|
+ |
586 |
|
|
+</div> |
587 |
|
|
+ |
588 |
|
|
+</section><!-- /.content --> |
589 |
|
|
\ No newline at end of file |
590 |
|
|
diff -ruN smeserver-manager-0.1.0.old/root/etc/e-smith/web/panels/manager2/cgi-bin/templates/_unavailable.html.ep smeserver-manager-0.1.0/root/etc/e-smith/web/panels/manager2/cgi-bin/templates/_unavailable.html.ep |
591 |
|
|
--- smeserver-manager-0.1.0.old/root/etc/e-smith/web/panels/manager2/cgi-bin/templates/_unavailable.html.ep 1970-01-01 01:00:00.000000000 +0100 |
592 |
|
|
+++ smeserver-manager-0.1.0/root/etc/e-smith/web/panels/manager2/cgi-bin/templates/_unavailable.html.ep 2018-02-15 23:05:44.000000000 +0100 |
593 |
|
|
@@ -0,0 +1,7 @@ |
594 |
|
|
+<div> |
595 |
|
|
+ <section class="content"> |
596 |
|
|
+ |
597 |
|
|
+No data available |
598 |
|
|
+ |
599 |
|
|
+ </section><!-- /.content --> |
600 |
|
|
+</div> |
601 |
|
|
diff -ruN smeserver-manager-0.1.0.old/root/etc/e-smith/web/panels/manager2/cgi-bin/templates/_useraccounts.html.ep smeserver-manager-0.1.0/root/etc/e-smith/web/panels/manager2/cgi-bin/templates/_useraccounts.html.ep |
602 |
|
|
--- smeserver-manager-0.1.0.old/root/etc/e-smith/web/panels/manager2/cgi-bin/templates/_useraccounts.html.ep 1970-01-01 01:00:00.000000000 +0100 |
603 |
|
|
+++ smeserver-manager-0.1.0/root/etc/e-smith/web/panels/manager2/cgi-bin/templates/_useraccounts.html.ep 2018-02-15 23:05:44.000000000 +0100 |
604 |
|
|
@@ -0,0 +1,39 @@ |
605 |
|
|
+<div> |
606 |
|
|
+ <section class="content"> |
607 |
|
|
+ <p>Returned Values</p> |
608 |
|
|
+ First line is from returned from list: |
609 |
|
|
+ <%= $listR %> |
610 |
|
|
+ <br /> |
611 |
|
|
+ </section><!-- /.content --> |
612 |
|
|
+</div> |
613 |
|
|
+<br /> |
614 |
|
|
+ |
615 |
|
|
+<div> |
616 |
|
|
+ <section class="content"> |
617 |
|
|
+ |
618 |
|
|
+ Form starts here |
619 |
|
|
+ <br /> |
620 |
|
|
+ |
621 |
|
|
+<table> |
622 |
|
|
+<tbody> |
623 |
|
|
+<tr> |
624 |
|
|
+ |
625 |
|
|
+% for my @user (@{ stash('userlist') }) { |
626 |
|
|
+ % for my $key (@$user) { |
627 |
|
|
+ <td> |
628 |
|
|
+ %= $key |
629 |
|
|
+ </td> |
630 |
|
|
+ %} |
631 |
|
|
+% } |
632 |
|
|
+ |
633 |
|
|
+</tr> |
634 |
|
|
+ |
635 |
|
|
+ |
636 |
|
|
+</tbody> |
637 |
|
|
+</table> |
638 |
|
|
+ |
639 |
|
|
+<br /> |
640 |
|
|
+<br /> |
641 |
|
|
+ |
642 |
|
|
+ </section><!-- /.content --> |
643 |
|
|
+</div> |
644 |
|
|
diff -ruN smeserver-manager-0.1.0.old/root/etc/e-smith/web/panels/manager2/cgi-bin/templates/_white.html.ep smeserver-manager-0.1.0/root/etc/e-smith/web/panels/manager2/cgi-bin/templates/_white.html.ep |
645 |
|
|
--- smeserver-manager-0.1.0.old/root/etc/e-smith/web/panels/manager2/cgi-bin/templates/_white.html.ep 1970-01-01 01:00:00.000000000 +0100 |
646 |
|
|
+++ smeserver-manager-0.1.0/root/etc/e-smith/web/panels/manager2/cgi-bin/templates/_white.html.ep 2018-02-15 23:05:44.000000000 +0100 |
647 |
|
|
@@ -0,0 +1,85 @@ |
648 |
|
|
+<section class="content"> |
649 |
|
|
+<div> |
650 |
|
|
+ <p>Returned Values</p> |
651 |
|
|
+ First line is from returned from list: |
652 |
|
|
+ <%= $listR %> |
653 |
|
|
+ <br /> |
654 |
|
|
+</div> |
655 |
|
|
+<br /> |
656 |
|
|
+<div> |
657 |
|
|
+ Form starts here |
658 |
|
|
+<br /> |
659 |
|
|
+ |
660 |
|
|
+<form name="list" action="" method="POST"> |
661 |
|
|
+<table> |
662 |
|
|
+<tbody> |
663 |
|
|
+<tr> |
664 |
|
|
+ |
665 |
|
|
+<b>Whitelist hosts</b> |
666 |
|
|
+<br /> |
667 |
|
|
+%= text_area story => (cols => 40) => begin |
668 |
|
|
+% for (@{ stash('whitehosts') }) { |
669 |
|
|
+%= $_ |
670 |
|
|
+% } |
671 |
|
|
+%end |
672 |
|
|
+<br /> |
673 |
|
|
+<br /> |
674 |
|
|
+ |
675 |
|
|
+<b>Whitelist helo</b> |
676 |
|
|
+<br /> |
677 |
|
|
+%= text_area story => (cols => 40) => begin |
678 |
|
|
+% for (@{ stash('whitehelo') }) { |
679 |
|
|
+%= $_ |
680 |
|
|
+% } |
681 |
|
|
+%end |
682 |
|
|
+<br /> |
683 |
|
|
+<br /> |
684 |
|
|
+ |
685 |
|
|
+<b>Whitelist senders</b> |
686 |
|
|
+<br /> |
687 |
|
|
+%= text_area story => (cols => 40) => begin |
688 |
|
|
+% for (@{ stash('whitesenders') }) { |
689 |
|
|
+%= $_ |
690 |
|
|
+% } |
691 |
|
|
+%end |
692 |
|
|
+<br /> |
693 |
|
|
+<br /> |
694 |
|
|
+ |
695 |
|
|
+<b>Spamassasin from</b> |
696 |
|
|
+<br /> |
697 |
|
|
+%= text_area story => (cols => 40) => begin |
698 |
|
|
+% for (@{ stash('whitefrom') }) { |
699 |
|
|
+%= $_ |
700 |
|
|
+% } |
701 |
|
|
+%end |
702 |
|
|
+<br /> |
703 |
|
|
+<br /> |
704 |
|
|
+ |
705 |
|
|
+<input type="submit" value="Submit"> |
706 |
|
|
+</form> |
707 |
|
|
+ |
708 |
|
|
+</tr> |
709 |
|
|
+</tbody> |
710 |
|
|
+</table> |
711 |
|
|
+ |
712 |
|
|
+<br /> |
713 |
|
|
+<br /> |
714 |
|
|
+Sample text areas |
715 |
|
|
+<br /> |
716 |
|
|
+ |
717 |
|
|
+%= text_area 'story' |
718 |
|
|
+<br /> |
719 |
|
|
+%= text_area 'story', cols => 40 |
720 |
|
|
+<br /> |
721 |
|
|
+%= text_area story => 'Default\nDove', cols => 40 |
722 |
|
|
+<br /> |
723 |
|
|
+%= text_area story => (cols => 40) => begin |
724 |
|
|
+ Default |
725 |
|
|
+ Swan |
726 |
|
|
+% end |
727 |
|
|
+<br /> |
728 |
|
|
+<br /> |
729 |
|
|
+ |
730 |
|
|
+</div> |
731 |
|
|
+ |
732 |
|
|
+</section><!-- /.content --> |
733 |
|
|
\ No newline at end of file |
734 |
|
|
diff -ruN smeserver-manager-0.1.0.old/root/etc/e-smith/web/panels/manager2/cgi-bin/useraccounts smeserver-manager-0.1.0/root/etc/e-smith/web/panels/manager2/cgi-bin/useraccounts |
735 |
|
|
--- smeserver-manager-0.1.0.old/root/etc/e-smith/web/panels/manager2/cgi-bin/useraccounts 1970-01-01 01:00:00.000000000 +0100 |
736 |
|
|
+++ smeserver-manager-0.1.0/root/etc/e-smith/web/panels/manager2/cgi-bin/useraccounts 2018-02-15 23:05:44.000000000 +0100 |
737 |
|
|
@@ -0,0 +1,52 @@ |
738 |
|
|
+#!/usr/bin/perl |
739 |
|
|
+# no -d allowed when running suid from the cgi-bin dir :-( |
740 |
|
|
+#-wT |
741 |
|
|
+# vim: ft=xml: |
742 |
|
|
+ |
743 |
|
|
+#---------------------------------------------------------------------- |
744 |
|
|
+# heading : Configuration |
745 |
|
|
+# description : E-mail WBL |
746 |
|
|
+# navigation : 6000 6710 |
747 |
|
|
+#---------------------------------------------------------------------- |
748 |
|
|
+ |
749 |
|
|
+use strict; |
750 |
|
|
+use warnings; |
751 |
|
|
+use Mojolicious::Lite; |
752 |
|
|
+use smeserver::Panel::useraccountsNew; |
753 |
|
|
+ |
754 |
|
|
+#use esmith::wblNew; |
755 |
|
|
+ |
756 |
|
|
+# We can use separate template in templates/somefile.html.ep |
757 |
|
|
+# plugin 'HTMLTemplateProRenderer'; |
758 |
|
|
+ |
759 |
|
|
+# Load up our wbl subroutines |
760 |
|
|
+# my $f = esmith::wblNew->new(); |
761 |
|
|
+ |
762 |
|
|
+# Initial setup when called |
763 |
|
|
+# get '/useraccounts' => sub { |
764 |
|
|
+ |
765 |
|
|
+get '/' => sub { |
766 |
|
|
+ |
767 |
|
|
+ my ($mojo) = @_; |
768 |
|
|
+ |
769 |
|
|
+ my @useraccounts = get_user_accounts(); |
770 |
|
|
+ |
771 |
|
|
+ if ( scalar @useraccounts ) { |
772 |
|
|
+ |
773 |
|
|
+ $mojo->stash( userlist => \@useraccounts ); |
774 |
|
|
+ |
775 |
|
|
+ # This is the template fragment to be embedded in main |
776 |
|
|
+ $mojo->stash( contentVar => '_useraccounts' ); |
777 |
|
|
+ |
778 |
|
|
+ } |
779 |
|
|
+ |
780 |
|
|
+ else { |
781 |
|
|
+ $mojo->stash( contentVar => '_unavailable' ); |
782 |
|
|
+ } |
783 |
|
|
+ |
784 |
|
|
+ $mojo->render( template => 'main' ); |
785 |
|
|
+}; |
786 |
|
|
+ |
787 |
|
|
+ |
788 |
|
|
+app->start; |
789 |
|
|
+ |
790 |
|
|
diff -ruN smeserver-manager-0.1.0.old/root/etc/e-smith/web/panels/manager2/cgi-bin/wbl smeserver-manager-0.1.0/root/etc/e-smith/web/panels/manager2/cgi-bin/wbl |
791 |
|
|
--- smeserver-manager-0.1.0.old/root/etc/e-smith/web/panels/manager2/cgi-bin/wbl 1970-01-01 01:00:00.000000000 +0100 |
792 |
|
|
+++ smeserver-manager-0.1.0/root/etc/e-smith/web/panels/manager2/cgi-bin/wbl 2018-02-15 23:05:44.000000000 +0100 |
793 |
|
|
@@ -0,0 +1,165 @@ |
794 |
|
|
+#!/usr/bin/perl |
795 |
|
|
+# no -d allowed when running suid from the cgi-bin dir :-( |
796 |
|
|
+#-wT |
797 |
|
|
+# vim: ft=xml: |
798 |
|
|
+ |
799 |
|
|
+#---------------------------------------------------------------------- |
800 |
|
|
+# heading : Configuration |
801 |
|
|
+# description : E-mail WBL |
802 |
|
|
+# navigation : 6000 6710 |
803 |
|
|
+#---------------------------------------------------------------------- |
804 |
|
|
+ |
805 |
|
|
+use strict; |
806 |
|
|
+use warnings; |
807 |
|
|
+use Mojolicious::Lite; |
808 |
|
|
+use smeserver::Panel::wblNew; |
809 |
|
|
+ |
810 |
|
|
+ |
811 |
|
|
+# We can use separate template in templates/somefile.html.ep |
812 |
|
|
+# plugin 'HTMLTemplateProRenderer'; |
813 |
|
|
+ |
814 |
|
|
+# Load up our wbl subroutines |
815 |
|
|
+# my $f = esmith::wblNew->new(); |
816 |
|
|
+ |
817 |
|
|
+# Initial setup when called |
818 |
|
|
+get '/' => sub { |
819 |
|
|
+ |
820 |
|
|
+ my ($mojo) = @_; |
821 |
|
|
+ |
822 |
|
|
+ # Setup our 3 - test |
823 |
|
|
+ # $mojo->stash( RBL => 'RBL List', Black => 'Black List', White => 'White List' ); |
824 |
|
|
+ |
825 |
|
|
+ # Or use a dropdown list |
826 |
|
|
+ my @wblList = ( 'RBL List', 'Black List', 'White List' ); |
827 |
|
|
+ $mojo->stash( list => \@wblList ); |
828 |
|
|
+ |
829 |
|
|
+ # This is the template fragment to be embedded in main |
830 |
|
|
+ $mojo->stash( contentVar => '_choice' ); |
831 |
|
|
+ |
832 |
|
|
+ # And now we render main |
833 |
|
|
+ $mojo->render( template => 'main' ); |
834 |
|
|
+ |
835 |
|
|
+}; |
836 |
|
|
+ |
837 |
|
|
+#get 'test1' => sub { |
838 |
|
|
+#}; |
839 |
|
|
+ |
840 |
|
|
+#get 'test2' => sub { |
841 |
|
|
+#}; |
842 |
|
|
+ |
843 |
|
|
+# called via post |
844 |
|
|
+post '/' => sub { |
845 |
|
|
+ |
846 |
|
|
+ # push the returned array to the $mojo array |
847 |
|
|
+ my $mojo = shift; |
848 |
|
|
+ |
849 |
|
|
+ my $button = $mojo->param('button'); |
850 |
|
|
+ |
851 |
|
|
+ # This is the name used in the select_files e.g. 'list' |
852 |
|
|
+ my $list = $mojo->param('list'); |
853 |
|
|
+ |
854 |
|
|
+ # We should put the vars below into these SWITCH statements |
855 |
|
|
+ # We can then check the call in the $list var. |
856 |
|
|
+ # If it is a straightforward POST call we return a template |
857 |
|
|
+ # If it is like wbl.cgi?get_dnsbl or wbl.cgi?get_rblSettings or similar |
858 |
|
|
+ # we could return some JSON instead |
859 |
|
|
+ # Just needs some logic to figure the call style and output relevant data |
860 |
|
|
+ |
861 |
|
|
+ # Hmm some of this comes back as a carriage return separated array |
862 |
|
|
+ # For now removed the \n and join in the wbl.pm file |
863 |
|
|
+ # eg joe@domain.com\nfred@domain.com |
864 |
|
|
+ # |
865 |
|
|
+ |
866 |
|
|
+ SWITCH: { |
867 |
|
|
+ |
868 |
|
|
+ if ( $list =~ /^RBL List/ ) { |
869 |
|
|
+ |
870 |
|
|
+ # Set the template we require |
871 |
|
|
+ # You could do some logic to either call a template to output the data, |
872 |
|
|
+ # or alternatively answer a query with some JSON instead |
873 |
|
|
+ $mojo->stash( contentVar => '_rbl' ); |
874 |
|
|
+ |
875 |
|
|
+ # Set the retrieved list name to display it for testing |
876 |
|
|
+ $mojo->stash( listR => $list ); |
877 |
|
|
+ |
878 |
|
|
+ # For RBL List |
879 |
|
|
+ # dnsbl - returns 'enabled/disabled |
880 |
|
|
+ my $dnsbl = get_dnsbl(); |
881 |
|
|
+ $mojo->stash( dnsbl => $dnsbl ); |
882 |
|
|
+ |
883 |
|
|
+ # rhsbl - returns 'enabled/disabled |
884 |
|
|
+ my $rhsbl = get_rhsbl(); |
885 |
|
|
+ $mojo->stash( rhsbl => $rhsbl ); |
886 |
|
|
+ |
887 |
|
|
+ # uribl - returns 'enabled/disabled |
888 |
|
|
+ my $uribl = get_uribl(); |
889 |
|
|
+ $mojo->stash( uribl => $uribl ); |
890 |
|
|
+ |
891 |
|
|
+ # For SBLList List |
892 |
|
|
+ my @sbllist = get_sbllist(); |
893 |
|
|
+ $mojo->stash( sbllist => \@sbllist ); |
894 |
|
|
+ |
895 |
|
|
+ # For RBLList List |
896 |
|
|
+ my @rbllist = get_rbllist(); |
897 |
|
|
+ $mojo->stash( rbllist => \@rbllist ); |
898 |
|
|
+ |
899 |
|
|
+ # For URLList List |
900 |
|
|
+ my @ubllist = get_ubllist(); |
901 |
|
|
+ $mojo->stash( ubllist => \@ubllist ); |
902 |
|
|
+ |
903 |
|
|
+ } |
904 |
|
|
+ if ( $list =~ /^Black List/ ) { |
905 |
|
|
+ |
906 |
|
|
+ # Set the template we require |
907 |
|
|
+ # You could do some logic to either call a template to output the data, |
908 |
|
|
+ # or alternatively answer a query with some JSON instead |
909 |
|
|
+ $mojo->stash( contentVar => '_black' ); |
910 |
|
|
+ |
911 |
|
|
+ # Set the retrieved list name to display it for testing |
912 |
|
|
+ $mojo->stash( listR => $list ); |
913 |
|
|
+ |
914 |
|
|
+ # For Black List |
915 |
|
|
+ my @badhelo = get_badhelo(); |
916 |
|
|
+ $mojo->stash( badhelo => \@badhelo ); |
917 |
|
|
+ |
918 |
|
|
+ my @badmailfrom = get_badmailfrom(); |
919 |
|
|
+ $mojo->stash( badmailfrom => \@badmailfrom ); |
920 |
|
|
+ |
921 |
|
|
+ } |
922 |
|
|
+ if ( $list =~ /^White List/ ) { |
923 |
|
|
+ |
924 |
|
|
+ # Set the template we require |
925 |
|
|
+ # You could do some logic to either call a template to output the data, |
926 |
|
|
+ # or alternatively answer a query with some JSON instead |
927 |
|
|
+ $mojo->stash( contentVar => '_white' ); |
928 |
|
|
+ |
929 |
|
|
+ # Set the retrieved list name to display it for testing |
930 |
|
|
+ $mojo->stash( listR => $list ); |
931 |
|
|
+ |
932 |
|
|
+ # For WBL List |
933 |
|
|
+ my @whitelistsenders = get_whitelistsenders(); |
934 |
|
|
+ $mojo->stash( whitesenders => \@whitelistsenders ); |
935 |
|
|
+ |
936 |
|
|
+ my @whitelisthelo = get_whitelisthelo(); |
937 |
|
|
+ $mojo->stash( whitehelo => \@whitelisthelo ); |
938 |
|
|
+ |
939 |
|
|
+ my @whitelisthosts = get_whitelisthosts(); |
940 |
|
|
+ $mojo->stash( whitehosts => \@whitelisthosts ); |
941 |
|
|
+ |
942 |
|
|
+ my @whitelistfrom = get_whitelistfrom(); |
943 |
|
|
+ $mojo->stash( whitefrom => \@whitelistfrom ); |
944 |
|
|
+ |
945 |
|
|
+ } |
946 |
|
|
+ |
947 |
|
|
+ # Fall through back to choice list |
948 |
|
|
+ # Not sure how do do an 'else' though ! |
949 |
|
|
+ # my @wblList = ( 'RBL List', 'Black List', 'White List' ); |
950 |
|
|
+ # $mojo->stash( list => \@wblList ); |
951 |
|
|
+ # $mojo->stash( contentVar => '_choice' ); |
952 |
|
|
+ } |
953 |
|
|
+ |
954 |
|
|
+ $mojo->render( template => 'main' ); |
955 |
|
|
+}; |
956 |
|
|
+ |
957 |
|
|
+app->start; |
958 |
|
|
+ |
959 |
|
|
diff -ruN smeserver-manager-0.1.0.old/root/usr/share/perl5/vendor_perl/smeserver/Panel/useraccountsNew.pm smeserver-manager-0.1.0/root/usr/share/perl5/vendor_perl/smeserver/Panel/useraccountsNew.pm |
960 |
|
|
--- smeserver-manager-0.1.0.old/root/usr/share/perl5/vendor_perl/smeserver/Panel/useraccountsNew.pm 1970-01-01 01:00:00.000000000 +0100 |
961 |
|
|
+++ smeserver-manager-0.1.0/root/usr/share/perl5/vendor_perl/smeserver/Panel/useraccountsNew.pm 2018-02-16 00:21:52.000000000 +0100 |
962 |
|
|
@@ -0,0 +1,1310 @@ |
963 |
|
|
+#!/usr/bin/perl -w |
964 |
|
|
+ |
965 |
|
|
+#---------------------------------------------------------------------- |
966 |
michel |
1.2 |
+# $Id: smeserver-manager-add-basic-files.patch,v 1.1 2019/12/15 22:14:17 jcrisp Exp $ |
967 |
jcrisp |
1.1 |
+#---------------------------------------------------------------------- |
968 |
|
|
+# copyright (C) 1999-2006 Mitel Networks Corporation |
969 |
|
|
+# |
970 |
|
|
+# This program is free software; you can redistribute it and/or modify |
971 |
|
|
+# it under the terms of the GNU General Public License as published by |
972 |
|
|
+# the Free Software Foundation; either version 2 of the License, or |
973 |
|
|
+# (at your option) any later version. |
974 |
|
|
+# |
975 |
|
|
+# This program is distributed in the hope that it will be useful, |
976 |
|
|
+# but WITHOUT ANY WARRANTY; without even the implied warranty of |
977 |
|
|
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
978 |
|
|
+# GNU General Public License for more details. |
979 |
|
|
+# |
980 |
|
|
+# You should have received a copy of the GNU General Public License |
981 |
|
|
+# along with this program; if not, write to the Free Software |
982 |
|
|
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
983 |
|
|
+#---------------------------------------------------------------------- |
984 |
|
|
+package smeserver::Panel::useraccountsNew; |
985 |
|
|
+ |
986 |
|
|
+use strict; |
987 |
|
|
+ |
988 |
|
|
+# Get shot of FormMagick and cgi |
989 |
|
|
+ |
990 |
|
|
+ |
991 |
|
|
+use esmith::AccountsDB; |
992 |
|
|
+use esmith::ConfigDB; |
993 |
|
|
+#use esmith::FormMagick; |
994 |
|
|
+#use esmith::cgi; |
995 |
|
|
+use esmith::util; |
996 |
|
|
+use File::Basename; |
997 |
|
|
+use Exporter; |
998 |
|
|
+use Carp qw(verbose); |
999 |
|
|
+ |
1000 |
|
|
+# This will have to go - where do we need it ? |
1001 |
|
|
+our @ISA = qw( Exporter); |
1002 |
|
|
+ |
1003 |
|
|
+# Anything with print is a non starter and should be renamed |
1004 |
|
|
+our @EXPORT = qw( |
1005 |
|
|
+ get_user_accounts |
1006 |
|
|
+ print_user_table |
1007 |
|
|
+ print_acctName_field |
1008 |
|
|
+ print_groupMemberships_field |
1009 |
|
|
+ print_page_description |
1010 |
|
|
+ get_ldap_value |
1011 |
|
|
+ username_clash |
1012 |
|
|
+ pseudonym_clash |
1013 |
|
|
+ handle_user_accounts |
1014 |
|
|
+ modify_admin |
1015 |
|
|
+ emailforward |
1016 |
|
|
+ verifyPasswords |
1017 |
|
|
+ lock_account |
1018 |
|
|
+ remove_account |
1019 |
|
|
+ reset_password |
1020 |
|
|
+ check_password |
1021 |
|
|
+ print_save_or_add_button |
1022 |
|
|
+ get_pptp_value |
1023 |
|
|
+ print_ipsec_client_section |
1024 |
|
|
+ get_prop |
1025 |
|
|
+ |
1026 |
|
|
+ system_password_compare |
1027 |
|
|
+ system_valid_password |
1028 |
|
|
+ system_change_password |
1029 |
|
|
+ system_check_password |
1030 |
|
|
+ system_authenticate_password |
1031 |
|
|
+); |
1032 |
|
|
+ |
1033 |
michel |
1.2 |
+our $VERSION = sprintf '%d.%03d', q$Revision: 1.1 $ =~ /: (\d+).(\d+)/; |
1034 |
jcrisp |
1.1 |
+ |
1035 |
|
|
+our $accountdb = esmith::AccountsDB->open(); |
1036 |
|
|
+our $configdb = esmith::ConfigDB->open(); |
1037 |
|
|
+ |
1038 |
|
|
+=pod |
1039 |
|
|
+ |
1040 |
|
|
+=head1 NAME |
1041 |
|
|
+ |
1042 |
|
|
+esmith::FormMagick::Panels::useraccounts - useful panel functions |
1043 |
|
|
+ |
1044 |
|
|
+=head1 SYNOPSIS |
1045 |
|
|
+ |
1046 |
|
|
+use esmith::FormMagick::Panels::useraccount; |
1047 |
|
|
+ |
1048 |
|
|
+my $panel = esmith::FormMagick::Panel::useraccount->new(); |
1049 |
|
|
+$panel->display(); |
1050 |
|
|
+ |
1051 |
|
|
+=head1 DESCRIPTION |
1052 |
|
|
+ |
1053 |
|
|
+ |
1054 |
|
|
+=head2 new(); |
1055 |
|
|
+ |
1056 |
|
|
+Exactly as for esmith::FormMagick |
1057 |
|
|
+ |
1058 |
|
|
+=begin testing |
1059 |
|
|
+ |
1060 |
|
|
+$ENV{ESMITH_ACCOUNT_DB} = "10e-smith-base/accounts.conf"; |
1061 |
|
|
+$ENV{ESMITH_CONFIG_DB} = "10e-smith-base/configuration.conf"; |
1062 |
|
|
+ |
1063 |
|
|
+open DATA, "echo '<form></form>'|"; |
1064 |
|
|
+use_ok('esmith::FormMagick::Panel::useraccounts'); |
1065 |
|
|
+use vars qw($panel); |
1066 |
|
|
+ok($panel = esmith::FormMagick::Panel::useraccounts->new(), |
1067 |
|
|
+"Create panel object"); |
1068 |
|
|
+close DATA; |
1069 |
|
|
+isa_ok($panel, 'esmith::FormMagick::Panel::useraccounts'); |
1070 |
|
|
+$panel->{cgi} = CGI->new(); |
1071 |
|
|
+$panel->parse_xml(); |
1072 |
|
|
+ |
1073 |
|
|
+{ package esmith::FormMagick::Panel::useraccounts; |
1074 |
|
|
+our $accountdb; |
1075 |
|
|
+::isa_ok($accountdb, 'esmith::AccountsDB'); |
1076 |
|
|
+} |
1077 |
|
|
+ |
1078 |
|
|
+=end testing |
1079 |
|
|
+ |
1080 |
|
|
+=cut |
1081 |
|
|
+ |
1082 |
|
|
+# Errrr ? No FormMagick now. |
1083 |
|
|
+sub new { |
1084 |
|
|
+ shift; |
1085 |
|
|
+ my $self = esmith::FormMagick->new(); |
1086 |
|
|
+ $self->{calling_package} = (caller)[0]; |
1087 |
|
|
+ bless $self; |
1088 |
|
|
+ return $self; |
1089 |
|
|
+} |
1090 |
|
|
+ |
1091 |
|
|
+=head1 HTML GENERATION ROUTINES |
1092 |
|
|
+ |
1093 |
|
|
+Routines for generating chunks of HTML needed by the panel. |
1094 |
|
|
+ |
1095 |
|
|
+=head2 print_user_table |
1096 |
|
|
+ |
1097 |
|
|
+Prints out the user table on the front page. |
1098 |
|
|
+ |
1099 |
|
|
+=for testing |
1100 |
|
|
+$panel->print_user_table; |
1101 |
|
|
+like($_STDOUT_, qr/bart/, "Found usernames in user table output"); |
1102 |
|
|
+like($_STDOUT_, qr/ff0000/, "Found red 'reset password' output"); |
1103 |
|
|
+ |
1104 |
|
|
+=cut |
1105 |
|
|
+ |
1106 |
|
|
+# The whole print_user_table routine can go - we just need get_users here |
1107 |
|
|
+ |
1108 |
|
|
+sub get_user_accounts { |
1109 |
|
|
+ #my $self = shift; |
1110 |
|
|
+ #my $q = $self->{cgi}; |
1111 |
|
|
+ #my $account = $self->localise('ACCOUNT'); |
1112 |
|
|
+ #my $acctName = $self->localise('USER_NAME'); |
1113 |
|
|
+ # |
1114 |
|
|
+ #my $modify = $self->localise('MODIFY'); |
1115 |
|
|
+ #my $resetpw = $self->localise('PASSWORD_RESET'); |
1116 |
|
|
+ #my $lock = $self->localise('LOCK_ACCOUNT'); |
1117 |
|
|
+ #my $account_locked = $self->localise('ACCOUNT_LOCKED'); |
1118 |
|
|
+ #my $remove = $self->localise('REMOVE'); |
1119 |
|
|
+ |
1120 |
|
|
+ my @users = $accountdb->get('admin'); |
1121 |
|
|
+ push @users, $accountdb->users(); |
1122 |
|
|
+ |
1123 |
|
|
+ unless ( scalar @users ) |
1124 |
|
|
+ { |
1125 |
|
|
+ return "No user accounts available"; |
1126 |
|
|
+ } |
1127 |
|
|
+ return @users; |
1128 |
|
|
+} |
1129 |
|
|
+ |
1130 |
|
|
+# Not required |
1131 |
|
|
+ |
1132 |
|
|
+sub print_user_table { |
1133 |
|
|
+ my $self = shift; |
1134 |
|
|
+ my $q = $self->{cgi}; |
1135 |
|
|
+ my $account = $self->localise('ACCOUNT'); |
1136 |
|
|
+ my $acctName = $self->localise('USER_NAME'); |
1137 |
|
|
+ |
1138 |
|
|
+ my $modify = $self->localise('MODIFY'); |
1139 |
|
|
+ my $resetpw = $self->localise('PASSWORD_RESET'); |
1140 |
|
|
+ my $lock = $self->localise('LOCK_ACCOUNT'); |
1141 |
|
|
+ my $account_locked = $self->localise('ACCOUNT_LOCKED'); |
1142 |
|
|
+ my $remove = $self->localise('REMOVE'); |
1143 |
|
|
+ |
1144 |
|
|
+ my @users = $accountdb->get('admin'); |
1145 |
|
|
+ push @users, $accountdb->users(); |
1146 |
|
|
+ |
1147 |
|
|
+ unless ( scalar @users ) |
1148 |
|
|
+ { |
1149 |
|
|
+ print $q->Tr($q->td($self->localise('NO_USER_ACCOUNTS'))); |
1150 |
|
|
+ return ""; |
1151 |
|
|
+ } |
1152 |
|
|
+ print " <tr>\n <td colspan=\"2\">\n "; |
1153 |
|
|
+ print $q->start_table ({-CLASS => "sme-border"}),"\n "; |
1154 |
|
|
+ print $q->Tr( |
1155 |
|
|
+ esmith::cgi::genSmallCell($q, $self->localise($account),"header"), |
1156 |
|
|
+ esmith::cgi::genSmallCell($q, $self->localise($acctName),"header"), |
1157 |
|
|
+ esmith::cgi::genSmallCell($q, $self->localise('VPN_CLIENT_ACCESS'), "header"), |
1158 |
|
|
+ esmith::cgi::genSmallCell($q, $self->localise('FORWARDING_ADDRESS'), "header"), |
1159 |
|
|
+ esmith::cgi::genSmallCell($q, $self->localise('ACTION'),"header",4)); |
1160 |
|
|
+ |
1161 |
|
|
+ my $scriptname = basename($0); |
1162 |
|
|
+ my $index=0; |
1163 |
|
|
+ |
1164 |
|
|
+ foreach my $u (@users) { |
1165 |
|
|
+ my $username = $u->key(); |
1166 |
|
|
+ my $first = $u->prop('FirstName'); |
1167 |
|
|
+ my $last = $u->prop('LastName'); |
1168 |
|
|
+ my $lockable = $u->prop('Lockable') || 'yes'; |
1169 |
|
|
+ my $removable = $u->prop('Removable') || 'yes'; |
1170 |
|
|
+ my $fwd = (($u->prop('EmailForward') || 'local') =~ m/^forward|both$/) ? |
1171 |
|
|
+ $u->prop('ForwardAddress') : ''; |
1172 |
|
|
+ my $vpnaccess = $u->prop('VPNClientAccess') || 'no'; |
1173 |
|
|
+ $vpnaccess = $vpnaccess eq 'yes' ? $self->localise('YES') : |
1174 |
|
|
+ $self->localise('NO'); |
1175 |
|
|
+ |
1176 |
|
|
+ my $params = $self->build_user_cgi_params($username, $u->props()); |
1177 |
|
|
+ |
1178 |
|
|
+ my $password_set = $u->prop('PasswordSet'); |
1179 |
|
|
+ |
1180 |
|
|
+ my $pagenum = ($username eq "admin") ? $self->get_page_by_name('SystemPasswordDummy') |
1181 |
|
|
+ : $self->get_page_by_name('ResetPasswordDummy'); |
1182 |
|
|
+ |
1183 |
|
|
+ # make normal links |
1184 |
|
|
+ my $lock_url = ($password_set eq 'yes') ? |
1185 |
|
|
+ qq(<a href="$scriptname?$params&Next=Next&wherenext=LockAccount">$lock</a>) : |
1186 |
|
|
+ qq($account_locked); |
1187 |
|
|
+ |
1188 |
|
|
+ $lock_url = "" unless ($lockable eq "yes"); |
1189 |
|
|
+ |
1190 |
|
|
+ my $where_next = ($username eq "admin") ? "ModifyAdmin" : "CreateModify"; |
1191 |
|
|
+ my $action1 = "<a href=\"$scriptname?page=0&page_stack=&acctName=$username&Next=Next&action=modify&wherenext=$where_next\">$modify</a>"; |
1192 |
|
|
+ |
1193 |
|
|
+ my $action2 = "<a href=\"$scriptname?page=$pagenum&page_stack=&Next=Next&acctName=$username\">$resetpw</a>"; |
1194 |
|
|
+ |
1195 |
|
|
+ unless ($password_set eq 'yes') |
1196 |
|
|
+ { |
1197 |
|
|
+ $action2 = "<span class='error-noborders'>" . $action2 . "</span>"; |
1198 |
|
|
+ } |
1199 |
|
|
+ |
1200 |
|
|
+ my $action3 = ($removable eq "yes") ? "<a href=\"$scriptname?$params&Next=Next&wherenext=RemoveAccount\">$remove</a>" : ''; |
1201 |
|
|
+ |
1202 |
|
|
+ print $q->Tr(esmith::cgi::genSmallCell($q, $username,"normal")," ", |
1203 |
|
|
+ esmith::cgi::genSmallCell($q, "$first $last","normal")," ", |
1204 |
|
|
+ esmith::cgi::genSmallCell($q, $vpnaccess), |
1205 |
|
|
+ esmith::cgi::genSmallCell($q, $fwd), |
1206 |
|
|
+ esmith::cgi::genSmallCell($q, "$action1","normal")," ", |
1207 |
|
|
+ esmith::cgi::genSmallCell($q, "$action2","normal")," ", |
1208 |
|
|
+ esmith::cgi::genSmallCell($q, "$lock_url","normal")," ", |
1209 |
|
|
+ esmith::cgi::genSmallCell($q, "$action3","normal")); |
1210 |
|
|
+ |
1211 |
|
|
+ $index++; |
1212 |
|
|
+ } |
1213 |
|
|
+ |
1214 |
|
|
+ print qq(</table></td></tr>\n); |
1215 |
|
|
+ |
1216 |
|
|
+ return ""; |
1217 |
|
|
+} |
1218 |
|
|
+ |
1219 |
|
|
+=head2 print_acctName_field |
1220 |
|
|
+ |
1221 |
|
|
+This subroutine is used to generate the Account name field on the form in |
1222 |
|
|
+the case of "create user", or to make it a plain uneditable string in the case |
1223 |
|
|
+of "modify user". |
1224 |
|
|
+ |
1225 |
|
|
+=begin testing |
1226 |
|
|
+ |
1227 |
|
|
+my $self = esmith::FormMagick::Panel::useraccounts->new(); |
1228 |
|
|
+$self->{cgi} = CGI->new(""); |
1229 |
|
|
+print_acctName_field($self); |
1230 |
|
|
+like($_STDOUT_, qr/text.*acctName/, "print text field if acctName not set"); |
1231 |
|
|
+like($_STDOUT_, qr/create/, "action=create if acctName not set"); |
1232 |
|
|
+$self->{cgi}->param(-name => 'acctName', -value => 'foo'); |
1233 |
|
|
+$self->{cgi}->param(-name => 'action', -value => 'modify'); |
1234 |
|
|
+print_acctName_field($self); |
1235 |
|
|
+like($_STDOUT_, qr/hidden.*acctName/, "print hidden field if acctName is set"); |
1236 |
|
|
+like($_STDOUT_, qr/modify/, "action=modify if acctName already set"); |
1237 |
|
|
+ |
1238 |
|
|
+=end testing |
1239 |
|
|
+ |
1240 |
|
|
+=cut |
1241 |
|
|
+ |
1242 |
|
|
+sub print_acctName_field { |
1243 |
|
|
+ my $self = shift; |
1244 |
|
|
+ my $cgi = $self->{cgi}; |
1245 |
|
|
+ my $an = $cgi->param('acctName') || ''; |
1246 |
|
|
+ print qq(<tr><td class=\"sme-noborders-label\">) . $self->localise('ACCOUNT_NAME') . qq(</td>\n); |
1247 |
|
|
+ my $action = $cgi->param('action') || ''; |
1248 |
|
|
+ if ( $action eq 'modify') { |
1249 |
|
|
+ print qq( |
1250 |
|
|
+ <td>$an |
1251 |
|
|
+ <input type="hidden" name="acctName" value="$an"> |
1252 |
|
|
+ <input type="hidden" name="action" value="modify"> |
1253 |
|
|
+ </td> |
1254 |
|
|
+ ); |
1255 |
|
|
+ # if there's no CGI data, fill in the fields with the account db |
1256 |
|
|
+ # data for this user |
1257 |
|
|
+ my $rec = $accountdb->get($an); |
1258 |
|
|
+ my $fn = $cgi->param('FirstName') ? |
1259 |
|
|
+ $cgi->param('FirstName') : |
1260 |
|
|
+ ($rec ? ($rec->prop('FirstName')) : ''); |
1261 |
|
|
+ my $ln = $cgi->param('LastName') ? |
1262 |
|
|
+ $cgi->param('LastName') : |
1263 |
|
|
+ ($rec ? ($rec->prop('LastName')) : ''); |
1264 |
|
|
+ my $dept = $cgi->param('Dept') ? |
1265 |
|
|
+ $cgi->param('Dept') : |
1266 |
|
|
+ ($rec ? ($rec->prop('Dept')) : ''); |
1267 |
|
|
+ my $company = $cgi->param('Company') ? |
1268 |
|
|
+ $cgi->param('Company') : |
1269 |
|
|
+ ($rec ? ($rec->prop('Company')) : ''); |
1270 |
|
|
+ my $street = $cgi->param('Street') ? |
1271 |
|
|
+ $cgi->param('Street') : |
1272 |
|
|
+ ($rec ? ($rec->prop('Street')) : ''); |
1273 |
|
|
+ my $city = $cgi->param('City') ? |
1274 |
|
|
+ $cgi->param('City') : |
1275 |
|
|
+ ($rec ? ($rec->prop('City')) : ''); |
1276 |
|
|
+ my $phone = $cgi->param('Phone') ? |
1277 |
|
|
+ $cgi->param('Phone') : |
1278 |
|
|
+ ($rec ? ($rec->prop('Phone')) : ''); |
1279 |
|
|
+ my $emf = $cgi->param('EmailForward') ? |
1280 |
|
|
+ $cgi->param('EmailForward') : |
1281 |
|
|
+ ($rec ? ($rec->prop('EmailForward')) : 'local'); |
1282 |
|
|
+ my $fwd = $cgi->param('ForwardAddress') ? |
1283 |
|
|
+ $cgi->param('ForwardAddress') : |
1284 |
|
|
+ ($rec ? ($rec->prop('ForwardAddress')) : ''); |
1285 |
|
|
+ my $pptp = $cgi->param('VPNClientAccess') ? |
1286 |
|
|
+ $cgi->param('VPNClientAccess') : |
1287 |
|
|
+ ($rec ? ($rec->prop('VPNClientAccess')) : 'no'); |
1288 |
|
|
+ # now that we're down with the 411, let's set the values |
1289 |
|
|
+ $cgi->param(-name=>'FirstName', -value=>$fn); |
1290 |
|
|
+ $cgi->param(-name=>'LastName', -value=>$ln); |
1291 |
|
|
+ $cgi->param(-name=>'Dept', -value=>$dept); |
1292 |
|
|
+ $cgi->param(-name=>'Company', -value=>$company); |
1293 |
|
|
+ $cgi->param(-name=>'Street', -value=>$street); |
1294 |
|
|
+ $cgi->param(-name=>'City', -value=>$city); |
1295 |
|
|
+ $cgi->param(-name=>'Phone', -value=>$phone); |
1296 |
|
|
+ $cgi->param(-name=>'EmailForward', -value=>$emf); |
1297 |
|
|
+ $cgi->param(-name=>'ForwardAddress', -value=>$fwd); |
1298 |
|
|
+ $cgi->param(-name=>'VPNClientAccess', -value=>$pptp); |
1299 |
|
|
+ } else { |
1300 |
|
|
+ print qq( |
1301 |
|
|
+ <td><input type="text" name="acctName" value="$an"> |
1302 |
|
|
+ <input type="hidden" name="action" value="create"> |
1303 |
|
|
+ </td> |
1304 |
|
|
+ ); |
1305 |
|
|
+ } |
1306 |
|
|
+ |
1307 |
|
|
+ print qq(</tr>\n); |
1308 |
|
|
+ return undef; |
1309 |
|
|
+ |
1310 |
|
|
+} |
1311 |
|
|
+ |
1312 |
|
|
+=head2 print_groupMemberships_field() |
1313 |
|
|
+ |
1314 |
|
|
+Builds a list of groups for the create/modify user screen. |
1315 |
|
|
+ |
1316 |
|
|
+=begin testing |
1317 |
|
|
+ |
1318 |
|
|
+my $self = esmith::FormMagick::Panel::useraccounts->new(); |
1319 |
|
|
+$self->{cgi} = CGI->new(""); |
1320 |
|
|
+$self->print_groupMemberships_field(); |
1321 |
|
|
+like($_STDOUT_, qr/simpsons/, "Found simpsons in group list"); |
1322 |
|
|
+like($_STDOUT_, qr/flanders/, "Found flanders in group list"); |
1323 |
|
|
+$self->{cgi}->param(-name => 'acctName', -value => 'rod'); |
1324 |
|
|
+$self->print_groupMemberships_field(); |
1325 |
|
|
+like($_STDOUT_, qr/checked value="flanders"/, "Checked flanders group for user rod"); |
1326 |
|
|
+ |
1327 |
|
|
+=end testing |
1328 |
|
|
+ |
1329 |
|
|
+=cut |
1330 |
|
|
+ |
1331 |
|
|
+sub print_groupMemberships_field { |
1332 |
|
|
+ my ($self) = @_; |
1333 |
|
|
+ my $q = $self->{cgi}; |
1334 |
|
|
+ my $user = $q->param('acctName'); |
1335 |
|
|
+ |
1336 |
|
|
+ if (my @groups = $accountdb->groups()) { |
1337 |
|
|
+ |
1338 |
|
|
+ print "<tr><td class=\"sme-noborders-label\">", |
1339 |
|
|
+ $self->localise('GROUP_MEMBERSHIPS'), |
1340 |
|
|
+ "</td><td>\n"; |
1341 |
|
|
+ |
1342 |
|
|
+ print $q->start_table({-class => "sme-border"}),"\n"; |
1343 |
|
|
+ print $q->Tr( |
1344 |
|
|
+ esmith::cgi::genSmallCell($q, $self->localise('MEMBER'),"header"), |
1345 |
|
|
+ esmith::cgi::genSmallCell($q, $self->localise('GROUP'),"header"), |
1346 |
|
|
+ esmith::cgi::genSmallCell($q, $self->localise('DESCRIPTION'),"header") |
1347 |
|
|
+ ); |
1348 |
|
|
+ |
1349 |
|
|
+ foreach my $g (@groups) { |
1350 |
|
|
+ my $groupname = $g->key(); |
1351 |
|
|
+ my $checked; |
1352 |
|
|
+ if ($user and $accountdb->is_user_in_group($user, $groupname)) { |
1353 |
|
|
+ $checked = 'checked'; |
1354 |
|
|
+ } else { |
1355 |
|
|
+ $checked = ''; |
1356 |
|
|
+ } |
1357 |
|
|
+ |
1358 |
|
|
+ print $q->Tr( |
1359 |
|
|
+ $q->td( |
1360 |
|
|
+ "<input type=\"checkbox\"" |
1361 |
|
|
+ . " name=\"groupMemberships\"" |
1362 |
|
|
+ . " $checked value=\"$groupname\">" |
1363 |
|
|
+ ), |
1364 |
|
|
+ esmith::cgi::genSmallCell($q, $groupname,"normal"), |
1365 |
|
|
+ esmith::cgi::genSmallCell( $q, $accountdb->get($groupname)->prop("Description"),"normal") |
1366 |
|
|
+ ); |
1367 |
|
|
+ } |
1368 |
|
|
+ |
1369 |
|
|
+ print "</table></td></tr>\n"; |
1370 |
|
|
+ |
1371 |
|
|
+ } |
1372 |
|
|
+ |
1373 |
|
|
+ return undef; |
1374 |
|
|
+ |
1375 |
|
|
+} |
1376 |
|
|
+ |
1377 |
|
|
+=head2 print_page_description($self, "reset|lock|remove") |
1378 |
|
|
+ |
1379 |
|
|
+Generates the page description for the the somewhat similar Reset |
1380 |
|
|
+Password, Lock Account and Remove Account pages. |
1381 |
|
|
+ |
1382 |
|
|
+=begin testing |
1383 |
|
|
+ |
1384 |
|
|
+my $self = esmith::FormMagick::Panel::useraccounts->new(); |
1385 |
|
|
+$self->{cgi} = CGI->new({ acctName => 'bart' }); |
1386 |
|
|
+print_page_description($self, "reset"); |
1387 |
|
|
+like($_STDOUT_, qr/bart/, "print_page_description prints username"); |
1388 |
|
|
+like($_STDOUT_, qr/Bart Simpson/, "print_page_description prints name"); |
1389 |
|
|
+like($_STDOUT_, qr/RESET_DESC/, "print_page_description prints description"); |
1390 |
|
|
+ |
1391 |
|
|
+=end testing |
1392 |
|
|
+ |
1393 |
|
|
+=cut |
1394 |
|
|
+ |
1395 |
|
|
+sub print_page_description { |
1396 |
|
|
+ my ($self, $pagename) = @_; |
1397 |
|
|
+ unless (grep /^$pagename$/, qw(reset lock remove)) { |
1398 |
|
|
+ warn "Can't generate page description for invalid pagename $pagename\n"; |
1399 |
|
|
+ return; |
1400 |
|
|
+ } |
1401 |
|
|
+ |
1402 |
|
|
+ $pagename = uc($pagename); |
1403 |
|
|
+ |
1404 |
|
|
+ my $desc = $self->localise("${pagename}_DESC"); |
1405 |
|
|
+ my $desc2 = $self->localise("${pagename}_DESC2"); |
1406 |
|
|
+ |
1407 |
|
|
+ my $acctName = $self->{cgi}->param('acctName'); |
1408 |
|
|
+ my $name = $accountdb->get($acctName)->prop('FirstName') . " " |
1409 |
|
|
+ . $accountdb->get($acctName)->prop('LastName'); |
1410 |
|
|
+ |
1411 |
|
|
+ print qq{ |
1412 |
|
|
+ <tr><td colspan="2"> |
1413 |
|
|
+ <p>$desc "$acctName" ($name)</p> |
1414 |
|
|
+ $desc2 |
1415 |
|
|
+ <input type="hidden" name="acctName" value="$acctName"> |
1416 |
|
|
+ </td></tr> |
1417 |
|
|
+ }; |
1418 |
|
|
+ |
1419 |
|
|
+ return; |
1420 |
|
|
+} |
1421 |
|
|
+ |
1422 |
|
|
+=head1 ROUTINES FOR FILLING IN FIELD DEFAULT VALUES |
1423 |
|
|
+ |
1424 |
|
|
+=head2 get_ldap_value($field) |
1425 |
|
|
+ |
1426 |
|
|
+This subroutine generates the default field value on the form using the |
1427 |
|
|
+parameter specified. |
1428 |
|
|
+ |
1429 |
|
|
+In this case, the default field values come from LDAP/directory |
1430 |
|
|
+settings. |
1431 |
|
|
+ |
1432 |
|
|
+If a CGI parameter has been passed that contains an account name, we |
1433 |
|
|
+assume that a value has already been set, as we're modifying a user, and |
1434 |
|
|
+use that value instead of a default. |
1435 |
|
|
+ |
1436 |
|
|
+=for testing |
1437 |
|
|
+my $self = esmith::FormMagick::Panel::useraccounts->new(); |
1438 |
|
|
+$self->{cgi} = CGI->new(""); |
1439 |
|
|
+is(get_ldap_value($self, "Dept"), "Main", "Pick up default value from LDAP"); |
1440 |
|
|
+$self->{cgi} = CGI->new({ acctName => 'bart' }); |
1441 |
|
|
+is(get_ldap_value($self, "Dept"), undef, "Don't pick up LDAP data if username provided"); |
1442 |
|
|
+ |
1443 |
|
|
+=cut |
1444 |
|
|
+ |
1445 |
|
|
+sub get_ldap_value { |
1446 |
|
|
+ my ($self, $field) = @_; |
1447 |
|
|
+ |
1448 |
|
|
+ # don't do the lookup if this is a modification of an existing user |
1449 |
|
|
+ if ($self->{cgi}->param('acctName')) { |
1450 |
|
|
+ return $self->{cgi}->param($field); |
1451 |
|
|
+ } |
1452 |
|
|
+ |
1453 |
|
|
+ my %CGIParam2DBfield = ( |
1454 |
|
|
+ Dept => 'defaultDepartment', |
1455 |
|
|
+ Company => 'defaultCompany', |
1456 |
|
|
+ Street => 'defaultStreet', |
1457 |
|
|
+ City => 'defaultCity', |
1458 |
|
|
+ Phone => 'defaultPhoneNumber' |
1459 |
|
|
+ ); |
1460 |
|
|
+ |
1461 |
|
|
+ return $configdb->get('ldap')->prop($CGIParam2DBfield{$field}); |
1462 |
|
|
+} |
1463 |
|
|
+ |
1464 |
|
|
+sub get_pptp_value |
1465 |
|
|
+{ |
1466 |
|
|
+ return $configdb->get('pptpd')->prop('AccessDefault') || 'no'; |
1467 |
|
|
+} |
1468 |
|
|
+ |
1469 |
|
|
+=head1 VALIDATION ROUTINES |
1470 |
|
|
+ |
1471 |
|
|
+=head2 pseudonym_clash |
1472 |
|
|
+ |
1473 |
|
|
+Validation routine to check whether a the first/last names clash with |
1474 |
|
|
+existing pseudonyms. |
1475 |
|
|
+ |
1476 |
|
|
+Note that it won't be considered a "clash" if there is an existing |
1477 |
|
|
+pseudonym which belongs to the same user -- it's only a clash if the |
1478 |
|
|
+generated pseudonyms are the same but the usernames aren't. |
1479 |
|
|
+ |
1480 |
|
|
+=begin testing |
1481 |
|
|
+ |
1482 |
|
|
+my $self = esmith::FormMagick::Panel::useraccounts->new(); |
1483 |
|
|
+ |
1484 |
|
|
+$self->{cgi} = CGI->new({ |
1485 |
|
|
+ acctName => 'skud', |
1486 |
|
|
+ FirstName => 'Kirrily', |
1487 |
|
|
+ LastName => 'Robert' |
1488 |
|
|
+}); |
1489 |
|
|
+ |
1490 |
|
|
+is (pseudonym_clash($self, 'Kirrily'), "OK", "New name doesn't clash pseudonyms"); |
1491 |
|
|
+ |
1492 |
|
|
+$self->{cgi} = CGI->new({ |
1493 |
|
|
+ acctName => 'bart2', |
1494 |
|
|
+ FirstName => 'Bart', |
1495 |
|
|
+ LastName => 'Simpson' |
1496 |
|
|
+}); |
1497 |
|
|
+ |
1498 |
|
|
+isnt(pseudonym_clash($self, 'Bart'), "OK", "Existing pseudonym with non-matching username causes clash"); |
1499 |
|
|
+ |
1500 |
|
|
+$self->{cgi} = CGI->new({ |
1501 |
|
|
+ acctName => 'bart', |
1502 |
|
|
+ FirstName => 'Bart', |
1503 |
|
|
+ LastName => 'Simpson' |
1504 |
|
|
+}); |
1505 |
|
|
+ |
1506 |
|
|
+is(pseudonym_clash($self, 'Bart'), "OK", "Existing pseudonym with matching username shouldn't clash"); |
1507 |
|
|
+ |
1508 |
|
|
+=end testing |
1509 |
|
|
+ |
1510 |
|
|
+=cut |
1511 |
|
|
+ |
1512 |
|
|
+sub pseudonym_clash { |
1513 |
|
|
+ my ($self, $first) = @_; |
1514 |
|
|
+ $first ||= ""; |
1515 |
|
|
+ my $last = $self->{cgi}->param('LastName') || ""; |
1516 |
|
|
+ my $acctName = $self->{cgi}->param('acctName') || ""; |
1517 |
|
|
+ |
1518 |
|
|
+ my $up = "$first $last"; |
1519 |
|
|
+ |
1520 |
|
|
+ $up =~ s/^\s+//; |
1521 |
|
|
+ $up =~ s/\s+$//; |
1522 |
|
|
+ $up =~ s/\s+/ /g; |
1523 |
|
|
+ $up =~ s/\s/_/g; |
1524 |
|
|
+ |
1525 |
|
|
+ my $dp = $up; |
1526 |
|
|
+ $dp =~ s/_/./g; |
1527 |
|
|
+ |
1528 |
|
|
+ $dp = $accountdb->get($dp); |
1529 |
|
|
+ $up = $accountdb->get($up); |
1530 |
|
|
+ |
1531 |
|
|
+ my $da = $dp->prop('Account') if $dp; |
1532 |
|
|
+ my $ua = $up->prop('Account') if $up; |
1533 |
|
|
+ if ($dp and $da and $da ne $acctName) |
1534 |
|
|
+ { |
1535 |
|
|
+ return $self->localise('PSEUDONYM_CLASH', |
1536 |
|
|
+ { |
1537 |
|
|
+ acctName => $acctName, |
1538 |
|
|
+ clashName => $da, |
1539 |
|
|
+ pseudonym => $dp->key |
1540 |
|
|
+ }); |
1541 |
|
|
+ } |
1542 |
|
|
+ elsif ($up and $ua and $ua ne $acctName) |
1543 |
|
|
+ { |
1544 |
|
|
+ return $self->localise('PSEUDONYM_CLASH', |
1545 |
|
|
+ { |
1546 |
|
|
+ acctName => $acctName, |
1547 |
|
|
+ clashName => $ua, |
1548 |
|
|
+ pseudonym => $up->key |
1549 |
|
|
+ }); |
1550 |
|
|
+ } |
1551 |
|
|
+ else |
1552 |
|
|
+ { |
1553 |
|
|
+ return "OK"; |
1554 |
|
|
+ } |
1555 |
|
|
+} |
1556 |
|
|
+ |
1557 |
|
|
+=head2 emailforward() |
1558 |
|
|
+ |
1559 |
|
|
+Validation routine for email forwarding |
1560 |
|
|
+ |
1561 |
|
|
+=cut |
1562 |
|
|
+ |
1563 |
|
|
+sub emailforward { |
1564 |
|
|
+ my ($self, $data) = @_; |
1565 |
|
|
+ my $response = $self->email_simple($data); |
1566 |
|
|
+ if ($response eq "OK") |
1567 |
|
|
+ { |
1568 |
|
|
+ return "OK"; |
1569 |
|
|
+ } |
1570 |
|
|
+ elsif ($data eq "") |
1571 |
|
|
+ { |
1572 |
|
|
+ # Blank is ok, only if we're not forwarding, which means that the |
1573 |
|
|
+ # EmailForward param must be set to 'local'. |
1574 |
|
|
+ my $email_forward = $self->{cgi}->param('EmailForward') || ''; |
1575 |
|
|
+ $email_forward =~ s/^\s+|\s+$//g; |
1576 |
|
|
+ return 'OK' if $email_forward eq 'local'; |
1577 |
|
|
+ return $self->localise('CANNOT_CONTAIN_WHITESPACE'); |
1578 |
|
|
+ } |
1579 |
|
|
+ else |
1580 |
|
|
+ { |
1581 |
|
|
+ return $self->localise('CANNOT_CONTAIN_WHITESPACE') |
1582 |
|
|
+ if ( $data =~ /\s+/ ); |
1583 |
|
|
+ # Permit a local address. |
1584 |
|
|
+ return "OK" if $data =~ /^[a-zA-Z][a-zA-Z0-9\._\-]*$/; |
1585 |
|
|
+ return $self->localise('UNACCEPTABLE_CHARS'); |
1586 |
|
|
+ } |
1587 |
|
|
+} |
1588 |
|
|
+ |
1589 |
|
|
+=head2 verifyPasswords() |
1590 |
|
|
+ |
1591 |
|
|
+Returns an error message if the two new passwords input don't match. |
1592 |
|
|
+ |
1593 |
|
|
+=cut |
1594 |
|
|
+ |
1595 |
|
|
+sub verifyPasswords { |
1596 |
|
|
+ my $self = shift; |
1597 |
|
|
+ my $pass2 = shift; |
1598 |
|
|
+ |
1599 |
|
|
+ my $pass1 = $self->{cgi}->param('password1'); |
1600 |
|
|
+ unless ($pass1 eq $pass2) { |
1601 |
|
|
+ $self->{cgi}->param( -name => 'wherenext', -value => 'Password' ); |
1602 |
|
|
+ return "PASSWORD_VERIFY_ERROR"; |
1603 |
|
|
+ } |
1604 |
|
|
+ return "OK"; |
1605 |
|
|
+} |
1606 |
|
|
+ |
1607 |
|
|
+=head1 CREATING AND MODIFYING USERS |
1608 |
|
|
+ |
1609 |
|
|
+=head2 handle_user_accounts() |
1610 |
|
|
+ |
1611 |
|
|
+This is the routine called by the "Save" button on the create/modify page. |
1612 |
|
|
+It checks the "action" param and calls either create_user() or modify_user() |
1613 |
|
|
+as appropriate. |
1614 |
|
|
+ |
1615 |
|
|
+=cut |
1616 |
|
|
+ |
1617 |
|
|
+sub handle_user_accounts { |
1618 |
|
|
+ my ($self) = @_; |
1619 |
|
|
+ |
1620 |
|
|
+ my $cgi = $self->{cgi}; |
1621 |
|
|
+ |
1622 |
|
|
+ if ($cgi->param("action") eq "create") { |
1623 |
|
|
+ my $msg = create_user($self); |
1624 |
|
|
+ if ($msg eq 'USER_CREATED') |
1625 |
|
|
+ { |
1626 |
|
|
+ $self->success($msg); |
1627 |
|
|
+ } |
1628 |
|
|
+ else |
1629 |
|
|
+ { |
1630 |
|
|
+ $self->error($msg); |
1631 |
|
|
+ } |
1632 |
|
|
+ } |
1633 |
|
|
+ else { |
1634 |
|
|
+ modify_user($self); |
1635 |
|
|
+ $self->success('USER_MODIFIED'); |
1636 |
|
|
+ } |
1637 |
|
|
+} |
1638 |
|
|
+ |
1639 |
|
|
+=head2 print_save_or_add_button() |
1640 |
|
|
+ |
1641 |
|
|
+=cut |
1642 |
|
|
+ |
1643 |
|
|
+sub print_save_or_add_button { |
1644 |
|
|
+ |
1645 |
|
|
+ my ($self) = @_; |
1646 |
|
|
+ |
1647 |
|
|
+ my $cgi = $self->{cgi}; |
1648 |
|
|
+ |
1649 |
|
|
+ if (($cgi->param("action") || '') eq "modify") { |
1650 |
|
|
+ $self->print_button("SAVE"); |
1651 |
|
|
+ } else { |
1652 |
|
|
+ $self->print_button("ADD"); |
1653 |
|
|
+ } |
1654 |
|
|
+ |
1655 |
|
|
+} |
1656 |
|
|
+ |
1657 |
|
|
+=head2 modify_admin($self) |
1658 |
|
|
+ |
1659 |
|
|
+=cut |
1660 |
|
|
+ |
1661 |
|
|
+sub modify_admin |
1662 |
|
|
+{ |
1663 |
|
|
+ my ($self) = @_; |
1664 |
|
|
+ |
1665 |
|
|
+ my $acct = $accountdb->get('admin'); |
1666 |
|
|
+ |
1667 |
|
|
+ my %newProperties = ( |
1668 |
|
|
+ 'FirstName' => $self->{cgi}->param('FirstName'), |
1669 |
|
|
+ 'LastName' => $self->{cgi}->param('LastName'), |
1670 |
|
|
+ 'EmailForward' => $self->{cgi}->param('EmailForward'), |
1671 |
|
|
+ 'ForwardAddress' => $self->{cgi}->param('ForwardAddress'), |
1672 |
|
|
+ 'VPNClientAccess'=> $self->{cgi}->param('VPNClientAccess'), |
1673 |
|
|
+ ); |
1674 |
|
|
+ |
1675 |
|
|
+ $acct->merge_props(%newProperties); |
1676 |
|
|
+ |
1677 |
|
|
+ undef $accountdb; |
1678 |
|
|
+ |
1679 |
|
|
+ my $status = |
1680 |
|
|
+ system ("/sbin/e-smith/signal-event", "user-modify-admin", 'admin'); |
1681 |
|
|
+ |
1682 |
|
|
+ $accountdb = esmith::AccountsDB->open(); |
1683 |
|
|
+ |
1684 |
|
|
+ if ($status == 0) |
1685 |
|
|
+ { |
1686 |
|
|
+ $self->success('USER_MODIFIED', 'First'); |
1687 |
|
|
+ } |
1688 |
|
|
+ else |
1689 |
|
|
+ { |
1690 |
|
|
+ $self->error('CANNOT_MODIFY_USER', 'First'); |
1691 |
|
|
+ } |
1692 |
|
|
+ return; |
1693 |
|
|
+} |
1694 |
|
|
+ |
1695 |
|
|
+=head2 modify_user($self) |
1696 |
|
|
+ |
1697 |
|
|
+=cut |
1698 |
|
|
+ |
1699 |
|
|
+sub modify_user { |
1700 |
|
|
+ my ($self) = @_; |
1701 |
|
|
+ my $acctName = $self->{cgi}->param('acctName'); |
1702 |
|
|
+ |
1703 |
|
|
+ unless (($acctName) = ($acctName =~ /^(\w[\-\w_\.]*)$/)) { |
1704 |
|
|
+ return $self->error($self->localise('TAINTED_USER', |
1705 |
|
|
+ { acctName => $acctName })); |
1706 |
|
|
+ } |
1707 |
|
|
+ # Untaint the username before use in system() |
1708 |
|
|
+ $acctName = $1; |
1709 |
|
|
+ |
1710 |
|
|
+ my $acct = $accountdb->get($acctName); |
1711 |
|
|
+ my $acctType = $acct->prop('type'); |
1712 |
|
|
+ |
1713 |
|
|
+ if ($acctType eq "user") |
1714 |
|
|
+ { |
1715 |
|
|
+ $accountdb->remove_user_auto_pseudonyms($acctName); |
1716 |
|
|
+ my %newProperties = ( |
1717 |
|
|
+ 'FirstName' => $self->{cgi}->param('FirstName'), |
1718 |
|
|
+ 'LastName' => $self->{cgi}->param('LastName'), |
1719 |
|
|
+ 'Phone' => $self->{cgi}->param('Phone'), |
1720 |
|
|
+ 'Company' => $self->{cgi}->param('Company'), |
1721 |
|
|
+ 'Dept' => $self->{cgi}->param('Dept'), |
1722 |
|
|
+ 'City' => $self->{cgi}->param('City'), |
1723 |
|
|
+ 'Street' => $self->{cgi}->param('Street'), |
1724 |
|
|
+ 'EmailForward' => $self->{cgi}->param('EmailForward'), |
1725 |
|
|
+ 'ForwardAddress' => $self->{cgi}->param('ForwardAddress'), |
1726 |
|
|
+ 'VPNClientAccess'=> $self->{cgi}->param('VPNClientAccess'), |
1727 |
|
|
+ ); |
1728 |
|
|
+ |
1729 |
|
|
+ $acct->merge_props(%newProperties); |
1730 |
|
|
+ |
1731 |
|
|
+ $accountdb->create_user_auto_pseudonyms($acctName); |
1732 |
|
|
+ |
1733 |
|
|
+ my @old_groups = $accountdb->user_group_list($acctName); |
1734 |
|
|
+ my @new_groups = $self->{cgi}->param("groupMemberships"); |
1735 |
|
|
+ $accountdb->remove_user_from_groups($acctName, @old_groups); |
1736 |
|
|
+ $accountdb->add_user_to_groups($acctName, @new_groups); |
1737 |
|
|
+ |
1738 |
|
|
+ undef $accountdb; |
1739 |
|
|
+ |
1740 |
|
|
+ unless (system ("/sbin/e-smith/signal-event", "user-modify", |
1741 |
|
|
+ $acctName) == 0) { |
1742 |
|
|
+ $accountdb = esmith::AccountsDB->open(); |
1743 |
|
|
+ return $self->error('CANNOT_MODIFY_USER'); |
1744 |
|
|
+ } |
1745 |
|
|
+ $accountdb = esmith::AccountsDB->open(); |
1746 |
|
|
+ } |
1747 |
|
|
+ $self->success('USER_MODIFIED'); |
1748 |
|
|
+} |
1749 |
|
|
+ |
1750 |
|
|
+=head2 create_user |
1751 |
|
|
+ |
1752 |
|
|
+Adds a user to the accounts db. |
1753 |
|
|
+ |
1754 |
|
|
+=cut |
1755 |
|
|
+ |
1756 |
|
|
+sub create_user { |
1757 |
|
|
+ my $self = shift; |
1758 |
|
|
+ my $q = $self->{cgi}; |
1759 |
|
|
+ |
1760 |
|
|
+ my $acctName = $q->param('acctName'); |
1761 |
|
|
+ |
1762 |
|
|
+ my $msg = $self->validate_acctName($acctName); |
1763 |
|
|
+ unless ($msg eq "OK") |
1764 |
|
|
+ { |
1765 |
|
|
+ return $msg; |
1766 |
|
|
+ } |
1767 |
|
|
+ |
1768 |
|
|
+ $msg = $self->validate_acctName_length($acctName); |
1769 |
|
|
+ unless ($msg eq "OK") |
1770 |
|
|
+ { |
1771 |
|
|
+ return $msg; |
1772 |
|
|
+ } |
1773 |
|
|
+ |
1774 |
|
|
+ $msg = $self->validate_acctName_conflict($acctName); |
1775 |
|
|
+ unless ($msg eq "OK") |
1776 |
|
|
+ { |
1777 |
|
|
+ return $msg; |
1778 |
|
|
+ } |
1779 |
|
|
+ |
1780 |
|
|
+ my %userprops; |
1781 |
|
|
+ foreach my $field ( qw( FirstName LastName Phone Company Dept |
1782 |
|
|
+ City Street EmailForward ForwardAddress VPNClientAccess) ) |
1783 |
|
|
+ { |
1784 |
|
|
+ $userprops{$field} = $q->param($field); |
1785 |
|
|
+ } |
1786 |
|
|
+ $userprops{'PasswordSet'} = "no"; |
1787 |
|
|
+ $userprops{'type'} = 'user'; |
1788 |
|
|
+ |
1789 |
|
|
+ my $acct = $accountdb->new_record($acctName) |
1790 |
|
|
+ or warn "Can't create new account for $acctName (does it already exist?)\n"; |
1791 |
|
|
+ $acct->reset_props(%userprops); |
1792 |
|
|
+ $accountdb->create_user_auto_pseudonyms($acctName); |
1793 |
|
|
+ my @groups = $self->{cgi}->param("groupMemberships"); |
1794 |
|
|
+ $accountdb->add_user_to_groups($acctName, @groups); |
1795 |
|
|
+ |
1796 |
|
|
+ undef $accountdb; |
1797 |
|
|
+ |
1798 |
|
|
+ # Untaint the username before use in system() |
1799 |
|
|
+ $acctName =~ /^(\w[\-\w_\.]*)$/; |
1800 |
|
|
+ $acctName = $1; |
1801 |
|
|
+ |
1802 |
|
|
+ if (system ("/sbin/e-smith/signal-event", "user-create", $acctName)) |
1803 |
|
|
+ { |
1804 |
|
|
+ $accountdb = esmith::AccountsDB->open(); |
1805 |
|
|
+ return $self->localise("ERR_OCCURRED_CREATING"); |
1806 |
|
|
+ } |
1807 |
|
|
+ |
1808 |
|
|
+ $accountdb = esmith::AccountsDB->open(); |
1809 |
|
|
+ |
1810 |
|
|
+ $self->set_groups(); |
1811 |
|
|
+ return 'USER_CREATED'; |
1812 |
|
|
+} |
1813 |
|
|
+ |
1814 |
|
|
+=head2 set_groups |
1815 |
|
|
+ |
1816 |
|
|
+Sets a user's groups in the accounts db. This is called as part of the |
1817 |
|
|
+create_user() routine. |
1818 |
|
|
+ |
1819 |
|
|
+=cut |
1820 |
|
|
+ |
1821 |
|
|
+sub set_groups |
1822 |
|
|
+{ |
1823 |
|
|
+ my $self = shift; |
1824 |
|
|
+ my $q = $self->{cgi}; |
1825 |
|
|
+ my $acctName = $q->param('acctName'); |
1826 |
|
|
+ |
1827 |
|
|
+ my @groups = $q->param('groupMemberships'); |
1828 |
|
|
+ $accountdb->set_user_groups($acctName, @groups); |
1829 |
|
|
+ |
1830 |
|
|
+} |
1831 |
|
|
+ |
1832 |
|
|
+=head1 REMOVING ACCOUNTS |
1833 |
|
|
+ |
1834 |
|
|
+=head2 remove_account() |
1835 |
|
|
+ |
1836 |
|
|
+=cut |
1837 |
|
|
+ |
1838 |
|
|
+sub remove_account { |
1839 |
|
|
+ my ($self) = @_; |
1840 |
|
|
+ my $acctName = $self->{cgi}->param('acctName'); |
1841 |
|
|
+ |
1842 |
|
|
+ my $acct = $accountdb->get($acctName); |
1843 |
|
|
+ if ($acct->prop('type') eq "user") { |
1844 |
|
|
+ $acct->set_prop('type', "user-deleted"); |
1845 |
|
|
+ |
1846 |
|
|
+ undef $accountdb; |
1847 |
|
|
+ |
1848 |
|
|
+ # Untaint the username before use in system() |
1849 |
|
|
+ $acctName =~ /^(\w[\-\w_\.]*)$/; |
1850 |
|
|
+ $acctName = $1; |
1851 |
|
|
+ if (system ("/sbin/e-smith/signal-event", "user-delete", $acctName)) |
1852 |
|
|
+ { |
1853 |
|
|
+ $accountdb = esmith::AccountsDB->open(); |
1854 |
|
|
+ return $self->error("ERR_OCCURRED_DELETING"); |
1855 |
|
|
+ } |
1856 |
|
|
+ |
1857 |
|
|
+ $accountdb = esmith::AccountsDB->open(); |
1858 |
|
|
+ $accountdb->get($acctName)->delete; |
1859 |
|
|
+ |
1860 |
|
|
+ } else { |
1861 |
|
|
+ # FIXME - this should be handled by input validation |
1862 |
|
|
+ # XXX error message here |
1863 |
|
|
+ } |
1864 |
|
|
+ $self->{cgi}->param(-name => 'wherenext', -value => 'First'); |
1865 |
|
|
+} |
1866 |
|
|
+ |
1867 |
|
|
+=head1 RESETTING THE PASSWORD |
1868 |
|
|
+ |
1869 |
|
|
+=head2 reset_password() |
1870 |
|
|
+ |
1871 |
|
|
+=cut |
1872 |
|
|
+ |
1873 |
|
|
+sub reset_password { |
1874 |
|
|
+ my ($self) = @_; |
1875 |
|
|
+ my $acctName = $self->{cgi}->param('acctName'); |
1876 |
|
|
+ |
1877 |
|
|
+ unless (($acctName) = ($acctName =~ /^(\w[\-\w_\.]*)$/)) { |
1878 |
|
|
+ return $self->error('TAINTED_USER'); |
1879 |
|
|
+ } |
1880 |
|
|
+ $acctName = $1; |
1881 |
|
|
+ |
1882 |
|
|
+ my $acct = $accountdb->get($acctName); |
1883 |
|
|
+ |
1884 |
|
|
+ if ( $acct->prop('type') eq "user") |
1885 |
|
|
+ { |
1886 |
|
|
+ esmith::util::setUserPassword ($acctName, |
1887 |
|
|
+ $self->{cgi}->param('password1')); |
1888 |
|
|
+ |
1889 |
|
|
+ $acct->set_prop("PasswordSet", "yes"); |
1890 |
|
|
+ undef $accountdb; |
1891 |
|
|
+ |
1892 |
|
|
+ if (system("/sbin/e-smith/signal-event", "password-modify", $acctName)) |
1893 |
|
|
+ { |
1894 |
|
|
+ $accountdb = esmith::AccountsDB->open(); |
1895 |
|
|
+ $self->error("ERR_OCCURRED_MODIFYING_PASSWORD"); |
1896 |
|
|
+ } |
1897 |
|
|
+ $accountdb = esmith::AccountsDB->open(); |
1898 |
|
|
+ |
1899 |
|
|
+ $self->success($self->localise('PASSWORD_CHANGE_SUCCEEDED', |
1900 |
|
|
+ { acctName => $acctName})); |
1901 |
|
|
+ } |
1902 |
|
|
+ else |
1903 |
|
|
+ { |
1904 |
|
|
+ $self->error($self->localise('NO_SUCH_USER', |
1905 |
|
|
+ { acctName => $acctName})); |
1906 |
|
|
+ } |
1907 |
|
|
+} |
1908 |
|
|
+ |
1909 |
|
|
+=head1 LOCKING AN ACCOUNT |
1910 |
|
|
+ |
1911 |
|
|
+=head2 lock_account() |
1912 |
|
|
+ |
1913 |
|
|
+=cut |
1914 |
|
|
+ |
1915 |
|
|
+sub lock_account { |
1916 |
|
|
+ my ($self) = @_; |
1917 |
|
|
+ my $acctName = $self->{cgi}->param('acctName'); |
1918 |
|
|
+ my $acct = $accountdb->get($acctName); |
1919 |
|
|
+ if ($acct->prop('type') eq "user") |
1920 |
|
|
+ { |
1921 |
|
|
+ undef $accountdb; |
1922 |
|
|
+ |
1923 |
|
|
+ # Untaint the username before use in system() |
1924 |
|
|
+ $acctName =~ /^(\w[\-\w_\.]*)$/; |
1925 |
|
|
+ $acctName = $1; |
1926 |
|
|
+ if (system("/sbin/e-smith/signal-event", "user-lock", $acctName)) |
1927 |
|
|
+ { |
1928 |
|
|
+ $accountdb = esmith::AccountsDB->open(); |
1929 |
|
|
+ return $self->error("ERR_OCCURRED_LOCKING"); |
1930 |
|
|
+ } |
1931 |
|
|
+ |
1932 |
|
|
+ $accountdb = esmith::AccountsDB->open(); |
1933 |
|
|
+ |
1934 |
|
|
+ $self->success($self->localise('LOCKED_ACCOUNT', |
1935 |
|
|
+ { acctName => $acctName})); |
1936 |
|
|
+ } |
1937 |
|
|
+ else |
1938 |
|
|
+ { |
1939 |
|
|
+ $self->error($self->localise('NO_SUCH_USER', |
1940 |
|
|
+ { acctName => $acctName})); |
1941 |
|
|
+ } |
1942 |
|
|
+} |
1943 |
|
|
+ |
1944 |
|
|
+ |
1945 |
|
|
+=head1 MISCELLANEOUS ROUTINES |
1946 |
|
|
+ |
1947 |
|
|
+=head2 build_user_cgi_params() |
1948 |
|
|
+ |
1949 |
|
|
+Builds a CGI query string based on user data, using various sensible |
1950 |
|
|
+defaults and esmith::FormMagick's props_to_query_string() method. |
1951 |
|
|
+ |
1952 |
|
|
+=cut |
1953 |
|
|
+ |
1954 |
|
|
+sub build_user_cgi_params { |
1955 |
|
|
+ my ($self, $acctName, %oldprops) = @_; |
1956 |
|
|
+ |
1957 |
|
|
+ my %props = ( |
1958 |
|
|
+ page => 0, |
1959 |
|
|
+ page_stack => "", |
1960 |
|
|
+ ".id" => $self->{cgi}->param('.id') || "", |
1961 |
|
|
+ acctName => $acctName, |
1962 |
|
|
+ #%oldprops |
1963 |
|
|
+ ); |
1964 |
|
|
+ |
1965 |
|
|
+ return $self->props_to_query_string(\%props); |
1966 |
|
|
+} |
1967 |
|
|
+ |
1968 |
|
|
+=pod |
1969 |
|
|
+ |
1970 |
|
|
+=head2 validate_acctName |
1971 |
|
|
+ |
1972 |
|
|
+Checks that the name supplied does not contain any unacceptable chars. |
1973 |
|
|
+Returns OK on success or a localised error message otherwise. |
1974 |
|
|
+ |
1975 |
|
|
+=for testing |
1976 |
|
|
+is($panel->validate_acctName('foo'), 'OK', 'validate_acctName'); |
1977 |
|
|
+isnt($panel->validate_acctName('3amigos'), 'OK', ' .. cannot start with number'); |
1978 |
|
|
+isnt($panel->validate_acctName('betty ford'), 'OK', ' .. cannot contain space'); |
1979 |
|
|
+ |
1980 |
|
|
+=cut |
1981 |
|
|
+ |
1982 |
|
|
+sub validate_acctName |
1983 |
|
|
+{ |
1984 |
|
|
+ my ($self, $acctName) = @_; |
1985 |
|
|
+ |
1986 |
|
|
+ unless ($accountdb->validate_account_name($acctName)) |
1987 |
|
|
+ { |
1988 |
|
|
+ return $self->localise('ACCT_NAME_HAS_INVALID_CHARS', |
1989 |
|
|
+ {acctName => $acctName}); |
1990 |
|
|
+ } |
1991 |
|
|
+ return "OK"; |
1992 |
|
|
+} |
1993 |
|
|
+ |
1994 |
|
|
+=head2 validate_account_length FM ACCOUNTNAME |
1995 |
|
|
+ |
1996 |
|
|
+returns 'OK' if the account name is shorter than the maximum account name length |
1997 |
|
|
+returns 'ACCOUNT_TOO_LONG' otherwise |
1998 |
|
|
+ |
1999 |
|
|
+=begin testing |
2000 |
|
|
+ |
2001 |
|
|
+ok(($panel->validate_acctName_length('foo') eq 'OK'), "a short account name passes"); |
2002 |
|
|
+ok(($panel->validate_acctName_length('fooooooooooooooooo') eq 'ACCOUNT_TOO_LONG'), "a long account name fails"); |
2003 |
|
|
+ |
2004 |
|
|
+=end testing |
2005 |
|
|
+ |
2006 |
|
|
+=cut |
2007 |
|
|
+ |
2008 |
|
|
+sub validate_acctName_length { |
2009 |
|
|
+ my $self = shift; |
2010 |
|
|
+ my $acctName = shift; |
2011 |
|
|
+ |
2012 |
|
|
+ |
2013 |
|
|
+ my $maxAcctNameLength = ($configdb->get('maxAcctNameLength') |
2014 |
|
|
+ ? $configdb->get('maxAcctNameLength')->prop('type') |
2015 |
|
|
+ : "") || 12; |
2016 |
|
|
+ |
2017 |
|
|
+ if ( length $acctName > $maxAcctNameLength ) { |
2018 |
|
|
+ |
2019 |
|
|
+ return $self->localise('ACCOUNT_TOO_LONG', |
2020 |
|
|
+ {maxLength => $maxAcctNameLength}); |
2021 |
|
|
+ } |
2022 |
|
|
+ else { |
2023 |
|
|
+ return ('OK'); |
2024 |
|
|
+ } |
2025 |
|
|
+} |
2026 |
|
|
+ |
2027 |
|
|
+=head2 validate_acctName_conflict |
2028 |
|
|
+ |
2029 |
|
|
+Returns 'OK' if the account name doesn't yet exist. Returns a localised error |
2030 |
|
|
+otherwise. |
2031 |
|
|
+ |
2032 |
|
|
+=cut |
2033 |
|
|
+ |
2034 |
|
|
+sub validate_acctName_conflict |
2035 |
|
|
+{ |
2036 |
|
|
+ my $self = shift; |
2037 |
|
|
+ my $acctName = shift; |
2038 |
|
|
+ |
2039 |
|
|
+ my $account = $accountdb->get($acctName); |
2040 |
|
|
+ my $type; |
2041 |
|
|
+ |
2042 |
|
|
+ if (defined $account) |
2043 |
|
|
+ { |
2044 |
|
|
+ $type = $account->prop('type'); |
2045 |
|
|
+ } |
2046 |
|
|
+ elsif (defined getpwnam($acctName) || defined getgrnam($acctName)) |
2047 |
|
|
+ { |
2048 |
|
|
+ $type = "system"; |
2049 |
|
|
+ } |
2050 |
|
|
+ else |
2051 |
|
|
+ { |
2052 |
|
|
+ return('OK'); |
2053 |
|
|
+ } |
2054 |
|
|
+ return $self->localise('ACCOUNT_CONFLICT', |
2055 |
|
|
+ { account => $acctName, |
2056 |
|
|
+ type => $type, |
2057 |
|
|
+}); |
2058 |
|
|
+} |
2059 |
|
|
+ |
2060 |
|
|
+=head2 check_password |
2061 |
|
|
+ |
2062 |
|
|
+Validates the password using the desired strength |
2063 |
|
|
+ |
2064 |
|
|
+=cut |
2065 |
|
|
+ |
2066 |
|
|
+sub check_password { |
2067 |
|
|
+ my $self = shift; |
2068 |
|
|
+ my $pass1 = shift; |
2069 |
|
|
+ |
2070 |
|
|
+ my $check_type; |
2071 |
|
|
+ my $rec = $configdb->get('passwordstrength'); |
2072 |
|
|
+ $check_type = ($rec ? ($rec->prop('Users') || 'none') : 'none'); |
2073 |
|
|
+ |
2074 |
|
|
+ return $self->validate_password($check_type,$pass1); |
2075 |
|
|
+} |
2076 |
|
|
+ |
2077 |
|
|
+ |
2078 |
|
|
+=head2 get_prop ITEM PROP |
2079 |
|
|
+ |
2080 |
|
|
+A simple accessor for esmith::ConfigDB::Record::prop |
2081 |
|
|
+ |
2082 |
|
|
+=cut |
2083 |
|
|
+ |
2084 |
|
|
+sub get_prop |
2085 |
|
|
+{ |
2086 |
|
|
+ my ($fm, $item, $prop, $default) = @_; |
2087 |
|
|
+ |
2088 |
|
|
+ return $configdb->get_prop($item, $prop) || $default; |
2089 |
|
|
+} |
2090 |
|
|
+ |
2091 |
|
|
+ |
2092 |
|
|
+=head1 System Password manipulation routines |
2093 |
|
|
+ |
2094 |
|
|
+XXX FIXME - These should be merged with the useraccouts versions |
2095 |
|
|
+ |
2096 |
|
|
+=head2 system_password_compare |
2097 |
|
|
+ |
2098 |
|
|
+=cut |
2099 |
|
|
+ |
2100 |
|
|
+sub system_password_compare |
2101 |
|
|
+{ |
2102 |
|
|
+ my $self = shift; |
2103 |
|
|
+ my $pass2 = shift; |
2104 |
|
|
+ |
2105 |
|
|
+ my $pass1 = $self->{cgi}->param('pass'); |
2106 |
|
|
+ unless ($pass1 eq $pass2) { |
2107 |
|
|
+ $self->{cgi}->param( -name => 'wherenext', -value => 'Password' ); |
2108 |
|
|
+ return "SYSTEM_PASSWORD_VERIFY_ERROR"; |
2109 |
|
|
+ } |
2110 |
|
|
+ return "OK"; |
2111 |
|
|
+} |
2112 |
|
|
+ |
2113 |
|
|
+=head2 system_valid_password |
2114 |
|
|
+ |
2115 |
|
|
+Throw an error if the password doesn't consist solely of one or more printable characters. |
2116 |
|
|
+ |
2117 |
|
|
+=cut |
2118 |
|
|
+ |
2119 |
|
|
+sub system_valid_password |
2120 |
|
|
+{ |
2121 |
|
|
+ my $self = shift; |
2122 |
|
|
+ my $pass1 = shift; |
2123 |
|
|
+ # If the password contains one or more printable character |
2124 |
|
|
+ if ($pass1 =~ /^([ -~]+)$/) { |
2125 |
|
|
+ return('OK'); |
2126 |
|
|
+ } else { |
2127 |
|
|
+ $self->{cgi}->param( -name => 'wherenext', -value => 'Password' ); |
2128 |
|
|
+ return 'SYSTEM_PASSWORD_UNPRINTABLES_IN_PASS'; |
2129 |
|
|
+ } |
2130 |
|
|
+} |
2131 |
|
|
+ |
2132 |
|
|
+=head2 system_check_password |
2133 |
|
|
+ |
2134 |
|
|
+Validates the password using the desired strength |
2135 |
|
|
+ |
2136 |
|
|
+=cut |
2137 |
|
|
+ |
2138 |
|
|
+sub system_check_password |
2139 |
|
|
+{ |
2140 |
|
|
+ my $self = shift; |
2141 |
|
|
+ my $pass1 = shift; |
2142 |
|
|
+ |
2143 |
|
|
+ use esmith::ConfigDB; |
2144 |
|
|
+ my $conf = esmith::ConfigDB->open(); |
2145 |
|
|
+ my $check_type; |
2146 |
|
|
+ my $rec; |
2147 |
|
|
+ if ($conf) |
2148 |
|
|
+ { |
2149 |
|
|
+ $rec = $conf->get('passwordstrength'); |
2150 |
|
|
+ } |
2151 |
|
|
+ $check_type = ($rec ? ($rec->prop('Admin') || 'strong') : 'strong'); |
2152 |
|
|
+ |
2153 |
|
|
+ return $self->validate_password($check_type,$pass1); |
2154 |
|
|
+} |
2155 |
|
|
+ |
2156 |
|
|
+=head2 authenticate_password |
2157 |
|
|
+ |
2158 |
|
|
+Compares the password with the current system password |
2159 |
|
|
+ |
2160 |
|
|
+=cut |
2161 |
|
|
+ |
2162 |
|
|
+sub system_authenticate_password |
2163 |
|
|
+{ |
2164 |
|
|
+ my $self = shift; |
2165 |
|
|
+ my $pass = shift; |
2166 |
|
|
+ |
2167 |
|
|
+ if (esmith::util::authenticateUnixPassword( ($configdb->get_value("AdminIsNotRoot") eq 'enabled') ? 'admin' : 'root', $pass)) |
2168 |
|
|
+ { |
2169 |
|
|
+ return "OK"; |
2170 |
|
|
+ } |
2171 |
|
|
+ else |
2172 |
|
|
+ { |
2173 |
|
|
+ return "SYSTEM_PASSWORD_AUTH_ERROR"; |
2174 |
|
|
+ } |
2175 |
|
|
+} |
2176 |
|
|
+ |
2177 |
|
|
+=head2 system_change_password |
2178 |
|
|
+ |
2179 |
|
|
+If everything has been validated, properly, go ahead and set the new password. |
2180 |
|
|
+ |
2181 |
|
|
+=cut |
2182 |
|
|
+ |
2183 |
|
|
+sub system_change_password |
2184 |
|
|
+{ |
2185 |
|
|
+ my ($self) = @_; |
2186 |
|
|
+ my $pass = $self->{cgi}->param('pass'); |
2187 |
|
|
+ |
2188 |
|
|
+ ($configdb->get_value("AdminIsNotRoot") eq 'enabled') ? esmith::util::setUnixPassword('admin',$pass) : esmith::util::setUnixSystemPassword($pass); |
2189 |
|
|
+ esmith::util::setServerSystemPassword($pass); |
2190 |
|
|
+ |
2191 |
|
|
+ my $result = system("/sbin/e-smith/signal-event password-modify admin"); |
2192 |
|
|
+ |
2193 |
|
|
+ if ($result == 0) |
2194 |
|
|
+ { |
2195 |
|
|
+ $self->success('SYSTEM_PASSWORD_CHANGED', 'First'); |
2196 |
|
|
+ } |
2197 |
|
|
+ else |
2198 |
|
|
+ { |
2199 |
|
|
+ $self->error("Error occurred while modifying password for admin.", 'First'); |
2200 |
|
|
+ } |
2201 |
|
|
+ |
2202 |
|
|
+ return; |
2203 |
|
|
+} |
2204 |
|
|
+ |
2205 |
|
|
+sub print_ipsec_client_section |
2206 |
|
|
+{ |
2207 |
|
|
+ my $self = shift; |
2208 |
|
|
+ my $q = $self->cgi; |
2209 |
|
|
+ |
2210 |
|
|
+ # Don't show ipsecrw setting unless the status property exists |
2211 |
|
|
+ return '' unless ($configdb->get('ipsec') |
2212 |
|
|
+ && $configdb->get('ipsec')->prop('RoadWarriorStatus')); |
2213 |
|
|
+ # Don't show ipsecrw setting unless /sbin/e-smith/roadwarrior exists |
2214 |
|
|
+ return '' unless -x '/sbin/e-smith/roadwarrior'; |
2215 |
|
|
+ my $acct = $q->param('acctName'); |
2216 |
|
|
+ my $rec = $accountdb->get($acct) if $acct; |
2217 |
|
|
+ if ($acct and $rec) |
2218 |
|
|
+ { |
2219 |
|
|
+ my $pwset = $rec->prop('PasswordSet') || 'no'; |
2220 |
|
|
+ my $VPNaccess = $rec->prop('VPNClientAccess') || 'no'; |
2221 |
|
|
+ if ($pwset eq 'yes' and $VPNaccess eq 'yes') |
2222 |
|
|
+ { |
2223 |
|
|
+ print $q->Tr( |
2224 |
|
|
+ $q->td({-class=>'sme-noborders-label'}, |
2225 |
|
|
+ $self->localise('LABEL_IPSECRW_DOWNLOAD')), |
2226 |
|
|
+ $q->td({-class=>'sme-noborders-content'}, |
2227 |
|
|
+ $q->a({-class=>'button-like', |
2228 |
|
|
+ -href=>"?action=getCert&user=$acct"}, |
2229 |
|
|
+ $self->localise('DOWNLOAD')))); |
2230 |
|
|
+ } |
2231 |
|
|
+ } |
2232 |
|
|
+ return ''; |
2233 |
|
|
+} |
2234 |
|
|
+ |
2235 |
|
|
+sub get_ipsec_client_cert |
2236 |
|
|
+{ |
2237 |
|
|
+ my $self = shift; |
2238 |
|
|
+ my $q = shift; |
2239 |
|
|
+ my $user = $q->param('user'); |
2240 |
|
|
+ ($user) = ($user =~ /^(.*)$/); |
2241 |
|
|
+ |
2242 |
|
|
+ die "Invalid user: $user\n" unless getpwnam($user); |
2243 |
|
|
+ |
2244 |
|
|
+ open (KID, "/sbin/e-smith/roadwarrior get_client_cert $user |") |
2245 |
|
|
+ or die "Can't fork: $!"; |
2246 |
|
|
+ my $certfile = <KID>; |
2247 |
|
|
+ close KID; |
2248 |
|
|
+ |
2249 |
|
|
+ require File::Basename; |
2250 |
|
|
+ my $certname = File::Basename::basename($certfile); |
2251 |
|
|
+ |
2252 |
|
|
+ print "Expires: 0\n"; |
2253 |
|
|
+ print "Content-type: application/x-pkcs12\n"; |
2254 |
|
|
+ print "Content-disposition: inline; filename=$certname\n"; |
2255 |
|
|
+ print "\n"; |
2256 |
|
|
+ |
2257 |
|
|
+ open (CERT, "<$certfile"); |
2258 |
|
|
+ while (<CERT>) |
2259 |
|
|
+ { |
2260 |
|
|
+ print; |
2261 |
|
|
+ } |
2262 |
|
|
+ close CERT; |
2263 |
|
|
+ |
2264 |
|
|
+ return ''; |
2265 |
|
|
+} |
2266 |
|
|
+ |
2267 |
|
|
+sub display_email_forwarding |
2268 |
|
|
+{ |
2269 |
|
|
+ return defined $configdb->get('smtpd'); |
2270 |
|
|
+} |
2271 |
|
|
+ |
2272 |
|
|
+1; |
2273 |
|
|
diff -ruN smeserver-manager-0.1.0.old/root/usr/share/perl5/vendor_perl/smeserver/Panel/wblNew.pm smeserver-manager-0.1.0/root/usr/share/perl5/vendor_perl/smeserver/Panel/wblNew.pm |
2274 |
|
|
--- smeserver-manager-0.1.0.old/root/usr/share/perl5/vendor_perl/smeserver/Panel/wblNew.pm 1970-01-01 01:00:00.000000000 +0100 |
2275 |
|
|
+++ smeserver-manager-0.1.0/root/usr/share/perl5/vendor_perl/smeserver/Panel/wblNew.pm 2018-02-15 23:05:44.000000000 +0100 |
2276 |
|
|
@@ -0,0 +1,455 @@ |
2277 |
|
|
+#!/usr/bin/perl -w |
2278 |
|
|
+ |
2279 |
|
|
+# package esmith::FormMagick::Panel::wblNew; |
2280 |
|
|
+package smeserver::Panel::wblNew; |
2281 |
|
|
+ |
2282 |
|
|
+use strict; |
2283 |
|
|
+use warnings; |
2284 |
|
|
+#use esmith::FormMagick; |
2285 |
|
|
+#use esmith::cgi; |
2286 |
|
|
+use esmith::ConfigDB; |
2287 |
|
|
+use esmith::util; |
2288 |
|
|
+use File::Basename; |
2289 |
|
|
+use Exporter; |
2290 |
|
|
+use Carp qw(verbose); |
2291 |
|
|
+ |
2292 |
|
|
+our @ISA = qw( Exporter); |
2293 |
|
|
+ |
2294 |
|
|
+our @EXPORT = qw( |
2295 |
|
|
+get_dnsbl |
2296 |
|
|
+get_rhsbl |
2297 |
|
|
+get_uribl |
2298 |
|
|
+get_sbllist |
2299 |
|
|
+get_rbllist |
2300 |
|
|
+get_ubllist |
2301 |
|
|
+get_badhelo |
2302 |
|
|
+get_badmailfrom |
2303 |
|
|
+get_whitelisthosts |
2304 |
|
|
+get_whitelisthelo |
2305 |
|
|
+get_whitelistsenders |
2306 |
|
|
+get_whitelistfrom |
2307 |
|
|
+create_modify_black |
2308 |
|
|
+create_modify_white |
2309 |
|
|
+email_update |
2310 |
|
|
+get_blacklistfrom |
2311 |
|
|
+create_modify_rbl |
2312 |
|
|
+); |
2313 |
|
|
+ |
2314 |
|
|
+our $VERSION = sprintf '%d.%03d', q$Revision: 1.1 $ =~ /: (\d+).(\d+)/; |
2315 |
|
|
+ |
2316 |
|
|
+our $db = esmith::ConfigDB->open() or die "Couldn't open ConfigDB\n"; |
2317 |
|
|
+our $wdb = esmith::ConfigDB->open('wbl') or die "Couldn't open wbl dbase\n"; |
2318 |
|
|
+our $sdb = esmith::ConfigDB->open('spamassassin') or die "Couldn't open spamassassin dbase\n"; |
2319 |
|
|
+ |
2320 |
|
|
+sub get_dnsbl |
2321 |
|
|
+{ |
2322 |
|
|
+ return ($db->get_prop('qpsmtpd', 'DNSBL') || 'disabled'); |
2323 |
|
|
+} |
2324 |
|
|
+ |
2325 |
|
|
+sub get_rhsbl |
2326 |
|
|
+{ |
2327 |
|
|
+ return ($db->get_prop('qpsmtpd', 'RHSBL') || 'disabled'); |
2328 |
|
|
+} |
2329 |
|
|
+ |
2330 |
|
|
+sub get_uribl |
2331 |
|
|
+{ |
2332 |
|
|
+ return ($db->get_prop('qpsmtpd', 'URIBL') || 'disabled'); |
2333 |
|
|
+} |
2334 |
|
|
+ |
2335 |
|
|
+sub get_sbllist |
2336 |
|
|
+{ |
2337 |
|
|
+my $sbllistform = $db->get_prop('qpsmtpd', 'SBLList') || ''; |
2338 |
|
|
+$sbllistform =~ s/,/\n/g; |
2339 |
|
|
+return $sbllistform; |
2340 |
|
|
+} |
2341 |
|
|
+ |
2342 |
|
|
+sub get_rbllist |
2343 |
|
|
+{ |
2344 |
|
|
+my $rbllistform = $db->get_prop('qpsmtpd', 'RBLList') || ''; |
2345 |
|
|
+$rbllistform =~ s/,/\n/g; |
2346 |
|
|
+return $rbllistform; |
2347 |
|
|
+} |
2348 |
|
|
+ |
2349 |
|
|
+sub get_ubllist |
2350 |
|
|
+{ |
2351 |
|
|
+my $rbllistform = $db->get_prop('qpsmtpd', 'UBLList') || ''; |
2352 |
|
|
+$rbllistform =~ s/,/\n/g; |
2353 |
|
|
+return $rbllistform; |
2354 |
|
|
+} |
2355 |
|
|
+ |
2356 |
|
|
+ |
2357 |
|
|
+sub get_badhelo |
2358 |
|
|
+{ |
2359 |
|
|
+ my %list = $wdb->get('badhelo')->props; |
2360 |
|
|
+ |
2361 |
|
|
+ my @badhelo = (); |
2362 |
|
|
+ my $parameter = ""; |
2363 |
|
|
+ my $value = ""; |
2364 |
|
|
+ while (($parameter,$value) = each(%list)) { |
2365 |
|
|
+ if ($parameter eq "type") {next;} |
2366 |
|
|
+ |
2367 |
|
|
+ if ($value eq "Black") { |
2368 |
|
|
+ push @badhelo, $parameter; |
2369 |
|
|
+ } |
2370 |
|
|
+ } |
2371 |
|
|
+ |
2372 |
|
|
+ return "" unless (scalar @badhelo); |
2373 |
|
|
+ |
2374 |
|
|
+# return join "\n", sort(@badhelo); |
2375 |
|
|
+ return sort(@badhelo); |
2376 |
|
|
+} |
2377 |
|
|
+ |
2378 |
|
|
+sub get_badmailfrom |
2379 |
|
|
+{ |
2380 |
|
|
+ my %list = $wdb->get('badmailfrom')->props; |
2381 |
|
|
+ |
2382 |
|
|
+ my @badmailfrom = (); |
2383 |
|
|
+ my $parameter = ""; |
2384 |
|
|
+ my $value = ""; |
2385 |
|
|
+ while (($parameter,$value) = each(%list)) { |
2386 |
|
|
+ if ($parameter eq "type") {next;} |
2387 |
|
|
+ |
2388 |
|
|
+ if ($value eq "Black") { |
2389 |
|
|
+ push @badmailfrom, $parameter; |
2390 |
|
|
+ } |
2391 |
|
|
+ } |
2392 |
|
|
+ |
2393 |
|
|
+ return "" unless (scalar @badmailfrom); |
2394 |
|
|
+ |
2395 |
|
|
+# return join "\n", sort(@badmailfrom); |
2396 |
|
|
+ return sort(@badmailfrom); |
2397 |
|
|
+} |
2398 |
|
|
+ |
2399 |
|
|
+sub get_whitelisthosts |
2400 |
|
|
+{ |
2401 |
|
|
+ my %list = $wdb->get('whitelisthosts')->props; |
2402 |
|
|
+ |
2403 |
|
|
+ my @whitelisthosts = (); |
2404 |
|
|
+ my $parameter = ""; |
2405 |
|
|
+ my $value = ""; |
2406 |
|
|
+ while (($parameter,$value) = each(%list)) { |
2407 |
|
|
+ if ($parameter eq "type") {next;} |
2408 |
|
|
+ |
2409 |
|
|
+ if ($value eq "White") { |
2410 |
|
|
+ push @whitelisthosts, $parameter; |
2411 |
|
|
+ } |
2412 |
|
|
+ } |
2413 |
|
|
+ |
2414 |
|
|
+ return "" unless (scalar @whitelisthosts); |
2415 |
|
|
+ |
2416 |
|
|
+# return join "\n", sort(@whitelisthosts); |
2417 |
|
|
+ return sort(@whitelisthosts); |
2418 |
|
|
+ |
2419 |
|
|
+} |
2420 |
|
|
+ |
2421 |
|
|
+sub get_whitelisthelo |
2422 |
|
|
+{ |
2423 |
|
|
+ my %list = $wdb->get('whitelisthelo')->props; |
2424 |
|
|
+ |
2425 |
|
|
+ my @whitelisthelo = (); |
2426 |
|
|
+ my $parameter = ""; |
2427 |
|
|
+ my $value = ""; |
2428 |
|
|
+ while (($parameter,$value) = each(%list)) { |
2429 |
|
|
+ if ($parameter eq "type") {next;} |
2430 |
|
|
+ |
2431 |
|
|
+ if ($value eq "White") { |
2432 |
|
|
+ push @whitelisthelo, $parameter; |
2433 |
|
|
+ } |
2434 |
|
|
+ } |
2435 |
|
|
+ |
2436 |
|
|
+ return "" unless (scalar @whitelisthelo); |
2437 |
|
|
+ |
2438 |
|
|
+# return join "\n", sort(@whitelisthelo); |
2439 |
|
|
+ return sort(@whitelisthelo); |
2440 |
|
|
+} |
2441 |
|
|
+ |
2442 |
|
|
+sub get_whitelistsenders |
2443 |
|
|
+{ |
2444 |
|
|
+ my %list = $wdb->get('whitelistsenders')->props; |
2445 |
|
|
+ |
2446 |
|
|
+ my @whitelistsenders = (); |
2447 |
|
|
+ my $parameter = ""; |
2448 |
|
|
+ my $value = ""; |
2449 |
|
|
+ while (($parameter,$value) = each(%list)) { |
2450 |
|
|
+ if ($parameter eq "type") {next;} |
2451 |
|
|
+ |
2452 |
|
|
+ if ($value eq "White") { |
2453 |
|
|
+ push @whitelistsenders, $parameter; |
2454 |
|
|
+ } |
2455 |
|
|
+ } |
2456 |
|
|
+ |
2457 |
|
|
+ return "" unless (scalar @whitelistsenders); |
2458 |
|
|
+ |
2459 |
|
|
+ #return join "\n", sort(@whitelistsenders); |
2460 |
|
|
+ return sort(@whitelistsenders); |
2461 |
|
|
+} |
2462 |
|
|
+ |
2463 |
|
|
+sub get_whitelistfrom |
2464 |
|
|
+{ |
2465 |
|
|
+ my %list = $sdb->get('wbl.global')->props; |
2466 |
|
|
+ |
2467 |
|
|
+ my @whitelistfrom = (); |
2468 |
|
|
+ my $parameter = ""; |
2469 |
|
|
+ my $value = ""; |
2470 |
|
|
+ while (($parameter,$value) = each(%list)) { |
2471 |
|
|
+ if ($parameter eq "type") {next;} |
2472 |
|
|
+ |
2473 |
|
|
+ if ($value eq "White") { |
2474 |
|
|
+ push @whitelistfrom, $parameter; |
2475 |
|
|
+ } |
2476 |
|
|
+ } |
2477 |
|
|
+ |
2478 |
|
|
+ return "" unless (scalar @whitelistfrom); |
2479 |
|
|
+ |
2480 |
|
|
+# return join "\n", sort(@whitelistfrom); |
2481 |
|
|
+ return sort(@whitelistfrom); |
2482 |
|
|
+} |
2483 |
|
|
+ |
2484 |
|
|
+sub create_modify_black |
2485 |
|
|
+{ |
2486 |
|
|
+ my $fm = shift; |
2487 |
|
|
+ my $q = $fm->{'cgi'}; |
2488 |
|
|
+ |
2489 |
|
|
+ # qmail badhelo |
2490 |
|
|
+ my %list = $wdb->get('badhelo')->props; |
2491 |
|
|
+ my $parameter = ""; |
2492 |
|
|
+ my $value = ""; |
2493 |
|
|
+ while (($parameter,$value) = each(%list)) { |
2494 |
|
|
+ if ($parameter eq "type") {next;} |
2495 |
|
|
+ |
2496 |
|
|
+ if ($value eq "Black") { |
2497 |
|
|
+ $wdb->get_prop_and_delete('badhelo', "$parameter"); |
2498 |
|
|
+ } |
2499 |
|
|
+ } |
2500 |
|
|
+ |
2501 |
|
|
+ my $BadHelo = $q->param("badhelo"); |
2502 |
|
|
+ $BadHelo =~ s/\r\n/,/g; |
2503 |
|
|
+ my @BadHelo = sort(split /,/, $BadHelo); |
2504 |
|
|
+ foreach $BadHelo (@BadHelo) |
2505 |
|
|
+ { |
2506 |
|
|
+ $wdb->set_prop('badhelo', "$BadHelo", 'Black'); |
2507 |
|
|
+ } |
2508 |
|
|
+ |
2509 |
|
|
+ # qmail badmailfrom |
2510 |
|
|
+ my %list_badmailfrom = $wdb->get('badmailfrom')->props; |
2511 |
|
|
+ my $parameter_badmailfrom = ""; |
2512 |
|
|
+ my $value_badmailfrom = ""; |
2513 |
|
|
+ while (($parameter_badmailfrom,$value_badmailfrom) = each(%list_badmailfrom)) { |
2514 |
|
|
+ if ($parameter_badmailfrom eq "type") {next;} |
2515 |
|
|
+ |
2516 |
|
|
+ if ($value_badmailfrom eq "Black") { |
2517 |
|
|
+ $wdb->get_prop_and_delete('badmailfrom', "$parameter_badmailfrom"); |
2518 |
|
|
+ } |
2519 |
|
|
+ } |
2520 |
|
|
+ |
2521 |
|
|
+ my $BadMailFrom = $q->param("badmailfrom"); |
2522 |
|
|
+ $BadMailFrom =~ s/\r\n/,/g; |
2523 |
|
|
+ my @BadMailFrom = sort(split /,/, $BadMailFrom); |
2524 |
|
|
+ foreach $BadMailFrom (@BadMailFrom){ |
2525 |
|
|
+ $wdb->set_prop('badmailfrom', "$BadMailFrom", 'Black'); |
2526 |
|
|
+ } |
2527 |
|
|
+ # spamassassin blacklist_from |
2528 |
|
|
+ my %list_wblglobal = $sdb->get('wbl.global')->props; |
2529 |
|
|
+ my $parameter_wblglobal = ""; |
2530 |
|
|
+ my $value_wblglobal = ""; |
2531 |
|
|
+ while (($parameter_wblglobal,$value_wblglobal) = each(%list_wblglobal)) { |
2532 |
|
|
+ if ($parameter_wblglobal eq "type") {next;} |
2533 |
|
|
+ |
2534 |
|
|
+ if ($value_wblglobal eq "Black") { |
2535 |
|
|
+ $sdb->get_prop_and_delete('wbl.global', "$parameter_wblglobal"); |
2536 |
|
|
+ } |
2537 |
|
|
+ } |
2538 |
|
|
+ |
2539 |
|
|
+ my $BlacklistFrom = $q->param("blacklistfrom"); |
2540 |
|
|
+ $BlacklistFrom =~ s/\r\n/,/g; |
2541 |
|
|
+ my @BlacklistFrom = sort(split /,/, $BlacklistFrom); |
2542 |
|
|
+ foreach $BlacklistFrom (@BlacklistFrom){ |
2543 |
|
|
+ $sdb->set_prop('wbl.global', "$BlacklistFrom", 'Black'); |
2544 |
|
|
+ } |
2545 |
|
|
+ |
2546 |
|
|
+ ##Update email settings |
2547 |
|
|
+ unless ( system ("/sbin/e-smith/signal-event", "smeserver-wbl-update") == 0 ){ |
2548 |
|
|
+ $fm->error('ERROR_UPDATING'); |
2549 |
|
|
+ return undef; |
2550 |
|
|
+ } |
2551 |
|
|
+ |
2552 |
|
|
+ $fm->success('SUCCESS'); |
2553 |
|
|
+} |
2554 |
|
|
+ |
2555 |
|
|
+sub create_modify_white |
2556 |
|
|
+{ |
2557 |
|
|
+ my $fm = shift; |
2558 |
|
|
+ my $q = $fm->{'cgi'}; |
2559 |
|
|
+ |
2560 |
|
|
+ # qpsmtpd whitelisthosts |
2561 |
|
|
+ my %list = $wdb->get('whitelisthosts')->props; |
2562 |
|
|
+ my $parameter = ""; |
2563 |
|
|
+ my $value = ""; |
2564 |
|
|
+ while (($parameter,$value) = each(%list)) { |
2565 |
|
|
+ if ($parameter eq "type") {next;} |
2566 |
|
|
+ |
2567 |
|
|
+ if ($value eq "White") { |
2568 |
|
|
+ $wdb->get_prop_and_delete('whitelisthosts', "$parameter"); |
2569 |
|
|
+ } |
2570 |
|
|
+ } |
2571 |
|
|
+ |
2572 |
|
|
+ my $WhitelistHosts = $q->param("whitelisthosts"); |
2573 |
|
|
+ $WhitelistHosts =~ s/\r\n/,/g; |
2574 |
|
|
+ my @WhitelistHosts = sort(split /,/, $WhitelistHosts); |
2575 |
|
|
+ foreach $WhitelistHosts (@WhitelistHosts) |
2576 |
|
|
+ { |
2577 |
|
|
+ $wdb->set_prop('whitelisthosts', "$WhitelistHosts", 'White'); |
2578 |
|
|
+ } |
2579 |
|
|
+ |
2580 |
|
|
+ # qpsmtpd whitelisthelo |
2581 |
|
|
+ my %list_whitelisthelo = $wdb->get('whitelisthelo')->props; |
2582 |
|
|
+ my $parameter_whitelisthelo = ""; |
2583 |
|
|
+ my $value_whitelisthelo = ""; |
2584 |
|
|
+ while (($parameter_whitelisthelo,$value_whitelisthelo) = each(%list_whitelisthelo)) { |
2585 |
|
|
+ if ($parameter_whitelisthelo eq "type") {next;} |
2586 |
|
|
+ |
2587 |
|
|
+ if ($value_whitelisthelo eq "White") { |
2588 |
|
|
+ $wdb->get_prop_and_delete('whitelisthelo', "$parameter_whitelisthelo"); |
2589 |
|
|
+ } |
2590 |
|
|
+ } |
2591 |
|
|
+ |
2592 |
|
|
+ my $WhitelistHelo = $q->param("whitelisthelo"); |
2593 |
|
|
+ $WhitelistHelo =~ s/\r\n/,/g; |
2594 |
|
|
+ my @WhitelistHelo = sort(split /,/, $WhitelistHelo); |
2595 |
|
|
+ foreach $WhitelistHelo (@WhitelistHelo) |
2596 |
|
|
+ { |
2597 |
|
|
+ $wdb->set_prop('whitelisthelo', "$WhitelistHelo", 'White'); |
2598 |
|
|
+ } |
2599 |
|
|
+ |
2600 |
|
|
+ # qpsmtpd whitelistsenders |
2601 |
|
|
+ my %list_whitelistsenders = $wdb->get('whitelistsenders')->props; |
2602 |
|
|
+ my $parameter_whitelistsenders = ""; |
2603 |
|
|
+ my $value_whitelistsenders = ""; |
2604 |
|
|
+ while (($parameter_whitelistsenders,$value_whitelistsenders) = each(%list_whitelistsenders)) { |
2605 |
|
|
+ if ($parameter_whitelistsenders eq "type") {next;} |
2606 |
|
|
+ |
2607 |
|
|
+ if ($value_whitelistsenders eq "White") { |
2608 |
|
|
+ $wdb->get_prop_and_delete('whitelistsenders', "$parameter_whitelistsenders"); |
2609 |
|
|
+ } |
2610 |
|
|
+ } |
2611 |
|
|
+ |
2612 |
|
|
+ my $WhitelistSenders = $q->param("whitelistsenders"); |
2613 |
|
|
+ $WhitelistSenders =~ s/\r\n/,/g; |
2614 |
|
|
+ my @WhitelistSenders = sort(split /,/, $WhitelistSenders); |
2615 |
|
|
+ foreach $WhitelistSenders (@WhitelistSenders) |
2616 |
|
|
+ { |
2617 |
|
|
+ $wdb->set_prop('whitelistsenders', "$WhitelistSenders", 'White'); |
2618 |
|
|
+ } |
2619 |
|
|
+ |
2620 |
|
|
+ # spamassassin whitelist_from |
2621 |
|
|
+ my %list_wblglobal = $sdb->get('wbl.global')->props; |
2622 |
|
|
+ my $parameter_wblglobal = ""; |
2623 |
|
|
+ my $value_wblglobal = ""; |
2624 |
|
|
+ while (($parameter_wblglobal,$value_wblglobal) = each(%list_wblglobal)) { |
2625 |
|
|
+ if ($parameter_wblglobal eq "type") {next;} |
2626 |
|
|
+ |
2627 |
|
|
+ if ($value_wblglobal eq "White") { |
2628 |
|
|
+ $sdb->get_prop_and_delete('wbl.global', "$parameter_wblglobal"); |
2629 |
|
|
+ } |
2630 |
|
|
+ } |
2631 |
|
|
+ |
2632 |
|
|
+ my $WhitelistFrom = $q->param("whitelistfrom"); |
2633 |
|
|
+ $WhitelistFrom =~ s/\r\n/,/g; |
2634 |
|
|
+ my @WhitelistFrom = sort(split /,/, $WhitelistFrom); |
2635 |
|
|
+ foreach $WhitelistFrom (@WhitelistFrom){ |
2636 |
|
|
+ $sdb->set_prop('wbl.global', "$WhitelistFrom", 'White'); |
2637 |
|
|
+ } |
2638 |
|
|
+ |
2639 |
|
|
+ ##Update email settings |
2640 |
|
|
+ unless ( system ("/sbin/e-smith/signal-event", "smeserver-wbl-update") == 0 ){ |
2641 |
|
|
+ $fm->error('ERROR_UPDATING'); |
2642 |
|
|
+ return undef; |
2643 |
|
|
+ } |
2644 |
|
|
+ |
2645 |
|
|
+ $fm->success('SUCCESS'); |
2646 |
|
|
+} |
2647 |
|
|
+ |
2648 |
|
|
+sub email_update |
2649 |
|
|
+{ |
2650 |
|
|
+ my $fm = shift; |
2651 |
|
|
+ my $q = $fm->{'cgi'}; |
2652 |
|
|
+ |
2653 |
|
|
+ unless ( system ("/sbin/e-smith/signal-event", "smeserver-wbl-update") == 0 ) |
2654 |
|
|
+ { |
2655 |
|
|
+ $fm->error('ERROR_UPDATING'); |
2656 |
|
|
+ return undef; |
2657 |
|
|
+ } |
2658 |
|
|
+ |
2659 |
|
|
+ $fm->success('SUCCESS'); |
2660 |
|
|
+ |
2661 |
|
|
+} |
2662 |
|
|
+ |
2663 |
|
|
+sub get_blacklistfrom |
2664 |
|
|
+{ |
2665 |
|
|
+ my %list = $sdb->get('wbl.global')->props; |
2666 |
|
|
+ |
2667 |
|
|
+ my @blacklistfrom = (); |
2668 |
|
|
+ my $parameter = ""; |
2669 |
|
|
+ my $value = ""; |
2670 |
|
|
+ while (($parameter,$value) = each(%list)) { |
2671 |
|
|
+ if ($parameter eq "type") {next;} |
2672 |
|
|
+ |
2673 |
|
|
+ if ($value eq "Black") { |
2674 |
|
|
+ push @blacklistfrom, $parameter; |
2675 |
|
|
+ } |
2676 |
|
|
+ } |
2677 |
|
|
+ |
2678 |
|
|
+ return "" unless (scalar @blacklistfrom); |
2679 |
|
|
+ |
2680 |
|
|
+ return join "\n", sort(@blacklistfrom); |
2681 |
|
|
+} |
2682 |
|
|
+sub create_modify_rbl |
2683 |
|
|
+{ |
2684 |
|
|
+ my $fm = shift; |
2685 |
|
|
+ my $q = $fm->{'cgi'}; |
2686 |
|
|
+ |
2687 |
|
|
+ my $dnsbl = $q->param('dnsbl'); |
2688 |
|
|
+ $db->set_prop('qpsmtpd', 'DNSBL', "$dnsbl"); |
2689 |
|
|
+ |
2690 |
|
|
+ my $rhsbl = $q->param('rhsbl'); |
2691 |
|
|
+ $db->set_prop('qpsmtpd', 'RHSBL', "$rhsbl"); |
2692 |
|
|
+ |
2693 |
|
|
+ |
2694 |
|
|
+ my $sbllistcgi = $q->param('sbllist'); |
2695 |
|
|
+ my @sbllistcgi = split /\s{2,}/, $sbllistcgi; |
2696 |
|
|
+ my $sbllistdb = ''; |
2697 |
|
|
+ foreach (@sbllistcgi) { $sbllistdb = $sbllistdb . ',' . $_; } |
2698 |
|
|
+ $sbllistdb =~ s/^,//; |
2699 |
|
|
+ |
2700 |
|
|
+ $db->set_prop('qpsmtpd', 'SBLList', "$sbllistdb"); |
2701 |
|
|
+ |
2702 |
|
|
+ |
2703 |
|
|
+ my $rbllistcgi = $q->param('rbllist'); |
2704 |
|
|
+ my @rbllistcgi = split /\s{2,}/, $rbllistcgi; |
2705 |
|
|
+ my $rbllistdb = ''; |
2706 |
|
|
+ foreach (@rbllistcgi) { $rbllistdb = $rbllistdb . ',' . $_; } |
2707 |
|
|
+ $rbllistdb =~ s/^,//; |
2708 |
|
|
+ |
2709 |
|
|
+ $db->set_prop('qpsmtpd', 'RBLList', "$rbllistdb"); |
2710 |
|
|
+ |
2711 |
|
|
+ ##Update email settings |
2712 |
|
|
+ |
2713 |
|
|
+ unless ( system ("/sbin/e-smith/signal-event", "smeserver-wbl-update") == 0 ){ |
2714 |
|
|
+ $fm->error('ERROR_UPDATING'); |
2715 |
|
|
+ return undef; |
2716 |
|
|
+ } |
2717 |
|
|
+ |
2718 |
|
|
+ $fm->success('SUCCESS'); |
2719 |
|
|
+} |
2720 |
|
|
+ |
2721 |
|
|
+#Subroutine to display buttons |
2722 |
|
|
+#sub print_custom_button{ |
2723 |
|
|
+# my ($fm,$desc,$url) = @_; |
2724 |
|
|
+# my $q = $fm->{cgi}; |
2725 |
|
|
+# $url="wbl?page=0&page_stack=&Next=Next&wherenext=".$url; |
2726 |
|
|
+# print " <tr>\n <td colspan='2'>\n"; |
2727 |
|
|
+# print $q->p($q->a({href => $url, -class => "button-like"},$fm->localise($desc))); |
2728 |
|
|
+# print qq(</tr>\n); |
2729 |
|
|
+# return undef; |
2730 |
|
|
+#} |
2731 |
|
|
+#; |