#include "claws.h"
#include "account.h"
+#include "passwordstore.h"
#include "gtk/inputdialog.h"
#include "md5.h"
#include "utils.h"
g_free(session->pass);
if (config->auth == SIEVEAUTH_NONE) {
session->pass = NULL;
- } else if (reuse_auth && account->passwd) {
- session->pass = g_strdup(account->passwd);
- } else if (config->passwd && config->passwd[0]) {
- session->pass = g_strdup(config->passwd);
+ } else if (reuse_auth && (session->pass = passwd_store_get(PWS_ACCOUNT,
+ account->account_name, PWS_ACCOUNT_RECV))) {
+ } else if ((session->pass = passwd_store_get(PWS_ACCOUNT,
+ account->account_name, "sieve"))) {
} else if (password_get(session->user, session->host, "sieve",
session->port, &session->pass)) {
} else {
#include "gtk/combobox.h"
#include "alertpanel.h"
#include "passcrypt.h"
+#include "password.h"
+#include "passwordstore.h"
#include "utils.h"
#include "prefs.h"
#include "prefs_gtk.h"
struct SieveAccountPage *page = (struct SieveAccountPage *) _page;
PrefsAccount *account = (PrefsAccount *) data;
SieveAccountConfig *config;
+ gchar *pass;
GtkWidget *page_vbox, *sieve_vbox;
GtkWidget *hbox;
gtk_entry_set_text(GTK_ENTRY(host_entry), config->host);
if (config->userid != NULL)
gtk_entry_set_text(GTK_ENTRY(uid_entry), config->userid);
- if (config->passwd != NULL)
- gtk_entry_set_text(GTK_ENTRY(pass_entry), config->passwd);
+ if ((pass = passwd_store_get(PWS_ACCOUNT, account->account_name,
+ "sieve")) != NULL) {
+ gtk_entry_set_text(GTK_ENTRY(pass_entry), pass);
+ memset(pass, 0, strlen(pass));
+ g_free(pass);
+ }
combobox_select_by_data(GTK_COMBO_BOX(auth_menu), config->auth_type);
SIEVE_TLS_MAYBE :
SIEVE_TLS_YES;
+ g_free(config->host);
+ g_free(config->userid);
+
config->host = gtk_editable_get_chars(GTK_EDITABLE(page->host_entry), 0, -1);
config->userid = gtk_editable_get_chars(GTK_EDITABLE(page->uid_entry), 0, -1);
- config->passwd = gtk_editable_get_chars(GTK_EDITABLE(page->pass_entry), 0, -1);
+ passwd_store_set(PWS_ACCOUNT, page->account->account_name, "sieve",
+ gtk_editable_get_chars(GTK_EDITABLE(page->pass_entry), 0, -1),
+ FALSE);
config->auth_type = combobox_get_active_data(GTK_COMBO_BOX(page->auth_menu));
sieve_prefs_account_set_config(page->account, config);
config->auth = SIEVEAUTH_REUSE;
config->auth_type = SIEVEAUTH_AUTO;
config->userid = NULL;
- config->passwd = NULL;
confstr = prefs_account_get_privacy_prefs(account, "sieve");
if (confstr == NULL)
}
config->userid = g_base64_decode(enc_userid, &len);
- config->passwd = g_base64_decode(enc_passwd, &len);
- passcrypt_decrypt(config->passwd, len);
+ if (enc_passwd[0]) {
+ // migrate password from passcrypt to passwordstore
+ gchar *pass = g_base64_decode(enc_passwd, &len);
+ passcrypt_decrypt(pass, len);
+ passwd_store_set(PWS_ACCOUNT, account->account_name, "sieve",
+ pass, FALSE);
+ g_free(pass);
+ }
return config;
}
{
gchar *confstr = NULL;
gchar *enc_userid = NULL;
- gchar *enc_passwd = NULL;
- gchar *tmp;
gsize len;
if (config->userid) {
enc_userid = g_base64_encode(config->userid, len);
}
- if (config->passwd) {
- tmp = g_strdup(config->passwd);
- len = strlen(tmp);
- passcrypt_encrypt(tmp, len);
- enc_passwd = g_base64_encode(tmp, len);
- g_free(tmp);
- }
-
confstr = g_strdup_printf("%c%c %s %c%hu %hhu %hhu %hhu %s %s",
config->enable ? 'y' : 'n',
config->use_host ? 'y' : 'n',
config->auth,
config->auth_type,
enc_userid ? enc_userid : "",
- enc_passwd ? enc_passwd : "");
+ "");
if (enc_userid)
g_free(enc_userid);
- if (enc_passwd)
- g_free(enc_passwd);
prefs_account_set_privacy_prefs(account, "sieve", confstr);
{
g_free(config->host);
g_free(config->userid);
- g_free(config->passwd);
g_free(config);
}