RSSyl: zero out password variables after migration to password store
[claws.git] / src / plugins / rssyl / rssyl.c
index 9c36d0cfad435e58ebe41efbc45a7233da8dcb77..139f5af0fd06349d9b8941d069f92f831e837c07 100644 (file)
@@ -152,7 +152,7 @@ void rssyl_init(void)
        else
                rssyl_update_format();
 
-       prefs_toolbar_register_plugin_item(TOOLBAR_MAIN, "RSSyl", _("Refresh all feeds"), rssyl_toolbar_cb_refresh_all_feeds, NULL);
+       prefs_toolbar_register_plugin_item(TOOLBAR_MAIN, PLUGIN_NAME, _("Refresh all feeds"), rssyl_toolbar_cb_refresh_all_feeds, NULL);
 
        if( rssyl_prefs_get()->refresh_on_startup &&
                        claws_is_starting() )
@@ -163,7 +163,7 @@ void rssyl_done(void)
 {
        rssyl_opml_export();
 
-       prefs_toolbar_unregister_plugin_item(TOOLBAR_MAIN, "RSSyl", _("Refresh all feeds"));
+       prefs_toolbar_unregister_plugin_item(TOOLBAR_MAIN, PLUGIN_NAME, _("Refresh all feeds"));
 
        rssyl_prefs_done();
        rssyl_gtk_done();
@@ -286,12 +286,14 @@ static void rssyl_item_set_xml(Folder *folder, FolderItem *item, XMLTag *tag)
                        g_free(ritem->auth->username);
                        ritem->auth->username = g_strdup(attr->value);
                }
-               /* (str) Auth pass */
+               /* (str) Auth pass - save directly to password store */
                if (!strcmp(attr->name, "auth_pass")) {
                        gsize len = 0;
                        guchar *pwd = g_base64_decode(attr->value, &len);
-                       g_free(ritem->auth->password);
-                       ritem->auth->password = (gchar *)pwd;
+                       memset(attr->value, 0, strlen(attr->value));
+                       rssyl_passwd_set(ritem, (gchar *)pwd);
+                       memset(pwd, 0, strlen(pwd));
+                       g_free(pwd);
                }
                /* (str) Official title */
                if( !strcmp(attr->name, "official_title")) {
@@ -346,12 +348,6 @@ static XMLTag *rssyl_item_get_xml(Folder *folder, FolderItem *item)
        /* (str) Auth user */
        if (ri->auth->username != NULL)
                xml_tag_add_attr(tag, xml_attr_new("auth_user", ri->auth->username));
-       /* (str) Auth pass */
-       if (ri->auth->password != NULL) {
-               gchar *pwd = g_base64_encode(ri->auth->password, strlen(ri->auth->password));
-               xml_tag_add_attr(tag, xml_attr_new("auth_pass", pwd));
-               g_free(pwd);
-       }
        /* (str) Official title */
        if( ri->official_title != NULL )
                xml_tag_add_attr(tag, xml_attr_new("official_title", ri->official_title));
@@ -530,7 +526,7 @@ static gchar *rssyl_item_get_path(Folder *folder, FolderItem *item)
 
        name = folder_item_get_name(rssyl_get_root_folderitem(item));
        path = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, RSSYL_DIR,
-                       G_DIR_SEPARATOR_S, name, G_DIR_SEPARATOR_S, item->path, NULL);
+                       G_DIR_SEPARATOR_S, name, item->path, NULL);
        g_free(name);
 
        return path;
@@ -945,7 +941,7 @@ FolderClass *rssyl_folder_get_class()
        if( rssyl_class.idstr == NULL ) {
                rssyl_class.type = F_UNKNOWN;
                rssyl_class.idstr = "rssyl";
-               rssyl_class.uistr = "RSSyl";
+               rssyl_class.uistr = PLUGIN_NAME;
 
                /* Folder functions */
                rssyl_class.new_folder = rssyl_new_folder;