亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? ftp.c

?? ReactOS是一些高手根據Windows XP的內核編寫出的類XP。內核實現機理和API函數調用幾乎相同。甚至可以兼容XP的程序。喜歡研究系統內核的人可以看一看。
?? C
?? 第 1 頁 / 共 3 頁
字號:
/* ftp.c
 *
 * Copyright (c) 1996-2001 Mike Gleason, NCEMRSoft.
 * All rights reserved.
 *
 */

#define _libncftp_ftp_c_
#include "syshdrs.h"

char gLibNcFTPVersion[64] = kLibraryVersion;

#ifdef NO_SIGNALS
static char gNoSignalsMarker[] = "@(#) LibNcFTP - NO_SIGNALS";
#else

static int gGotSig = 0;
#ifdef HAVE_SIGSETJMP
static sigjmp_buf gCancelConnectJmp;
#else
static jmp_buf gCancelConnectJmp;
#endif	/* HAVE_SIGSETJMP */

#endif	/* NO_SIGNALS */


#ifndef lint
static char gCopyright[] = "@(#) LibNcFTP Copyright 1995-2000, by Mike Gleason.  All rights reserved.";
#endif

#ifdef HAVE_LIBSOCKS5
#	define SOCKS 5
#	include <socks.h>
#else
#	ifdef HAVE_LIBSOCKS
#		define accept		Raccept
#		define connect		Rconnect
#		define getsockname	Rgetsockname
#		define listen		Rlisten
#	endif
#endif




/* On entry, you should have 'host' be set to a symbolic name (like
 * cse.unl.edu), or set to a numeric address (like 129.93.3.1).
 * If the function fails, it will return NULL, but if the host was
 * a numeric style address, you'll have the ip_address to fall back on.
 */

static struct hostent *
GetHostEntry(char *host, struct in_addr *ip_address)
{
	struct in_addr ip;
	struct hostent *hp;

	/* See if the host was given in the dotted IP format, like "36.44.0.2."
	 * If it was, inet_addr will convert that to a 32-bit binary value;
	 * it not, inet_addr will return (-1L).
	 */
	ip.s_addr = inet_addr(host);
	if (ip.s_addr != INADDR_NONE) {
		hp = NULL;
	} else {
		/* No IP address, so it must be a hostname, like ftp.wustl.edu. */
		hp = gethostbyname(host);
		if (hp != NULL)
			(void) memcpy(&ip.s_addr, hp->h_addr_list[0], (size_t) hp->h_length);
	}
	if (ip_address != NULL)
		*ip_address = ip;
	return (hp);
}	/* GetHostEntry */




