Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
pop3.c
Package: shell.rar [view]
Upload User: xhy777
Upload Date: 2007-02-14
Package Size: 24088k
Code Size: 4k
Category:
Windows Kernel
Development Platform:
Visual C++
- /*****************************************************************************
- *
- * pop3.c
- *
- * Copyright (c) 1997 Microsoft Corporation. All Rights Reserved.
- *
- * Abstract:
- *
- * Prepares for and waits for client connections.
- *
- *****************************************************************************/
- #include "msnspa.h"
- #define PROXY_PORT 110 /* I listen to this */
- #define PROXY_DEST 110 /* And talk to this */
- #define PROXY_HOST "pop3.email.msn.com" /* And I talk to him */
- #define PROTOCOL "MSN" /* with this protocol */
- BOOL CALLBACK POP3_Negotiate(SOCKET s);
- /*****************************************************************************
- *
- * PROXYINFO for POP3
- *
- *****************************************************************************/
- #pragma BEGIN_CONST_DATA
- PROXYINFO g_proxyPop = {
- PROXY_PORT, /* localport */
- PROXY_DEST, /* serverport */
- PROXY_HOST, /* remote server */
- &g_cMailUsers, /* Usage counter */
- POP3_Negotiate, /* Negotiation function */
- "-ERR Server inaccessiblern", /* Failed to connect */
- "-ERR Authentication failedrn", /* Password problem */
- "+OK MSN Secure Password Authentication Proxyrn", /* Generic happy */
- "USER", /* First 4-char command to ignore */
- "PASS", /* Second 4-char command to ignore */
- };
- /*****************************************************************************
- *
- * POP3_Negotiate
- *
- * Perform an authenticated MSN logon.
- *
- *****************************************************************************/
- BOOL CALLBACK
- POP3_Negotiate(SOCKET ssfd)
- {
- WIN32AUTHSTATE was;
- char buf[BUFSIZE+1];
- int cb;
- /*
- * Wait for the greeting.
- */
- cb = recv(ssfd, buf, BUFSIZE, 0); /* read a hunk */
- #ifdef CHATTY
- if (cb >= 0) {
- buf[cb] = 0;
- Squirt("<%srn", buf);
- }
- #endif
- if (cb <= 0 || buf[0] != '+') {
- return FALSE;
- }
- /*
- * Tell the server to go into authentication mode.
- */
- sendsz(ssfd, "AUTH " PROTOCOL "rn");
- #ifdef CHATTY
- Squirt(">AUTH " PROTOCOL "rn");
- #endif
- /*
- * Wait for the Proceed.
- */
- cb = recv(ssfd, buf, BUFSIZE, 0); /* read a hunk */
- #ifdef CHATTY
- if (cb >= 0) {
- buf[cb] = 0;
- Squirt("<%srn", buf);
- }
- #endif
- if (cb <= 0 || buf[0] != '+') {
- return FALSE;
- }
- if (!Security_AcquireCredentials(&was, TEXT(PROTOCOL))) {
- Die(TEXT("Cannot acquire credentials handle"));
- }
- if (!Security_GetNegotiation(&was)) {
- Die(TEXT("Cannot get negotiation string"));
- }
- /*
- * Now send the initial cookie.
- */
- sendsz(ssfd, was.szBuffer);
- sendsz(ssfd, "rn");
- #ifdef CHATTY
- Squirt(">%srn", was.szBuffer);
- #endif
- /*
- * Response should be
- *
- * + <challenge>
- */
- cb = recv(ssfd, buf, BUFSIZE, 0);
- if (cb <= 0 || buf[0] != '+') {
- return FALSE;
- }
- #ifdef CHATTY
- buf[cb] = 0;
- Squirt("<%s", buf);
- #endif
- /*
- * Parse the server response and build our response.
- */
- if (!Security_GetResponse(&was, buf + 2)) {
- Die(TEXT("Cannot build response"));
- }
- /*
- * Now send our response.
- */
- sendsz(ssfd, was.szBuffer);
- sendsz(ssfd, "rn");
- #ifdef CHATTY
- Squirt(">%srn", was.szBuffer);
- #endif
- Security_ReleaseCredentials(&was);
- /*
- * Now see how that worked. Response should be
- *
- * + OK
- */
- cb = recv(ssfd, buf, BUFSIZE, 0);
- if (cb <= 0 || buf[0] != '+') {
- return FALSE;
- }
- return TRUE;
- }