* RFC 1869 warns that some listeners hang up on a failed EHLO,
* so it's safest not to assume the socket will still be good.
*/
- close(ctl->smtp_socket);
+ SockClose(ctl->smtp_socket);
ctl->smtp_socket = -1;
/* if opening for ESMTP failed, try SMTP */
SMTP_helo(ctl->smtp_socket, id_me) == SM_OK)
break; /* success */
- close(ctl->smtp_socket);
+ SockClose(ctl->smtp_socket);
ctl->smtp_socket = -1;
}
set_timeout(0);
if (ctl->smtp_socket != -1)
close(ctl->smtp_socket);
if (sock != -1)
- close(sock);
+ SockClose(sock);
if (sinkfp)
pclose(sinkfp);
ok = PS_ERROR;
*/
if (ok == 0)
ok = (fetches > 0) ? PS_SUCCESS : PS_NOMAIL;
- close(sock);
+ SockClose(sock);
goto closeUp;
cleanUp:
if (ok != 0 && ok != PS_SOCKET)
(protocol->logout_cmd)(sock, ctl);
- close(sock);
+ SockClose(sock);
}
msg = (char *)NULL; /* sacrifice to -Wall */
{
imap_version = IMAP4;
if (outlevel == O_VERBOSE)
- error(0, 0, "Protocol identified as IMAP4 rev 0");
+ error(0, 0, "Protocol identified as IMAP4 rev 0");
}
}
else if (ok == PS_ERROR)
peek_capable = (imap_version >= IMAP4);
#if OPIE
- if ((ctl->server.protocol == P_IMAP) && strstr(capabilities, "AUTH=X-OTP")) {
- if (outlevel == O_VERBOSE)
- error(0, 0, "OTP authentication is supported");
- if (do_otp(sock, ctl) == PS_SUCCESS)
- return PS_SUCCESS;
+ if ((ctl->server.protocol == P_IMAP) && strstr(capabilities, "AUTH=X-OTP"))
+ {
+ if (outlevel == O_VERBOSE)
+ error(0, 0, "OTP authentication is supported");
+ if (do_otp(sock, ctl) == PS_SUCCESS)
+ return(PS_SUCCESS);
};
#endif /* OPIE */
return(ch);
}
+int SockClose(int sock)
+/* close a socket (someday we may do other cleanup here) */
+{
+ return(close(sock));
+}
+
#ifdef MAIN
/*
* Use the chargen service to test input beuffering directly.
while (SockRead(sock, buf, sizeof(buf)-1))
SockWrite(1, buf, strlen(buf));
+ SockClose(sock);
}
#endif /* MAIN */
int SockPrintf();
#endif
+/*
+Close a socket previously opened by SockOpen. This allows for some
+additional clean-up if necessary.
+*/
+int SockClose(int sock);
+
#endif /* SOCKET__ */