/[smecontribs]/rpms/smeserver-ddclient/contribs10/smeserver-ddclient-1.3.0-bz11667-Update-SM2-lib.patch
ViewVC logotype

Contents of /rpms/smeserver-ddclient/contribs10/smeserver-ddclient-1.3.0-bz11667-Update-SM2-lib.patch

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


Revision 1.1 - (show annotations) (download)
Tue Aug 31 13:49:07 2021 UTC (2 years, 8 months ago) by jcrisp
Branch: MAIN
CVS Tags: smeserver-ddclient-1_3_0-19_el7_sme, smeserver-ddclient-1_3_0-22_el7_sme, smeserver-ddclient-1_3_0-21_el7_sme, smeserver-ddclient-1_3_0-31_el7_sme, smeserver-ddclient-1_3_0-23_el7_sme, smeserver-ddclient-1_3_0-24_el7_sme, smeserver-ddclient-1_3_0-32_el7_sme, smeserver-ddclient-1_3_0-27_el7_sme, smeserver-ddclient-1_3_0-20_el7_sme, smeserver-ddclient-1_3_0-26_el7_sme, smeserver-ddclient-1_3_0-30_el7_sme, smeserver-ddclient-1_3_0-15_el7_sme, smeserver-ddclient-1_3_0-29_el7_sme, smeserver-ddclient-1_3_0-16_el7_sme, smeserver-ddclient-1_3_0-28_el7_sme, smeserver-ddclient-1_3_0-25_el7_sme, smeserver-ddclient-1_3_0-17_el7_sme, smeserver-ddclient-1_3_0-18_el7_sme, HEAD
* Tue Aug 31 2021 John Crisp <jcrisp@safeandsoundit.co.uk> 1.3.0-15.sme
- Fix events in ddclient SM2 library [SME:11667]