/* Makes every effort to return a fully qualified domain name. */
int
GetOurHostName(char *host, size_t siz)
{
#ifdef HOSTNAME
	/* You can hardcode in the name if this routine doesn't work
	 * the way you want it to.
	 */
	Strncpy(host, HOSTNAME, siz);
	return (1);		/* Success */
#else
	struct hostent *hp;
	int result;
	char **curAlias;
	char domain[64];
	char *cp;
	int rc;

	host[0] = '\0';
	result = gethostname(host, (int) siz);
	if ((result < 0) || (host[0] == '\0')) {
		return (-1);
	}

	if (strchr(host, '.') != NULL) {
		/* gethostname returned full name (like "cse.unl.edu"), instead
		 * of just the node name (like "cse").
		 */
		return (2);		/* Success */
	}

	hp = gethostbyname(host);
	if (hp != NULL) {
		/* Maybe the host entry has the full name. */
		cp = strchr((char *) hp->h_name, '.');
		if ((cp != NULL) && (cp[1] != '\0')) {
			/* The 'name' field for the host entry had full name. */
			(void) Strncpy(host, (char *) hp->h_name, siz);
			return (3);		/* Success */
		}

		/* Now try the list of aliases, to see if any of those look real. */
		for (curAlias = hp->h_aliases; *curAlias != NULL; curAlias++) {
			cp = strchr(*curAlias, '.');
			if ((cp != NULL) && (cp[1] != '\0')) {
				(void) Strncpy(host, *curAlias, siz);
				return (4);		/* Success */
			}
		}
	}

	/* Otherwise, we just have the node name.  See if we can get the
	 * domain name ourselves.
	 */
#ifdef DOMAINNAME
	(void) STRNCPY(domain, DOMAINNAME);
	rc = 5;
#else
	rc = -1;
	domain[0] = '\0';
#	if defined(HAVE_RES_INIT) && defined(HAVE__RES_DEFDNAME)
	if (domain[0] == '\0') {
		(void) res_init();
		if ((_res.defdname != NULL) && (_res.defdname[0] != '\0')) {
			(void) STRNCPY(domain, _res.defdname);
			rc = 6;
		}
	}
#	endif	/* HAVE_RES_INIT && HAVE__RES_DEFDNAME */

	if (domain[0] == '\0') {
		FILE *fp;
		char line[256];
		char *tok;

		fp = fopen("/etc/resolv.conf", "r");
		if (fp != NULL) {
			(void) memset(line, 0, sizeof(line));
			while (fgets(line, sizeof(line) - 1, fp) != NULL) {
				if (!isalpha((int) line[0]))
					continue;	/* Skip comment lines. */
				tok = strtok(line, " \t\n\r");
				if (tok == NULL)
					continue;	/* Impossible */
				if (strcmp(tok, "domain") == 0) {
					tok = strtok(NULL, " \t\n\r");
					if (tok == NULL)
						continue;	/* syntax error */
					(void) STRNCPY(domain, tok);
					rc = 7;
					break;	/* Done. */
				}
			}
			(void) fclose(fp);
		}
	}
#endif	/* DOMAINNAME */

	if (domain[0] != '\0') {
		/* Supposedly, it's legal for a domain name with
		 * a period at the end.
		 */
		cp = domain + strlen(domain) - 1;
		if (*cp == '.')
			*cp = '\0';
		if (domain[0] != '.')
			(void) Strncat(host, ".", siz);
		(void) Strncat(host, domain, siz);
	}
	if (rc < 0)
		host[0] = '\0';
	return(rc);	/* Success */
#endif	/* !HOSTNAME */
}	/* GetOurHostName */



void
CloseControlConnection(const FTPCIPtr cip)
{
	/* This will close each file, if it was open. */
#ifdef NO_SIGNALS
	SClose(cip->ctrlSocketR, 3);
	cip->ctrlSocketR = kClosedFileDescriptor;
	cip->ctrlSocketW = kClosedFileDescriptor;
	DisposeSReadlineInfo(&cip->ctrlSrl);
#else	/* NO_SIGNALS */
	if (cip->ctrlTimeout > 0)
		(void) alarm(cip->ctrlTimeout);
	CloseFile(&cip->cin);
	CloseFile(&cip->cout);
	cip->ctrlSocketR = kClosedFileDescriptor;
	cip->ctrlSocketW = kClosedFileDescriptor;
	if (cip->ctrlTimeout > 0)
		(void) alarm(0);
#endif	/* NO_SIGNALS */
	cip->connected = 0;
	cip->loggedIn = 0;
}	/* CloseControlConnection */



static int
GetSocketAddress(const FTPCIPtr cip, int sockfd, struct sockaddr_in *saddr)
{
	int len = (int) sizeof (struct sockaddr_in);
	int result = 0;

	if (getsockname(sockfd, (struct sockaddr *)saddr, &len) < 0) {
		Error(cip, kDoPerror, "Could not get socket name.\n");
		cip->errNo = kErrGetSockName;
		result = kErrGetSockName;
	}
	return (result);
}	/* GetSocketAddress */




int
SetKeepAlive(const FTPCIPtr cip, int sockfd)
{
#ifndef SO_KEEPALIVE
	cip->errNo = kErrSetKeepAlive;
	return (kErrSetKeepAlive);
#else
	int opt;

	opt = 1;

	if (setsockopt(sockfd, SOL_SOCKET, SO_KEEPALIVE, (char *) &opt, (int) sizeof(opt)) < 0) {
		/* Error(cip, kDoPerror, "Could not set keep-alive mode.\n"); */
		cip->errNo = kErrSetKeepAlive;
		return (kErrSetKeepAlive);
	}
	return (kNoErr);
#endif	/* SO_KEEPALIVE */
}	/* SetKeepAlive */




