X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/75a98caa3dddfc3276b9506d04a82014bd732e74..c02f66668d32980a3770e450061c5b96b9f31690:/uip/popsbr.c diff --git a/uip/popsbr.c b/uip/popsbr.c index 8d2cf9d7..fefd4954 100644 --- a/uip/popsbr.c +++ b/uip/popsbr.c @@ -15,7 +15,6 @@ #include #define TRM "." -#define TRMLEN (sizeof TRM - 1) static int poprint = 0; @@ -145,6 +144,8 @@ pop_init (char *host, char *port, char *user, char *proxy, int snoop, if (user) netsec_set_userid(nsc, user); + netsec_set_hostname(nsc, host); + if (oauth_svc != NULL) { if (netsec_set_oauth_service(nsc, oauth_svc) != OK) { snprintf(response, sizeof(response), "OAuth2 not supported"); @@ -212,8 +213,8 @@ pop_init (char *host, char *port, char *user, char *proxy, int snoop, netsec_set_fd(nsc, fd1, fd2); netsec_set_snoop(nsc, snoop); - if (tls) { - if (netsec_set_tls(nsc, 1, &errstr) != OK) { + if (tls & P_INITTLS) { + if (netsec_set_tls(nsc, 1, tls & P_NOVERIFY, &errstr) != OK) { snprintf(response, sizeof(response), "%s", errstr); free(errstr); return NOTOK; @@ -227,8 +228,8 @@ pop_init (char *host, char *port, char *user, char *proxy, int snoop, } if (sasl) { - if (netsec_set_sasl_params(nsc, host, "pop", mech, - pop_sasl_callback, &errstr) != OK) { + if (netsec_set_sasl_params(nsc, "pop", mech, pop_sasl_callback, + &errstr) != OK) { snprintf(response, sizeof(response), "%s", errstr); free(errstr); return NOTOK; @@ -686,14 +687,14 @@ vcommand (const char *fmt, va_list ap) int multiline (void) { - char buffer[BUFSIZ + TRMLEN]; + char buffer[BUFSIZ + LEN(TRM)]; if (pop_getline (buffer, sizeof buffer, nsc) != OK) return NOTOK; if (HasPrefix(buffer, TRM)) { - if (buffer[TRMLEN] == 0) + if (buffer[LEN(TRM)] == 0) return DONE; - strncpy (response, buffer + TRMLEN, sizeof(response)); + strncpy (response, buffer + LEN(TRM), sizeof(response)); } else strncpy (response, buffer, sizeof(response));