Revision: 7205 http://sourceforge.net/p/ipcop/svn/7205 Author: owes Date: 2014-01-10 11:56:08 +0000 (Fri, 10 Jan 2014) Log Message: ----------- Add 'use TLS' option. Newer SSLeay looks to be more strict when using TLS capable email server, so use TLS=no can help if you do not want full certificate checking
Modified Paths: -------------- ipcop/trunk/html/cgi-bin/email.cgi ipcop/trunk/src/misc-progs/emailhelper.c ipcop/trunk/updates/2.1.0/ROOTFILES.i486-2.1.0 Modified: ipcop/trunk/html/cgi-bin/email.cgi =================================================================== --- ipcop/trunk/html/cgi-bin/email.cgi 2014-01-08 07:17:38 UTC (rev 7204) +++ ipcop/trunk/html/cgi-bin/email.cgi 2014-01-10 11:56:08 UTC (rev 7205) @@ -15,6 +15,8 @@ # You should have received a copy of the GNU General Public License # along with IPCop. If not, see <http://www.gnu.org/licenses/>. # +# (c) 2011-2014 The IPCop Team +# # $Id$ # @@ -54,6 +56,7 @@ $cgiparams{'EMAIL_PW'} = ''; $cgiparams{'EMAIL_SERVER'} = ''; $cgiparams{'EMAIL_SERVER_PORT'} = ''; +$cgiparams{'EMAIL_USE_TLS'} = 'auto'; &General::getcgihash(\%cgiparams); @@ -73,6 +76,7 @@ $settings{'EMAIL_PW'} = $cgiparams{'EMAIL_PW'}; $settings{'EMAIL_SERVER'} = $cgiparams{'EMAIL_SERVER'}; $settings{'EMAIL_SERVER_PORT'} = $cgiparams{'EMAIL_SERVER_PORT'}; + $settings{'EMAIL_USE_TLS'} = $cgiparams{'EMAIL_USE_TLS'}; &General::writehash('/var/ipcop/email/settings', \%settings); @@ -90,12 +94,18 @@ $settings{'EMAIL_FROM'} = $mainsettings{'HOSTNAME'} . "@" . $mainsettings{'DOMAINNAME'}; } + # Set default EMAIL_USE_TLS if not configured + if (!exists($settings{'EMAIL_USE_TLS'})) { + $settings{'EMAIL_USE_TLS'} = 'auto'; + } + $cgiparams{'EMAIL_TO'} = $settings{'EMAIL_TO'}; $cgiparams{'EMAIL_FROM'} = $settings{'EMAIL_FROM'}; $cgiparams{'EMAIL_USR'} = $settings{'EMAIL_USR'}; $cgiparams{'EMAIL_PW'} = $settings{'EMAIL_PW'}; $cgiparams{'EMAIL_SERVER'} = $settings{'EMAIL_SERVER'}; $cgiparams{'EMAIL_SERVER_PORT'} = $settings{'EMAIL_SERVER_PORT'}; + $cgiparams{'EMAIL_USE_TLS'} = $settings{'EMAIL_USE_TLS'}; } # end unless ($saveerror) @@ -148,6 +158,13 @@ ERROR: } # end if ($cgiparams{'ACTION'} eq $Lang::tr{'send test mail'}) + +my %selected = (); +$selected{'auto'} = ''; +$selected{'yes'} = ''; +$selected{'no'} = ''; +$selected{$settings{'EMAIL_USE_TLS'}} = "selected='selected'"; + &Header::openpage($Lang::tr{'email settings'}, 1, ''); &Header::openbigbox('100%', 'left'); @@ -191,15 +208,25 @@ <td width='25%' align='left' class='base' nowrap='nowrap'> $Lang::tr{'email server'}: </td> - <td width='75%' align='left' class='base' > + <td width='25%' align='left' class='base' > <input type='text' name='EMAIL_SERVER' value='$cgiparams{'EMAIL_SERVER'}' size='25' /> </td> + <td width='25%' align='left' class='base' nowrap='nowrap'> + $Lang::tr{'email use tls'}: + </td> + <td width='25%' align='left' class='base' > + <select name='EMAIL_USE_TLS'> + <option value='auto' $selected{'auto'}>$Lang::tr{'automatic'}</option> + <option value='yes' $selected{'yes'}>$Lang::tr{'yes'}</option> + <option value='no' $selected{'no'}>$Lang::tr{'no'}</option> + </select> + </td> </tr> <tr> <td align='left' class='base' nowrap='nowrap'> $Lang::tr{'email server port'}: <img src='/blob.gif' alt='*' /> </td> - <td align='left' class='base' > + <td align='left' class='base' colspan='3'> <input type='text' name='EMAIL_SERVER_PORT' value='$cgiparams{'EMAIL_SERVER_PORT'}' size='25' /> </td> </tr> @@ -207,7 +234,7 @@ <td align='left' class='base' nowrap='nowrap'> $Lang::tr{'username'}: <img src='/blob.gif' alt='*' /> </td> - <td align='left' class='base' > + <td align='left' class='base' colspan='3'> <input type='text' name='EMAIL_USR' value='$cgiparams{'EMAIL_USR'}' size='25' /> </td> </tr> @@ -215,7 +242,7 @@ <td align='left' class='base' nowrap='nowrap'> $Lang::tr{'password'}: <img src='/blob.gif' alt='*' /> </td> - <td align='left' class='base' > + <td align='left' class='base' colspan='3'> <input type='password' name='EMAIL_PW' value='$cgiparams{'EMAIL_PW'}' size='25' /> </td> </tr> @@ -223,7 +250,7 @@ <td align='left' class='base' nowrap='nowrap'> $Lang::tr{'from email adr'}: </td> - <td align='left' class='base' > + <td align='left' class='base' colspan='3'> <input type='text' name='EMAIL_FROM' value='$cgiparams{'EMAIL_FROM'}' size='25' /> </td> </tr> @@ -231,12 +258,12 @@ <td align='left' class='base' nowrap='nowrap'> $Lang::tr{'to email adr'}: <img src='/blob.gif' alt='*' /><img src='/blob.gif' alt='*' /> </td> - <td align='left' class='base' > + <td align='left' class='base' colspan='3'> <input type='text' name='EMAIL_TO' value='$cgiparams{'EMAIL_TO'}' size='25' /> </td> </tr> <tr> - <td align='left' class='base' colspan="2"> + <td align='left' class='base' colspan='4'> <input type='submit' name='ACTION' value='$Lang::tr{'send test mail'}' $disabletest /> </td> </tr> Modified: ipcop/trunk/src/misc-progs/emailhelper.c =================================================================== --- ipcop/trunk/src/misc-progs/emailhelper.c 2014-01-08 07:17:38 UTC (rev 7204) +++ ipcop/trunk/src/misc-progs/emailhelper.c 2014-01-10 11:56:08 UTC (rev 7205) @@ -16,7 +16,7 @@ * You should have received a copy of the GNU General Public License * along with IPCop. If not, see <http://www.gnu.org/licenses/>. * - * (c) 2011-2013 The IPCop Team + * (c) 2011-2014 The IPCop Team * * $Id$ * @@ -86,6 +86,7 @@ char opt_password[STRING_SIZE]; char from[STRING_SIZE]; char to[STRING_SIZE]; + char tls[STRING_SIZE]; char hostname[STRING_SIZE]; char domainname[STRING_SIZE]; char subject[STRING_SIZE]; @@ -311,6 +312,12 @@ } + /* TLS can be non-existant, use auto for default */ + strcpy(tls, "auto"); + find_kv_default(kv, "EMAIL_USE_TLS", tls); + /* Valid values for tls: auto,yes,no. Set via GUI no need for validation. */ + verbose_printf(2, "Use TLS: %s\n", tls); + verbose_printf(1, "Reading main settings ... \n"); if (read_kv_from_file(&main_kv, "/var/ipcop/main/settings") != SUCCESS) { fprintf(stdout, "Cannot read main settings\n"); @@ -393,7 +400,7 @@ snprintf(command, STRING_SIZE_LARGE, - "/usr/bin/sendEmail -s %s%s %s %s -f %s -t %s %s %s %s -o message-charset=utf-8", server, port, user, password, from, to, subject, message, attachment); + "/usr/bin/sendEmail -s %s%s %s %s -f %s -t %s %s %s %s -o tls=%s -o message-charset=utf-8", server, port, user, password, from, to, subject, message, attachment, tls); if (flag_verbose >= 2) { strcat(command, " -vv"); } Modified: ipcop/trunk/updates/2.1.0/ROOTFILES.i486-2.1.0 =================================================================== --- ipcop/trunk/updates/2.1.0/ROOTFILES.i486-2.1.0 2014-01-08 07:17:38 UTC (rev 7204) +++ ipcop/trunk/updates/2.1.0/ROOTFILES.i486-2.1.0 2014-01-10 11:56:08 UTC (rev 7205) @@ -13,6 +13,7 @@ /home/httpd/cgi-bin/credits.cgi /home/httpd/cgi-bin/ddns.cgi /home/httpd/cgi-bin/dhcp.cgi +/home/httpd/cgi-bin/email.cgi /home/httpd/cgi-bin/fwrules.cgi /home/httpd/cgi-bin/hosts.cgi /home/httpd/cgi-bin/index.cgi This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ CenturyLink Cloud: The Leader in Enterprise Cloud Services. Learn Why More Businesses Are Choosing CenturyLink Cloud For Critical Workloads, Development Environments & Everything In Between. Get a Quote or Start a Free Trial Today. http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk _______________________________________________ Ipcop-svn mailing list Ipcop-svn@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ipcop-svn