int
SetLinger(const FTPCIPtr cip, int sockfd, int onoff)
{
#ifndef SO_LINGER
	cip->errNo = kErrSetLinger;
	return (kErrSetLinger);
#else
	struct linger li;

	if (onoff != 0) {
		li.l_onoff = 1;
		li.l_linger = 120;	/* 2 minutes, but system ignores field. */
	} else {
		li.l_onoff = 0;
		li.l_linger = 0;
	}
	/* Have the system make an effort to deliver any unsent data,
	 * even after we close the connection.
	 */
	if (setsockopt(sockfd, SOL_SOCKET, SO_LINGER, (char *) &li, (int) sizeof(li)) < 0) {
		/* Error(cip, kDoPerror, "Could not set linger mode.\n"); */
		cip->errNo = kErrSetLinger;
		return (kErrSetLinger);
	}
	return (kNoErr);
#endif	/* SO_LINGER */
}	/* SetLinger */




#ifdef IP_TOS
int
SetTypeOfService(const FTPCIPtr cip, int sockfd, int tosType)
{
	/* Specify to the router what type of connection this is, so it
	 * can prioritize packets.
	 */
	if (setsockopt(sockfd, IPPROTO_IP, IP_TOS, (char *) &tosType, (int) sizeof(tosType)) < 0) {
		/* Error(cip, kDoPerror, "Could not set type of service.\n"); */
		cip->errNo = kErrSetTypeOfService;
		return (kErrSetTypeOfService);
	}
	return (kNoErr);
}	/* SetTypeOfService */
#endif	/* IP_TOS */




#ifdef SO_OOBINLINE
int
SetInlineOutOfBandData(const FTPCIPtr cip, int sockfd)
{
	int on = 1;

	if (setsockopt(sockfd, SOL_SOCKET, SO_OOBINLINE, (char *) &on, (int) sizeof(on)) < 0) {
		Error(cip, kDoPerror, "Could not set out of band inline mode.\n");
		cip->errNo = kErrSetOutOfBandInline;
		return (kErrSetOutOfBandInline);
	}
	return (kNoErr);
}	/* SetInlineOutOfBandData */
#endif /* SO_OOBINLINE */




#ifndef NO_SIGNALS

static void
CancelConnect(int signum)
{
	gGotSig = signum;
#ifdef HAVE_SIGSETJMP
	siglongjmp(gCancelConnectJmp, 1);
#else
	longjmp(gCancelConnectJmp, 1);
#endif	/* HAVE_SIGSETJMP */
}	/* CancelConnect */

#endif	/* NO_SIGNALS */



