From 75a83fa35cfd4b74fbea712457f71b9fee5e6065 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 25 Jan 2017 11:39:31 +0100 Subject: [PATCH] allow to store (user specific) s/mime private keys in mail account --- api/setup/setup.inc.php | 2 +- api/setup/tables_current.inc.php | 2 +- api/setup/tables_update.inc.php | 26 ++++++++++++++++++++++++++ api/src/Mail/Credentials.php | 9 +++++++-- 4 files changed, 35 insertions(+), 4 deletions(-) diff --git a/api/setup/setup.inc.php b/api/setup/setup.inc.php index 3e45c828d6..80bdaec128 100644 --- a/api/setup/setup.inc.php +++ b/api/setup/setup.inc.php @@ -12,7 +12,7 @@ /* Basic information about this app */ $setup_info['api']['name'] = 'api'; $setup_info['api']['title'] = 'EGroupware API'; -$setup_info['api']['version'] = '16.1.005'; +$setup_info['api']['version'] = '16.9.001'; $setup_info['api']['versions']['current_header'] = '1.29'; $setup_info['api']['enable'] = 3; $setup_info['api']['app_order'] = 1; diff --git a/api/setup/tables_current.inc.php b/api/setup/tables_current.inc.php index a380f4b718..6ebee6d978 100644 --- a/api/setup/tables_current.inc.php +++ b/api/setup/tables_current.inc.php @@ -463,7 +463,7 @@ $phpgw_baseline = array( 'cred_type' => array('type' => 'int','precision' => '1','nullable' => False,'comment' => '&1=imap, &2=smtp, &4=admin'), 'account_id' => array('type' => 'int','meta' => 'user','precision' => '4','nullable' => False,'comment' => 'account_id or 0=all'), 'cred_username' => array('type' => 'varchar','precision' => '80','nullable' => False,'comment' => 'username'), - 'cred_password' => array('type' => 'varchar','precision' => '80','comment' => 'password encrypted'), + 'cred_password' => array('type' => 'varchar','precision' => '9600','comment' => 'password encrypted'), 'cred_pw_enc' => array('type' => 'int','precision' => '1','default' => '0','comment' => '0=not, 1=user pw, 2=system') ), 'pk' => array('cred_id'), diff --git a/api/setup/tables_update.inc.php b/api/setup/tables_update.inc.php index 7ea565c9fd..b81a28d06e 100644 --- a/api/setup/tables_update.inc.php +++ b/api/setup/tables_update.inc.php @@ -192,3 +192,29 @@ HAVING COUNT(*) > 1', __LINE__, __FILE__, 0, $junk_size, false, Api\Db::FETCH_AS return $GLOBALS['setup_info']['api']['currentver'] = '16.1.005'; } + +/** + * Update to 17.1 development as 16.9 + * + * @return string + */ +function api_upgrade16_1_005() +{ + return $GLOBALS['setup_info']['api']['currentver'] = '16.9'; +} + +/** + * Give egw_ea_credentials.cred_password size 9600 to accomodate private s/mime keys + * + * @return string + */ +function api_upgrade16_9() +{ + $GLOBALS['egw_setup']->oProc->AlterColumn('egw_ea_credentials','cred_password',array( + 'type' => 'varchar', + 'precision' => '9600', + 'comment' => 'password encrypted' + )); + + return $GLOBALS['setup_info']['api']['currentver'] = '16.9.001'; +} diff --git a/api/src/Mail/Credentials.php b/api/src/Mail/Credentials.php index 605d797464..c53a0863a2 100644 --- a/api/src/Mail/Credentials.php +++ b/api/src/Mail/Credentials.php @@ -59,9 +59,13 @@ class Credentials */ const ADMIN = 8; /** - * All credentials IMAP|SMTP|ADMIN + * Credentials for admin connection */ - const ALL = 11; + const SMIME = 16; + /** + * All credentials IMAP|SMTP|ADMIN|SMIME + */ + const ALL = 27; /** * Password in cleartext @@ -108,6 +112,7 @@ class Credentials self::IMAP => 'acc_imap_', self::SMTP => 'acc_smtp_', self::ADMIN => 'acc_imap_admin_', + self::SMIME => 'acc_smime_', ); /**