#include "account.h"
#include "tags.h"
#include "main.h"
+#include "password.h"
typedef struct _IMAPFolder IMAPFolder;
typedef struct _IMAPSession IMAPSession;
Xstrdup_a(acc_pass, pass, {g_free(pass); return MAILIMAP_NO_ERROR;});
g_free(pass);
} else {
- acc_pass = account->passwd;
+ acc_pass = password_decrypt(account->passwd, NULL);
}
try_again:
pass = acc_pass;
tmp_pass = input_dialog_query_password_keep(account->recv_server,
account->userid,
&(account->session_passwd));
- if (!tmp_pass)
+ if (!tmp_pass) {
return MAILIMAP_NO_ERROR;
+ }
Xstrdup_a(pass, tmp_pass, {g_free(tmp_pass); return MAILIMAP_NO_ERROR;});
g_free(tmp_pass);
} else if (account->imap_auth_type == IMAP_AUTH_ANON || account->imap_auth_type == IMAP_AUTH_GSSAPI) {
if ((ok = imap_auth(session, account->userid, pass, account->imap_auth_type)) != MAILIMAP_NO_ERROR) {
if (!failed && !is_fatal(ok)) {
- acc_pass = NULL;
+ if (acc_pass != NULL) {
+ memset(acc_pass, 0, strlen(acc_pass));
+ g_free(acc_pass);
+ acc_pass = NULL;
+ }
failed = TRUE;
if (account->session_passwd != NULL) {
g_free(account->session_passwd);
mainwindow_show_error();
} else
alertpanel_error_log(_("Couldn't login to IMAP server %s."), account->recv_server);
- }
+ }
+
+ if (acc_pass != NULL) {
+ g_free(acc_pass);
+ memset(acc_pass, 0, strlen(acc_pass));
+ }
return ok;
}
+ if (acc_pass) {
+ memset(acc_pass, 0, strlen(acc_pass));
+ g_free(acc_pass);
+ }
statuswindow_pop_all();
session->authenticated = TRUE;
return MAILIMAP_NO_ERROR;
have_size, cached->size);
procmsg_msginfo_set_flags(cached, MSG_FULLY_CACHED, 0);
}
- procmsg_msginfo_free(cached);
+ procmsg_msginfo_free(&cached);
return filename;
} else if (!cached && time(NULL) - get_file_mtime(filename) < 60) {
debug_print("message not cached and file recent, considering file complete\n");
if (ok == 0)
return filename;
} else {
- procmsg_msginfo_free(cached);
+ procmsg_msginfo_free(&cached);
}
}
if (cached && MSG_IS_FULLY_CACHED(cached->flags)) {
- procmsg_msginfo_free(cached);
+ procmsg_msginfo_free(&cached);
return filename;
}
} else {
MsgInfo *cached = msgcache_get_msg(item->cache,uid);
if (cached) {
procmsg_msginfo_unset_flags(cached, MSG_FULLY_CACHED, 0);
- procmsg_msginfo_free(cached);
+ procmsg_msginfo_free(&cached);
}
}
MsgInfo *cached = msgcache_get_msg(item->cache,uid);
if (cached) {
procmsg_msginfo_set_flags(cached, MSG_FULLY_CACHED, 0);
- procmsg_msginfo_free(cached);
+ procmsg_msginfo_free(&cached);
}
} else if (ok == -1) {
MsgInfo *cached = msgcache_get_msg(item->cache,uid);
if (cached) {
procmsg_msginfo_unset_flags(cached, MSG_FULLY_CACHED, 0);
- procmsg_msginfo_free(cached);
+ procmsg_msginfo_free(&cached);
}
}
return filename;
return FALSE;
if (MSG_IS_FULLY_CACHED(cached->flags)) {
- procmsg_msginfo_free(cached);
+ procmsg_msginfo_free(&cached);
return TRUE;
}
if (cached && size >= cached->size) {
cached->total_size = cached->size;
procmsg_msginfo_set_flags(cached, MSG_FULLY_CACHED, 0);
- procmsg_msginfo_free(cached);
+ procmsg_msginfo_free(&cached);
return TRUE;
}
if (cached)
- procmsg_msginfo_free(cached);
+ procmsg_msginfo_free(&cached);
return FALSE;
}
return NULL;
ret = g_malloc(3*strlen(str)+1);
o_ret = ret;
- for (i = str; *i; i++) {
+ for (i = (gchar *)str; *i; i++) {
switch(*i) {
case ':':
case '|':
g_free(real_oldpath);
return -1;
}
- if (strchr(item->path, G_DIR_SEPARATOR)) {
+ if (strchr(item->path, '/')) {
dirpath = g_path_get_dirname(item->path);
- newpath = g_strconcat(dirpath, G_DIR_SEPARATOR_S, name, NULL);
+ newpath = g_strconcat(dirpath, "/", name, NULL);
g_free(dirpath);
} else
newpath = g_strdup(name);
}
base = item->path + oldpathlen;
- while (*base == G_DIR_SEPARATOR) base++;
+ while (*base == '/') base++;
if (*base == '\0')
new_itempath = g_strdup(newpath);
else
- new_itempath = g_strconcat(newpath, G_DIR_SEPARATOR_S, base,
+ new_itempath = g_strconcat(newpath, "/", base,
NULL);
real_oldpath = imap_get_real_path(session, IMAP_FOLDER(item->folder), item->path, &ok);
if (FOLDER_ITEM(item)->path)
statusbar_print_all(_("Scanning folder %s%c%s..."),
FOLDER_ITEM(item)->folder->name,
- G_DIR_SEPARATOR,
+ '/',
FOLDER_ITEM(item)->path);
else
statusbar_print_all(_("Scanning folder %s..."),
data->full_search = TRUE;
for (cur = tmp; cur; cur = cur->next)
- procmsg_msginfo_free((MsgInfo *)cur->data);
+ procmsg_msginfo_free((MsgInfo **)&(cur->data));
g_slist_free(tmp);