[Goodies-commits] r5326 - in xfce4-mailwatch-plugin/trunk: . libmailwatch-core
Brian Tarricone
kelnos at xfce.org
Sat Aug 30 11:07:43 CEST 2008
Author: kelnos
Date: 2008-08-30 09:07:43 +0000 (Sat, 30 Aug 2008)
New Revision: 5326
Modified:
xfce4-mailwatch-plugin/trunk/NEWS
xfce4-mailwatch-plugin/trunk/libmailwatch-core/mailwatch-mailbox-imap.c
xfce4-mailwatch-plugin/trunk/libmailwatch-core/mailwatch-mailbox-pop3.c
xfce4-mailwatch-plugin/trunk/libmailwatch-core/mailwatch-net-conn.c
Log:
put useful msg about auth failure in the log (bug 4344)
Modified: xfce4-mailwatch-plugin/trunk/NEWS
===================================================================
--- xfce4-mailwatch-plugin/trunk/NEWS 2008-08-30 08:44:59 UTC (rev 5325)
+++ xfce4-mailwatch-plugin/trunk/NEWS 2008-08-30 09:07:43 UTC (rev 5326)
@@ -15,6 +15,8 @@
* Fix problems receiving full commands on IMAP accounts (bug 2416).
* Fix problems receiving full commands on POP3 accounts (bug 2013).
* Fix removed new-mail folders sometimes re-adding themselves (bug 2647).
+ * Display message in log about possible incorrect username/password
+ when IMAP or POP3 authentication fails (bug 4344).
Features:
* Update the new message counts for all mailboxes on startup, rather than
Modified: xfce4-mailwatch-plugin/trunk/libmailwatch-core/mailwatch-mailbox-imap.c
===================================================================
--- xfce4-mailwatch-plugin/trunk/libmailwatch-core/mailwatch-mailbox-imap.c 2008-08-30 08:44:59 UTC (rev 5325)
+++ xfce4-mailwatch-plugin/trunk/libmailwatch-core/mailwatch-mailbox-imap.c 2008-08-30 09:07:43 UTC (rev 5326)
@@ -229,6 +229,9 @@
gssize bin, tot = 0;
gchar *p;
+ if(len)
+ *buf = 0;
+
while(len - tot > 0) {
DBG("trying to get line");
bin = imap_recv(imailbox, net_conn, buf+tot, len-tot);
@@ -322,8 +325,21 @@
bin = imap_recv_command(imailbox, net_conn, buf, BUFSIZE);
DBG("reponse from cram-md5 resp (%d): %s\n", bin, bin>0?buf:"(nada)");
- if(bin <= 0)
+ if(bin <= 0) {
+ if(bin < 0) {
+ gchar tmp[16];
+ g_snprintf(tmp, sizeof(tmp), "%05d NO",
+ imailbox->imap_tag - 1);
+ if(strstr(buf, tmp)) {
+ xfce_mailwatch_log_message(imailbox->mailwatch,
+ XFCE_MAILWATCH_MAILBOX(imailbox),
+ XFCE_MAILWATCH_LOG_ERROR,
+ _("Authentication failed. Perhaps your username or password is incorrect?"));
+ }
+ }
+
goto cleanuperr;
+ }
/* auth successful */
TRACE("leaving (success)");
@@ -343,8 +359,19 @@
/* and see if we actually got auth-ed */
bin = imap_recv_command(imailbox, net_conn, buf, BUFSIZE);
DBG("response from login (%d): %s", bin, bin>0?buf:"(nada)");
- if(bin <= 0)
+ if(bin <= 0) {
+ if(bin < 0) {
+ gchar tmp[16];
+ g_snprintf(tmp, sizeof(tmp), "%05d NO", imailbox->imap_tag - 1);
+ if(strstr(buf, tmp)) {
+ xfce_mailwatch_log_message(imailbox->mailwatch,
+ XFCE_MAILWATCH_MAILBOX(imailbox),
+ XFCE_MAILWATCH_LOG_ERROR,
+ _("Authentication failed. Perhaps your username or password is incorrect?"));
+ }
+ }
goto cleanuperr;
+ }
TRACE("leaving (success)");
Modified: xfce4-mailwatch-plugin/trunk/libmailwatch-core/mailwatch-mailbox-pop3.c
===================================================================
--- xfce4-mailwatch-plugin/trunk/libmailwatch-core/mailwatch-mailbox-pop3.c 2008-08-30 08:44:59 UTC (rev 5325)
+++ xfce4-mailwatch-plugin/trunk/libmailwatch-core/mailwatch-mailbox-pop3.c 2008-08-30 09:07:43 UTC (rev 5326)
@@ -144,6 +144,9 @@
gssize bin, tot = 0;
gboolean got_ok = FALSE;
+ if(len)
+ *buf = 0;
+
while(len - tot > 0) {
DBG("trying to get line");
bin = pop3_recv(pmailbox, buf+tot, len-tot);
@@ -230,8 +233,17 @@
return FALSE;
bin = pop3_recv_command(pmailbox, buf, BUFSIZE, FALSE);
- if(bin <= 0)
+ if(bin <= 0) {
+ if(bin < 0) {
+ if(strstr(buf, "-ERR")) {
+ xfce_mailwatch_log_message(pmailbox->mailwatch,
+ XFCE_MAILWATCH_MAILBOX(pmailbox),
+ XFCE_MAILWATCH_LOG_ERROR,
+ _("Authentication failed. Perhaps your username or password is incorrect?"));
+ }
+ }
return FALSE;
+ }
TRACE("leaving (success)");
@@ -262,9 +274,18 @@
/* check for OK response */
bin = pop3_recv_command(pmailbox, buf, BUFSIZE, FALSE);
- DBG("response from USER (%d): %s", bin, bin>0?buf:"(nada)");
- if(bin <= 0)
+ DBG("response from PASS (%d): %s", bin, bin>0?buf:"(nada)");
+ if(bin <= 0) {
+ if(bin < 0) {
+ if(strstr(buf, "-ERR")) {
+ xfce_mailwatch_log_message(pmailbox->mailwatch,
+ XFCE_MAILWATCH_MAILBOX(pmailbox),
+ XFCE_MAILWATCH_LOG_ERROR,
+ _("Authentication failed. Perhaps your username or password is incorrect?"));
+ }
+ }
return FALSE;
+ }
TRACE("leaving (success)");
Modified: xfce4-mailwatch-plugin/trunk/libmailwatch-core/mailwatch-net-conn.c
===================================================================
--- xfce4-mailwatch-plugin/trunk/libmailwatch-core/mailwatch-net-conn.c 2008-08-30 08:44:59 UTC (rev 5325)
+++ xfce4-mailwatch-plugin/trunk/libmailwatch-core/mailwatch-net-conn.c 2008-08-30 09:07:43 UTC (rev 5326)
@@ -528,7 +528,7 @@
if(fcntl(net_conn->fd, F_SETFL,
fcntl(net_conn->fd, F_GETFL) | O_NONBLOCK))
{
- g_warning(_("Unable to set socket to non-blocking mode. Things may not work properly from here on out."));
+ g_warning("Unable to set socket to non-blocking mode. Things may not work properly from here on out.");
}
switch(xfce_mailwatch_net_conn_do_connect(net_conn, ai->ai_addr,
@@ -560,7 +560,7 @@
if(fcntl(net_conn->fd, F_SETFL,
fcntl(net_conn->fd, F_GETFL) & ~(O_NONBLOCK)))
{
- g_warning(_("Unable to return socket to blocking mode. Data may not be retreived correctly."));
+ g_warning("Unable to return socket to blocking mode. Data may not be retreived correctly.");
}
#endif
freeaddrinfo(addresses);
More information about the Goodies-commits
mailing list