diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.c | 14 | ||||
| -rw-r--r-- | src/prefs_ui.c | 27 |
2 files changed, 28 insertions, 13 deletions
| @@ -280,7 +280,7 @@ int main(int argc, char *argv[]) | |||
| 280 | #if USE_SSL | 280 | #if USE_SSL |
| 281 | if (prefs_common.use_master_password) { | 281 | if (prefs_common.use_master_password) { |
| 282 | if (prefs_common.master_password_hash != NULL) { | 282 | if (prefs_common.master_password_hash != NULL) { |
| 283 | if (check_master_password_interactively(3) != RC_OK) { | 283 | if (check_master_password_interactively(3) != MP_RC_OK) { |
| 284 | if (alertpanel(_("Master password"), | 284 | if (alertpanel(_("Master password"), |
| 285 | _("Invalid master password"), | 285 | _("Invalid master password"), |
| 286 | GTK_STOCK_DISCARD, | 286 | GTK_STOCK_DISCARD, |
| @@ -292,7 +292,7 @@ int main(int argc, char *argv[]) | |||
| 292 | } else { | 292 | } else { |
| 293 | alertpanel_notice( | 293 | alertpanel_notice( |
| 294 | _("Master password enabled but not set. Setting one now")); | 294 | _("Master password enabled but not set. Setting one now")); |
| 295 | if (set_master_password_interactively(3) != RC_OK) { | 295 | if (set_master_password_interactively(3) != MP_RC_OK) { |
| 296 | if (alertpanel(_("Master password"), | 296 | if (alertpanel(_("Master password"), |
| 297 | _("Unable to set master password"), | 297 | _("Unable to set master password"), |
| 298 | GTK_STOCK_DISCARD, | 298 | GTK_STOCK_DISCARD, |
| @@ -303,6 +303,16 @@ int main(int argc, char *argv[]) | |||
| 303 | } | 303 | } |
| 304 | } | 304 | } |
| 305 | } | 305 | } |
| 306 | /* security goal: | ||
| 307 | * if the master password is enabled and loaded on init, | ||
| 308 | * an attacker can potentially set use_master_password - disabled | ||
| 309 | * afterwards and then force Sylpheed to save account data - the result | ||
| 310 | * being passwords saved to accountrc in plain-text. | ||
| 311 | * possible solution: | ||
| 312 | * Do not allow the passwords to be stored in plain-text if Sylpheed | ||
| 313 | * was started with use_master_password - enabled. | ||
| 314 | */ | ||
| 315 | master_password_enabled_on_init = prefs_common.use_master_password; | ||
| 306 | #endif | 316 | #endif |
| 307 | filter_set_addressbook_func(addressbook_has_address); | 317 | filter_set_addressbook_func(addressbook_has_address); |
| 308 | filter_read_config(); | 318 | filter_read_config(); |
diff --git a/src/prefs_ui.c b/src/prefs_ui.c index 051a058..2ab1d45 100644 --- a/src/prefs_ui.c +++ b/src/prefs_ui.c | |||
| @@ -279,23 +279,28 @@ void prefs_set_data_from_epass_entry(PrefParam *pparam) | |||
| 279 | 279 | ||
| 280 | /* This is where decrypted passwords are encrypted and stored again */ | 280 | /* This is where decrypted passwords are encrypted and stored again */ |
| 281 | 281 | ||
| 282 | /* TODO: A potential exploit is disabling master password and then forcing | ||
| 283 | * Sylpheed to store the password | ||
| 284 | */ | ||
| 285 | |||
| 286 | /* master_password == NULL for any of the following reasons: | 282 | /* master_password == NULL for any of the following reasons: |
| 287 | * - use_master_password is not enabled (we just save without encrypting) | 283 | * - use_master_password is not enabled (we just save without encrypting) |
| 288 | * - master_password is auto unloaded (let the encrypt function handle it) | 284 | * - master_password is auto unloaded (prompt for the master password) |
| 289 | * - undefined reason (refure to store the password) | 285 | * - undefined reason (refure to store the password) |
| 290 | */ | 286 | */ |
| 291 | if (!prefs_common.use_master_password) { | 287 | if (!prefs_common.use_master_password) { |
| 292 | prefs_set_data_from_entry(pparam); | 288 | /* check if use_master_password was enabled when Sylpheed started */ |
| 293 | return; | 289 | if (!master_password_enabled_on_init) { |
| 294 | } else if ((master_password == NULL) && | 290 | prefs_set_data_from_entry(pparam); |
| 295 | (!prefs_common.auto_unload_master_password)) { | 291 | } |
| 296 | debug_print("Master password enabled, but not loaded for no " | ||
| 297 | "apparent reason. Not storing\n"); | ||
| 298 | return; | 292 | return; |
| 293 | } else if (master_password == NULL) { | ||
| 294 | if (!prefs_common.auto_unload_master_password) { | ||
| 295 | debug_print("Master password enabled, but not loaded for no " | ||
| 296 | "apparent reason. Not storing\n"); | ||
| 297 | return; | ||
| 298 | } else { | ||
| 299 | if (check_master_password_interactively(3) != MP_RC_OK) { | ||
| 300 | debug_print("Failed to reload the master password\n"); | ||
| 301 | return; | ||
| 302 | } | ||
| 303 | } | ||
| 299 | } | 304 | } |
| 300 | 305 | ||
| 301 | ui_data = (PrefsUIData *)pparam->ui_data; | 306 | ui_data = (PrefsUIData *)pparam->ui_data; |
