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

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

?? utility.c

?? 經典的unix下telnetd代碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
/* * Copyright (c) 1989, 1993 *	The Regents of the University of California.  All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright *    notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright *    notice, this list of conditions and the following disclaimer in the *    documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors *    may be used to endorse or promote products derived from this software *    without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */#define PRINTOPTIONS#include "telnetd.h"/* RCSID("$KTH: utility.c,v 1.25 2001/05/17 00:34:42 assar Exp $"); *//* * utility functions performing io related tasks *//* * ttloop * * A small subroutine to flush the network output buffer, get some * data from the network, and pass it through the telnet state * machine.  We also flush the pty input buffer (by dropping its data) * if it becomes too full. * * return 0 if OK or 1 if interrupted by a signal. */intttloop(void){    void netflush(void);        DIAG(TD_REPORT, {	output_data("td: ttloop\r\n");    });    if (nfrontp-nbackp)	netflush();    ncc = read(net, netibuf, sizeof netibuf);    if (ncc < 0) {	if (errno == EINTR)	    return 1;	syslog(LOG_INFO, "ttloop:  read: %m");	exit(1);    } else if (ncc == 0) {	syslog(LOG_INFO, "ttloop:  peer died");	exit(1);    }    DIAG(TD_REPORT, {	output_data("td: ttloop read %d chars\r\n", ncc);    });    netip = netibuf;    telrcv();			/* state machine */    if (ncc > 0) {	pfrontp = pbackp = ptyobuf;	telrcv();    }    return 0;}  /* end of ttloop *//* * Check a descriptor to see if out of band data exists on it. */intstilloob(int s){    static struct timeval timeout = { 0 };    fd_set	excepts;    int value;    if (s >= FD_SETSIZE)	fatal(ourpty, "fd too large");    do {	FD_ZERO(&excepts);	FD_SET(s, &excepts);	value = select(s+1, 0, 0, &excepts, &timeout);    } while ((value == -1) && (errno == EINTR));    if (value < 0) {	fatalperror(ourpty, "select");    }    if (FD_ISSET(s, &excepts)) {	return 1;    } else {	return 0;    }}voidptyflush(void){    int n;    if ((n = pfrontp - pbackp) > 0) {	DIAG((TD_REPORT | TD_PTYDATA), { 	    output_data("td: ptyflush %d chars\r\n", n);	});	DIAG(TD_PTYDATA, printdata("pd", pbackp, n));	n = write(ourpty, pbackp, n);    }    if (n < 0) {	if (errno == EWOULDBLOCK || errno == EINTR)	    return;	cleanup(0);    }    pbackp += n;    if (pbackp == pfrontp)	pbackp = pfrontp = ptyobuf;}/* * nextitem() * *	Return the address of the next "item" in the TELNET data * stream.  This will be the address of the next character if * the current address is a user data character, or it will * be the address of the character following the TELNET command * if the current address is a TELNET IAC ("I Am a Command") * character. */char *nextitem(char *current){    if ((*current&0xff) != IAC) {	return current+1;    }    switch (*(current+1)&0xff) {    case DO:    case DONT:    case WILL:    case WONT:	return current+3;    case SB:{	/* loop forever looking for the SE */	char *look = current+2;	for (;;) {	    if ((*look++&0xff) == IAC) {		if ((*look++&0xff) == SE) {		    return look;		}	    }	}    }    default:	return current+2;    }}/* * netclear() * *	We are about to do a TELNET SYNCH operation.  Clear * the path to the network. * *	Things are a bit tricky since we may have sent the first * byte or so of a previous TELNET command into the network. * So, we have to scan the network buffer from the beginning * until we are up to where we want to be. * *	A side effect of what we do, just to keep things * simple, is to clear the urgent data pointer.  The principal * caller should be setting the urgent data pointer AFTER calling * us in any case. */voidnetclear(void){    char *thisitem, *next;    char *good;#define	wewant(p)	((nfrontp > p) && ((*p&0xff) == IAC) && \			 ((*(p+1)&0xff) != EC) && ((*(p+1)&0xff) != EL))#ifdef ENCRYPTION	thisitem = nclearto > netobuf ? nclearto : netobuf;#else	thisitem = netobuf;#endif	while ((next = nextitem(thisitem)) <= nbackp) {	    thisitem = next;	}	/* Now, thisitem is first before/at boundary. */#ifdef ENCRYPTION	good = nclearto > netobuf ? nclearto : netobuf;#else	good = netobuf;	/* where the good bytes go */#endif	while (nfrontp > thisitem) {	    if (wewant(thisitem)) {		int length;		next = thisitem;		do {		    next = nextitem(next);		} while (wewant(next) && (nfrontp > next));		length = next-thisitem;		memmove(good, thisitem, length);		good += length;		thisitem = next;	    } else {		thisitem = nextitem(thisitem);	    }	}	nbackp = netobuf;	nfrontp = good;		/* next byte to be sent */	neturg = 0;}  /* end of netclear *//* *  netflush *		Send as much data as possible to the network, *	handling requests for urgent data. */voidnetflush(void){    int n;    extern int not42;    if ((n = nfrontp - nbackp) > 0) {	DIAG(TD_REPORT,	     { n += output_data("td: netflush %d chars\r\n", n);	     });#ifdef ENCRYPTION	if (encrypt_output) {	    char *s = nclearto ? nclearto : nbackp;	    if (nfrontp - s > 0) {		(*encrypt_output)((unsigned char *)s, nfrontp-s);		nclearto = nfrontp;	    }	}#endif	/*	 * if no urgent data, or if the other side appears to be an	 * old 4.2 client (and thus unable to survive TCP urgent data),	 * write the entire buffer in non-OOB mode.	 */#if 1 /* remove this to make it work between solaris 2.6 and linux */	if ((neturg == 0) || (not42 == 0)) {#endif	    n = write(net, nbackp, n);	/* normal write */#if 1 /* remove this to make it work between solaris 2.6 and linux */	} else {	    n = neturg - nbackp;	    /*	     * In 4.2 (and 4.3) systems, there is some question about	     * what byte in a sendOOB operation is the "OOB" data.	     * To make ourselves compatible, we only send ONE byte	     * out of band, the one WE THINK should be OOB (though	     * we really have more the TCP philosophy of urgent data	     * rather than the Unix philosophy of OOB data).	     */	    if (n > 1) {		n = send(net, nbackp, n-1, 0);	/* send URGENT all by itself */	    } else {		n = send(net, nbackp, n, MSG_OOB);	/* URGENT data */	    }	}#endif    }    if (n < 0) {	if (errno == EWOULDBLOCK || errno == EINTR)	    return;	cleanup(0);    }    nbackp += n;#ifdef ENCRYPTION    if (nbackp > nclearto)	nclearto = 0;#endif    if (nbackp >= neturg) {	neturg = 0;    }    if (nbackp == nfrontp) {	nbackp = nfrontp = netobuf;#ifdef ENCRYPTION	nclearto = 0;#endif    }    return;}/* * writenet * * Just a handy little function to write a bit of raw data to the net. * It will force a transmit of the buffer if necessary * * arguments *    ptr - A pointer to a character string to write *    len - How many bytes to write */voidwritenet(unsigned char *ptr, int len){    /* flush buffer if no room for new data) */    while ((&netobuf[BUFSIZ] - nfrontp) < len) {	/* if this fails, don't worry, buffer is a little big */	netflush();    }    memmove(nfrontp, ptr, len);    nfrontp += len;}/* * miscellaneous functions doing a variety of little jobs follow ... */void fatal(int f, char *msg){    char buf[BUFSIZ];    snprintf(buf, sizeof(buf), "telnetd: %s.\r\n", msg);#ifdef ENCRYPTION    if (encrypt_output) {	/*	 * Better turn off encryption first....	 * Hope it flushes...	 */	encrypt_send_end();	netflush();    }#endif    write(f, buf, (int)strlen(buf));    sleep(1);	/*XXX*/    exit(1);}voidfatalperror_errno(int f, const char *msg, int error){    char buf[BUFSIZ];        snprintf(buf, sizeof(buf), "%s: %s", msg, strerror(error));    fatal(f, buf);}voidfatalperror(int f, const char *msg){    fatalperror_errno(f, msg, errno);}char editedhost[32];void edithost(char *pat, char *host){    char *res = editedhost;    if (!pat)	pat = "";    while (*pat) {	switch (*pat) {	case '#':	    if (*host)		host++;	    break;	case '@':	    if (*host)		*res++ = *host++;	    break;	default:	    *res++ = *pat;	    break;	}	if (res == &editedhost[sizeof editedhost - 1]) {	    *res = '\0';	    return;	}	pat++;    }    if (*host)	strlcpy (res, host,			 sizeof editedhost - (res - editedhost));    else	*res = '\0';    editedhost[sizeof editedhost - 1] = '\0';}static char *putlocation;voidputstr(char *s){    while (*s)	putchr(*s++);}voidputchr(int cc){    *putlocation++ = cc;}/* * This is split on two lines so that SCCS will not see the M * between two % signs and expand it... */static char fmtstr[] = { "%l:%M" "%P on %A, %d %B %Y" };void putf(char *cp, char *where){#ifdef HAVE_UNAME    struct utsname name;#endif    char *slash;    time_t t;    char db[100];    /* if we don't have uname, set these to sensible values */    char *sysname = "Unix", 	*machine = "", 	*release = "",	*version = ""; #ifdef HAVE_UNAME    uname(&name);    sysname=name.sysname;    machine=name.machine;    release=name.release;    version=name.version;#endif    putlocation = where;    while (*cp) {	if (*cp != '%') {	    putchr(*cp++);	    continue;	}	switch (*++cp) {	case 't':#ifdef	STREAMSPTY	    /* names are like /dev/pts/2 -- we want pts/2 */	    slash = strchr(line+1, '/');#else	    slash = strrchr(line, '/');#endif	    if (slash == (char *) 0)		putstr(line);	    else		putstr(&slash[1]);	    break;	case 'h':	    putstr(editedhost);	    break;	case 's':	    putstr(sysname);	    break;	case 'm':	    putstr(machine);	    break;	case 'r':	    putstr(release);	    break;	case 'v':	    putstr(version);	    break;	case 'd':	    time(&t);	    strftime(db, sizeof(db), fmtstr, localtime(&t));	    putstr(db);	    break;	case '%':	    putchr('%');	    break;	}	cp++;    }}#ifdef DIAGNOSTICS/* * Print telnet options and commands in plain text, if possible. */voidprintoption(char *fmt, int option){    if (TELOPT_OK(option))	output_data("%s %s\r\n",		    fmt,		    TELOPT(option));    else if (TELCMD_OK(option))	output_data("%s %s\r\n",		    fmt,		    TELCMD(option));    else	output_data("%s %d\r\n",		    fmt,		    option);    return;}voidprintsub(int direction, unsigned char *pointer, int length)        		          	/* '<' or '>' */                 	         	/* where suboption data sits */       			       		/* length of suboption data */{    int i = 0;#ifdef AUTHENTICATION    unsigned char buf[512];#endif    if (!(diagnostic & TD_OPTIONS))	return;    if (direction) {	output_data("td: %s suboption ",		    direction == '<' ? "recv" : "send");	if (length >= 3) {	    int j;	    i = pointer[length-2];	    j = pointer[length-1];	    if (i != IAC || j != SE) {		output_data("(terminated by ");		if (TELOPT_OK(i))		    output_data("%s ",				TELOPT(i));		else if (TELCMD_OK(i))		    output_data("%s ",				TELCMD(i));		else		    output_data("%d ",				i);		if (TELOPT_OK(j))		    output_data("%s",				TELOPT(j));		else if (TELCMD_OK(j))		    output_data("%s",				TELCMD(j));		else		    output_data("%d",				j);		output_data(", not IAC SE!) ");	    }	}	length -= 2;    }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
色综合天天综合网天天看片| 欧美性做爰猛烈叫床潮| 日韩免费性生活视频播放| 久久99久久精品欧美| 国产精品网友自拍| 91视频com| 韩国精品主播一区二区在线观看 | 成人免费在线视频| 欧美精品成人一区二区三区四区| 亚洲国产成人tv| 欧美吻胸吃奶大尺度电影| 国产美女主播视频一区| 亚洲免费观看视频| 精品国免费一区二区三区| 日本精品一级二级| 国产成人av福利| 天天免费综合色| 亚洲一区二区三区美女| 亚洲国产精品高清| 2020国产成人综合网| 日韩精品最新网址| 欧美一二三区在线观看| 日本韩国欧美国产| 99国产精品久久久久| 国产九九视频一区二区三区| 蜜臀av一区二区三区| 视频一区视频二区中文字幕| 亚洲精品成人悠悠色影视| 图片区日韩欧美亚洲| 午夜精品一区在线观看| 日韩影院免费视频| 蜜臀av性久久久久蜜臀av麻豆| 视频一区视频二区中文字幕| 婷婷久久综合九色国产成人| 一区二区三区在线观看欧美| 国产精品麻豆欧美日韩ww| 国产精品你懂的在线| 亚洲日本成人在线观看| 亚洲国产精品欧美一二99| 日本成人中文字幕在线视频| 激情av综合网| 成人av在线看| 欧美日韩aaaaaa| 久久久久久电影| 亚洲一区国产视频| 美日韩一区二区三区| 成人午夜电影小说| 欧美一区二区三区思思人| 国产精品丝袜一区| 奇米色一区二区| 一本久道中文字幕精品亚洲嫩| 日韩欧美精品在线| 亚洲电影一区二区| 懂色av中文字幕一区二区三区| 日韩一区二区三区精品视频| 一区二区三区成人| 日本在线不卡视频一二三区| 欧美男人的天堂一二区| 蜜臀91精品一区二区三区| 91官网在线观看| 欧美mv日韩mv国产| 午夜视频一区在线观看| 国产jizzjizz一区二区| 欧美精品亚洲二区| 国产精品天美传媒| 丝袜亚洲另类丝袜在线| 精品制服美女丁香| 在线亚洲欧美专区二区| 欧美极品xxx| 欧美另类高清zo欧美| 亚洲美女免费视频| 欧美影院一区二区三区| 亚洲一区二区av电影| 欧美酷刑日本凌虐凌虐| 天天操天天综合网| 欧美一级日韩免费不卡| 国产老女人精品毛片久久| 久久久久久久久久久久久夜| 国产成人无遮挡在线视频| 国产欧美一区二区精品秋霞影院| 国产成人福利片| 亚洲精品自拍动漫在线| 91精品国产aⅴ一区二区| 国产suv精品一区二区三区| 日韩一区在线免费观看| 中文字幕亚洲不卡| 色94色欧美sute亚洲13| 不卡在线视频中文字幕| 国产suv精品一区二区三区| 久久超碰97人人做人人爱| 国产精品情趣视频| 欧美精品一区二区三区高清aⅴ| 91黄视频在线观看| av亚洲精华国产精华精华| 日韩电影在线一区| 亚洲一区二区精品3399| 国产精品久久久久三级| 久久久91精品国产一区二区三区| 欧洲一区在线电影| 91成人国产精品| 色呦呦日韩精品| 99免费精品在线| 不卡的电影网站| 国产做a爰片久久毛片| 日韩一区欧美二区| 亚洲国产日日夜夜| 有码一区二区三区| 亚洲精品五月天| 亚洲图片欧美激情| 亚洲男人的天堂网| 国产精品无圣光一区二区| 色婷婷亚洲综合| 91国模大尺度私拍在线视频| 色偷偷久久一区二区三区| 99视频在线观看一区三区| 91视频观看视频| 欧美日韩亚洲高清一区二区| 日韩一区二区三| 欧美激情一区在线观看| 亚洲香肠在线观看| 麻豆91在线播放免费| 一本一道综合狠狠老| 欧美一区二区三区的| 一区二区三区在线视频观看 | 91福利精品视频| 91色在线porny| 欧美一区三区四区| 日韩午夜电影在线观看| 久久久噜噜噜久久中文字幕色伊伊| 精品成人免费观看| 亚洲欧洲av一区二区三区久久| 亚洲男人的天堂在线aⅴ视频| 无码av中文一区二区三区桃花岛| 美腿丝袜亚洲色图| 色呦呦国产精品| 亚洲国产电影在线观看| 三级久久三级久久久| 丁香婷婷综合网| 欧美精品一区男女天堂| 亚洲精品国产第一综合99久久| 精品午夜久久福利影院| 欧美男男青年gay1069videost| 欧美激情一区二区三区蜜桃视频 | 色香蕉成人二区免费| 久久九九久久九九| 久久99精品久久久久婷婷| 欧美日韩国产三级| 樱花影视一区二区| 懂色av一区二区三区免费看| 成人av高清在线| 欧美大片拔萝卜| 欧美美女一区二区| 国产在线日韩欧美| 国产精品亲子伦对白| 这里只有精品电影| 91在线免费看| 国产精品亚洲午夜一区二区三区 | 欧美日韩成人综合在线一区二区| 国产精品88888| 国产乱码精品一区二区三| 午夜精品福利在线| 亚洲视频一区二区在线观看| 2020国产精品| 欧美成人免费网站| 欧美一级国产精品| 精品国产乱码久久久久久牛牛| 91社区在线播放| 91麻豆自制传媒国产之光| 国产成人一区在线| 国产精品亚洲午夜一区二区三区| 精品在线观看免费| 玖玖九九国产精品| 国产一区二区三区香蕉| 国产一区二区三区香蕉| 久久99久久精品| 韩国女主播一区二区三区| 国产乱人伦偷精品视频不卡 | 欧美伊人久久久久久久久影院| 一本色道久久综合狠狠躁的推荐| 91亚洲永久精品| 欧美日韩精品免费观看视频| 欧美日韩国产123区| 日韩欧美一二三四区| 久久久久97国产精华液好用吗| 国产精品伦理一区二区| 久久五月婷婷丁香社区| 欧美日韩亚洲国产综合| 日韩一区二区三区视频在线| 久久综合视频网| 亚洲欧美色图小说| 天天影视涩香欲综合网| 日本强好片久久久久久aaa| 亚洲福利视频一区| 国产麻豆精品在线| 欧美性感一类影片在线播放| 7799精品视频| 欧美激情一二三区| 亚洲午夜电影网| 成人激情午夜影院| 欧美日韩在线电影|