1 diff -ruN smeserver-ddclient-1.3.0.old/root/usr/share/smanager/lib/SrvMngr/Controller/Ddclient.pm smeserver-ddclient-1.3.0/root/usr/share/smanager/lib/SrvMngr/Controller/Ddclient.pm
2 --- smeserver-ddclient-1.3.0.old/root/usr/share/smanager/lib/SrvMngr/Controller/Ddclient.pm 2021-08-31 13:48:19.475463250 +0200
3 +++ smeserver-ddclient-1.3.0/root/usr/share/smanager/lib/SrvMngr/Controller/Ddclient.pm 2021-08-31 15:44:36.773106124 +0200
4 @@ -68,51 +68,50 @@
5 our $adb = esmith::AccountsDB->open();
6
7 our $domaindb = esmith::ConfigDB->open('/home/e-smith/db/domains')
8 - or die "Unable to open domains db";
9 + or die "Unable to open domains db";
10 our $edb;
11 $edb = esmith::ConfigDB->open('/home/e-smith/db/ddclient')
12 - or $edb = esmith::ConfigDB->create('/home/e-smith/db/ddclient');
13 + or $edb = esmith::ConfigDB->create('/home/e-smith/db/ddclient');
14
15 my %ddc_datas = ();
16
17 sub get_dns_labels {
18 - #
19 - # dns service names
20 - #
21 + #
22 + # dns service names
23 + #
24 my $c = shift;
25 my $Labels = (
26 - [
27 - [ $c->l('ddc_CUSTOMDNS'), 'CUSTOMDNS' ],
28 - [ $c->l('ddc_DYNDNS1'), 'DYNDNS1' ],
29 - [ $c->l('ddc_DYNDNS2'), 'DYNDNS2' ],
30 - [ $c->l('ddc_DYNDNS3'), 'DYNDNS3' ],
31 - [ $c->l('ddc_ZONEDIT'), 'ZONEDIT' ],
32 - [ $c->l('ddc_EASYDNS'), 'EASYDNS' ],
33 - [ $c->l('ddc_HAMMER'), 'HAMMER' ],
34 - [ $c->l('ddc_DSLREPORTS'), 'DSLREPORTS' ],
35 - [ $c->l('ddc_EURODYNDNS'), 'EURODYNDNS' ],
36 - [ $c->l('ddc_DTDNS'), 'DTDNS' ],
37 - [ $c->l('ddc_LOOPIA'), 'LOOPIA' ],
38 - [ $c->l('ddc_DNSPARK'), 'DNSPARK' ],
39 - [ $c->l('ddc_DYNHOST'), 'DYNHOST' ],
40 - [ $c->l('ddc_NOIP'), 'NOIP' ],
41 - [ $c->l('ddc_CHANGEIP'), 'CHANGEIP' ],
42 - [ $c->l('ddc_NAMECHEAP'), 'NAMECHEAP' ],
43 - [ $c->l('ddc_SPDNS'), 'SPDNS' ],
44 - [ $c->l('ddc_SITELUTIONS'), 'SITELUTIONS'],
45 - [ $c->l('ddc_FREEDNS'), 'FREEDNS'],
46 - [ $c->l('ddc_NSUPDATE'), 'NSUPDATE'],
47 - [ $c->l('ddc_CLOUDFLARE'), 'CLOUDFLARE'],
48 - [ $c->l('ddc_GOOGLEDOMAINS'), 'GOOGLEDOMAINS'],
49 - [ $c->l('ddc_DUCKDNS'), 'DUCKDNS'],
50 - [ $c->l('ddc_FREEMYIP'), 'FREEMYIP'],
51 - [ $c->l('ddc_WOIMA'), 'WOIMA'],
52 - [ $c->l('ddc_YANDEX'), 'YANDEX'],
53 - [ $c->l('ddc_DNSMADEEASY'), 'DNSMADEEASY'],
54 - [ $c->l('ddc_DONDOMINIO'), 'DONDOMINIO'],
55 - [ $c->l('ddc_NEARLYFREESPEECH'),'NFSN'],
56 - [ $c->l('ddc_OVH'), 'OVH'],
57 - [ $c->l('ddc_CLOUDNS'), 'CLOUDNS']
58 + [ [ $c->l('ddc_CUSTOMDNS'), 'CUSTOMDNS' ],
59 + [ $c->l('ddc_DYNDNS1'), 'DYNDNS1' ],
60 + [ $c->l('ddc_DYNDNS2'), 'DYNDNS2' ],
61 + [ $c->l('ddc_DYNDNS3'), 'DYNDNS3' ],
62 + [ $c->l('ddc_ZONEDIT'), 'ZONEDIT' ],
63 + [ $c->l('ddc_EASYDNS'), 'EASYDNS' ],
64 + [ $c->l('ddc_HAMMER'), 'HAMMER' ],
65 + [ $c->l('ddc_DSLREPORTS'), 'DSLREPORTS' ],
66 + [ $c->l('ddc_EURODYNDNS'), 'EURODYNDNS' ],
67 + [ $c->l('ddc_DTDNS'), 'DTDNS' ],
68 + [ $c->l('ddc_LOOPIA'), 'LOOPIA' ],
69 + [ $c->l('ddc_DNSPARK'), 'DNSPARK' ],
70 + [ $c->l('ddc_DYNHOST'), 'DYNHOST' ],
71 + [ $c->l('ddc_NOIP'), 'NOIP' ],
72 + [ $c->l('ddc_CHANGEIP'), 'CHANGEIP' ],
73 + [ $c->l('ddc_NAMECHEAP'), 'NAMECHEAP' ],
74 + [ $c->l('ddc_SPDNS'), 'SPDNS' ],
75 + [ $c->l('ddc_SITELUTIONS'), 'SITELUTIONS' ],
76 + [ $c->l('ddc_FREEDNS'), 'FREEDNS' ],
77 + [ $c->l('ddc_NSUPDATE'), 'NSUPDATE' ],
78 + [ $c->l('ddc_CLOUDFLARE'), 'CLOUDFLARE' ],
79 + [ $c->l('ddc_GOOGLEDOMAINS'), 'GOOGLEDOMAINS' ],
80 + [ $c->l('ddc_DUCKDNS'), 'DUCKDNS' ],
81 + [ $c->l('ddc_FREEMYIP'), 'FREEMYIP' ],
82 + [ $c->l('ddc_WOIMA'), 'WOIMA' ],
83 + [ $c->l('ddc_YANDEX'), 'YANDEX' ],
84 + [ $c->l('ddc_DNSMADEEASY'), 'DNSMADEEASY' ],
85 + [ $c->l('ddc_DONDOMINIO'), 'DONDOMINIO' ],
86 + [ $c->l('ddc_NEARLYFREESPEECH'), 'NFSN' ],
87 + [ $c->l('ddc_OVH'), 'OVH' ],
88 + [ $c->l('ddc_CLOUDNS'), 'CLOUDNS' ]
89 ]
90 );
91 return $Labels;
92 @@ -148,8 +147,7 @@
93 my $emptycust = ( scalar @FreeDomains == 0 );
94
95 my $Labels = (
96 - [
97 - [ $c->l('ddc_SME external Interface'), "smeIF" ],
98 + [ [ $c->l('ddc_SME external Interface'), "smeIF" ],
99 [ $c->l('ddc_SME configuration DB'), "smeCMD" ],
100 [ $c->l('ddc_web'), "web" ],
101 [ $c->l('ddc_Interface'), "if" ],
102 @@ -198,8 +196,8 @@
103 if ( $retmsg eq "ok" ) {
104 my $dns = $c->param('dns');
105 my $domain = $c->param('domainname');
106 - $ddc_datas{"success"} =
107 - $c->l( "ddc_SUCCESSFULLY_MODIFIED", $domain, $c->l( 'ddc_' . $dns ) );
108 + $ddc_datas{"success"} = $c->l( "ddc_SUCCESSFULLY_MODIFIED", $domain,
109 + $c->l( 'ddc_' . $dns ) );
110 do_display( $c, %ddc_datas );
111 }
112 else {
113 @@ -235,12 +233,13 @@
114 if ( $retmsg eq "ok" ) {
115 my $dns = $c->param('dns');
116 my $domain = $c->param('domainname');
117 - $ddc_datas{"success"} =
118 - $c->l( "ddc_SUCCESSFULLY_DELETED", $domain, $c->l( 'ddc_' . $dns ) );
119 + $ddc_datas{"success"} = $c->l( "ddc_SUCCESSFULLY_DELETED", $domain,
120 + $c->l( 'ddc_' . $dns ) );
121 do_display( $c, %ddc_datas );
122 }
123 else {
124 $ddc_datas{"error"} = $retmsg;
125 +
126 #Back to input panel to correct error
127 do_create_custom($c);
128 }
129 @@ -257,8 +256,8 @@
130 my $trt = $c->param("trt");
131
132 #Extract domain stuff from DB
133 - my @results =
134 - get_custom_table( $c, $c->param("Domain") ); #Returns just one row
135 + my @results
136 + = get_custom_table( $c, $c->param("Domain") ); #Returns just one row
137
138 $ddc_datas{"Domain_details"} = $results[0];
139
140 @@ -283,8 +282,8 @@
141 my $trt = $c->param("trt");
142
143 #Extract domain stuff from DB
144 - my @results =
145 - get_domain_table( $c, $c->param("Domain") ); #Returns just one row
146 + my @results
147 + = get_domain_table( $c, $c->param("Domain") ); #Returns just one row
148 $ddc_datas{"Domain_details"} = $results[0];
149
150 $ddc_datas{'trt'} = $trt;
151 @@ -309,7 +308,7 @@
152 my $retmsg = "";
153 my $domain = $c->param("Domain");
154
155 - #Delete it and return to front summary panel - depends on route domain or custom
156 + #Delete it and return to front summary panel - depends on route domain or custom
157 if ( $c->param("Route") eq "ddclient2" ) { #Route is hidden field
158 $retmsg = performDeleteCustom( $c, $domain );
159 }
160 @@ -338,7 +337,7 @@
161 my $retmsg = "";
162 my $domain = $c->param("Domain");
163
164 - #Delete it and return to front summary panel - depends on route domain or custom
165 + #Delete it and return to front summary panel - depends on route domain or custom
166 $retmsg = performDeleteCustom( $c, $domain );
167 if ( $retmsg eq "ok" ) {
168 $ddc_datas{"success"} = $c->l( "ddc_SUCCESSFULLY_DELETED", $domain );
169 @@ -348,80 +347,6 @@
170
171 }
172
173 -sub performDeleteDomain {
174 - my ( $c, $domain ) = @_;
175 -
176 - #------------------------------------------------------------
177 - # Attempt to delete domain
178 - #------------------------------------------------------------
179 -
180 - if ( $domain =~ /^([a-zA-Z0-9\-\.]+)$/ ) {
181 - $domain = $1;
182 - }
183 - else {
184 - return $c->l( 'ddc_ERROR_WHILE_REMOVING_DOMAIN', $domain );
185 - }
186 -
187 - my $value = $domaindb->get($domain);
188 - unless ($value) {
189 - return $c->l( 'ddc_NONEXISTENT_DOMAIN_ERROR', $domain );
190 - }
191 -
192 - my %properties = $value->props;
193 - my $type = $properties{'type'};
194 - if ( $type ne 'domain' ) {
195 - return $c->l( 'ddc_NONEXISTENT_DOMAIN_ERROR', $domain );
196 - }
197 -
198 - my $evalue = $domaindb->get($domain);
199 -
200 - $evalue->set_prop( 'dns' => '' );
201 - $evalue->set_prop( 'login' => '' );
202 - $evalue->set_prop( 'password' => '' );
203 - $evalue->set_prop( 'customdns' => '' );
204 - $evalue->set_prop( 'customprotocol' => '' );
205 -
206 - $domaindb->reload();
207 -
208 - system( "/sbin/e-smith/signal-event", "ddclient" );
209 -
210 - return "ok";
211 -}
212 -
213 -sub performDeleteCustom {
214 - my ( $c, $domain ) = @_;
215 -
216 - #------------------------------------------------------------
217 - # Attempt to delete domain
218 - #------------------------------------------------------------
219 -
220 - if ( $domain =~ /^([a-zA-Z0-9\-\.]+)$/ ) {
221 - $domain = $1;
222 - }
223 - else {
224 - return $c->l( 'ddc_ERROR_WHILE_REMOVING_DOMAIN', $domain );
225 - }
226 -
227 - my $evalue = $edb->get($domain);
228 - unless ($evalue) {
229 - return $c->l( 'ddc_NONEXISTENT_DOMAIN_ERROR', $domain );
230 - }
231 -
232 - my %properties = $evalue->props;
233 - my $type = $properties{'type'};
234 -
235 - if ( $type ne 'ddhost' ) {
236 - return $c->l( 'ddc_NONEXISTENT_DOMAIN_ERROR', $domain );
237 -
238 - }
239 -
240 - $evalue->delete;
241 - $edb->reload();
242 -
243 - system( "/sbin/e-smith/signal-event", "ddclient" );
244 - return "ok";
245 -}
246 -
247 sub get_domain_table {
248 #
249 # Return full table of all domains OR just the details for the specified one
250 @@ -442,15 +367,19 @@
251
252 foreach $domain ( sort @virtualDomains ) {
253 my %properties = $domaindb->get($domain)->props;
254 - my $test = $domaindb->get_prop( $domain, "dns" ) || '';
255 + my $test = $domaindb->get_prop( $domain, "dns" ) || '';
256 my %extraprops;
257 - if ( $test ne '' ) { %extraprops = $domaindb->get($domain)->props; }
258 + if ( $test ne '' ) {
259 + %extraprops = $domaindb->get($domain)->props;
260 + }
261
262 my $content;
263 if ( $properties{'Content'} eq 'wwwpublic' ) {
264 $content = $c->l('ddc_PRIMARY_SITE');
265 }
266 - else { $content = $c->l( 'ddc_CONTENT', $properties{'Content'} ); }
267 + else {
268 + $content = $c->l( 'ddc_CONTENT', $properties{'Content'} );
269 + }
270
271 my $public;
272 my %thisrow;
273 @@ -520,20 +449,20 @@
274 'Domain' => $domain,
275 "Description" => $content,
276 "dns" => $publish,
277 - "Publication" =>
278 - $c->l( 'ddc_' . $publish ), #msg ddc prefix for ddclient
279 - "customprotocol" => $vals->prop("customprotocol"),
280 - "customdns" => $vals->prop("customdns"),
281 - "login" => $vals->prop("login"),
282 - "password" => $vals->prop("password"),
283 - "mx" => $vals->prop("mx"),
284 + "Publication" => $c->l( 'ddc_' . $publish )
285 + , #msg ddc prefix for ddclient
286 + "customprotocol" => $vals->prop("customprotocol"),
287 + "customdns" => $vals->prop("customdns"),
288 + "login" => $vals->prop("login"),
289 + "password" => $vals->prop("password"),
290 + "mx" => $vals->prop("mx"),
291
292 );
293
294 push( @freedomains2d, \%thisrow );
295 if ($findDomain) {
296 if ( $domain eq $findDomain ) {
297 - @freedomains2d = (); #Just return matching one
298 + @freedomains2d = (); #Just return matching one
299 push( @freedomains2d, \%thisrow );
300 last;
301 }
302 @@ -549,9 +478,9 @@
303 my $ddretrieve = $db->get('ddclient');
304 my $ExtIF = $db->get('ExternalInterface');
305 my $DeamonUpdate = $ddretrieve->prop('DeamonUpdate') || '300';
306 - my $urlcheckip = $ddretrieve->prop('urlcheckip') || 'checkip.dyndns.org';
307 - my $ssl = $ddretrieve->prop('SSL') || 'yes';
308 - my $method = $ddretrieve->prop('method') || 'web';
309 + my $urlcheckip = $ddretrieve->prop('urlcheckip') || 'checkip.dyndns.org';
310 + my $ssl = $ddretrieve->prop('SSL') || 'yes';
311 + my $method = $ddretrieve->prop('method') || 'web';
312 my $Extinterface = $ddretrieve->prop('Extinterface') || '';
313 my $cmd = $ddretrieve->prop('cmd') || '';
314 my $forceIP = $ddretrieve->prop('ForceIP') || '';
315 @@ -588,13 +517,16 @@
316
317 $domaindb->reload();
318
319 - system( "/sbin/e-smith/signal-event", "ddclient" );
320 + system( "/sbin/e-smith/signal-event", "smeserver-ddclient-update" );
321
322 return $c->l('ddc_SUCCESSFULLY_MODIFIED_RETRIEVE_IP');
323 }
324
325 -sub performCreateCustom {
326 - my ($c) = shift;
327 +# We seem to be missing a Create Domain here
328 +# sub performCreateDomain
329 +
330 +sub performModifyDomain {
331 + my $c = shift;
332
333 #------------------------------------------------------------
334 # Validate parameters and untaint them
335 @@ -608,21 +540,6 @@
336 return $c->l( 'ddc_DOMAIN_NAME_VALIDATION_ERROR', $domainName );
337 }
338
339 - foreach my $domain ( $edb->get_all_by_prop( type => 'domain' ) ) {
340 - my $key = $domain->key;
341 - if ( $key eq $domainName ) {
342 - return $c->l( 'ddc_DOMAIN_NAME_ALREADY_EXIST', $domainName );
343 - }
344 - }
345 -
346 - foreach my $domain ( $domaindb->get_all_by_prop( type => 'ddhost' ) ) {
347 - my $key = $domain->key;
348 - if ( $key eq $domainName ) {
349 - return $c->l( 'ddc_DOMAIN_NAME_ALREADY_EXIST', $domainName );
350 - }
351 - }
352 -
353 - my $domainDesc = $c->param('desc');
354 my $domainLogin = $c->param('login');
355 if ( $domainLogin =~ /^([\-\'\w][\-\'\w\s\.\@]*)$/ ) {
356 $domainLogin = $1;
357 @@ -636,7 +553,8 @@
358 $domainPassword = $1;
359 }
360 else {
361 - return $c->l( 'ddc_DOMAIN_PASSWORD_VALIDATION_ERROR', $domainPassword );
362 + return $c->l( 'ddc_DOMAIN_PASSWORD_VALIDATION_ERROR',
363 + $domainPassword );
364 }
365
366 my $domainMX = $c->param('mx');
367 @@ -648,7 +566,9 @@
368 if ( $customDNS =~ /^([a-zA-Z0-9\-\.]+)$/ ) {
369 $customDNS = $1;
370 }
371 - else {
372 + else
373 +
374 + {
375 return $c->l( 'ddc_CUSTOMDNS_VALIDATION_ERROR', $domainName );
376 }
377 }
378 @@ -658,25 +578,65 @@
379 # or if the domain is a reserved to provide a secured webserver
380 # for a previous domain
381 #------------------------------------------------------------
382 + # my $dns = $c->param ('dns');
383
384 - my %properties = ();
385 - $properties{'type'} = 'ddhost';
386 - $properties{'dns'} = $dns;
387 - $properties{'login'} = $domainLogin;
388 - $properties{'password'} = $domainPassword;
389 - $properties{'mx'} = $domainMX;
390 - $properties{'desc'} = $domainDesc;
391 - $properties{'customdns'} = $customDNS;
392 - $properties{'customprotocol'} = $customPROTOCOL;
393 - $edb->new_record( $domainName, \%properties );
394 + my $dom = $domaindb->get($domainName);
395 +
396 + $dom->set_prop( 'dns' => $dns );
397 + $dom->set_prop( 'login' => $domainLogin );
398 + $dom->set_prop( 'password' => $domainPassword );
399 + $dom->set_prop( 'mx' => $domainMX );
400 + $dom->set_prop( 'customdns' => $customDNS );
401 + $dom->set_prop( 'customprotocol' => $customPROTOCOL );
402 +
403 + $domaindb->reload();
404
405 system( "/sbin/e-smith/signal-event", "ddclient" );
406 return "ok";
407 +}
408 +
409 +sub performDeleteDomain {
410 + my ( $c, $domain ) = @_;
411
412 + #------------------------------------------------------------
413 + # Attempt to delete domain
414 + #------------------------------------------------------------
415 +
416 + if ( $domain =~ /^([a-zA-Z0-9\-\.]+)$/ ) {
417 + $domain = $1;
418 + }
419 + else {
420 + return $c->l( 'ddc_ERROR_WHILE_REMOVING_DOMAIN', $domain );
421 + }
422 +
423 + my $value = $domaindb->get($domain);
424 + unless ($value) {
425 + return $c->l( 'ddc_NONEXISTENT_DOMAIN_ERROR', $domain );
426 + }
427 +
428 + my %properties = $value->props;
429 + my $type = $properties{'type'};
430 + if ( $type ne 'domain' ) {
431 + return $c->l( 'ddc_NONEXISTENT_DOMAIN_ERROR', $domain );
432 + }
433 +
434 + my $evalue = $domaindb->get($domain);
435 +
436 + $evalue->set_prop( 'dns' => '' );
437 + $evalue->set_prop( 'login' => '' );
438 + $evalue->set_prop( 'password' => '' );
439 + $evalue->set_prop( 'customdns' => '' );
440 + $evalue->set_prop( 'customprotocol' => '' );
441 +
442 + $domaindb->reload();
443 +
444 + system( "/sbin/e-smith/signal-event", "domain-modify" );
445 +
446 + return "ok";
447 }
448
449 -sub performModifyDomain {
450 - my $c = shift;
451 +sub performCreateCustom {
452 + my ($c) = shift;
453
454 #------------------------------------------------------------
455 # Validate parameters and untaint them
456 @@ -690,6 +650,21 @@
457 return $c->l( 'ddc_DOMAIN_NAME_VALIDATION_ERROR', $domainName );
458 }
459
460 + foreach my $domain ( $edb->get_all_by_prop( type => 'domain' ) ) {
461 + my $key = $domain->key;
462 + if ( $key eq $domainName ) {
463 + return $c->l( 'ddc_DOMAIN_NAME_ALREADY_EXIST', $domainName );
464 + }
465 + }
466 +
467 + foreach my $domain ( $domaindb->get_all_by_prop( type => 'ddhost' ) ) {
468 + my $key = $domain->key;
469 + if ( $key eq $domainName ) {
470 + return $c->l( 'ddc_DOMAIN_NAME_ALREADY_EXIST', $domainName );
471 + }
472 + }
473 +
474 + my $domainDesc = $c->param('desc');
475 my $domainLogin = $c->param('login');
476 if ( $domainLogin =~ /^([\-\'\w][\-\'\w\s\.\@]*)$/ ) {
477 $domainLogin = $1;
478 @@ -703,7 +678,8 @@
479 $domainPassword = $1;
480 }
481 else {
482 - return $c->l( 'ddc_DOMAIN_PASSWORD_VALIDATION_ERROR', $domainPassword );
483 + return $c->l( 'ddc_DOMAIN_PASSWORD_VALIDATION_ERROR',
484 + $domainPassword );
485 }
486
487 my $domainMX = $c->param('mx');
488 @@ -715,9 +691,7 @@
489 if ( $customDNS =~ /^([a-zA-Z0-9\-\.]+)$/ ) {
490 $customDNS = $1;
491 }
492 - else
493 -
494 - {
495 + else {
496 return $c->l( 'ddc_CUSTOMDNS_VALIDATION_ERROR', $domainName );
497 }
498 }
499 @@ -727,21 +701,21 @@
500 # or if the domain is a reserved to provide a secured webserver
501 # for a previous domain
502 #------------------------------------------------------------
503 - # my $dns = $c->param ('dns');
504 -
505 - my $dom = $domaindb->get($domainName);
506 -
507 - $dom->set_prop( 'dns' => $dns );
508 - $dom->set_prop( 'login' => $domainLogin );
509 - $dom->set_prop( 'password' => $domainPassword );
510 - $dom->set_prop( 'mx' => $domainMX );
511 - $dom->set_prop( 'customdns' => $customDNS );
512 - $dom->set_prop( 'customprotocol' => $customPROTOCOL );
513
514 - $domaindb->reload();
515 + my %properties = ();
516 + $properties{'type'} = 'ddhost';
517 + $properties{'dns'} = $dns;
518 + $properties{'login'} = $domainLogin;
519 + $properties{'password'} = $domainPassword;
520 + $properties{'mx'} = $domainMX;
521 + $properties{'desc'} = $domainDesc;
522 + $properties{'customdns'} = $customDNS;
523 + $properties{'customprotocol'} = $customPROTOCOL;
524 + $edb->new_record( $domainName, \%properties );
525
526 - system( "/sbin/e-smith/signal-event", "ddclient" );
527 + system( "/sbin/e-smith/signal-event", "domain-create" );
528 return "ok";
529 +
530 }
531
532 sub performModifyCustom {
533 @@ -772,7 +746,8 @@
534 $domainPassword = $1;
535 }
536 else {
537 - return $c->l( 'ddc_DOMAIN_PASSWORD_VALIDATION_ERROR', $domainPassword );
538 + return $c->l( 'ddc_DOMAIN_PASSWORD_VALIDATION_ERROR',
539 + $domainPassword );
540 }
541
542 my $domainMX = $c->param('mx');
543 @@ -809,7 +784,41 @@
544
545 $domaindb->reload();
546
547 - system( "/sbin/e-smith/signal-event", "ddclient" );
548 + system( "/sbin/e-smith/signal-event", "domain-modify" );
549 + return "ok";
550 +}
551 +
552 +sub performDeleteCustom {
553 + my ( $c, $domain ) = @_;
554 +
555 + #------------------------------------------------------------
556 + # Attempt to delete domain
557 + #------------------------------------------------------------
558 +
559 + if ( $domain =~ /^([a-zA-Z0-9\-\.]+)$/ ) {
560 + $domain = $1;
561 + }
562 + else {
563 + return $c->l( 'ddc_ERROR_WHILE_REMOVING_DOMAIN', $domain );
564 + }
565 +
566 + my $evalue = $edb->get($domain);
567 + unless ($evalue) {
568 + return $c->l( 'ddc_NONEXISTENT_DOMAIN_ERROR', $domain );
569 + }
570 +
571 + my %properties = $evalue->props;
572 + my $type = $properties{'type'};
573 +
574 + if ( $type ne 'ddhost' ) {
575 + return $c->l( 'ddc_NONEXISTENT_DOMAIN_ERROR', $domain );
576 +
577 + }
578 +
579 + $evalue->delete;
580 + $edb->reload();
581 +
582 + system( "/sbin/e-smith/signal-event", "domain-delete" );
583 return "ok";
584 }
585

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