#define DOTLINE(s) (s[0] == '.' && (s[1]=='\r'||s[1]=='\n'||s[1]=='\0'))
-int pop3_ok (int sock, char *argbuf)
+static int pop3_ok (int sock, char *argbuf)
/* parse command response */
{
int ok;
char *bufp;
if ((ok = gen_recv(sock, buf, sizeof(buf))) == 0)
- {
- bufp = buf;
+ { bufp = buf;
if (*bufp == '+' || *bufp == '-')
bufp++;
else
/* these are blessed by RFC 2449 */
|| strstr(bufp,"[IN-USE]")||strstr(bufp,"[LOGIN-DELAY]"))
ok = PS_LOCKBUSY;
+ else if ((strstr(bufp,"Service")
+ || strstr(bufp,"service"))
+ && (strstr(bufp,"unavailable")))
+ ok = PS_SERVBUSY;
else
ok = PS_AUTHFAIL;
/*
return(ok);
}
-int pop3_getauth(int sock, struct query *ctl, char *greeting)
+static int pop3_getauth(int sock, struct query *ctl, char *greeting)
/* apply for connection authorization */
{
int ok;
#endif /* defined(KERBEROS_V4) || defined(KERBEROS_V5) */
flag has_cram = FALSE;
#ifdef OPIE_ENABLE
- flag has_opie = FALSE;
+ flag has_otp = FALSE;
#endif /* OPIE_ENABLE */
char buffer[64];
if (has_cram)
ctl->server.authenticate = A_CRAM_MD5;
#ifdef OPIE_ENABLE
- if (has_opie)
+ if (has_otp)
ctl->server.authenticate = A_OTP;
#endif /* OPIE_ENABLE */
#if defined(GSSAPI)
* OK, we have an authentication type now.
*/
#if defined(KERBEROS_V4) || defined(KERBEROS_V5)
- if (ctl->server.authenticate == A_KERBEROS_V4
- || ctl->server.authenticate == A_KERBEROS_V5)
+ /*
+ * Servers doing KPOP have to go through a dummy login sequence
+ * rather than doing SASL.
+ */
+ if (
+#if INET6_ENABLE
+ ctl->server.service && (strcmp(ctl->server.service, KPOP_PORT)!=0)
+#else /* INET6_ENABLE */
+ ctl->server.port != KPOP_PORT
+#endif /* INET6_ENABLE */
+ && (ctl->server.authenticate == A_KERBEROS_V4
+ || ctl->server.authenticate == A_KERBEROS_V5))
return(do_rfc1731(sock, "AUTH", ctl->server.truename));
#endif /* defined(KERBEROS_V4) || defined(KERBEROS_V5) */
#if defined(GSSAPI)
- if (ctl->server.authenticate==A_GSSAPI))
+ if (ctl->server.authenticate==A_GSSAPI)
return(do_gssauth(sock, "AUTH",
ctl->server.truename, ctl->remotename));
#endif /* defined(GSSAPI) */
#ifdef OPIE_ENABLE
if (ctl->server.authenticate == A_OTP)
- do_otp(sock, "AUTH", ctl)
+ do_otp(sock, "AUTH", ctl);
#endif /* OPIE_ENABLE */
if (ctl->server.authenticate == A_CRAM_MD5)
return(do_cram_md5(sock, "AUTH", ctl));
/* ordinary validation, no one-time password or RPA */
gen_transact(sock, "USER %s", ctl->remotename);
+ strcpy(shroud, ctl->password);
ok = gen_transact(sock, "PASS %s", ctl->password);
+ shroud[0] = '\0';
break;
case P_APOP:
return(PS_SUCCESS);
}
-static int
-pop3_gettopid( int sock, int num , char *id)
+static int pop3_gettopid( int sock, int num , char *id)
{
int ok;
int got_it;
return 0;
}
-static int
-pop3_slowuidl( int sock, struct query *ctl, int *countp, int *newp)
+static int pop3_slowuidl( int sock, struct query *ctl, int *countp, int *newp)
{
/* This approach tries to get the message headers from the
* remote hosts and compares the message-id to the already known
FALSE, /* this is not a tagged protocol */
TRUE, /* this uses a message delimiter */
pop3_ok, /* parse command response */
- NULL, /* no password canonicalization */
pop3_getauth, /* get authorization */
pop3_getrange, /* query range of messages */
pop3_getsizes, /* we can get a list of sizes */