commit 0ab9bbd83def20e1abf974238f0a712a52222fa7
parent b4ec5f3b2df7ff74a25369f05ce164c8ae94bfab
Author: Colin Leroy <colin@colino.net>
Date: Thu, 11 Feb 2016 11:33:19 +0100
SpamReport: use new password API
Diffstat:
3 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/src/plugins/spam_report/claws.def b/src/plugins/spam_report/claws.def
@@ -33,6 +33,7 @@ matcherlist_free
matcherlist_match
matcherlist_new
matcherprop_new
+password_decrypt
pref_get_escaped_pref
pref_get_unescaped_pref
prefs_common
diff --git a/src/plugins/spam_report/spam_report.c b/src/plugins/spam_report/spam_report.c
@@ -32,6 +32,7 @@
#include "common/claws.h"
#include "common/version.h"
#include "main.h"
+#include "password.h"
#include "plugin.h"
#include "prefs_common.h"
#include "utils.h"
@@ -221,7 +222,12 @@ static void report_spam(gint id, ReportInterface *intf, MsgInfo *msginfo, gchar
switch(intf->type) {
case INTF_HTTP_AUTH:
if (spamreport_prefs.user[id] && *(spamreport_prefs.user[id])) {
- auth = g_strdup_printf("%s:%s", spamreport_prefs.user[id], spamreport_prefs.pass[id]);
+ gchar *pass = password_decrypt(spamreport_prefs.pass[id], NULL);
+ auth = g_strdup_printf("%s:%s", spamreport_prefs.user[id], (pass != NULL ? pass : ""));
+ if (pass != NULL) {
+ memset(pass, 0, strlen(pass));
+ }
+ g_free(pass);
curl = curl_easy_init();
curl_easy_setopt(curl, CURLOPT_URL, intf->url);
diff --git a/src/plugins/spam_report/spam_report_prefs.c b/src/plugins/spam_report/spam_report_prefs.c
@@ -30,6 +30,7 @@
#include <gtk/gtk.h>
#include "gtkutils.h"
+#include "password.h"
#include "prefs.h"
#include "prefs_gtk.h"
#include "prefswindow.h"
@@ -114,6 +115,7 @@ static void create_spamreport_prefs_page(PrefsPage *page,
gtk_widget_show(vbox);
for (i = 0; i < INTF_LAST; i++) {
+ gchar *pass;
prefs_page->frame[i] = gtk_frame_new(spam_interfaces[i].name);
gtk_box_pack_start(GTK_BOX(vbox), prefs_page->frame[i], FALSE, FALSE, 6);
@@ -125,8 +127,13 @@ static void create_spamreport_prefs_page(PrefsPage *page,
gtk_entry_set_text(GTK_ENTRY(prefs_page->user_entry[i]),
spamreport_prefs.user[i] ? spamreport_prefs.user[i]:"");
- gtk_entry_set_text(GTK_ENTRY(prefs_page->pass_entry[i]),
- spamreport_prefs.pass[i] ? spamreport_prefs.pass[i]:"");
+
+ pass = password_decrypt(spamreport_prefs.pass[i], NULL);
+ gtk_entry_set_text(GTK_ENTRY(prefs_page->pass_entry[i]), pass ? pass:"");
+ if (pass != NULL) {
+ memset(pass, 0, strlen(pass));
+ }
+ g_free(pass);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(prefs_page->enabled_chkbtn[i]),
spamreport_prefs.enabled[i]);