int
OpenControlConnection(const FTPCIPtr cip, char *host, unsigned int port)
{
	struct in_addr ip_address;
	int err = 0;
	int result;
	int oerrno;
	volatile int sockfd = -1;
	volatile int sock2fd = -1;
	ResponsePtr rp;
	char **volatile curaddr;
	struct hostent *hp;
	char *volatile fhost;
	unsigned int fport;
#ifndef NO_SIGNALS
	volatile FTPSigProc osigint;
	volatile FTPSigProc osigalrm;
	volatile FTPCIPtr vcip;
	int sj;
#endif	/* NO_SIGNALS */
	const char *firstLine, *secondLine, *srvr;

	LIBNCFTP_USE_VAR(gLibNcFTPVersion);
	LIBNCFTP_USE_VAR(gCopyright);
#ifdef NO_SIGNALS
	LIBNCFTP_USE_VAR(gNoSignalsMarker);
#endif	/* NO_SIGNALS */

	if (cip->firewallType == kFirewallNotInUse) {
		fhost = host;
		fport = port;
	} else {
		fhost = cip->firewallHost;
		fport = cip->firewallPort;
	}
	if (fport == 0)
		fport = cip->lip->defaultPort;

	/* Since we're the client, we just have to get a socket() and
	 * connect() it.
	 */
	(void) ZERO(cip->servCtlAddr);
	cip->cin = NULL;
	cip->cout = NULL;

	/* Make sure we use network byte-order. */
	fport = (unsigned int) htons((unsigned short) fport);

	cip->servCtlAddr.sin_port = (unsigned short) fport;

	hp = GetHostEntry(fhost, &ip_address);

	if (hp == NULL) {
		/* Okay, no Host entry, but maybe we have a numeric address
		 * in ip_address we can try.
		 */
		if (ip_address.s_addr == INADDR_NONE) {
			Error(cip, kDontPerror, "%s: unknown host.\n", fhost);
			cip->errNo = kErrHostUnknown;
			return (kErrHostUnknown);
		}
		cip->servCtlAddr.sin_family = AF_INET;
		cip->servCtlAddr.sin_addr.s_addr = ip_address.s_addr;
	} else {
		cip->servCtlAddr.sin_family = hp->h_addrtype;
		/* We'll fill in the rest of the structure below. */
	}

	/* After obtaining a socket, try to connect it to a remote
	 * address.  If we didn't get a host entry, we will only have
	 * one thing to try (ip_address);  if we do have one, we can try
	 * every address in the list from the host entry.
	 */

	if (hp == NULL) {
		/* Since we're given a single raw address, and not a host entry,
		 * we can only try this one address and not any other addresses
		 * that could be present for a site with a host entry.
		 */

		if ((sockfd = socket(cip->servCtlAddr.sin_family, SOCK_STREAM, 0)) < 0) {
			Error(cip, kDoPerror, "Could not get a socket.\n");
			cip->errNo = kErrNewStreamSocket;
			return (kErrNewStreamSocket);
		}

		/* This doesn't do anything if you left these
		 * at their defaults (zero).  Otherwise it
		 * tries to set the buffer size to the
		 * size specified.
		 */
		(void) SetSockBufSize(sockfd, cip->ctrlSocketRBufSize, cip->ctrlSocketSBufSize);

#ifdef NO_SIGNALS
		err = SConnect(sockfd, &cip->servCtlAddr, (int) cip->connTimeout);

		if (err < 0) {
			oerrno = errno;
			(void) SClose(sockfd, 3);
			errno = oerrno;
			sockfd = -1;
		}
#else	/* NO_SIGNALS */
		osigint = (volatile FTPSigProc) signal(SIGINT, CancelConnect);
		if (cip->connTimeout > 0) {
			osigalrm = (volatile FTPSigProc) signal(SIGALRM, CancelConnect);
			(void) alarm(cip->connTimeout);
		}

		vcip = cip;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产日韩欧美在线一区| 亚洲成a人v欧美综合天堂下载| 成人97人人超碰人人99| 亚洲激情欧美激情| 久久女同精品一区二区| 在线不卡a资源高清| av欧美精品.com| 狠狠色狠狠色综合系列| 日韩精品亚洲一区二区三区免费| 成人免费高清在线观看| 一区二区成人在线视频| 国产日韩欧美电影| 久久久久久99久久久精品网站| 8v天堂国产在线一区二区| 日本韩国精品在线| www.亚洲激情.com| 成人免费av在线| www.亚洲国产| 99久久99久久免费精品蜜臀| 国产a级毛片一区| 国产成人精品网址| www.视频一区| 91福利视频久久久久| 欧美午夜精品一区二区蜜桃 | 91精品福利在线一区二区三区 | 日韩综合在线视频| 亚洲午夜av在线| 日韩av电影免费观看高清完整版| 日韩黄色免费网站| 日本在线不卡视频| 国产精品91一区二区| 99精品视频在线观看免费| aaa亚洲精品| 欧美精品国产精品| 久久99精品久久久久久动态图| 亚洲一区二区3| 开心九九激情九九欧美日韩精美视频电影 | 91麻豆精品国产91久久久资源速度 | 国产日韩欧美制服另类| 中文字幕一区免费在线观看| 亚洲综合小说图片| 国产在线麻豆精品观看| 成人一道本在线| 欧美精品aⅴ在线视频| 国产精品理伦片| 秋霞电影网一区二区| 91在线视频观看| 精品欧美一区二区久久| 亚洲乱码中文字幕| 国产成人精品一区二区三区网站观看| 91福利国产精品| 国产亚洲精品7777| 国产精品综合视频| 亚洲成人在线网站| 一区二区三区**美女毛片| 久久成人综合网| 欧美夫妻性生活| 99久久99精品久久久久久| 99久久精品免费看| 欧美大片在线观看| 免费观看30秒视频久久| 成人精品gif动图一区| 日韩手机在线导航| 奇米色777欧美一区二区| 欧美伊人久久久久久久久影院| 日本一区二区三区dvd视频在线| 丝袜脚交一区二区| 91麻豆精品91久久久久同性| 亚洲第一激情av| 欧美二区三区91| 午夜a成v人精品| 欧美久久免费观看| 精品国产3级a| 美洲天堂一区二卡三卡四卡视频| 欧美日韩国产高清一区二区三区 | 91麻豆免费视频| 亚洲免费电影在线| 在线欧美日韩精品| 日韩电影免费在线观看网站| 3d动漫精品啪啪一区二区竹菊| 日韩电影在线看| 国产视频一区二区在线| 国产成人精品一区二| 国产精品国产a级| 在线观看日韩精品| 日韩影院免费视频| 日本一区二区三区久久久久久久久不 | 欧美视频第二页| 久久99精品久久久久久久久久久久| 美女www一区二区| 日韩午夜激情视频| 亚洲自拍偷拍麻豆| 国产成人自拍网| 亚洲色图制服诱惑| 7777精品久久久大香线蕉| 国产精品综合二区| 欧美一级免费观看| 精品一区二区三区日韩| 欧美电影免费观看高清完整版在线| 亚洲一区二区欧美激情| 欧美在线999| 亚洲123区在线观看| 日韩一区二区中文字幕| 蜜臀精品久久久久久蜜臀| 日韩精品中文字幕一区二区三区 | 欧美精品一区二区三区高清aⅴ | 欧美韩日一区二区三区四区| 国v精品久久久网| 中文字幕一区视频| 欧美午夜不卡视频| 免费成人性网站| 国产精品精品国产色婷婷| 日本精品免费观看高清观看| 亚洲狠狠爱一区二区三区| 日韩欧美一区二区不卡| 国产成人免费在线观看| 洋洋成人永久网站入口| 欧美人妇做爰xxxⅹ性高电影| 精品一区二区三区在线播放| 国产精品毛片久久久久久久| 在线欧美日韩精品| 极品少妇xxxx精品少妇| 亚洲人成影院在线观看| 欧美电影免费提供在线观看| 成人性生交大合| 精品亚洲成av人在线观看| 最新国产の精品合集bt伙计| 欧美视频在线观看一区| 国产日本欧美一区二区| 99v久久综合狠狠综合久久| 偷拍自拍另类欧美| 亚洲三级免费观看| 久久精品综合网| 欧美一卡在线观看| 色88888久久久久久影院野外| 久久精品国产99国产| 亚洲成国产人片在线观看| 国产欧美日本一区视频| 日韩精品一区二区三区三区免费| www..com久久爱| 成人中文字幕在线| 欧美一区二区播放| 99久久精品国产精品久久| 国产高清不卡一区| 久久电影国产免费久久电影| 日日夜夜免费精品| 日产国产欧美视频一区精品| 亚洲一区在线观看网站| 中文字幕一区二区三区不卡| 国产视频亚洲色图| 国产目拍亚洲精品99久久精品| 国产亚洲成年网址在线观看| 精品成人佐山爱一区二区| 精品国产乱码久久久久久夜甘婷婷 | 3d动漫精品啪啪一区二区竹菊| 在线观看免费成人| 7777精品伊人久久久大香线蕉经典版下载 | 99在线视频精品| 色婷婷av一区二区| 欧美久久免费观看| 国产欧美一区二区在线| 最近日韩中文字幕| 男女性色大片免费观看一区二区 | 国产剧情av麻豆香蕉精品| 国产精品正在播放| 色婷婷综合久久久中文一区二区| 在线视频你懂得一区二区三区| 欧美一区二区福利视频| 国产精品久久久久婷婷| 午夜视频一区二区三区| 美女视频免费一区| jizzjizzjizz欧美| 欧美一级久久久| 亚洲精品国产高清久久伦理二区| 日本不卡视频在线| 一本久久a久久免费精品不卡| 日韩精品中文字幕在线不卡尤物| 国产精品色在线| 久久99久久99小草精品免视看| 色婷婷av一区| 欧美国产亚洲另类动漫| 九九视频精品免费| 欧美日韩高清不卡| 亚洲理论在线观看| av在线播放一区二区三区| 26uuu久久天堂性欧美| 奇米影视一区二区三区小说| 欧美午夜精品免费| 亚洲一区二区三区美女| 欧美中文字幕亚洲一区二区va在线 | 一本到不卡免费一区二区| 国产精品每日更新| 国产成人免费高清| 国产精品三级视频| 国产盗摄一区二区| 欧美经典一区二区| 国产成人99久久亚洲综合精品| 久久日一线二线三线suv| 精品在线免费视频| 国产精品免费av|