From 46669dddf7405c3c05f008543524ca8c2a74e8a3 Mon Sep 17 00:00:00 2001 From: Alan Garcia Date: Mon, 22 Jul 2013 16:37:44 +0000 Subject: [PATCH] Mail autodetect pour thunderbird --- .gitattributes | 1 - .../templates/bind/templates/mx.template | 1 - src/functions.sh | 4 ++++ src/functions_dns.sh | 17 +++++++++++++---- 4 files changed, 17 insertions(+), 6 deletions(-) delete mode 100644 etc/alternc/templates/bind/templates/mx.template diff --git a/.gitattributes b/.gitattributes index f2d99422..09d99bbf 100644 --- a/.gitattributes +++ b/.gitattributes @@ -469,7 +469,6 @@ etc/alternc/templates/apache2/vhost.conf -text etc/alternc/templates/bind/automatic.conf -text etc/alternc/templates/bind/named.conf.options -text etc/alternc/templates/bind/slaveip.conf -text -etc/alternc/templates/bind/templates/mx.template -text etc/alternc/templates/bind/templates/named.template -text etc/alternc/templates/bind/templates/slave.template -text etc/alternc/templates/bind/templates/zone.template -text diff --git a/etc/alternc/templates/bind/templates/mx.template b/etc/alternc/templates/bind/templates/mx.template deleted file mode 100644 index 2c27486a..00000000 --- a/etc/alternc/templates/bind/templates/mx.template +++ /dev/null @@ -1 +0,0 @@ - IN MX 5 @@MX@@. diff --git a/src/functions.sh b/src/functions.sh index b4698e01..28ed1627 100755 --- a/src/functions.sh +++ b/src/functions.sh @@ -71,6 +71,10 @@ get_uid_by_name() { mysql_query 'SELECT uid FROM membres WHERE login="'"$1"'" LIMIT 1;' } +get_variable_from_db() { + mysql_query 'SELECT value FROM membres WHERE name="'"$1"'" LIMIT 1;' +} + # imprime le nom d'usager associé au domaine get_account_by_domain() { diff --git a/src/functions_dns.sh b/src/functions_dns.sh index 54517226..b82c8b60 100755 --- a/src/functions_dns.sh +++ b/src/functions_dns.sh @@ -127,10 +127,19 @@ dns_regenerate() { $MYSQL_DO "select distinct replace(replace(dt.entry,'%TARGET%',sd.valeur), '%SUB%', if(length(sd.sub)>0,sd.sub,'@')) as entry from sub_domaines sd,domaines_type dt where sd.type=dt.name and sd.domaine='$domain' and sd.enable in ('ENABLE', 'ENABLED') order by entry ;" ) - # Get some usefull vars - -# Deprecated ? -# local mx=$( $MYSQL_DO "select mx from domaines where domaine='$domain' limit 1;") + ##### Mail autodetect for thunderbird / outlook - START + # If $file contain DEFAULT_MX + if [ ! -z "$(echo -e "$file" |egrep 'DEFAULT_MX' )" ] ; then + # If $file ! contain autoconfig -> add entry + if [ -z "$(echo -e "$file" |egrep '^autoconfig' )" ] ; then + file="$(echo -e "$file" ; echo -e "autoconfig IN CNAME $FQDN.\n")" + fi + # if $file ! contain autodiscover -> add entry + if [ -z "$(echo -e "$file" |egrep '^autodiscover' )" ] ; then + file="$(echo -e "$file" ; echo -e "autodiscover IN CNAME $FQDN.\n")" + fi + fi # End if containt DEFAULT_MX + ##### Mail autodetect for thunderbird / outlook - END # Replace the vars by their values # Here we can add dynamic value for the default MX