*** protocol.c Wed Jan 24 21:53:10 2001 --- protocol.c.new Fri Jun 29 19:12:38 2001 *************** *** 37,42 **** --- 37,44 ---- static int smb_server(int, int); static int smtp_client(int, int); static int smtp_server(int, int); + static int pop3_client(int, int); + static int pop3_server(int, int); static int telnet_client(int, int); static int telnet_server(int, int); static int RFC2487(int); *************** *** 63,68 **** --- 65,76 ---- else return smtp_server(local, remote); } + if(!strcmp(protocol, "pop3")) { + if(client) + return pop3_client(local, remote); + else + return pop3_server(local, remote); + } if(!strcmp(protocol, "telnet")) { if(client) return telnet_client(local, remote); *************** *** 122,127 **** --- 130,162 ---- return 0; } + static int pop3_client(int local, int remote) + { + char line[STRLEN]; + + fdscanf(remote, "%[^\r]", line); + if(strncmp(line,"+OK ",4)) { + log(LOG_ERR, "Unknown server welcome"); + return -1; + } + if(fdprintf(local, line)<0) + return -1; + if(fdprintf(remote, "STLS")<0) + return -1; + fdscanf(remote, "%[^\r]", line); + if(strncmp(line,"+OK ",4)) { + log(LOG_ERR, "Server does not support TLS"); + return -1; + } + return 0; + } + + static int pop3_server(int local, int remote) + { + log(LOG_ERR, "Protocol not supported in server mode"); + return -1; + } + static int telnet_client(int local, int remote) { log(LOG_ERR, "Protocol not supported");