diff -urN smeserver-ddclient-1.2.1.old/root/etc/e-smith/web/dirs.txt smeserver-ddclient-1.2.1/root/etc/e-smith/web/dirs.txt
--- smeserver-ddclient-1.2.1.old/root/etc/e-smith/web/dirs.txt 1970-01-01 01:00:00.000000000 +0100
+++ smeserver-ddclient-1.2.1/root/etc/e-smith/web/dirs.txt 2020-06-08 12:52:14.342548072 +0100
@@ -0,0 +1,4 @@
+mkdir -p ./manager2/cgi-bin/srvmngr/lib/SrvMngr/Controller
+mkdir -p ./manager2/cgi-bin/srvmngr/lib/SrvMngr/I18N/Modules/Ddclient
+mkdir -p ./manager2/cgi-bin/srvmngr/themes/default/templates
+mkdir -p ./manager2/cgi-bin/srvmngr/themes/default/templates/partials
diff -urN smeserver-ddclient-1.2.1.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/Controller/Ddclient.pm smeserver-ddclient-1.2.1/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/Controller/Ddclient.pm
--- smeserver-ddclient-1.2.1.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/Controller/Ddclient.pm 1970-01-01 01:00:00.000000000 +0100
+++ smeserver-ddclient-1.2.1/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/Controller/Ddclient.pm 2020-06-08 08:44:00.000000000 +0100
@@ -0,0 +1,772 @@
+package SrvMngr::Controller::Ddclient;
+
+#----------------------------------------------------------------------
+# heading : Configuration
+# description : Dynamic Clients
+# navigation : 3000 3400
+#
+# name : ddclient, method : get, url : /ddclient, ctlact : Ddclient#main
+# name : ddclient3, method : post, url : /ddclient3, ctlact : Ddclient#do_updateparams
+# name : ddclient1, method : get, url : /ddclient1, ctlact : Ddclient#do_summary_domain
+# name : ddclient2, method : get, url : /ddclient2, ctlact : Ddclient#do_summary_custom
+# name : ddclient4, method : post, url : /ddclient4, ctlact : Ddclient#do_delete_domain
+# name : ddclient5, method : get, url : /ddclient5, ctlact : Ddclient#do_update_domain
+# name : ddclient6, method : get, url : /ddclient6, ctlact : Ddclient#do_create_custom
+# name : ddclient7, method : post, url : /ddclient7, ctlact : Ddclient#do_create_custom_actual
+# name : ddclient8, method : post, url : /ddclient8, ctlact : Ddclient#do_update_domain
+#
+# routes : end
+#----------------------------------------------------------------------
+
+use strict;
+use warnings;
+use Mojo::Base 'Mojolicious::Controller';
+
+use constant FALSE => 0;
+use constant TRUE => 1;
+
+use Locale::gettext;
+use SrvMngr::I18N;
+use SrvMngr qw(theme_list init_session_cgi);
+
+use Data::Dumper;
+use esmith::util;
+use esmith::HostsDB;
+use esmith::AccountsDB;
+
+our $db = esmith::ConfigDB->open();
+our $adb = esmith::AccountsDB->open();
+
+our $domaindb = esmith::ConfigDB->open('/home/e-smith/db/domains')
+ or die "Unable to open domains db";
+our $edb;
+$edb = esmith::ConfigDB->open('/home/e-smith/db/ddclient')
+ or $edb = esmith::ConfigDB->create('/home/e-smith/db/ddclient');
+
+my %ddc_datas = ();
+
+sub get_dns_labels {
+ #
+ # dns service names
+ #
+ my $c = shift;
+ my $Labels = (
+ [
+ [ $c->l('ddc_CUSTOMDNS'), 'CUSTOMDNS' ],
+ [ $c->l('ddc_DYNDNS1'), 'DYNDNS1' ],
+ [ $c->l('ddc_DYNDNS2'), 'DYNDNS2' ],
+ [ $c->l('ddc_DYNDNS3'), 'DYNDNS3' ],
+ [ $c->l('ddc_ZONEDIT'), 'ZONEDIT' ],
+ [ $c->l('ddc_EASYDNS'), 'EASYDNS' ],
+ [ $c->l('ddc_HAMMER'), 'HAMMER' ],
+ [ $c->l('ddc_DSLREPORTS'), 'DSLREPORTS' ],
+ [ $c->l('ddc_EURODYNDNS'), 'EURODYNDNS' ],
+ [ $c->l('ddc_DTDNS'), 'DTDNS' ],
+ [ $c->l('ddc_LOOPIA'), 'LOOPIA' ],
+ [ $c->l('ddc_DNSPARK'), 'DNSPARK' ],
+ [ $c->l('ddc_DYNHOST'), 'DYNHOST' ],
+ [ $c->l('ddc_NOIP'), 'NOIP' ],
+ [ $c->l('ddc_CHANGEIP'), 'CHANGEIP' ],
+ [ $c->l('ddc_NAMECHEAP'), 'NAMECHEAP' ],
+ [ $c->l('ddc_SPDNS'), 'SPDNS' ]
+ ]
+ );
+ return $Labels;
+}
+
+sub main {
+ #
+ # Initial page - full summary of parameters etc
+ # Initial para from the Wiki.
+ #
+ my $c = shift;
+ $ddc_datas{"first"} = 'ddc_DESCRIPTION';
+ do_display( $c, %ddc_datas );
+}
+
+sub do_display {
+ #
+ # Front Summary page
+ #
+ my $c = shift;
+ $c->app->log->info( $c->log_req );
+
+ my $title = $c->l('ddc_FORM_TITLE');
+ my $modul = '';
+ $ddc_datas{trt} = 'LIST';
+ my $trt = "LIST";
+
+ $ddc_datas{"params"} = get_params($c);
+ my @domains = get_domain_table($c);
+ my @FreeDomains = get_custom_table($c);
+
+ my $emptydom = ( scalar @domains == 0 );
+ my $emptycust = ( scalar @FreeDomains == 0 );
+
+ my $Labels = (
+ [
+ [ $c->l('ddc_SME external Interface'), "smeIF" ],
+ [ $c->l('ddc_SME configuration DB'), "smeCMD" ],
+ [ $c->l('ddc_web'), "web" ],
+ [ $c->l('ddc_Interface'), "if" ],
+ [ $c->l('ddc_IP'), "ip" ],
+ [ $c->l('ddc_Command'), "cmd" ]
+ ]
+ );
+
+ $c->stash(
+ title => $title,
+ modul => $modul,
+ ddc_datas => \%ddc_datas,
+ domains => \@domains,
+ freedomains => \@FreeDomains,
+ methodlabels => $Labels,
+ emptydom => $emptydom,
+ emptycust => $emptycust
+ );
+ $ddc_datas{'trt'} = $trt;
+ $c->stash( title => $title, modul => $modul, ddc_datas => \%ddc_datas );
+ $c->render( template => 'ddclient' );
+
+}
+
+sub do_updateparams {
+ #
+ # Called to update the parameters relating to the Ip address of the server
+ #
+ my $c = shift;
+ $ddc_datas{"success"} = pushParams($c);
+ do_display($c);
+}
+
+sub do_update_domain {
+ #
+ #Called to update/delete the ddclient for a specific inbuilt domain
+ #
+ my $c = shift;
+ my $retmsg;
+ if ( $c->param("Route") eq "ddclient2" ) { #Route is hidden field
+ $retmsg = performModifyCustom($c);
+ }
+ else {
+ $retmsg = performModifyDomain($c);
+ }
+ if ( $retmsg eq "ok" ) {
+ my $dns = $c->param('dns');
+ my $domain = $c->param('domainname');
+ $ddc_datas{"success"} =
+ $c->l( "ddc_SUCCESSFULLY_MODIFIED", $domain, $c->l( 'ddc_' . $dns ) );
+ do_display( $c, %ddc_datas );
+ }
+ else {
+ $ddc_datas{"error"} = $retmsg;
+
+ #Back to input panel to correct error
+ do_summary_domain($c);
+ }
+}
+
+sub do_create_custom {
+ #
+ # Create custom domain
+ #
+ my $c = shift;
+ my $title = $c->l("ddc_CREATE_TITLE");
+ my $modul = '';
+ my $trt = "NEW";
+
+ $ddc_datas{trt} = $trt;
+ $c->stash(
+ title => $title,
+ modul => $modul,
+ ddc_datas => \%ddc_datas,
+ dnslabels => get_dns_labels($c)
+ );
+ $c->render( template => 'ddclient' );
+}
+
+sub do_create_custom_actual {
+ my $c = shift;
+ my $retmsg = performCreateCustom($c);
+ if ( $retmsg eq "ok" ) {
+ my $dns = $c->param('dns');
+ my $domain = $c->param('domainname');
+ $ddc_datas{"success"} =
+ $c->l( "ddc_SUCCESSFULLY_DELETED", $domain, $c->l( 'ddc_' . $dns ) );
+ do_display( $c, %ddc_datas );
+ }
+ else {
+ $ddc_datas{"error"} = $retmsg;
+ #Back to input panel to correct error
+ do_createcustom($c);
+ }
+
+}
+
+sub do_summary_custom {
+ #
+ # Display delete or modify panel for custom domain
+ #
+ my $c = shift;
+ my $title = $c->l("ddc_MODIFY_TITLE");
+ my $modul = '';
+ my $trt = $c->param("trt");
+
+ #Extract domain stuff from DB
+ my @results =
+ get_custom_table( $c, $c->param("Domain") ); #Returns just one row
+
+ $ddc_datas{"Domain_details"} = $results[0];
+
+ $ddc_datas{'trt'} = $trt;
+ $c->stash(
+ title => $title,
+ modul => $modul,
+ ddc_datas => \%ddc_datas,
+ dnslabels => get_dns_labels($c)
+ );
+ $c->render( template => 'ddclient' );
+}
+
+sub do_summary_domain {
+ #
+ # Display delete or modify panel for inbuilt domain
+ # param trt = MOD or DEL
+ #
+ my $c = shift;
+ my $title = $c->l("ddc_MODIFY_TITLE");
+ my $modul = '';
+ my $trt = $c->param("trt");
+
+ #Extract domain stuff from DB
+ my @results =
+ get_domain_table( $c, $c->param("Domain") ); #Returns just one row
+ $ddc_datas{"Domain_details"} = $results[0];
+
+ $ddc_datas{'trt'} = $trt;
+ $c->stash(
+ title => $title,
+ modul => $modul,
+ ddc_datas => \%ddc_datas,
+ dnslabels => get_dns_labels($c)
+ );
+ $c->render( template => 'ddclient' );
+}
+
+sub do_delete_domain {
+ #
+ # Actually clearout the inbuilt domain
+ # Return to initial page with message at the top.
+ #
+ my $c = shift;
+ my $route = $c->current_route;
+ my $title = $c->l("ddc_REMOVE_TITLE");
+ my $modul = '';
+ my $retmsg = "";
+ my $domain = $c->param("Domain");
+
+ #Delete it and return to front summary panel - depends on route domain or custom
+ if ( $c->param("Route") eq "ddclient2" ) { #Route is hidden field
+ $retmsg = performDeleteCustom( $c, $domain );
+ }
+ else {
+ $retmsg = performDeleteDomain( $c, $domain );
+ }
+
+ if ( $retmsg eq "ok" ) {
+ $ddc_datas{"success"} = $c->l( "ddc_SUCCESSFULLY_DELETED", $domain,
+ $c->l( 'ddc_' . $c->param("dns") ) );
+ }
+ else { $ddc_datas{"error"} = $retmsg; }
+ do_display( $c, %ddc_datas );
+
+}
+
+sub do_delete_custom {
+ #
+ # Actually delete the custom domain
+ # Return to initial page with message at the top.
+ #
+ my $c = shift;
+ my $route = $c->current_route;
+ my $title = $c->l("ddc_REMOVE_TITLE");
+ my $modul = '';
+ my $retmsg = "";
+ my $domain = $c->param("Domain");
+
+ #Delete it and return to front summary panel - depends on route domain or custom
+ $retmsg = performDeleteCustom( $c, $domain );
+ if ( $retmsg eq "ok" ) {
+ $ddc_datas{"success"} = $c->l( "ddc_SUCCESSFULLY_DELETED", $domain );
+ }
+ else { $ddc_datas{"error"} = $retmsg; }
+ do_display( $c, %ddc_datas );
+
+}
+
+sub performDeleteDomain {
+ my ( $c, $domain ) = @_;
+
+ #------------------------------------------------------------
+ # Attempt to delete domain
+ #------------------------------------------------------------
+
+ if ( $domain =~ /^([a-zA-Z0-9\-\.]+)$/ ) {
+ $domain = $1;
+ }
+ else {
+ return $c->l( 'ddc_ERROR_WHILE_REMOVING_DOMAIN', $domain );
+ }
+
+ my $value = $domaindb->get($domain);
+ unless ($value) {
+ return $c->l( 'ddc_NONEXISTENT_DOMAIN_ERROR', $domain );
+ }
+
+ my %properties = $value->props;
+ my $type = $properties{'type'};
+ if ( $type ne 'domain' ) {
+ return $c->l( 'ddc_NONEXISTENT_DOMAIN_ERROR', $domain );
+ }
+
+ my $evalue = $domaindb->get($domain);
+
+ $evalue->set_prop( 'dns' => '' );
+ $evalue->set_prop( 'login' => '' );
+ $evalue->set_prop( 'password' => '' );
+ $evalue->set_prop( 'customdns' => '' );
+ $evalue->set_prop( 'customprotocol' => '' );
+
+ $domaindb->reload();
+
+ system( "/sbin/e-smith/signal-event", "ddclient" );
+
+ return "ok";
+}
+
+sub performDeleteCustom {
+ my ( $c, $domain ) = @_;
+
+ #------------------------------------------------------------
+ # Attempt to delete domain
+ #------------------------------------------------------------
+
+ if ( $domain =~ /^([a-zA-Z0-9\-\.]+)$/ ) {
+ $domain = $1;
+ }
+ else {
+ return $c->l( 'ddc_ERROR_WHILE_REMOVING_DOMAIN', $domain );
+ }
+
+ my $evalue = $edb->get($domain);
+ unless ($evalue) {
+ return $c->l( 'ddc_NONEXISTENT_DOMAIN_ERROR', $domain );
+ }
+
+ my %properties = $evalue->props;
+ my $type = $properties{'type'};
+
+ if ( $type ne 'ddhost' ) {
+ return $c->l( 'ddc_NONEXISTENT_DOMAIN_ERROR', $domain );
+
+ }
+
+ $evalue->delete;
+ $edb->reload();
+
+ system( "/sbin/e-smith/signal-event", "ddclient" );
+ return "ok";
+}
+
+sub get_domain_table {
+ #
+ # Return full table of all domains OR just the details for the specified one
+ #
+ my ( $c, $findDomain ) = @_; #$c and domain to find
+ $findDomain = FALSE if ( scalar(@_) <= 1 );
+ my $key;
+ my @virtualDomains = ();
+ foreach my $domain ( $domaindb->get_all_by_prop( type => 'domain' ) ) {
+ $key = $domain->key;
+ push( @virtualDomains, $key );
+ }
+ my $numDomains = @virtualDomains;
+ if ( $numDomains == 0 ) { return () }
+ else {
+ my $domain;
+ my @virtualDomains2d = ();
+
+ foreach $domain ( sort @virtualDomains ) {
+ my %properties = $domaindb->get($domain)->props;
+ my $test = $domaindb->get_prop( $domain, "dns" ) || '';
+ my %extraprops;
+ if ( $test ne '' ) { %extraprops = $domaindb->get($domain)->props; }
+
+ my $content;
+ if ( $properties{'Content'} eq 'wwwpublic' ) {
+ $content = $c->l('ddc_PRIMARY_SITE');
+ }
+ else { $content = $c->l( 'ddc_CONTENT', $properties{'Content'} ); }
+
+ my $public;
+ my %thisrow;
+ if ( $test eq '' ) {
+ %thisrow = (
+ "Domain" => $domain,
+ "Description" => $properties{'Description'},
+ "Content" => $content,
+ "dns" => "",
+ "Publication" => "",
+ "customprotocol" => "",
+ "customdns" => "",
+ "login" => "",
+ "password" => "",
+ "mx" => ""
+ );
+ push( @virtualDomains2d, \%thisrow );
+ }
+ else {
+ %thisrow = (
+ "Domain" => $domain,
+ "Description" => $properties{'Description'},
+ "Content" => $content,
+ "dns" => $extraprops{'dns'},
+ "Publication" => $c->l( 'ddc_' . $extraprops{'dns'} ),
+ "customprotocol" => $properties{"customprotocol"},
+ "customdns" => $properties{"customdns"},
+ "login" => $properties{"login"},
+ "password" => $properties{"password"},
+ "mx" => $properties{"mx"},
+ );
+ push( @virtualDomains2d, \%thisrow );
+
+ }
+ if ($findDomain) {
+ if ( $domain eq $findDomain ) {
+ @virtualDomains2d = (); #Just return matching one
+ push( @virtualDomains2d, \%thisrow );
+ last;
+ }
+ } #Found the one needed
+ }
+ return @virtualDomains2d; #Return the lot
+ }
+}
+
+sub get_custom_table {
+ #
+ # Return full table of all domains OR just the details for the specified one
+ #
+ my ( $c, $findDomain ) = @_; #$c and domain to find
+ $findDomain = FALSE if ( scalar(@_) <= 1 );
+ my $key;
+ my @FreeDomains = ();
+ foreach my $domain ( $edb->get_all_by_prop( type => 'ddhost' ) ) {
+ $key = $domain->key;
+ push( @FreeDomains, $key );
+ }
+ my $numDomains = @FreeDomains;
+ my @freedomains2d = ();
+ if ( $numDomains > 0 ) {
+ foreach my $domain ( sort @FreeDomains ) {
+ my $vals = $edb->get($domain);
+ my $content = $vals->prop('desc');
+ my $publish = $vals->prop('dns');
+ my %thisrow = (
+ 'Domain' => $domain,
+ "Description" => $content,
+ "dns" => $publish,
+ "Publication" =>
+ $c->l( 'ddc_' . $publish ), #msg ddc prefix for ddclient
+ "customprotocol" => $vals->prop("customprotocol"),
+ "customdns" => $vals->prop("customdns"),
+ "login" => $vals->prop("login"),
+ "password" => $vals->prop("password"),
+ "mx" => $vals->prop("mx"),
+
+ );
+
+ push( @freedomains2d, \%thisrow );
+ if ($findDomain) {
+ if ( $domain eq $findDomain ) {
+ @freedomains2d = (); #Just return matching one
+ push( @freedomains2d, \%thisrow );
+ last;
+ }
+ } #Found the one needed
+
+ }
+ }
+ return @freedomains2d;
+}
+
+sub get_params {
+ my $c = shift;
+ my $ddretrieve = $db->get('ddclient');
+ my $ExtIF = $db->get('ExternalInterface');
+ my $DeamonUpdate = $ddretrieve->prop('DeamonUpdate') || '300';
+ my $urlcheckip = $ddretrieve->prop('urlcheckip') || 'checkip.dyndns.org';
+ my $ssl = $ddretrieve->prop('SSL') || 'yes';
+ my $method = $ddretrieve->prop('method') || 'web';
+ my $Extinterface = $ddretrieve->prop('Extinterface') || '';
+ my $cmd = $ddretrieve->prop('cmd') || '';
+ my $forceIP = $ddretrieve->prop('ForceIP') || '';
+ my $res = {
+ "ssl" => $ssl,
+ "DeamonUpdate" => $DeamonUpdate,
+ "method" => $method,
+ "Extinterface" => $Extinterface,
+ "cmd" => $cmd,
+ "ForceIP" => $forceIP,
+ "urlcheckip" => $urlcheckip
+ };
+ return $res;
+}
+
+sub pushParams {
+ my $c = shift;
+ my $DeamonUpdate = $c->param('retrievedeamonupdate');
+ my $urlcheckip = $c->param('retrieveurlcheckip');
+ my $ssl = $c->param('retrievessl');
+ my $retrievemethod = $c->param('retrievemethod');
+ my $retrieveinterface = $c->param('retrieveinterface');
+ my $retrievecmd = $c->param('retrievecmd');
+ my $retrieveip = $c->param('retrieveip');
+
+ my $ddclient = $db->get('ddclient');
+ $ddclient->set_prop( 'urlcheckip' => $urlcheckip );
+ $ddclient->set_prop( 'DeamonUpdate' => $DeamonUpdate );
+ $ddclient->set_prop( 'SSL' => $ssl );
+ $ddclient->set_prop( 'method' => $retrievemethod );
+ $ddclient->set_prop( 'Extinterface' => $retrieveinterface );
+ $ddclient->set_prop( 'cmd' => $retrievecmd );
+ $ddclient->set_prop( 'ForceIP' => $retrieveip );
+
+ $domaindb->reload();
+
+ system( "/sbin/e-smith/signal-event", "ddclient" );
+
+ return $c->l('ddc_SUCCESSFULLY_MODIFIED_RETRIEVE_IP');
+}
+
+sub performCreateCustom {
+ my ($c) = shift;
+
+ #------------------------------------------------------------
+ # Validate parameters and untaint them
+ #------------------------------------------------------------
+
+ my $domainName = $c->param('domainName');
+ if ( $domainName =~ /^([a-zA-Z0-9\-\.]+)$/ ) {
+ $domainName = $1;
+ }
+ else {
+ return $c->l( 'ddc_DOMAIN_NAME_VALIDATION_ERROR', $domainName );
+ }
+
+ foreach my $domain ( $edb->get_all_by_prop( type => 'domain' ) ) {
+ my $key = $domain->key;
+ if ( $key eq $domainName ) {
+ return $c->l( 'ddc_DOMAIN_NAME_ALREADY_EXIST', $domainName );
+ }
+ }
+
+ foreach my $domain ( $domaindb->get_all_by_prop( type => 'ddhost' ) ) {
+ my $key = $domain->key;
+ if ( $key eq $domainName ) {
+ return $c->l( 'ddc_DOMAIN_NAME_ALREADY_EXIST', $domainName );
+ }
+ }
+
+ my $domainDesc = $c->param('desc');
+ my $domainLogin = $c->param('login');
+ if ( $domainLogin =~ /^([\-\'\w][\-\'\w\s\.\@]*)$/ ) {
+ $domainLogin = $1;
+ }
+ else {
+ return $c->l( 'ddc_DOMAIN_LOGIN_VALIDATION_ERROR', $domainLogin );
+ }
+
+ my $domainPassword = $c->param('password');
+ if ( $domainPassword =~ /^(.*)$/ ) {
+ $domainPassword = $1;
+ }
+ else {
+ return $c->l( 'ddc_DOMAIN_PASSWORD_VALIDATION_ERROR', $domainPassword );
+ }
+
+ my $domainMX = $c->param('mx');
+ my $customDNS = $c->param('customdns');
+ my $customPROTOCOL = $c->param('customprotocol');
+
+ my $dns = $c->param('dns');
+ if ( $dns eq 'CUSTOMDNS' ) {
+ if ( $customDNS =~ /^([a-zA-Z0-9\-\.]+)$/ ) {
+ $customDNS = $1;
+ }
+ else {
+ return $c->l( 'ddc_CUSTOMDNS_VALIDATION_ERROR', $domainName );
+ }
+ }
+
+ #------------------------------------------------------------
+ # Looks good. Find out if this domain has been taken
+ # or if the domain is a reserved to provide a secured webserver
+ # for a previous domain
+ #------------------------------------------------------------
+
+ my %properties = ();
+ $properties{'type'} = 'ddhost';
+ $properties{'dns'} = $dns;
+ $properties{'login'} = $domainLogin;
+ $properties{'password'} = $domainPassword;
+ $properties{'mx'} = $domainMX;
+ $properties{'desc'} = $domainDesc;
+ $properties{'customdns'} = $customDNS;
+ $properties{'customprotocol'} = $customPROTOCOL;
+ $edb->new_record( $domainName, \%properties );
+
+ system( "/sbin/e-smith/signal-event", "ddclient" );
+ return "ok";
+
+}
+
+sub performModifyDomain {
+ my $c = shift;
+
+ #------------------------------------------------------------
+ # Validate parameters and untaint them
+ #------------------------------------------------------------
+
+ my $domainName = $c->param('domainName');
+ if ( $domainName =~ /^([a-zA-Z0-9\-\.]+)$/ ) {
+ $domainName = $1;
+ }
+ else {
+ return $c->l( 'ddc_DOMAIN_NAME_VALIDATION_ERROR', $domainName );
+ }
+
+ my $domainLogin = $c->param('login');
+ if ( $domainLogin =~ /^([\-\'\w][\-\'\w\s\.\@]*)$/ ) {
+ $domainLogin = $1;
+ }
+ else {
+ return $c->l( 'ddc_DOMAIN_LOGIN_VALIDATION_ERROR', $domainLogin );
+ }
+
+ my $domainPassword = $c->param('password');
+ if ( $domainPassword =~ /^(.*)$/ ) {
+ $domainPassword = $1;
+ }
+ else {
+ return $c->l( 'ddc_DOMAIN_PASSWORD_VALIDATION_ERROR', $domainPassword );
+ }
+
+ my $domainMX = $c->param('mx');
+ my $customDNS = $c->param('customdns');
+ my $customPROTOCOL = $c->param('customprotocol');
+
+ my $dns = $c->param('dns');
+ if ( $dns eq 'CUSTOMDNS' ) {
+ if ( $customDNS =~ /^([a-zA-Z0-9\-\.]+)$/ ) {
+ $customDNS = $1;
+ }
+ else
+
+ {
+ return $c->l( 'ddc_CUSTOMDNS_VALIDATION_ERROR', $domainName );
+ }
+ }
+
+ #------------------------------------------------------------
+ # Looks good. Find out if this domain has been taken
+ # or if the domain is a reserved to provide a secured webserver
+ # for a previous domain
+ #------------------------------------------------------------
+ # my $dns = $c->param ('dns');
+
+ my $dom = $domaindb->get($domainName);
+
+ $dom->set_prop( 'dns' => $dns );
+ $dom->set_prop( 'login' => $domainLogin );
+ $dom->set_prop( 'password' => $domainPassword );
+ $dom->set_prop( 'mx' => $domainMX );
+ $dom->set_prop( 'customdns' => $customDNS );
+ $dom->set_prop( 'customprotocol' => $customPROTOCOL );
+
+ $domaindb->reload();
+
+ system( "/sbin/e-smith/signal-event", "ddclient" );
+ return "ok";
+}
+
+sub performModifyCustom {
+ my $c = shift;
+
+ #------------------------------------------------------------
+ # Validate parameters and untaint them
+ #------------------------------------------------------------
+
+ my $domainName = $c->param('domainName');
+ if ( $domainName =~ /^([a-zA-Z0-9\-\.]+)$/ ) {
+ $domainName = $1;
+ }
+ else {
+ return $c->l( 'ddc_DOMAIN_NAME_VALIDATION_ERROR', $domainName );
+ }
+
+ my $domainLogin = $c->param('login');
+ if ( $domainLogin =~ /^([\-\'\w][\-\'\w\s\.\@]*)$/ ) {
+ $domainLogin = $1;
+ }
+ else {
+ return $c->l( 'ddc_DOMAIN_LOGIN_VALIDATION_ERROR', $domainLogin );
+ }
+
+ my $domainPassword = $c->param('password');
+ if ( $domainPassword =~ /^(.*)$/ ) {
+ $domainPassword = $1;
+ }
+ else {
+ return $c->l( 'ddc_DOMAIN_PASSWORD_VALIDATION_ERROR', $domainPassword );
+ }
+
+ my $domainMX = $c->param('mx');
+ my $customDNS = $c->param('customdns');
+ my $customPROTOCOL = $c->param('customprotocol');
+
+ my $dns = $c->param('dns');
+ if ( $dns eq 'CUSTOMDNS' ) {
+ if ( $customDNS =~ /^([a-zA-Z0-9\-\.]+)$/ ) {
+ $customDNS = $1;
+ }
+ else
+
+ {
+ return $c->l( 'ddc_CUSTOMDNS_VALIDATION_ERROR', $domainName );
+ }
+ }
+
+ #------------------------------------------------------------
+ # Looks good. Find out if this domain has been taken
+ # or if the domain is a reserved to provide a secured webserver
+ # for a previous domain
+ #------------------------------------------------------------
+ # my $dns = $c->param ('dns');
+
+ my $dom = $edb->get($domainName);
+
+ $dom->set_prop( 'dns' => $dns );
+ $dom->set_prop( 'login' => $domainLogin );
+ $dom->set_prop( 'password' => $domainPassword );
+ $dom->set_prop( 'mx' => $domainMX );
+ $dom->set_prop( 'customdns' => $customDNS );
+ $dom->set_prop( 'customprotocol' => $customPROTOCOL );
+
+ $domaindb->reload();
+
+ system( "/sbin/e-smith/signal-event", "ddclient" );
+ return "ok";
+}
+
+1;
diff -urN smeserver-ddclient-1.2.1.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/I18N/Modules/Ddclient/en.pm smeserver-ddclient-1.2.1/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/I18N/Modules/Ddclient/en.pm
--- smeserver-ddclient-1.2.1.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/I18N/Modules/Ddclient/en.pm 1970-01-01 01:00:00.000000000 +0100
+++ smeserver-ddclient-1.2.1/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/I18N/Modules/Ddclient/en.pm 2020-06-08 09:45:00.000000000 +0100
@@ -0,0 +1,97 @@
+package SrvMngr::I18N::Modules::Ddclient::en;
+use strict;
+use warnings;
+use utf8;
+use Mojo::Base 'SrvMngr::I18N';
+
+use SrvMngr::I18N::Modules::General::en;
+
+my %lexicon = (
+'ddc_FORM_TITLE' => 'Create, remove or change the publication of virtual domains',
+'ddc_Params_for_IP_Retrieval'=>' Parameters to control how the IP of your server is found:',
+'ddc_DESCRIPTION'=> 'Use this contrib when you have a sme server connected to a ISP service using a dynamic IP, and you wish to host multiple domains.
+
ddclient is a client for updating dynamic DNS entries for domains hosted at different DNS providers.
+
Configure your dynamic host domains via the ddclient server manager panel.
+
ddclient can be used on servers configured in server gateway mode or in server only mode.
',
+'ddc_FORM_DESCRIPTION' => 'Virtual Domains for publication on the net:',
+'ddc_NO_VIRTUAL_DOMAINS' => 'There are no virtual domains in the system.',
+'ddc_CURRENT_LIST_OF_DOMAINS' => 'Current list of virtual domains',
+'ddc_PUBLICATION' => 'Publication',
+'ddc_PRIMARY_SITE' => 'Primary Site',
+'ddc_CONTENT' => '[_1] i-bay',
+'ddc_CREATE_TITLE' => 'Create a new publication virtual domain',
+'ddc_SERVERS_LABEL' => 'Where to publish',
+'ddc_MX' => 'record MX',
+'ddc_NAME_LABEL' => 'Login to publish',
+'ddc_PASSWORD_LABEL' => 'Password to publish',
+'ddc_CONTENT_FIELD_DESCRIPTION' => 'For the web site, you may choose your primary web site or any i-bay as the content.',
+'ddc_DOMAIN_NAME_VALIDATION_ERROR' => 'Error: unexpected or missing characters in domain name [_1]. The domain name should contain one or more letters, numbers, periods and minus signs. Did not create new domain.',
+'ddc_DOMAIN_DESCRIPTION_VALIDATION_ERROR' => 'Error: unexpected or missing characters in domain description [_1]. Did not create new domain.',
+'ddc_DOMAIN_IN_USE_ERROR' => 'Error: domain [_1] is already in use. Did not create new domain.',
+'ddc_DOMAIN_LOGIN_VALIDATION_ERROR'=> 'Domain login must not be blank and only consist of letter, numbers, "." or "@"',
+'ddc_RESERVED_SECURE_DOMAIN_ERROR' => 'Error: domain [_1] is reserved to provide a secured webserver for the virtual domain [_2]. Did not create new domain.',
+'ddc_SYSTEM_DOMAIN_ERROR' => 'Error: domain [_1] is your system domain name. You cannot have a virtual domain with the same name. Did not create new domain.',
+'ddc_RESERVED_SECURE_SYSTEM_DOMAIN_ERROR' => 'Error: domain [_1] is reserved to provide a secured webserver for your system domain name [_2]. Did not create new domain.',
+'ddc_SUCCESSFULLY_CREATED' => 'Successfully publication domain [_1] on [_2].',
+'ddc_MODIFY_TITLE' => 'Modify virtual domain',
+'ddc_NONEXISTENT_DOMAIN_ERROR' => 'Error: [_1] is not an existing domain.',
+'ddc_SUCCESSFULLY_MODIFIED' => 'Successfully modified the publication [_1] on [_2].',
+'ddc_REMOVE_TITLE' => 'Remove publication of virtual domain',
+'ddc_REMOVE_DESCRIPTION' => '
You are about to remove the publication of domain [_1] ([_2]) on [_3]. +
++Are you sure you wish to remove this domain\'s publication ? +
+', +'ddc_ERROR_WHILE_REMOVING_DOMAIN' => 'Error: internal failure while removing publication of [_1].', +'ddc_SUCCESSFULLY_DELETED' => 'Successfully deleted publication of [_1] on [_2].', +'ddc_DYNDNS1' => 'dyndns.org dynamic addresses', +'ddc_DYNDNS2' => 'dyndns.org static addresses', +'ddc_DYNDNS3' => 'dyndns.org custom addresses', +'ddc_ZONEDIT' => 'ZoneEdit (zoneedit.com)', +'ddc_EASYDNS' => 'EasyDNS (easydns.com)', +'ddc_HAMMER' => 'Hammernode (hn.org) dynamic addresses', +'ddc_DSLREPORTS' => 'dslreports.com dynamic-host monitoring', +'ddc_EURODYNDNS' => 'eurodyndns.org dynamic addresses', +'ddc_DTDNS' => 'DtDNS (www.dtdns.com) dynamic addresses', +'ddc_LOOPIA' => 'Loopia (loopia.se) dynamic addresses', +'ddc_DNSPARK' => ' Dnspark (dnspark.com) dynamic addresses', +'ddc_DYNHOST' => ' DynHost (ovh.com) dynamic addresses', +'ddc_NOIP' => ' NoIP (noip.com) dynamic addresses', +'ddc_CHANGEIP' => ' ChangeIP (changeip.com) dynamic addresses', +'ddc_NAMECHEAP' => ' NAMECHEAP (namecheap.com) dynamic addresses', +'ddc_SPDNS' => ' SPDNS (spdns.de) dynamic addresses', +'ddc_CUSTOMDNS' => 'Custom Dynamic DNS Provider', +'ddc_CUSTOMDNS_LABEL' => 'Custom server Address', +'ddc_CUSTOM_PROTOCOL_LABEL' => 'Custom ddclient Protocol', +'ddc_CUSTOM_DESCRIPTION' => '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', +'ddc_CUSTOMDNS_VALIDATION_ERROR' => 'Error: unexpected or missing characters in custom server address field of domain [_1]. The server address should contain one or more letters, numbers, periods and minus signs. Did not apply the change.', +'ddc_ddclient' =>'Dynamic Clients', +'ddc_DOMAIN_NAME_ALREADY_EXIST' => 'Error: this domain:"[_1]" already exists. Please chose another.', +'ddc_FREE_FORM_DESCRIPTION' => 'Here you can create any domain name to publish over the net:', +'ddc_RETRIEVE_SSL' => 'SSL update', +'ddc_RETRIEVE_DEAMONUPDATE' => 'Deamon update (seconds)', +'ddc_RETRIEVE_URLCHECKIP' => 'Url for the external IP', +'ddc_APPLY' => 'Save', +'ddc_DOMAIN_NAME_LABEL' => 'Domain Name', +'ddc_DESCRIPTION_LABEL' => 'Domain description', +'ddc_SUCCESSFULLY_MODIFIED_RETRIEVE_IP' => 'You have successfully modified the retrieve IP options.', +'ddc_RETRIEVE_METHOD' => 'Method to retrieve new IP:', +'ddc_RETRIEVE_IF' => 'Local interface to get new IP, if selected interface method', +'ddc_RETRIEVE_CMD' => 'Command to execute to get IP, if selected command method', +'ddc_SME external Interface' => 'SME external interface', +'ddc_SME configuration DB' => 'SME configuration DB', +'ddc_web' => 'Web query', +'ddc_Interface' => 'IP from interface', +'ddc_IP' => 'Manual IP setting', +'ddc_Command' => 'Command to execute', +'ddc_RETRIEVE_IP' => 'IP to manually force' +); + +our %Lexicon = ( + %{ SrvMngr::I18N::Modules::General::en::Lexicon }, + %lexicon +); + + +1; diff -urN smeserver-ddclient-1.2.1.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/templates/ddclient.html.ep smeserver-ddclient-1.2.1/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/templates/ddclient.html.ep --- smeserver-ddclient-1.2.1.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/templates/ddclient.html.ep 1970-01-01 01:00:00.000000000 +0100 +++ smeserver-ddclient-1.2.1/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/templates/ddclient.html.ep 2020-06-07 10:18:00.000000000 +0100 @@ -0,0 +1,48 @@ +% layout 'default', title => "Sme server 2 - Dynamic Clients", share_dir => './'; + +% content_for 'module' => begin ++ %= dumper $c->current_route +
+ % } + ++ %=$c->render_to_string(inline =>$c->l($ddc_datas->{first})) +
+ + %} elsif ($ddc_datas->{success}) { ++ %= $c->l($ddc_datas->{success}); +
++ %= $c->l($ddc_datas->{error}); +
++ %=l 'ddc_DOMAIN_NAME_LABEL' + | ++ %=l 'ddc_DESCRIPTION_LABEL' + | ++ %=l 'ddc_PUBLICATION' + | ++ %=l 'ACTION' + | +|
---|---|---|---|---|
+ <%=l 'MODIFY'%> + | + <%=l 'REMOVE'%> + | + +|||
+ | + | + | + | + <%=l 'CREATE'%> + | +
+ %= $c->render_to_string(inline =>l("ddc_REMOVE_DESCRIPTION",$ddc_datas->{"Domain_details"}->{"Domain"},$ddc_datas->{"Domain_details"}->{"Description"},$c->l($ddc_datas->{"Domain_details"}->{"Publication"}))) +
+ % param Domain=>$ddc_datas->{"Domain_details"}->{"Domain"}; + %= hidden_field Domain=>$ddc_datas->{"Domain_details"}->{"Domain"} + %= hidden_field Route=>$c->current_route + %= hidden_field dns=>$ddc_datas->{"Domain_details"}->{"dns"} + %= hidden_field trt=>"DEL" + %= submit_button "$btn", class => 'action' + % end ++ %=l 'ddc_DOMAIN_NAME_LABEL' + | ++ %=l 'ddc_DESCRIPTION_LABEL' + | ++ %=l('ddc_CONTENT',"") + | ++ %=l 'ddc_PUBLICATION' + | + ++ %=l 'ACTION' + | +|
---|---|---|---|---|---|
+ "><%=l 'MODIFY'%> + | + "><%=l 'REMOVE'%> + | +