Skip to content

Commit

Permalink
Fix regression where smtp_user did not allow pre/post strings befor…
Browse files Browse the repository at this point in the history
…e/after `%u` placeholder (#9162)
  • Loading branch information
alecpl committed Oct 29, 2023
1 parent efd5842 commit 6d75577
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- Fix UI issue when dealing with an invalid managesieve_default_headers value (#9175)
- Fix bug where images attached to application/smil messages weren't displayed (#8870)
- Fix PHP string replacement error in utils/error.php (#9185)
- Fix regression where `smtp_user` did not allow pre/post strings before/after `%u` placeholder (#9162)

## Release 1.6.4

Expand Down
8 changes: 4 additions & 4 deletions config/defaults.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -270,12 +270,12 @@
// of IMAP host (no prefix or port) and SMTP server e.g. ['imap.example.com' => 'smtp.example.net']
$config['smtp_host'] = 'localhost:587';

// SMTP username (if required) if you use %u as the username Roundcube
// will use the current username for login
// SMTP username (if required)
// Note: %u variable will be replaced with current user's username
$config['smtp_user'] = '%u';

// SMTP password (if required) if you use %p as the password Roundcube
// will use the current user's password for login
// SMTP password (if required)
// Note: When set to '%p' current user's password will be used
$config['smtp_pass'] = '%p';

// SMTP AUTH type (DIGEST-MD5, CRAM-MD5, LOGIN, PLAIN or empty to use
Expand Down
7 changes: 1 addition & 6 deletions program/lib/Roundcube/rcube_smtp.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,18 +170,13 @@ public function connect($host = null, $port = null, $user = null, $pass = null)
}
}

if ($CONFIG['smtp_user'] == '%u') {
$smtp_user = (string) $rcube->get_user_name();
} else {
$smtp_user = $CONFIG['smtp_user'];
}

if ($CONFIG['smtp_pass'] == '%p') {
$smtp_pass = (string) $rcube->get_user_password();
} else {
$smtp_pass = $CONFIG['smtp_pass'];
}

$smtp_user = str_replace('%u', (string) $rcube->get_user_name(), $CONFIG['smtp_user']);
$smtp_auth_type = $CONFIG['smtp_auth_type'] ?: null;
$smtp_authz = null;

Expand Down

0 comments on commit 6d75577

Please sign in to comment.