/[smecontribs]/rpms/smeserver-ddclient/contribs9/smeserver-ddclient-1.2.1.bz8961.customDNS.patch
ViewVC logotype

Contents of /rpms/smeserver-ddclient/contribs9/smeserver-ddclient-1.2.1.bz8961.customDNS.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Fri Jul 10 14:28:57 2015 UTC (8 years, 9 months ago) by stephdl
Branch: MAIN
CVS Tags: smeserver-ddclient-1_2_1-14_el6_sme, smeserver-ddclient-1_2_1-11_el6_sme, smeserver-ddclient-1_2_1-12_el6_sme, smeserver-ddclient-1_2_1-6_el6_sme, smeserver-ddclient-1_2_1-5_el6_sme, smeserver-ddclient-1_2_1-15_el6_sme, smeserver-ddclient-1_2_1-8_el6_sme, smeserver-ddclient-1_2_1-9_el6_sme, smeserver-ddclient-1_2_1-7_el6_sme, smeserver-ddclient--, smeserver-ddclient-1_2_1-13_el6_sme, HEAD
* Mon Jul 10 2015 stephane de labrusse <stephdl@de-labrusse.fr> - 1.2.1-5.sme
- added spdns.de [SME: 8975]
- added custom fields for dns providers [SME: 8961]
- added custom fields for free domains and panel options to ddclient [SME: 8983]

