X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/55a31c2eec8e219a297ba7fa2f11c3f5108b0fe2..e28d5a554d798965d530d77b8f360e9bb7952e6b:/uip/popsbr.c diff --git a/uip/popsbr.c b/uip/popsbr.c index de9cafbd..f913fce2 100644 --- a/uip/popsbr.c +++ b/uip/popsbr.c @@ -12,7 +12,7 @@ #include #include -#include "../sbr/base64.h" +#include "sbr/base64.h" #define TRM "." @@ -56,23 +56,16 @@ check_mech(char *server_mechs, size_t server_mechs_size) return NOTOK; } - while ((status = multiline()) != DONE) - switch (status) { - case NOTOK: + while ((status = multiline()) != DONE) { + if (status == NOTOK) return NOTOK; - break; - case DONE: /* Shouldn't be possible, but just in case */ - break; - case OK: - if (strncasecmp(response, "SASL ", 5) == 0) { - /* - * We've seen the SASL capability. Grab the mech list - */ - sasl_capability++; - strncpy(server_mechs, response + 5, server_mechs_size); - } - break; - } + + if (strncasecmp(response, "SASL ", 5) == 0) { + /* We've seen the SASL capability. Grab the mech list. */ + sasl_capability++; + strncpy(server_mechs, response + 5, server_mechs_size); + } + } if (!sasl_capability) { snprintf(response, sizeof(response), "POP server does not support " @@ -189,7 +182,7 @@ pop_init (char *host, char *port, char *user, char *proxy, int snoop, close(1); free(*argv); free(argv); - exit(10); + exit(1); } /* okay in the parent we do some stuff */ @@ -277,8 +270,10 @@ pop_init (char *host, char *port, char *user, char *proxy, int snoop, case NOTOK: case DONE: - if (poprint) - fprintf (stderr, "%s\n", response); + if (poprint) { + fputs(response, stderr); + putc('\n', stderr); + } netsec_shutdown(nsc); nsc = NULL; return NOTOK; @@ -599,12 +594,14 @@ vcommand (const char *fmt, va_list ap) case OK: if (poprint) fprintf (stderr, "<--- %s\n", response); - return (*response == '+' ? OK : NOTOK); + return *response == '+' ? OK : NOTOK; case NOTOK: case DONE: - if (poprint) - fprintf (stderr, "%s\n", response); + if (poprint) { + fputs(response, stderr); + putc('\n', stderr); + } return NOTOK; }