From f54ec17df2bfba971e7e3cba9bdc46a501cf7d97 Mon Sep 17 00:00:00 2001 From: kink Date: Mon, 25 Jun 2007 20:18:15 +0000 Subject: [PATCH] - Fix disabling password encryption in mail_fetch (#1738001). Thanks Stephen More git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@12473 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- plugins/mail_fetch/functions.php | 3 ++- plugins/mail_fetch/options.php | 24 +++++++++++++++++++++--- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/plugins/mail_fetch/functions.php b/plugins/mail_fetch/functions.php index 436ef54f..507fa387 100644 --- a/plugins/mail_fetch/functions.php +++ b/plugins/mail_fetch/functions.php @@ -64,8 +64,9 @@ function mail_fetch_login_function() { $mailfetch_login_[$i_loop] = getPref($data_dir, $username, "mailfetch_login_$i_loop"); $mailfetch_fref_[$i_loop] = getPref($data_dir, $username, "mailfetch_fref_$i_loop"); $mailfetch_pass_[$i_loop] = getPref($data_dir, $username, "mailfetch_pass_$i_loop"); - if( $mailfetch_cypher == 'on' ) + if( $mailfetch_cypher == 'on' ) { $mailfetch_pass_[$i_loop] = decrypt( $mailfetch_pass_[$i_loop] ); + } if( $mailfetch_pass_[$i_loop] <> '' && // Empty passwords no allowed ( ( $mailfetch_login_[$i_loop] == 'on' && $mailfetch_newlog == 'on' ) || $mailfetch_fref_[$i_loop] == 'on' ) ) { diff --git a/plugins/mail_fetch/options.php b/plugins/mail_fetch/options.php index 7931bb61..35eb094e 100644 --- a/plugins/mail_fetch/options.php +++ b/plugins/mail_fetch/options.php @@ -65,7 +65,16 @@ switch( $mf_action ) { setPref($data_dir,$username,"mailfetch_port_$mf_sn", (isset($mf_port)?$mf_port:110)); setPref($data_dir,$username,"mailfetch_alias_$mf_sn", (isset($mf_alias)?$mf_alias:"")); setPref($data_dir,$username,"mailfetch_user_$mf_sn",(isset($mf_user)?$mf_user:"")); - setPref($data_dir,$username,"mailfetch_pass_$mf_sn",(isset($mf_pass)?encrypt( $mf_pass ) :"")); + $pass = ""; + if ( isset($mf_pass) ) { + if ( isset($mf_cypher) && $mf_cypher == 'on' ) { + setPref($data_dir,$username,"mailfetch_cypher", ($mf_cypher == 'on' ? 'on' : '')); + $pass = encrypt($mf_pass); + } else { + $pass = $mf_pass; + } + } + setPref($data_dir,$username,"mailfetch_pass_$mf_sn",$pass); setPref($data_dir,$username,"mailfetch_lmos_$mf_sn",(isset($mf_lmos)?$mf_lmos:"")); setPref($data_dir,$username,"mailfetch_login_$mf_sn",(isset($mf_login)?$mf_login:"")); setPref($data_dir,$username,"mailfetch_fref_$mf_sn",(isset($mf_fref)?$mf_fref:"")); @@ -83,8 +92,17 @@ switch( $mf_action ) { setPref($data_dir,$username,"mailfetch_port_$mf_sn", (isset($mf_port)?$mf_port:110)); setPref($data_dir,$username,"mailfetch_alias_$mf_sn", (isset($mf_alias)?$mf_alias:"")); setPref($data_dir,$username,"mailfetch_user_$mf_sn",(isset($mf_user)?$mf_user:"")); - setPref($data_dir,$username,"mailfetch_pass_$mf_sn",(isset($mf_pass)?encrypt( $mf_pass ) :"")); - setPref($data_dir,$username,"mailfetch_cypher", ($mf_cypher == 'on' ? 'on' : '')); + $pass = ""; + if ( isset($mf_pass) ) { + if ( isset($mf_cypher) && $mf_cypher == 'on' ) { + setPref($data_dir,$username,"mailfetch_cypher", 'on'); + $pass = encrypt($mf_pass); + } else { + setPref($data_dir,$username,"mailfetch_cypher", ''); + $pass = $mf_pass; + } + } + setPref($data_dir,$username,"mailfetch_pass_$mf_sn",$pass); setPref($data_dir,$username,"mailfetch_lmos_$mf_sn",(isset($mf_lmos)?$mf_lmos:"")); setPref($data_dir,$username,"mailfetch_login_$mf_sn",(isset($mf_login)?$mf_login:"")); setPref($data_dir,$username,"mailfetch_fref_$mf_sn",(isset($mf_fref)?$mf_fref:"")); -- 2.25.1