1 diff -Nur smeserver-ddclient-1.2.1.bz8961.old/createlinks smeserver-ddclient-1.2.1.bz8961/createlinks
2 --- smeserver-ddclient-1.2.1.bz8961.old/createlinks 2015-07-07 00:04:46.528387351 +0200
3 +++ smeserver-ddclient-1.2.1.bz8961/createlinks 2015-07-10 14:39:00.481270709 +0200
4 @@ -8,15 +8,15 @@
5
6 my $event = 'ddclient';
7 safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/ddclient");
8 - templates2events("/etc/ddclient.conf", $event);
9 + templates2events("/etc/ddclient/ddclient.conf", $event);
10
11 $event = 'domain-delete';
12 safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/ddclient");
13 - templates2events("/etc/ddclient.conf", $event);
14 + templates2events("/etc/ddclient/ddclient.conf", $event);
15
16 $event = 'domain-modify';
17 safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/ddclient");
18 - templates2events("/etc/ddclient.conf", $event);
19 + templates2events("/etc/ddclient/ddclient.conf", $event);
20
21 $event = 'post-upgrade';
22 templates2events("/etc/ddclient.conf", $event);
23 diff -Nur smeserver-ddclient-1.2.1.bz8961.old/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/ddclient smeserver-ddclient-1.2.1.bz8961/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/ddclient
24 --- smeserver-ddclient-1.2.1.bz8961.old/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/ddclient 2015-07-07 00:04:46.527387281 +0200
25 +++ smeserver-ddclient-1.2.1.bz8961/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/ddclient 2015-07-10 15:41:22.479300535 +0200
26 @@ -241,7 +241,68 @@
27 <trans> SPDNS (spdns.de) dynamic adresses</trans>
28 </entry>
29 <entry>
30 + <base>CUSTOMDNS</base>
31 + <trans>Custom Dynamic DNS Provider</trans>
32 + </entry>
33 + <entry>
34 + <base>CUSTOMDNS_LABEL</base>
35 + <trans>Custom server Address</trans>
36 + </entry>
37 + <entry>
38 + <base>CUSTOM_PROTOCOL_LABEL</base>
39 + <trans>Custom ddclient Protocol</trans>
40 + </entry>
41 + <entry>
42 + <base>CUSTOM_DESCRIPTION</base>
43 + <trans>You can use a custom dynamic dns provider if yours is not in the published list. Please fill the custom fields with the appropriate settings</trans>
44 + </entry>
45 + <entry>
46 + <base>CUSTOMDNS_VALIDATION_ERROR</base>
47 + <trans>
48 + Error: unexpected or missing characters in custom server address field of domain
49 + {$domainName}. The server address should contain one or more
50 + letters, numbers, periods and minus signs. Did not apply the change.
51 + </trans>
52 + </entry>
53 + <entry>
54 <base>ddclient</base>
55 <trans>Dynamic Clients</trans>
56 </entry>
57 + <entry>
58 + <base>DOMAIN_NAME_ALREADY_EXIST</base>
59 + <trans>Error: this domain:"{$domainName}" already exists. Please chose another.
60 + </trans>
61 + </entry>
62 + <entry>
63 + <base>FREE_FORM_DESCRIPTION</base>
64 + <trans>Here you can create any domain name to publish over the net.</trans>
65 + </entry>
66 + <entry>
67 + <base>RETRIEVE_SSL</base>
68 + <trans>SSL update</trans>
69 + </entry>
70 + <entry>
71 + <base>RETRIEVE_DEAMONUPDATE</base>
72 + <trans>Deamon update (seconds)</trans>
73 + </entry>
74 + <entry>
75 + <base>RETRIEVE_URLCHECKIP</base>
76 + <trans>Url for the external IP</trans>
77 + </entry>
78 + <entry>
79 + <base>APPLY</base>
80 + <trans>Save</trans>
81 + </entry>
82 + <entry>
83 + <base>DOMAIN_NAME_LABEL</base>
84 + <trans>Domain Name</trans>
85 + </entry>
86 + <entry>
87 + <base>DESCRIPTION_LABEL</base>
88 + <trans>Domain description</trans>
89 + </entry>
90 + <entry>
91 + <base>SUCCESSFULLY_MODIFIED_RETRIEVE_IP</base>
92 + <trans>You have successfully modified the retrieve IP options.</trans>
93 + </entry>
94 </lexicon>
95 diff -Nur smeserver-ddclient-1.2.1.bz8961.old/root/etc/e-smith/templates/etc/ddclient/ddclient.conf/10Headers smeserver-ddclient-1.2.1.bz8961/root/etc/e-smith/templates/etc/ddclient/ddclient.conf/10Headers
96 --- smeserver-ddclient-1.2.1.bz8961.old/root/etc/e-smith/templates/etc/ddclient/ddclient.conf/10Headers 1970-01-01 01:00:00.000000000 +0100
97 +++ smeserver-ddclient-1.2.1.bz8961/root/etc/e-smith/templates/etc/ddclient/ddclient.conf/10Headers 2015-07-10 14:59:35.674527582 +0200
98 @@ -0,0 +1,13 @@
99 + {
100 + my $deamonupdate = ${ddclient}{DeamonUpdate} || '300';
101 + my $ssl = ${ddclient}{SSL} || 'yes';
102 + $OUT .= qq(
103 +daemon=$deamonupdate # check every $deamonupdate seconds
104 +syslog=yes # log update msgs to syslog
105 +mail=admin # mail update msgs to admin
106 +mail-failure=admin
107 +pid=/var/run/ddclient.pid # record PID in file.
108 +ssl=$ssl
109 +#);
110 + }
111 +
112 diff -Nur smeserver-ddclient-1.2.1.bz8961.old/root/etc/e-smith/templates/etc/ddclient/ddclient.conf/20Declaration smeserver-ddclient-1.2.1.bz8961/root/etc/e-smith/templates/etc/ddclient/ddclient.conf/20Declaration
113 --- smeserver-ddclient-1.2.1.bz8961.old/root/etc/e-smith/templates/etc/ddclient/ddclient.conf/20Declaration 1970-01-01 01:00:00.000000000 +0100
114 +++ smeserver-ddclient-1.2.1.bz8961/root/etc/e-smith/templates/etc/ddclient/ddclient.conf/20Declaration 2015-07-07 00:07:17.215743624 +0200
115 @@ -0,0 +1,186 @@
116 +{
117 + use esmith::DomainsDB;
118 +
119 + $OUT='';
120 +
121 + my $ddb = esmith::DomainsDB->open_ro();
122 +
123 + $OUT .="use=web, web=$ddclient{'urlcheckip'}\/, web-skip='IP Address:' \n";
124 +
125 + for my $edom ( $ddb->domains )
126 + {
127 + {
128 +
129 + my $dns = $edom->prop('dns') || '';
130 + next if ($dns eq '');
131 + $dns =~ tr/a-z/A-Z/;
132 + my $login = $edom->prop('login');
133 + my $password = $edom->prop('password');
134 + my $customdns = $edom->prop('customdns') || '';
135 + my $customprotocol = $edom->prop('customprotocol') || '';
136 + my $pubserv='';
137 + my $static='';
138 + my $custom='';
139 + my $wildcard='';
140 + my $mx=$edom->prop('mx') || '';
141 + my $backupmx='';
142 + my $protocol='';
143 + my $explain='';
144 +
145 + if( $dns eq 'DYNDNS1')
146 + {
147 + $explain='## dyndns.org dynamic addresses';
148 + $pubserv ='members.dyndns.org';
149 + $protocol='dyndns2';
150 + $static='no';
151 + $custom='no';
152 + $wildcard='yes';
153 + }
154 + elsif( $dns eq 'DYNDNS2')
155 + {
156 + $explain='## dyndns.org static addresses';
157 + $pubserv ='members.dyndns.org';
158 + $protocol='dyndns2';
159 + $static ='yes';
160 + $custom ='no';
161 + $wildcard='yes';
162 + }
163 + elsif( $dns eq 'DYNDNS3')
164 + {
165 + $explain='## dyndns.org static2 addresses';
166 + $pubserv='members.dyndns.org';
167 + $custom ='yes';
168 + $protocol='dyndns2';
169 + $static ='';
170 + $wildcard='yes';
171 + }
172 + elsif( $dns eq 'ZONEDIT')
173 + {
174 + $explain='## zoneedit dynamic addresses';
175 + $pubserv='www.zoneedit.com';
176 + $protocol='zoneedit1';
177 + }
178 + elsif( $dns eq 'EASYDNS')
179 + {
180 + $explain='## easydns.com dynamic addresses';
181 + $pubserv='members.easydns.com';
182 + $protocol='easydns';
183 + }
184 + elsif( $dns eq 'HAMMER')
185 + {
186 + $explain='## hammer dup.hn.org dynamic addresses';
187 + $pubserv='dup.hn.org';
188 + $protocol='hammernode1';
189 + }
190 + elsif( $dns eq 'DSLREPORTS' )
191 + {
192 + $explain='## dslreports.org dynamic addresses';
193 + $pubserv='members.dslreports.com';
194 + $protocol='dslreports1';
195 + }
196 + elsif( $dns eq 'EURODYNDNS' )
197 + {
198 + $explain='## euroddyndns.org dynamic addresses';
199 + $pubserv='eurodyndns.org';
200 + $protocol='namecheap';
201 + }
202 + elsif( $dns eq 'DTDNS' )
203 + {
204 + $explain='## DtDNS (www.dtdns.com) dynamic addresses';
205 + $pubserv='www.dtdns.com';
206 + $protocol='dtdns';
207 + }
208 + elsif( $dns eq 'LOOPIA' )
209 + {
210 + $explain='## Loopia (loopia.se) dynamic addresses';
211 + $pubserv='dns.loopia.se';
212 + $protocol='dyndns2';
213 + }
214 + elsif( $dns eq 'DNSPARK' )
215 + {
216 + $explain='## dnspark.com dynamic addresses';
217 + $pubserv='www.dnspark.com';
218 + $protocol='dnspark';
219 + }
220 + elsif( $dns eq 'DYNHOST' )
221 + {
222 + $explain='## DynHost (ovh.com) dynamic addresses';
223 + $pubserv='www.ovh.com';
224 + $protocol='dyndns2';
225 + }
226 + elsif( $dns eq 'NOIP' )
227 + {
228 + $explain='## Noip (noip.com) dynamic addresses';
229 + $pubserv='dynupdate.no-ip.com';
230 + $protocol='noip';
231 + }
232 + elsif( $dns eq 'CHANGEIP' )
233 + {
234 + $explain='## ChangeIP (changeip.com) dynamic addresses';
235 + $pubserv='nic.changeip.com';
236 + $protocol='dyndns2';
237 + }
238 +
239 + elsif( $dns eq 'NAMECHEAP' )
240 + {
241 + $explain='## NAMECHEAP (namecheap.com) dynamic addresses';
242 + $pubserv='dynamicdns.park-your-domain.com';
243 + $protocol='namecheap';
244 + }
245 +
246 + elsif( $dns eq 'SPDNS' )
247 + {
248 + $explain='## SPDNS (spdns.de) dynamic addresses';
249 + $pubserv='update.spdns.de';
250 + $protocol='dyndns2';
251 + }
252 + elsif( $dns eq 'CUSTOMDNS' )
253 + {
254 + $explain='## CUSTOMDNS PROVIDER dynamic addresses';
255 + $pubserv= $customdns;
256 + $protocol= $customprotocol;
257 + }
258 +
259 + if($pubserv ne '')
260 + {
261 + $OUT .="##\n";
262 + $OUT .=$explain."\n";
263 + $OUT .="##\n";
264 + $OUT .="server=".$pubserv.", \\\n";
265 + $OUT .="protocol=".$protocol.", \\\n";
266 + if( $dns eq 'DTDNS' ) {
267 + $OUT .="client=ddclient, \\\n";
268 + }
269 + if( $dns eq 'LOOPIA' ) {
270 + $OUT .="use=web, \\\n";
271 + $OUT .="web=loopia, \\\n";
272 + $OUT .="script=/XDynDNSServer/XDynDNS.php, \\\n";
273 + }
274 + if($static ne '') {
275 + $OUT .="static=".$static.", \\\n";
276 + }
277 +
278 + if($wildcard ne '') {
279 + $OUT .="wildcard=".$wildcard.", \\\n";
280 + }
281 +
282 + if($custom ne '') {
283 + $OUT .="custom=".$custom.", \\\n";
284 + }
285 +
286 + if ($mx ne '') {
287 + $OUT .="mx=".$mx.", \\\n";
288 + }
289 +
290 + $OUT .="login=".$login.", \\\n";
291 + $OUT .="password=".$password." \\\n";
292 + $OUT .="\@\n" if ( $dns eq 'NAMECHEAP' );
293 +
294 + $OUT .=$edom->key()."\n" if ( $dns ne 'NAMECHEAP' );
295 + $OUT .="##\n";
296 + $OUT .="##\n";
297 + }
298 + }
299 + }
300 +}
301 +
302 diff -Nur smeserver-ddclient-1.2.1.bz8961.old/root/etc/e-smith/templates/etc/ddclient/ddclient.conf/30FreeHosts smeserver-ddclient-1.2.1.bz8961/root/etc/e-smith/templates/etc/ddclient/ddclient.conf/30FreeHosts
303 --- smeserver-ddclient-1.2.1.bz8961.old/root/etc/e-smith/templates/etc/ddclient/ddclient.conf/30FreeHosts 1970-01-01 01:00:00.000000000 +0100
304 +++ smeserver-ddclient-1.2.1.bz8961/root/etc/e-smith/templates/etc/ddclient/ddclient.conf/30FreeHosts 2015-07-10 15:01:50.685735873 +0200
305 @@ -0,0 +1,210 @@
306 +{
307 + use strict;
308 + use esmith::util;
309 + use esmith::ConfigDB;
310 + use esmith::AccountsDB;
311 +
312 + $OUT='';
313 +
314 + my $conf = esmith::ConfigDB->open()
315 + or die "Unable to open configuration db";
316 +
317 + my $edb;
318 +
319 + $edb = esmith::ConfigDB->open('/home/e-smith/db/ddclient')
320 + or $edb = esmith::ConfigDB->create('/home/e-smith/db/ddclient');
321 +
322 + #------------------------------------------------------------
323 + # Look up domains and domain descriptions
324 + #------------------------------------------------------------
325 +
326 + my $key;
327 + my @virtualDomains = ();
328 + foreach my $domain ($edb->get_all_by_prop(type=>'ddhost'))
329 + {
330 + $key = $domain->key;
331 + push (@virtualDomains, $key);
332 + }
333 +
334 + my $numDomains = @virtualDomains;
335 + if ($numDomains > 0) {
336 + foreach my $dom (sort @virtualDomains)
337 + {
338 + my $edom=$edb->get($dom);
339 +
340 + if( defined $edom )
341 + {
342 + my $dns = $edom->prop('dns');
343 + $dns =~ tr/a-z/A-Z/;
344 + my $login = $edom->prop('login');
345 + my $password = $edom->prop('password');
346 + my $customdns = $edom->prop('customdns') || '';
347 + my $customprotocol = $edom->prop('customprotocol') || '';
348 + my $pubserv='';
349 + my $static='';
350 + my $custom='';
351 + my $wildcard='';
352 + my $mx=$edom->prop('mx') || '';
353 + my $backupmx='';
354 + my $protocol='';
355 + my $explain='';
356 +
357 + if( $dns eq 'DYNDNS1')
358 + {
359 + $explain='## dyndns.org dynamic addresses';
360 + $pubserv ='members.dyndns.org';
361 + $protocol='dyndns2';
362 + $static='no';
363 + $custom='no';
364 + $wildcard='yes';
365 + }
366 + elsif( $dns eq 'DYNDNS2')
367 + {
368 + $explain='## dyndns.org static addresses';
369 + $pubserv ='members.dyndns.org';
370 + $protocol='dyndns2';
371 + $static ='yes';
372 + $custom ='no';
373 + $wildcard='yes';
374 + }
375 + elsif( $dns eq 'DYNDNS3')
376 + {
377 + $explain='## dyndns.org static2 addresses';
378 + $pubserv='members.dyndns.org';
379 + $custom ='yes';
380 + $protocol='dyndns2';
381 + $static ='';
382 + $wildcard='yes';
383 + }
384 + elsif( $dns eq 'ZONEDIT')
385 + {
386 + $explain='## zoneedit dynamic addresses';
387 + $pubserv='www.zoneedit.com';
388 + $protocol='zoneedit1';
389 + }
390 + elsif( $dns eq 'EASYDNS')
391 + {
392 + $explain='## easydns.com dynamic addresses';
393 + $pubserv='members.easydns.com';
394 + $protocol='easydns';
395 + }
396 + elsif( $dns eq 'HAMMER')
397 + {
398 + $explain='## hammer dup.hn.org dynamic addresses';
399 + $pubserv='dup.hn.org';
400 + $protocol='hammernode1';
401 + }
402 + elsif( $dns eq 'DSLREPORTS' )
403 + {
404 + $explain='## dslreports.org dynamic addresses';
405 + $pubserv='members.dslreports.com';
406 + $protocol='dslreports1';
407 + }
408 + elsif( $dns eq 'EURODYNDNS' )
409 + {
410 + $explain='## euroddyndns.org dynamic addresses';
411 + $pubserv='eurodyndns.org';
412 + $protocol='namecheap';
413 + }
414 + elsif( $dns eq 'DTDNS' )
415 + {
416 + $explain='## DtDNS (www.dtdns.com) dynamic addresses';
417 + $pubserv='www.dtdns.com';
418 + $protocol='dtdns';
419 + }
420 + elsif( $dns eq 'LOOPIA' )
421 + {
422 + $explain='## Loopia (loopia.se) dynamic addresses';
423 + $pubserv='dns.loopia.se';
424 + $protocol='dyndns2';
425 + }
426 + elsif( $dns eq 'DNSPARK' )
427 + {
428 + $explain='## dnspark.com dynamic addresses';
429 + $pubserv='www.dnspark.com';
430 + $protocol='dnspark';
431 + }
432 + elsif( $dns eq 'DYNHOST' )
433 + {
434 + $explain='## DynHost (ovh.com) dynamic addresses';
435 + $pubserv='www.ovh.com';
436 + $protocol='dyndns2';
437 + }
438 + elsif( $dns eq 'NOIP' )
439 + {
440 + $explain='## Noip (noip.com) dynamic addresses';
441 + $pubserv='dynupdate.no-ip.com';
442 + $protocol='noip';
443 + }
444 + elsif( $dns eq 'CHANGEIP' )
445 + {
446 + $explain='## ChangeIP (changeip.com) dynamic addresses';
447 + $pubserv='nic.changeip.com';
448 + $protocol='dyndns2';
449 + }
450 +
451 + elsif( $dns eq 'NAMECHEAP' )
452 + {
453 + $explain='## NAMECHEAP (namecheap.com) dynamic addresses';
454 + $pubserv='dynamicdns.park-your-domain.com';
455 + $protocol='namecheap';
456 + }
457 +
458 + elsif( $dns eq 'SPDNS' )
459 + {
460 + $explain='## SPDNS (spdns.de) dynamic addresses';
461 + $pubserv='update.spdns.de';
462 + $protocol='dyndns2';
463 + }
464 +
465 + elsif( $dns eq 'CUSTOMDNS' )
466 + {
467 + $explain='## CUSTOMDNS PROVIDER dynamic addresses';
468 + $pubserv= $customdns;
469 + $protocol= $customprotocol;
470 + }
471 +
472 + if($pubserv ne '')
473 + {
474 + $OUT .="##\n";
475 + $OUT .=$explain."\n";
476 + $OUT .="##\n";
477 + $OUT .="server=".$pubserv.", \\\n";
478 + $OUT .="protocol=".$protocol.", \\\n";
479 + if( $dns eq 'DTDNS' ) {
480 + $OUT .="client=ddclient, \\\n";
481 + }
482 + if( $dns eq 'LOOPIA' ) {
483 + $OUT .="use=web, \\\n";
484 + $OUT .="web=loopia, \\\n";
485 + $OUT .="script=/XDynDNSServer/XDynDNS.php, \\\n";
486 + }
487 + if($static ne '') {
488 + $OUT .="static=".$static.", \\\n";
489 + }
490 +
491 + if($wildcard ne '') {
492 + $OUT .="wildcard=".$wildcard.", \\\n";
493 + }
494 +
495 + if($custom ne '') {
496 + $OUT .="custom=".$custom.", \\\n";
497 + }
498 +
499 + if ($mx ne '') {
500 + $OUT .="mx=".$mx.", \\\n";
501 + }
502 +
503 + $OUT .="login=".$login.", \\\n";
504 + $OUT .="password=".$password." \\\n";
505 + $OUT .="\@\n" if ( $dns eq 'NAMECHEAP' );
506 +
507 + $OUT .=$edom->key()."\n" if ( $dns ne 'NAMECHEAP' );
508 + $OUT .="##\n";
509 + $OUT .="##\n";
510 + }
511 + }
512 + }
513 + }
514 +}
515 +
516 diff -Nur smeserver-ddclient-1.2.1.bz8961.old/root/etc/e-smith/templates/etc/ddclient.conf/10Headers smeserver-ddclient-1.2.1.bz8961/root/etc/e-smith/templates/etc/ddclient.conf/10Headers
517 --- smeserver-ddclient-1.2.1.bz8961.old/root/etc/e-smith/templates/etc/ddclient.conf/10Headers 2015-07-07 00:04:46.528387351 +0200
518 +++ smeserver-ddclient-1.2.1.bz8961/root/etc/e-smith/templates/etc/ddclient.conf/10Headers 1970-01-01 01:00:00.000000000 +0100
519 @@ -1,13 +0,0 @@
520 - {
521 - my $deamonupdate = ${ddclient}{DeamonUpdate} || '300';
522 - my $ssl = ${ddclient}{SSL} || 'yes';
523 - $OUT .= qq(
524 -daemon=$deamonupdate # check every $deamonupdate seconds
525 -syslog=yes # log update msgs to syslog
526 -mail=admin # mail update msgs to admin
527 -mail-failure=admin
528 -pid=/var/run/ddclient/ddclient.pid # record PID in file.
529 -ssl=$ssl
530 -#);
531 - }
532 -
533 diff -Nur smeserver-ddclient-1.2.1.bz8961.old/root/etc/e-smith/templates/etc/ddclient.conf/20Declaration smeserver-ddclient-1.2.1.bz8961/root/etc/e-smith/templates/etc/ddclient.conf/20Declaration
534 --- smeserver-ddclient-1.2.1.bz8961.old/root/etc/e-smith/templates/etc/ddclient.conf/20Declaration 2015-07-07 00:04:46.528387351 +0200
535 +++ smeserver-ddclient-1.2.1.bz8961/root/etc/e-smith/templates/etc/ddclient.conf/20Declaration 1970-01-01 01:00:00.000000000 +0100
536 @@ -1,178 +0,0 @@
537 -{
538 - use esmith::DomainsDB;
539 -
540 - $OUT='';
541 -
542 - my $ddb = esmith::DomainsDB->open_ro();
543 -
544 - $OUT .="use=web, web=$ddclient{'urlcheckip'}\/, web-skip='IP Address:' \n";
545 -
546 - for my $edom ( $ddb->domains )
547 - {
548 - {
549 -
550 - my $dns = $edom->prop('dns') || '';
551 - next if ($dns eq '');
552 - $dns =~ tr/a-z/A-Z/;
553 - my $login = $edom->prop('login');
554 - my $password = $edom->prop('password');
555 - my $pubserv='';
556 - my $static='';
557 - my $custom='';
558 - my $wildcard='';
559 - my $mx=$edom->prop('mx') || '';
560 - my $backupmx='';
561 - my $protocol='';
562 - my $explain='';
563 -
564 - if( $dns eq 'DYNDNS1')
565 - {
566 - $explain='## dyndns.org dynamic addresses';
567 - $pubserv ='members.dyndns.org';
568 - $protocol='dyndns2';
569 - $static='no';
570 - $custom='no';
571 - $wildcard='yes';
572 - }
573 - elsif( $dns eq 'DYNDNS2')
574 - {
575 - $explain='## dyndns.org static addresses';
576 - $pubserv ='members.dyndns.org';
577 - $protocol='dyndns2';
578 - $static ='yes';
579 - $custom ='no';
580 - $wildcard='yes';
581 - }
582 - elsif( $dns eq 'DYNDNS3')
583 - {
584 - $explain='## dyndns.org static2 addresses';
585 - $pubserv='members.dyndns.org';
586 - $custom ='yes';
587 - $protocol='dyndns2';
588 - $static ='';
589 - $wildcard='yes';
590 - }
591 - elsif( $dns eq 'ZONEDIT')
592 - {
593 - $explain='## zoneedit dynamic addresses';
594 - $pubserv='www.zoneedit.com';
595 - $protocol='zoneedit1';
596 - }
597 - elsif( $dns eq 'EASYDNS')
598 - {
599 - $explain='## easydns.com dynamic addresses';
600 - $pubserv='members.easydns.com';
601 - $protocol='easydns';
602 - }
603 - elsif( $dns eq 'HAMMER')
604 - {
605 - $explain='## hammer dup.hn.org dynamic addresses';
606 - $pubserv='dup.hn.org';
607 - $protocol='hammernode1';
608 - }
609 - elsif( $dns eq 'DSLREPORTS' )
610 - {
611 - $explain='## dslreports.org dynamic addresses';
612 - $pubserv='members.dslreports.com';
613 - $protocol='dslreports1';
614 - }
615 - elsif( $dns eq 'EURODYNDNS' )
616 - {
617 - $explain='## euroddyndns.org dynamic addresses';
618 - $pubserv='eurodyndns.org';
619 - $protocol='namecheap';
620 - }
621 - elsif( $dns eq 'DTDNS' )
622 - {
623 - $explain='## DtDNS (www.dtdns.com) dynamic addresses';
624 - $pubserv='www.dtdns.com';
625 - $protocol='dtdns';
626 - }
627 - elsif( $dns eq 'LOOPIA' )
628 - {
629 - $explain='## Loopia (loopia.se) dynamic addresses';
630 - $pubserv='dns.loopia.se';
631 - $protocol='dyndns2';
632 - }
633 - elsif( $dns eq 'DNSPARK' )
634 - {
635 - $explain='## dnspark.com dynamic addresses';
636 - $pubserv='www.dnspark.com';
637 - $protocol='dnspark';
638 - }
639 - elsif( $dns eq 'DYNHOST' )
640 - {
641 - $explain='## DynHost (ovh.com) dynamic addresses';
642 - $pubserv='www.ovh.com';
643 - $protocol='dyndns2';
644 - }
645 - elsif( $dns eq 'NOIP' )
646 - {
647 - $explain='## Noip (noip.com) dynamic addresses';
648 - $pubserv='dynupdate.no-ip.com';
649 - $protocol='noip';
650 - }
651 - elsif( $dns eq 'CHANGEIP' )
652 - {
653 - $explain='## ChangeIP (changeip.com) dynamic addresses';
654 - $pubserv='nic.changeip.com';
655 - $protocol='dyndns2';
656 - }
657 -
658 - elsif( $dns eq 'NAMECHEAP' )
659 - {
660 - $explain='## NAMECHEAP (namecheap.com) dynamic addresses';
661 - $pubserv='dynamicdns.park-your-domain.com';
662 - $protocol='namecheap';
663 - }
664 -
665 - elsif( $dns eq 'SPDNS' )
666 - {
667 - $explain='## SPDNS (spdns.de) dynamic addresses';
668 - $pubserv='update.spdns.de';
669 - $protocol='dyndns2';
670 - }
671 -
672 - if($pubserv ne '')
673 - {
674 - $OUT .="##\n";
675 - $OUT .=$explain."\n";
676 - $OUT .="##\n";
677 - $OUT .="server=".$pubserv.", \\\n";
678 - $OUT .="protocol=".$protocol.", \\\n";
679 - if( $dns eq 'DTDNS' ) {
680 - $OUT .="client=ddclient, \\\n";
681 - }
682 - if( $dns eq 'LOOPIA' ) {
683 - $OUT .="use=web, \\\n";
684 - $OUT .="web=loopia, \\\n";
685 - $OUT .="script=/XDynDNSServer/XDynDNS.php, \\\n";
686 - }
687 - if($static ne '') {
688 - $OUT .="static=".$static.", \\\n";
689 - }
690 -
691 - if($wildcard ne '') {
692 - $OUT .="wildcard=".$wildcard.", \\\n";
693 - }
694 -
695 - if($custom ne '') {
696 - $OUT .="custom=".$custom.", \\\n";
697 - }
698 -
699 - if ($mx ne '') {
700 - $OUT .="mx=".$mx.", \\\n";
701 - }
702 -
703 - $OUT .="login=".$login.", \\\n";
704 - $OUT .="password=".$password." \\\n";
705 - $OUT .="\@\n" if ( $dns eq 'NAMECHEAP' );
706 -
707 - $OUT .=$edom->key()."\n" if ( $dns ne 'NAMECHEAP' );
708 - $OUT .="##\n";
709 - $OUT .="##\n";
710 - }
711 - }
712 - }
713 -}
714 -
715 diff -Nur smeserver-ddclient-1.2.1.bz8961.old/root/etc/e-smith/templates.metadata/etc/ddclient/ddclient.conf smeserver-ddclient-1.2.1.bz8961/root/etc/e-smith/templates.metadata/etc/ddclient/ddclient.conf
716 --- smeserver-ddclient-1.2.1.bz8961.old/root/etc/e-smith/templates.metadata/etc/ddclient/ddclient.conf 1970-01-01 01:00:00.000000000 +0100
717 +++ smeserver-ddclient-1.2.1.bz8961/root/etc/e-smith/templates.metadata/etc/ddclient/ddclient.conf 2015-07-10 14:10:14.014570889 +0200
718 @@ -0,0 +1,3 @@
719 +UID="root"
720 +GID="root"
721 +PERMS=0600
722 diff -Nur smeserver-ddclient-1.2.1.bz8961.old/root/etc/e-smith/templates.metadata/etc/ddclient.conf smeserver-ddclient-1.2.1.bz8961/root/etc/e-smith/templates.metadata/etc/ddclient.conf
723 --- smeserver-ddclient-1.2.1.bz8961.old/root/etc/e-smith/templates.metadata/etc/ddclient.conf 2015-07-07 00:04:46.528387351 +0200
724 +++ smeserver-ddclient-1.2.1.bz8961/root/etc/e-smith/templates.metadata/etc/ddclient.conf 1970-01-01 01:00:00.000000000 +0100
725 @@ -1,3 +0,0 @@
726 -UID="ddclient"
727 -GID="ddclient"
728 -PERMS=0600
729 diff -Nur smeserver-ddclient-1.2.1.bz8961.old/root/etc/e-smith/web/functions/ddclient smeserver-ddclient-1.2.1.bz8961/root/etc/e-smith/web/functions/ddclient
730 --- smeserver-ddclient-1.2.1.bz8961.old/root/etc/e-smith/web/functions/ddclient 2015-07-07 00:04:46.528387351 +0200
731 +++ smeserver-ddclient-1.2.1.bz8961/root/etc/e-smith/web/functions/ddclient 2015-07-10 15:02:32.360861723 +0200
732 @@ -49,8 +49,18 @@
733 sub performModifyDomain ($);
734 sub deleteDomain ($);
735 sub performDeleteDomain ($);
736 +sub ddcreateDomain ($);
737 +sub ddperformCreateDomain ($);
738 +sub ddmodifyDomain ($);
739 +sub ddperformModifyDomain ($);
740 +sub dddeleteDomain ($);
741 +sub ddperformDeleteDomain ($);
742 sub genServer ($$);
743
744 +sub genRetrieve($$);
745 +sub performRetrieve($);
746 +
747 +################################################################################################################"
748 BEGIN
749 {
750 # Clear PATH and related environment variables so that calls to
751 @@ -73,13 +83,12 @@
752 tie %conf, 'esmith::config', '/home/e-smith/configuration';
753 }
754
755 -my $domaindb = esmith::ConfigDB->open('/home/e-smith/db/domains');
756 - if ( not defined $domaindb ) {
757 - $domaindb = esmith::ConfigDB->open('/home/e-smith/domains');
758 - if ( not defined $domaindb ) {
759 - die "Unable to open domains db";
760 - }
761 - }
762 +my $domaindb = esmith::ConfigDB->open('/home/e-smith/db/domains')
763 + or die "Unable to open domains db";
764 +my $edb;
765 +
766 +$edb = esmith::ConfigDB->open('/home/e-smith/db/ddclient')
767 + or $edb = esmith::ConfigDB->create('/home/e-smith/db/ddclient');
768 #------------------------------------------------------------
769 # examine state parameter and display the appropriate form
770 #------------------------------------------------------------
771 @@ -121,6 +130,29 @@
772 performDeleteDomain ($q);
773 }
774
775 +elsif ($q->param ('state') eq "ddcreate") {
776 + ddcreateDomain ($q);
777 +}
778 +elsif ($q->param ('state') eq "ddperformCreate") {
779 + ddperformCreateDomain ($q);
780 +}
781 +elsif ($q->param ('state') eq "ddmodify") {
782 + ddmodifyDomain ($q);
783 +}
784 +elsif ($q->param ('state') eq "ddperformModify") {
785 + ddperformModifyDomain ($q);
786 +}
787 +elsif ($q->param ('state') eq "dddelete") {
788 + dddeleteDomain ($q);
789 +}
790 +elsif ($q->param ('state') eq "ddperformDelete") {
791 + ddperformDeleteDomain ($q);
792 +}
793 +
794 +elsif ($q->param ('state') eq "performRetrieve") {
795 + performRetrieve($q);
796 +}
797 +
798 else
799 {
800 esmith::cgi::genStateError ($q, \%conf);
801 @@ -142,6 +174,7 @@
802 }
803
804 my %Labels = (
805 + 'CUSTOMDNS' => $fm->localise('CUSTOMDNS'),
806 'DYNDNS1' => $fm->localise('DYNDNS1'),
807 'DYNDNS2' => $fm->localise('DYNDNS2'),
808 'DYNDNS3' => $fm->localise('DYNDNS3'),
809 @@ -162,7 +195,7 @@
810
811 return esmith::cgi::genCell ($q, $q->popup_menu (-name => 'dns',
812 -values => [
813 - 'DYNDNS1','DYNDNS2','DYNDNS3','ZONEDIT',
814 + 'CUSTOMDNS', 'DYNDNS1','DYNDNS2','DYNDNS3','ZONEDIT',
815 'EASYDNS','HAMMER','DSLREPORTS', 'EURODYNDNS',
816 'DTDNS','LOOPIA','DNSPARK','DYNHOST','NOIP','CHANGEIP',
817 'NAMECHEAP','SPDNS'
818 @@ -170,6 +203,28 @@
819 -default => $curSetting,
820 -labels => \%Labels));
821 }
822 +
823 +#-----------------------------------------------------------------------------------------------------
824 +sub genRetrieve($$) {
825 + my ($q, $curSetting) = @_;
826 +
827 + if ((! defined $curSetting) || ($curSetting eq ''))
828 + {
829 + $curSetting = 'yes';
830 + }
831 +
832 + my %Labels = (
833 + 'yes' => $fm->localise('yes'),
834 + 'no' => $fm->localise('no'),
835 + );
836 +
837 + return esmith::cgi::genCell ($q, $q->popup_menu (-name => 'retrievessl',
838 + -values => [
839 + 'yes','no'
840 + ],
841 + -default => $curSetting,
842 + -labels => \%Labels));
843 +}
844 #------------------------------------------------------------
845
846 sub showInitial ($$)
847 @@ -192,6 +247,44 @@
848 print $q->hr;
849 }
850
851 + print $q->p ($fm->localise('FORM_DESCRIPTION'));
852 +
853 + #------------------------------------------------------------
854 + # get the ip retrieve method
855 + #------------------------------------------------------------
856 + my $ddretrieve=$conf->get('ddclient');
857 + my $DeamonUpdate=$ddretrieve->prop('DeamonUpdate')|| '300';
858 + my $urlcheckip=$ddretrieve->prop('urlcheckip')|| 'checkip.dyndns.org';
859 + my $ssl=$ddretrieve->prop('SSL')|| 'yes';
860 +
861 + print $q->startform (-method => 'POST',
862 + -action => $q->url (-absolute => 1));
863 +
864 + print $q->table ({border => 0, cellspacing => 0, cellpadding => 4},
865 + $q->Tr (esmith::cgi::genCell ($q,$fm->localise('RETRIEVE_SSL')),
866 + genRetrieve($q,$ssl)),
867 +# esmith::cgi::genWidgetRow ($q, $fm->localise('RETRIEVE_SSL')),
868 +# $q->popup_menu (-name => 'SSL',
869 +# -values => ['yes', 'no'],
870 +# -default => $ssl),
871 +# -labels => \%status)) ,
872 +
873 +
874 + $q->Tr (esmith::cgi::genNameValueRow ($q,$fm->localise('RETRIEVE_DEAMONUPDATE'),
875 + "retrievedeamonupdate",$DeamonUpdate)),
876 + $q->Tr (esmith::cgi::genNameValueRow ($q,$fm->localise('RETRIEVE_URLCHECKIP'),
877 + "retrieveurlcheckip",$urlcheckip)),
878 + esmith::cgi::genButtonRow ( $q,
879 + $q->submit (-name => 'action',
880 + -value => $fm->localise('APPLY')))
881 + );
882 +
883 + print $q->hidden (-name => 'state',
884 + -override => 1,
885 + -default => 'performRetrieve');
886 +
887 + print $q->endform;
888 + print $q->hr;
889
890 #------------------------------------------------------------
891 # Look up domains and domain descriptions
892 @@ -256,6 +349,7 @@
893 esmith::cgi::genSmallCell ($q, $properties{'Description'}),
894 esmith::cgi::genSmallCell ($q, $content),
895 esmith::cgi::genSmallCell ($q, '&nbsp'),
896 + esmith::cgi::genSmallCell ($q, '&nbsp'),
897 esmith::cgi::genSmallCell ($q,
898 $q->a ({href => $q->url (-absolute => 1)
899 . "?state=create&domain="
900 @@ -284,6 +378,61 @@
901
902 print '</table>';
903 }
904 + print $q->hr;
905 +#########################################################################################################################################
906 +# now the free form part
907 +#
908 + my @FreeDomains = ();
909 + foreach my $domain ($edb->get_all_by_prop(type=>'ddhost'))
910 + {
911 + my $key = $domain->key;
912 + push (@FreeDomains, $key);
913 + }
914 +
915 + print $q->p ($fm->localise('FREE_FORM_DESCRIPTION'));
916 +
917 + $numDomains = @FreeDomains;
918 +
919 + print $q->p ($q->b ($fm->localise('CURRENT_LIST_OF_DOMAINS')));
920 +
921 + print $q->table ({border => 1, cellspacing => 1, cellpadding => 4});
922 +
923 + print $q->Tr (esmith::cgi::genSmallCell ($q, $q->b ($fm->localise('DOMAIN'))),
924 + esmith::cgi::genSmallCell ($q, $q->b ($fm->localise('DESCRIPTION'))),
925 + esmith::cgi::genSmallCell ($q, $q->b ($fm->localise('PUBLICATION'))),
926 + $q->td ('&nbsp;'),
927 + $q->td ('&nbsp;')
928 + );
929 +
930 + if ( $numDomains > 0 ) {
931 + foreach my $domain (sort @FreeDomains) {
932 + my $vals = $edb->get($domain);
933 + my $content = $vals->prop('desc');
934 + my $publish = $vals->prop('dns');
935 + print $q->Tr (esmith::cgi::genSmallCell ($q, $domain),
936 + esmith::cgi::genSmallCell ($q, $content),
937 + esmith::cgi::genSmallCell ($q, $publish),
938 + esmith::cgi::genSmallCell ($q,
939 + $q->a ({href => $q->url (-absolute => 1)
940 + . "?state=ddmodify&domain="
941 + . $domain}, $fm->localise('MODIFY', ))),
942 + esmith::cgi::genSmallCell ($q,
943 + $q->a ({href => $q->url (-absolute => 1)
944 + . "?state=dddelete&domain="
945 + . $domain}, $fm->localise('DELETE', )))
946 + );
947 + }
948 + }
949 +
950 + print $q->Tr (($q->td('&nbsp;')),
951 + ($q->td('&nbsp;')),
952 + ($q->td('&nbsp;')),
953 + ($q->td('&nbsp;')),
954 + esmith::cgi::genSmallCell ($q,
955 + $q->a ({href => $q->url (-absolute => 1)
956 + . "?state=ddcreate"}, $fm->localise('CREATE', )))
957 + );
958 + print '</table>';
959
960 esmith::cgi::genFooter ($q);
961 }
962 @@ -324,7 +473,27 @@
963 -labels => \%labels));
964 }
965 #------------------------------------------------------------
966 +#
967 +#------------------------------------------------------------
968 +sub performRetrieve($) {
969 + my ($q) = @_;
970 + my $deamonupdate =$q->param('retrievedeamonupdate');
971 + my $urlcheckip =$q->param('retrieveurlcheckip');
972 + my $ssl = $q->param('retrievessl');
973 +
974 + my $ddclient=$conf->get('ddclient');
975 + $ddclient->set_prop('urlcheckip' => $urlcheckip);
976 + $ddclient->set_prop('DeamonUpdate' => $deamonupdate);
977 + $ddclient->set_prop('SSL' => $ssl);
978
979 + $domaindb->reload();
980 +
981 + system ("/sbin/e-smith/signal-event", "ddclient");
982 +
983 + showInitial ($q, $fm->localise('SUCCESSFULLY_MODIFIED_RETRIEVE_IP'));
984 +}
985 +
986 +#------------------------------------------------------------
987 sub createDomain ($)
988 {
989 my ($q) = @_;
990 @@ -502,6 +671,9 @@
991 {content => $properties{'Content'}});
992 }
993
994 + print $q->h3 ($fm->localise('CUSTOM_DESCRIPTION'));
995 + print $q->p;
996 +
997 print $q->table ({border => 0, cellspacing => 0, cellpadding => 4},
998 $q->Tr (esmith::cgi::genCell ($q,
999 $fm->localise('DOMAIN_NAME')),
1000 @@ -518,6 +690,14 @@
1001 $q->Tr (esmith::cgi::genCell ($q, $fm->localise('SERVERS_LABEL')),
1002 genServer($q, $eprops{'dns'})),
1003
1004 + $q->Tr (esmith::cgi::genNameValueRow ($q,$fm->localise('CUSTOMDNS_LABEL'),
1005 + "customdns",
1006 + $eprops{'customdns'})),
1007 +
1008 + $q->Tr (esmith::cgi::genNameValueRow ($q,$fm->localise('CUSTOM_PROTOCOL_LABEL'),
1009 + "customprotocol",
1010 + $eprops{'customprotocol'})),
1011 +
1012 $q->Tr (esmith::cgi::genNameValueRow ($q,$fm->localise('NAME_LABEL'),
1013 "login",
1014 $eprops{'login'})),
1015 @@ -597,12 +777,30 @@
1016 }
1017
1018 my $domainMX = $q->param ('mx');
1019 + my $customDNS = $q->param('customdns');
1020 + my $customPROTOCOL = $q->param('customprotocol');
1021 +
1022 + my $dns = $q->param ('dns');
1023 + if ($dns eq 'CUSTOMDNS')
1024 + {
1025 + if ($customDNS =~ /^([a-zA-Z0-9\-\.]+)$/)
1026 + {
1027 + $customDNS = $1;
1028 + }
1029 + else
1030 +
1031 + {
1032 + showInitial ($q, $fm->localise('CUSTOMDNS_VALIDATION_ERROR',
1033 + {domainName => $domainName}));
1034 + return;
1035 + }
1036 + }
1037 #------------------------------------------------------------
1038 # Looks good. Find out if this domain has been taken
1039 # or if the domain is a reserved to provide a secured webserver
1040 # for a previous domain
1041 #------------------------------------------------------------
1042 - my $dns = $q->param ('dns');
1043 +# my $dns = $q->param ('dns');
1044
1045 my $dom=$domaindb->get($domainName);
1046
1047 @@ -610,6 +808,8 @@
1048 $dom->set_prop('login' => $domainLogin);
1049 $dom->set_prop('password' => $domainPassword);
1050 $dom->set_prop('mx' => $domainMX);
1051 + $dom->set_prop('customdns' => $customDNS);
1052 + $dom->set_prop('customprotocol' => $customPROTOCOL);
1053
1054 $domaindb->reload();
1055
1056 @@ -708,6 +908,11 @@
1057 my $dns = $fm->localise($props{'dns'});
1058
1059 $evalue->set_prop('dns' => '');
1060 + $evalue->set_prop('login' => '');
1061 + $evalue->set_prop('password' => '');
1062 + $evalue->set_prop('customdns' => '');
1063 + $evalue->set_prop('customprotocol' => '');
1064 +
1065 $domaindb->reload();
1066
1067 system ("/sbin/e-smith/signal-event", "ddclient");
1068 @@ -716,6 +921,422 @@
1069 {domain => $domain, dns => $dns}));
1070 }
1071
1072 +##################################################################################################################################################
1073 +# create a free publish
1074 +#
1075 +sub ddcreateDomain ($)
1076 +{
1077 + my ($q) = @_;
1078 +
1079 + esmith::cgi::genHeaderNonCacheable
1080 + ($q, \%conf, $fm->localise('CREATE_TITLE'));
1081 +
1082 + print $q->startform (-method => 'POST',
1083 + -action => $q->url (-absolute => 1));
1084 + print $q->h3 ($fm->localise('CUSTOM_DESCRIPTION'));
1085 + print $q->p;
1086 + print $q->table ({border => 0, cellspacing => 0, cellpadding => 4},
1087 +
1088 + $q->Tr (esmith::cgi::genNameValueRow ($q,$fm->localise('DOMAIN_NAME_LABEL'),
1089 + "domainName","")),
1090 +
1091 + $q->Tr (esmith::cgi::genNameValueRow($q,$fm->localise('DESCRIPTION_LABEL'),
1092 + "desc","")),
1093 +
1094 + $q->Tr (esmith::cgi::genCell ($q, $fm->localise('SERVERS_LABEL')),
1095 + genServer($q, '')),
1096 +
1097 + $q->Tr (esmith::cgi::genNameValueRow ($q,$fm->localise('CUSTOMDNS_LABEL'),
1098 + "customdns",'')),
1099 +
1100 + $q->Tr (esmith::cgi::genNameValueRow ($q,$fm->localise('CUSTOM_PROTOCOL_LABEL'),
1101 + "customprotocol",'')),
1102 +
1103 + $q->Tr (esmith::cgi::genNameValueRow ($q,$fm->localise('NAME_LABEL'),
1104 + "login","")),
1105 +
1106 + $q->Tr (esmith::cgi::genNameValueRow ($q,$fm->localise('PASSWORD_LABEL'),
1107 + "password","")),
1108 +
1109 + $q->Tr (esmith::cgi::genNameValueRow ($q,$fm->localise('MX'),
1110 + "mx","")),
1111 +
1112 + esmith::cgi::genButtonRow ( $q,
1113 + $q->submit (-name => 'action',
1114 + -value => $fm->localise('CREATE'))));
1115 +
1116 + print $q->hidden (-name => 'state',
1117 + -override => 1,
1118 + -default => 'ddperformCreate');
1119 +
1120 + print $q->endform;
1121 +
1122 + esmith::cgi::genFooter ($q);
1123 + return;
1124 +}
1125 +
1126 +#------------------------------------------------------------
1127 +#
1128 +#------------------------------------------------------------
1129 +
1130 +sub ddperformCreateDomain ($)
1131 +{
1132 + my ($q) = @_;
1133 +
1134 + #------------------------------------------------------------
1135 + # Validate parameters and untaint them
1136 + #------------------------------------------------------------
1137 +
1138 + my $domainName = $q->param ('domainName');
1139 + if ($domainName =~ /^([a-zA-Z0-9\-\.]+)$/) {
1140 + $domainName = $1;
1141 + } else {
1142 + showInitial ($q, $fm->localise('DOMAIN_NAME_VALIDATION_ERROR',
1143 + {domainName => $domainName}));
1144 + return;
1145 + }
1146 +###############################################
1147 + foreach my $domain ($domaindb->get_all_by_prop(type=>'domain'))
1148 + {
1149 + my $key = $domain->key;
1150 + if ( $key eq $domainName ) {
1151 + showInitial ($q, $fm->localise('DOMAIN_NAME_ALREADY_EXIST',
1152 + {domainName => $domainName}));
1153 + return;
1154 + }
1155 + }
1156 +
1157 + foreach my $domain ($edb->get_all_by_prop(type=>'ddhost'))
1158 + {
1159 + my $key = $domain->key;
1160 + if ( $key eq $domainName ) {
1161 + showInitial ($q, $fm->localise('DOMAIN_NAME_ALREADY_EXIST',
1162 + {domainName => $domainName}));
1163 + return;
1164 + }
1165 + }
1166 +
1167 +#############################################
1168 +
1169 + my $domainDesc = $q->param ('desc');
1170 + my $domainLogin = $q->param ('login');
1171 + if ($domainLogin =~ /^([\-\'\w][\-\'\w\s\.]*)$/) {
1172 + $domainLogin = $1;
1173 + } else {
1174 + showInitial ($q, $fm->localise('DOMAIN_LOGIN_VALIDATION_ERROR',
1175 + {domainLogin => $domainLogin}));
1176 + return;
1177 + }
1178 +
1179 + my $domainPassword = $q->param ('password');
1180 + if ($domainPassword =~ /^(.*)$/) {
1181 + $domainPassword = $1;
1182 + } else {
1183 + showInitial ($q, $fm->localise('DOMAIN_PASSWORD_VALIDATION_ERROR',
1184 + {domainPassword => $domainPassword}));
1185 + return;
1186 + }
1187 +
1188 + my $domainMX = $q->param ('mx');
1189 +##Custom dns retrieve
1190 + my $customDNS = $q->param('customdns');
1191 + my $customPROTOCOL = $q->param('customprotocol');
1192 +
1193 + my $dns = $q->param ('dns');
1194 + if ($dns eq 'CUSTOMDNS')
1195 + {
1196 + if ($customDNS =~ /^([a-zA-Z0-9\-\.]+)$/)
1197 + {
1198 + $customDNS = $1;
1199 + }
1200 + else
1201 +
1202 + {
1203 + showInitial ($q, $fm->localise('CUSTOMDNS_VALIDATION_ERROR',
1204 + {domainName => $domainName}));
1205 + return;
1206 + }
1207 + }
1208 + #------------------------------------------------------------
1209 + # Looks good. Find out if this domain has been taken
1210 + # or if the domain is a reserved to provide a secured webserver
1211 + # for a previous domain
1212 + #------------------------------------------------------------
1213 +# my $dns = $q->param ('dns');
1214 +
1215 + my %properties = ();
1216 + $properties{'type'} = 'ddhost';
1217 + $properties{'dns'} = $dns;
1218 + $properties{'login'} = $domainLogin;
1219 + $properties{'password'} = $domainPassword;
1220 + $properties{'mx'} = $domainMX;
1221 + $properties{'desc'} = $domainDesc;
1222 + $properties{'customdns'} = $customDNS;
1223 + $properties{'customprotocol'} = $customPROTOCOL;
1224 + $edb->new_record($domainName, \%properties);
1225 +
1226 + system ("/sbin/e-smith/signal-event", "ddclient");
1227 +
1228 + showInitial ($q, $fm->localise('SUCCESSFULLY_CREATED',
1229 + {domainName => $domainName,dns => $fm->localise($dns) }));
1230 +}
1231 +
1232 +#------------------------------------------------------------
1233 +#
1234 +#------------------------------------------------------------
1235 +
1236 +sub ddmodifyDomain ($)
1237 +{
1238 + my ($q) = @_;
1239 +
1240 + esmith::cgi::genHeaderNonCacheable ($q, \%conf,
1241 + $fm->localise('MODIFY_TITLE'));
1242 +
1243 + print $q->startform (-method => 'POST', -action => $q->url (-absolute => 1));
1244 +
1245 + my $domain = $q->param ('domain');
1246 + my $evalue = $edb->get($domain);
1247 +
1248 + if (defined $evalue)
1249 + {
1250 + my %eprops = $evalue->props;
1251 +
1252 + print $q->h3 ($fm->localise('CUSTOM_DESCRIPTION'));
1253 + print $q->p;
1254 +
1255 + print $q->table ({border => 0, cellspacing => 0, cellpadding => 4},
1256 + $q->Tr (esmith::cgi::genCell ($q, $fm->localise('DOMAIN_NAME_LABEL')),
1257 + esmith::cgi::genCell ($q, $domain)),
1258 +
1259 + $q->Tr (esmith::cgi::genNameValueRow ($q, $fm->localise('DESCRIPTION_LABEL'),
1260 + "desc",
1261 + $eprops{'desc'})),
1262 +
1263 + $q->Tr (esmith::cgi::genCell ($q, $fm->localise('SERVERS_LABEL')),
1264 + genServer($q, $eprops{'dns'})),
1265 +
1266 + $q->Tr (esmith::cgi::genNameValueRow ($q,$fm->localise('CUSTOMDNS_LABEL'),
1267 + "customdns",
1268 + $eprops{'customdns'})),
1269 +
1270 + $q->Tr (esmith::cgi::genNameValueRow ($q,$fm->localise('CUSTOM_PROTOCOL_LABEL'),
1271 + "customprotocol",
1272 + $eprops{'customprotocol'})),
1273 +
1274 + $q->Tr (esmith::cgi::genNameValueRow ($q,$fm->localise('NAME_LABEL'),
1275 + "login",
1276 + $eprops{'login'})),
1277 +
1278 + $q->Tr (esmith::cgi::genNameValueRow ($q,$fm->localise('PASSWORD_LABEL'),
1279 + "password",
1280 + $eprops{'password'})),
1281 +
1282 + $q->Tr (esmith::cgi::genNameValueRow ($q,$fm->localise('MX'),
1283 + "mx",$eprops{'mx'})),
1284 +
1285 + esmith::cgi::genButtonRow ($q,
1286 + $q->submit (-name => 'action',
1287 + -value => $fm->localise('MODIFY')))
1288 + );
1289 +
1290 + print $q->hidden (-name => 'domainName',
1291 + -override => 1,
1292 + -default => $domain);
1293 +
1294 + print $q->hidden (-name => 'state',
1295 + -override => 1,
1296 + -default => 'ddperformModify');
1297 +
1298 + } else {
1299 + showInitial ($q, $fm->localise('ERROR_ON_EXTRA_DATABASE',
1300 + {domainName => $domain }));
1301 + return;
1302 + }
1303 +
1304 + print $q->endform;
1305 + esmith::cgi::genFooter ($q);
1306 + return;
1307 +}
1308 +
1309 +#------------------------------------------------------------
1310 +#
1311 +#------------------------------------------------------------
1312 +
1313 +sub ddperformModifyDomain ($)
1314 +{
1315 + my ($q) = @_;
1316 +
1317 + #------------------------------------------------------------
1318 + # Validate parameters and untaint them
1319 + #------------------------------------------------------------
1320 +
1321 + my $domainName = $q->param ('domainName');
1322 + if ($domainName =~ /^([a-zA-Z0-9\-\.]+)$/) {
1323 + $domainName = $1;
1324 + } else {
1325 + showInitial ($q, $fm->localise('DOMAIN_NAME_VALIDATION_ERROR',
1326 + {domainName => $domainName}));
1327 + return;
1328 + }
1329 +
1330 + my $domainLogin = $q->param ('login');
1331 + if ($domainLogin =~ /^([\-\'\w][\-\'\w\s\.]*)$/) {
1332 + $domainLogin = $1;
1333 + } else {
1334 + showInitial ($q, $fm->localise('DOMAIN_LOGIN_VALIDATION_ERROR',
1335 + {domainLogin => $domainLogin}));
1336 + return;
1337 + }
1338 +
1339 + my $domainPassword = $q->param ('password');
1340 + if ($domainPassword =~ /^(.*)$/) {
1341 + $domainPassword = $1;
1342 + } else {
1343 + showInitial ($q, $fm->localise('DOMAIN_PASSWORD_VALIDATION_ERROR',
1344 + {domainPassword => $domainPassword}));
1345 + return;
1346 + }
1347 +
1348 + my $domainMX = $q->param ('mx');
1349 + my $desc = $q->param ('desc');
1350 + my $customDNS = $q->param('customdns');
1351 + my $customPROTOCOL = $q->param('customprotocol');
1352 +
1353 + my $dns = $q->param ('dns');
1354 +
1355 + if ($dns eq 'CUSTOMDNS')
1356 + {
1357 + if ($customDNS =~ /^([a-zA-Z0-9\-\.]+)$/)
1358 + {
1359 + $customDNS = $1;
1360 + }
1361 + else
1362 +
1363 + {
1364 + showInitial ($q, $fm->localise('CUSTOMDNS_VALIDATION_ERROR',
1365 + {domainName => $domainName}));
1366 + return;
1367 + }
1368 + }
1369 + #------------------------------------------------------------
1370 + # Looks good. Find out if this domain has been taken
1371 + # or if the domain is a reserved to provide a secured webserver
1372 + # for a previous domain
1373 + #------------------------------------------------------------
1374 +# my $dns = $q->param ('dns');
1375 +
1376 + my $dom=$edb->get($domainName);
1377 +
1378 + $dom->set_prop('desc' => $desc);
1379 + $dom->set_prop('dns' => $dns);
1380 + $dom->set_prop('login' => $domainLogin);
1381 + $dom->set_prop('password' => $domainPassword);
1382 + $dom->set_prop('mx' => $domainMX);
1383 + $dom->set_prop('customdns' => $customDNS);
1384 + $dom->set_prop('customprotocol' => $customPROTOCOL);
1385 +
1386 + $edb->reload();
1387 +
1388 + system ("/sbin/e-smith/signal-event", "ddclient");
1389 +
1390 + showInitial ($q, $fm->localise('SUCCESSFULLY_MODIFIED',
1391 + {domainName => $domainName,dns => $fm->localise($dns)}));
1392 +}
1393 +
1394 +#------------------------------------------------------------
1395 +#
1396 +#------------------------------------------------------------
1397 +
1398 +sub dddeleteDomain ($)
1399 +{
1400 + my ($q) = @_;
1401 +
1402 + esmith::cgi::genHeaderNonCacheable ($q, \%conf, $fm->localise('REMOVE_TITLE'));
1403 +
1404 + print $q->startform (-method => 'POST', -action => $q->url (-absolute => 1));
1405 +
1406 + my $domain = $q->param ('domain');
1407 + my $evalue = $edb->get($domain);
1408 +
1409 + if (defined $evalue)
1410 + {
1411 + my %eprops = $evalue->props;
1412 + my $domainDesc = $eprops{'desc'};
1413 + my $dns = $fm->localise($eprops{'dns'});
1414 +
1415 + print $q->p($fm->localise('REMOVE_DESCRIPTION',
1416 + {domain => $domain,
1417 + domainDesc => $domainDesc,
1418 + dns => $dns } ));
1419 +
1420 + print $q->submit (-name => 'action', -value => $fm->localise('REMOVE'));
1421 + print $q->hidden (-name => 'domain', -override => 1, -default => $domain);
1422 +
1423 + print $q->hidden (-name => 'state',
1424 + -override => 1,
1425 + -default => 'ddperformDelete');
1426 + } else {
1427 + showInitial ($q, $fm->localise('ERROR_ON_EXTRA_DATABASE',
1428 + {domainName => $domain }));
1429 + return;
1430 + }
1431 +
1432 + print $q->endform;
1433 + esmith::cgi::genFooter ($q);
1434 + return;
1435 +}
1436 +
1437 +#------------------------------------------------------------
1438 +#
1439 +#------------------------------------------------------------
1440 +
1441 +sub ddperformDeleteDomain ($)
1442 +{
1443 + my ($q) = @_;
1444 +
1445 + #------------------------------------------------------------
1446 + # Attempt to delete domain
1447 + #------------------------------------------------------------
1448 +
1449 + my $domain = $q->param ('domain');
1450 +
1451 + if ($domain =~ /^([a-zA-Z0-9\-\.]+)$/) {
1452 + $domain = $1;
1453 + } else {
1454 + showInitial ($q, $fm->localise('ERROR_WHILE_REMOVING_DOMAIN',
1455 + {domain => $domain}));
1456 + return;
1457 + }
1458 +
1459 + my $evalue = $edb->get($domain);
1460 + unless ($evalue)
1461 + {
1462 + showInitial ($q, $fm->localise('NONEXISTENT_DOMAIN_ERROR',
1463 + {domainName => $domain}));
1464 + return;
1465 + }
1466 +
1467 + my %properties = $evalue->props;
1468 + my $type = $properties{'type'};
1469 + my $dns = $fm->localise($properties{'dns'});
1470 +
1471 + if ($type ne 'ddhost')
1472 + {
1473 + showInitial ($q, $fm->localise('NONEXISTENT_DOMAIN_ERROR',
1474 + {domainName => $domain}));
1475 + return;
1476 + }
1477 +
1478 +# $evalue = $edb->get($domain);
1479 + $evalue->delete;
1480 + $edb->reload();
1481 +
1482 + system ("/sbin/e-smith/signal-event", "ddclient");
1483 +
1484 + showInitial ($q, $fm->localise('SUCCESSFULLY_DELETED',
1485 + {domain => $domain, dns => $dns}));
1486 +}
1487 +
1488 #################################################################################################
1489
1490 __DATA__

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed