X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=uip%2Fpopsbr.c;h=6f2b35ade848263a349022c7bf1cbe53a1557491;hb=b28e871ba874a53257b37eed94adfc365ed6ebf2;hp=6b026c6ecf57161d331ff0ba643198ec47c4a0cf;hpb=1691e80890e5d8ba258c51c214a3e91880e1db2b;p=mmh diff --git a/uip/popsbr.c b/uip/popsbr.c index 6b026c6..6f2b35a 100644 --- a/uip/popsbr.c +++ b/uip/popsbr.c @@ -7,6 +7,9 @@ #include +extern int client(char *args, char *protocol, char *service, int rproto, + char *response, int len_response); + #if defined(NNTP) && !defined(PSHSBR) # undef NNTP #endif @@ -22,12 +25,11 @@ #include #include #include +#include #define TRM "." #define TRMLEN (sizeof TRM - 1) -extern int errno; - static int poprint = 0; static int pophack = 0; @@ -87,7 +89,7 @@ pop_auth (char *user, char *pass) return NULL; } - *++lp = NULL; + *(++lp) = '\0'; snprintf (buffer, sizeof(buffer), "%s%s", cp, pass); MD5Init (&mdContext); @@ -108,7 +110,7 @@ pop_auth (char *user, char *pass) cp += 2; buflen -= 2; } - *cp = NULL; + *cp = '\0'; return buffer; } @@ -116,7 +118,7 @@ pop_auth (char *user, char *pass) int -pop_init (char *host, char *user, char *pass, int snoop, int rpop) +pop_init (char *host, char *user, char *pass, int snoop, int rpop, int kpop) { int fd1, fd2; char buffer[BUFSIZ]; @@ -129,16 +131,24 @@ pop_init (char *host, char *user, char *pass, int snoop, int rpop) #endif #ifndef NNTP -# ifndef KPOP - if ((fd1 = client (host, "tcp", POPSERVICE, rpop, response, sizeof(response))) == NOTOK) -# else /* KPOP */ - snprintf (buffer, sizeof(buffer), "%s/%s", KPOP_PRINCIPAL, POPSERVICE); - if ((fd1 = client (host, "tcp", buffer, rpop, response, sizeof(response))) == NOTOK) -# endif +# ifdef KPOP + if ( kpop ) { + snprintf (buffer, sizeof(buffer), "%s/%s", KPOP_PRINCIPAL, "kpop"); + if ((fd1 = client (host, "tcp", buffer, 0, response, sizeof(response))) == NOTOK) { + return NOTOK; + } + } else { +# endif /* KPOP */ + if ((fd1 = client (host, "tcp", POPSERVICE, rpop, response, sizeof(response))) == NOTOK) { + return NOTOK; + } +# ifdef KPOP + } +# endif /* KPOP */ #else /* NNTP */ if ((fd1 = client (host, "tcp", "nntp", rpop, response, sizeof(response))) == NOTOK) -#endif return NOTOK; +#endif if ((fd2 = dup (fd1)) == NOTOK) { char *s; @@ -570,7 +580,7 @@ vcommand (const char *fmt, va_list ap) char *cp, buffer[BUFSIZ]; vsnprintf (buffer, sizeof(buffer), fmt, ap); - if (poprint) + if (poprint) { if (pophack) { if ((cp = strchr (buffer, ' '))) *cp = 0; @@ -581,6 +591,7 @@ vcommand (const char *fmt, va_list ap) } else fprintf (stderr, "---> %s\n", buffer); + } if (putline (buffer, output) == NOTOK) return NOTOK;