X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=uip%2Fpopsbr.c;h=d1bbafcfde0feeae7d2985a5d3f34dd09db0d5d5;hp=aa396fd23844bb060d987f062ab744c805231c99;hb=81a21a9a97d8633f6d6231e31fdb6e328d0d3ff2;hpb=99e5043db7ee6cf80f93708610a6e584a8068c6a diff --git a/uip/popsbr.c b/uip/popsbr.c index aa396fd..d1bbafc 100644 --- a/uip/popsbr.c +++ b/uip/popsbr.c @@ -9,6 +9,7 @@ */ #include +#include extern int client(char *args, char *protocol, char *service, int rproto, char *response, int len_response); @@ -26,8 +27,8 @@ extern int client(char *args, char *protocol, char *service, int rproto, #endif #ifdef CYRUS_SASL -# include -# include +# include +# include #endif /* CYRUS_SASL */ #include @@ -432,10 +433,7 @@ sasl_get_pass(sasl_conn_t *conn, void *context, int id, sasl_secret_t **psecret) len = strlen(pass); - *psecret = (sasl_secret_t *) malloc(sizeof(sasl_secret_t) + len); - - if (! *psecret) - return SASL_NOMEM; + *psecret = (sasl_secret_t *) mh_xmalloc(sizeof(sasl_secret_t) + len); (*psecret)->len = len; strcpy((char *) (*psecret)->data, pass); @@ -476,8 +474,8 @@ parse_proxy(char *proxy, char *host) } /* put together list of arguments */ - p = pargv = malloc(pargc * sizeof(char *)); - c = *pargv = malloc(plen * sizeof(char)); + p = pargv = mh_xmalloc(pargc * sizeof(char *)); + c = *pargv = mh_xmalloc(plen * sizeof(char)); for (cur = pro; *cur; cur++) { if (isspace(*cur) && cur[1] && !isspace(cur[1])) { *c++ = '\0'; @@ -500,6 +498,13 @@ pop_init (char *host, char *user, char *pass, char *proxy, int snoop, int fd1, fd2; char buffer[BUFSIZ]; +#ifdef APOP + int apop; + + if ((apop = rpop) < 0) + rpop = 0; +#endif + if (proxy && *proxy) { int pid; int inpipe[2]; /* for reading from the server */ @@ -549,28 +554,22 @@ pop_init (char *host, char *user, char *pass, char *proxy, int snoop, } else { -#ifdef APOP - int apop; - - if ((apop = rpop) < 0) - rpop = 0; -#endif - #ifndef NNTP -# ifdef KPOP if ( kpop ) { +# ifdef KPOP snprintf (buffer, sizeof(buffer), "%s/%s", KPOP_PRINCIPAL, "kpop"); if ((fd1 = client (host, "tcp", buffer, 0, response, sizeof(response))) == NOTOK) { return NOTOK; } - } else { +# else /* KPOP */ + snprintf (response, sizeof(response), "this version of nmh compiled without KPOP support"); + return NOTOK; # endif /* KPOP */ + } else { 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) return NOTOK;