]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
BUG10965: only write auth.conf if username/password are set
authorAlexander Marx <alexander.marx@ipfire.org>
Sat, 31 Oct 2015 06:34:56 +0000 (07:34 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 5 Nov 2015 15:34:28 +0000 (15:34 +0000)
auth.conf was always written, even if no username/password provided.
In this case only the ip or Hostname of the mailserver was written into
auth.conf. Now the file is only filled if username/password are filled.

Signed-off-by: Alexander Marx <alexander.marx@ipfire.org>
Tested-by: Timo Eissler <timo.eissler@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
html/cgi-bin/mail.cgi

index a72f923ca84acd294f762f712ef92ef6be22bf12..072888cb4baaf501bc3317b22a34684946942f29 100755 (executable)
@@ -110,9 +110,12 @@ if ($cgiparams{'ACTION'} eq "$Lang::tr{'save'}"){ #SaveButton on configsite
                $mail{'SENDER'}                 = $cgiparams{'txt_mailsender'};
                $mail{'RECIPIENT'}              = $cgiparams{'txt_recipient'};
 
-               $auth{'AUTHNAME'}               = $cgiparams{'txt_mailuser'};
-               $auth{'AUTHPASS'}               = $cgiparams{'txt_mailpass'};
-               $auth{'AUTHHOST'}               = $cgiparams{'txt_mailserver'};
+               if ($cgiparams{'txt_mailuser'} && $cgiparams{'txt_mailpass'}) {
+                       $auth{'AUTHNAME'}               = $cgiparams{'txt_mailuser'};
+                       $auth{'AUTHPASS'}               = $cgiparams{'txt_mailpass'};
+                       $auth{'AUTHHOST'}               = $cgiparams{'txt_mailserver'};
+                       print TXT1 "$auth{'AUTHNAME'}|$auth{'AUTHHOST'}:$auth{'AUTHPASS'}\n";
+               }
 
                $dma{'SMARTHOST'}               = $cgiparams{'txt_mailserver'};
                $dma{'PORT'}                    = $cgiparams{'txt_mailport'};
@@ -129,7 +132,7 @@ if ($cgiparams{'ACTION'} eq "$Lang::tr{'save'}"){ #SaveButton on configsite
                        print TXT "$k $v\n";
                }
                close TXT;
-               print TXT1 "$auth{'AUTHNAME'}|$auth{'AUTHHOST'}:$auth{'AUTHPASS'}\n";
+               close TXT1;
                close TXT2;
 
        }else{