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

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

?? nchan.c

?? C++編寫
?? C
字號:
/* * Copyright (c) 1999, 2000, 2001, 2002 Markus Friedl.  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. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. */#include "includes.h"RCSID("$OpenBSD: nchan.c,v 1.47 2002/06/19 00:27:55 deraadt Exp $");#include "ssh1.h"#include "ssh2.h"#include "buffer.h"#include "packet.h"#include "channels.h"#include "compat.h"#include "log.h"/* * SSH Protocol 1.5 aka New Channel Protocol * Thanks to Martina, Axel and everyone who left Erlangen, leaving me bored. * Written by Markus Friedl in October 1999 * * Protocol versions 1.3 and 1.5 differ in the handshake protocol used for the * tear down of channels: * * 1.3:	strict request-ack-protocol: * 	CLOSE	-> * 		<-  CLOSE_CONFIRM * * 1.5:	uses variations of: * 	IEOF	-> * 		<-  OCLOSE * 		<-  IEOF * 	OCLOSE	-> * 	i.e. both sides have to close the channel * * 2.0: the EOF messages are optional * * See the debugging output from 'ssh -v' and 'sshd -d' of * ssh-1.2.27 as an example. * *//* functions manipulating channel states *//* * EVENTS update channel input/output states execute ACTIONS *//* * ACTIONS: should never update the channel states */static void	chan_send_ieof1(Channel *);static void	chan_send_oclose1(Channel *);static void	chan_send_close2(Channel *);static void	chan_send_eof2(Channel *);/* helper */static void	chan_shutdown_write(Channel *);static void	chan_shutdown_read(Channel *);static char *ostates[] = { "open", "drain", "wait_ieof", "closed" };static char *istates[] = { "open", "drain", "wait_oclose", "closed" };static voidchan_set_istate(Channel *c, u_int next){	if (c->istate > CHAN_INPUT_CLOSED || next > CHAN_INPUT_CLOSED)		fatal("chan_set_istate: bad state %d -> %d", c->istate, next);	debug("channel %d: input %s -> %s", c->self, istates[c->istate],	    istates[next]);	c->istate = next;}static voidchan_set_ostate(Channel *c, u_int next){	if (c->ostate > CHAN_OUTPUT_CLOSED || next > CHAN_OUTPUT_CLOSED)		fatal("chan_set_ostate: bad state %d -> %d", c->ostate, next);	debug("channel %d: output %s -> %s", c->self, ostates[c->ostate],	    ostates[next]);	c->ostate = next;}/* * SSH1 specific implementation of event functions */static voidchan_rcvd_oclose1(Channel *c){	debug("channel %d: rcvd oclose", c->self);	switch (c->istate) {	case CHAN_INPUT_WAIT_OCLOSE:		chan_set_istate(c, CHAN_INPUT_CLOSED);		break;	case CHAN_INPUT_OPEN:		chan_shutdown_read(c);		chan_send_ieof1(c);		chan_set_istate(c, CHAN_INPUT_CLOSED);		break;	case CHAN_INPUT_WAIT_DRAIN:		/* both local read_failed and remote write_failed  */		chan_send_ieof1(c);		chan_set_istate(c, CHAN_INPUT_CLOSED);		break;	default:		error("channel %d: protocol error: rcvd_oclose for istate %d",		    c->self, c->istate);		return;	}}voidchan_read_failed(Channel *c){	debug("channel %d: read failed", c->self);	switch (c->istate) {	case CHAN_INPUT_OPEN:		chan_shutdown_read(c);		chan_set_istate(c, CHAN_INPUT_WAIT_DRAIN);		break;	default:		error("channel %d: chan_read_failed for istate %d",		    c->self, c->istate);		break;	}}voidchan_ibuf_empty(Channel *c){	debug("channel %d: ibuf empty", c->self);	if (buffer_len(&c->input)) {		error("channel %d: chan_ibuf_empty for non empty buffer",		    c->self);		return;	}	switch (c->istate) {	case CHAN_INPUT_WAIT_DRAIN:		if (compat20) {			if (!(c->flags & CHAN_CLOSE_SENT))				chan_send_eof2(c);			chan_set_istate(c, CHAN_INPUT_CLOSED);		} else {			chan_send_ieof1(c);			chan_set_istate(c, CHAN_INPUT_WAIT_OCLOSE);		}		break;	default:		error("channel %d: chan_ibuf_empty for istate %d",		    c->self, c->istate);		break;	}}static voidchan_rcvd_ieof1(Channel *c){	debug("channel %d: rcvd ieof", c->self);	switch (c->ostate) {	case CHAN_OUTPUT_OPEN:		chan_set_ostate(c, CHAN_OUTPUT_WAIT_DRAIN);		break;	case CHAN_OUTPUT_WAIT_IEOF:		chan_set_ostate(c, CHAN_OUTPUT_CLOSED);		break;	default:		error("channel %d: protocol error: rcvd_ieof for ostate %d",		    c->self, c->ostate);		break;	}}static voidchan_write_failed1(Channel *c){	debug("channel %d: write failed", c->self);	switch (c->ostate) {	case CHAN_OUTPUT_OPEN:		chan_shutdown_write(c);		chan_send_oclose1(c);		chan_set_ostate(c, CHAN_OUTPUT_WAIT_IEOF);		break;	case CHAN_OUTPUT_WAIT_DRAIN:		chan_shutdown_write(c);		chan_send_oclose1(c);		chan_set_ostate(c, CHAN_OUTPUT_CLOSED);		break;	default:		error("channel %d: chan_write_failed for ostate %d",		    c->self, c->ostate);		break;	}}voidchan_obuf_empty(Channel *c){	debug("channel %d: obuf empty", c->self);	if (buffer_len(&c->output)) {		error("channel %d: chan_obuf_empty for non empty buffer",		    c->self);		return;	}	switch (c->ostate) {	case CHAN_OUTPUT_WAIT_DRAIN:		chan_shutdown_write(c);		if (!compat20)			chan_send_oclose1(c);		chan_set_ostate(c, CHAN_OUTPUT_CLOSED);		break;	default:		error("channel %d: internal error: obuf_empty for ostate %d",		    c->self, c->ostate);		break;	}}static voidchan_send_ieof1(Channel *c){	debug("channel %d: send ieof", c->self);	switch (c->istate) {	case CHAN_INPUT_OPEN:	case CHAN_INPUT_WAIT_DRAIN:		packet_start(SSH_MSG_CHANNEL_INPUT_EOF);		packet_put_int(c->remote_id);		packet_send();		break;	default:		error("channel %d: cannot send ieof for istate %d",		    c->self, c->istate);		break;	}}static voidchan_send_oclose1(Channel *c){	debug("channel %d: send oclose", c->self);	switch (c->ostate) {	case CHAN_OUTPUT_OPEN:	case CHAN_OUTPUT_WAIT_DRAIN:		buffer_clear(&c->output);		packet_start(SSH_MSG_CHANNEL_OUTPUT_CLOSE);		packet_put_int(c->remote_id);		packet_send();		break;	default:		error("channel %d: cannot send oclose for ostate %d",		    c->self, c->ostate);		break;	}}/* * the same for SSH2 */static voidchan_rcvd_close2(Channel *c){	debug("channel %d: rcvd close", c->self);	if (c->flags & CHAN_CLOSE_RCVD)		error("channel %d: protocol error: close rcvd twice", c->self);	c->flags |= CHAN_CLOSE_RCVD;	if (c->type == SSH_CHANNEL_LARVAL) {		/* tear down larval channels immediately */		chan_set_ostate(c, CHAN_OUTPUT_CLOSED);		chan_set_istate(c, CHAN_INPUT_CLOSED);		return;	}	switch (c->ostate) {	case CHAN_OUTPUT_OPEN:		/*		 * wait until a data from the channel is consumed if a CLOSE		 * is received		 */		chan_set_ostate(c, CHAN_OUTPUT_WAIT_DRAIN);		break;	}	switch (c->istate) {	case CHAN_INPUT_OPEN:		chan_shutdown_read(c);		chan_set_istate(c, CHAN_INPUT_CLOSED);		break;	case CHAN_INPUT_WAIT_DRAIN:		chan_send_eof2(c);		chan_set_istate(c, CHAN_INPUT_CLOSED);		break;	}}static voidchan_rcvd_eof2(Channel *c){	debug("channel %d: rcvd eof", c->self);	c->flags |= CHAN_EOF_RCVD;	if (c->ostate == CHAN_OUTPUT_OPEN)		chan_set_ostate(c, CHAN_OUTPUT_WAIT_DRAIN);}static voidchan_write_failed2(Channel *c){	debug("channel %d: write failed", c->self);	switch (c->ostate) {	case CHAN_OUTPUT_OPEN:	case CHAN_OUTPUT_WAIT_DRAIN:		chan_shutdown_write(c);		chan_set_ostate(c, CHAN_OUTPUT_CLOSED);		break;	default:		error("channel %d: chan_write_failed for ostate %d",		    c->self, c->ostate);		break;	}}static voidchan_send_eof2(Channel *c){	debug("channel %d: send eof", c->self);	switch (c->istate) {	case CHAN_INPUT_WAIT_DRAIN:		packet_start(SSH2_MSG_CHANNEL_EOF);		packet_put_int(c->remote_id);		packet_send();		c->flags |= CHAN_EOF_SENT;		break;	default:		error("channel %d: cannot send eof for istate %d",		    c->self, c->istate);		break;	}}static voidchan_send_close2(Channel *c){	debug("channel %d: send close", c->self);	if (c->ostate != CHAN_OUTPUT_CLOSED ||	    c->istate != CHAN_INPUT_CLOSED) {		error("channel %d: cannot send close for istate/ostate %d/%d",		    c->self, c->istate, c->ostate);	} else if (c->flags & CHAN_CLOSE_SENT) {		error("channel %d: already sent close", c->self);	} else {		packet_start(SSH2_MSG_CHANNEL_CLOSE);		packet_put_int(c->remote_id);		packet_send();		c->flags |= CHAN_CLOSE_SENT;	}}/* shared */voidchan_rcvd_ieof(Channel *c){	if (compat20)		chan_rcvd_eof2(c);	else		chan_rcvd_ieof1(c);	if (c->ostate == CHAN_OUTPUT_WAIT_DRAIN &&	    buffer_len(&c->output) == 0 &&	    !CHANNEL_EFD_OUTPUT_ACTIVE(c))		chan_obuf_empty(c);}voidchan_rcvd_oclose(Channel *c){	if (compat20)		chan_rcvd_close2(c);	else		chan_rcvd_oclose1(c);}voidchan_write_failed(Channel *c){	if (compat20)		chan_write_failed2(c);	else		chan_write_failed1(c);}voidchan_mark_dead(Channel *c){	c->type = SSH_CHANNEL_ZOMBIE;}intchan_is_dead(Channel *c, int send){	if (c->type == SSH_CHANNEL_ZOMBIE) {		debug("channel %d: zombie", c->self);		return 1;	}	if (c->istate != CHAN_INPUT_CLOSED || c->ostate != CHAN_OUTPUT_CLOSED)		return 0;	if (!compat20) {		debug("channel %d: is dead", c->self);		return 1;	}	if ((datafellows & SSH_BUG_EXTEOF) &&	    c->extended_usage == CHAN_EXTENDED_WRITE &&	    c->efd != -1 &&	    buffer_len(&c->extended) > 0) {		debug2("channel %d: active efd: %d len %d",		    c->self, c->efd, buffer_len(&c->extended));		return 0;	}	if (!(c->flags & CHAN_CLOSE_SENT)) {		if (send) {			chan_send_close2(c);		} else {			/* channel would be dead if we sent a close */			if (c->flags & CHAN_CLOSE_RCVD) {				debug("channel %d: almost dead",				    c->self);				return 1;			}		}	}	if ((c->flags & CHAN_CLOSE_SENT) &&	    (c->flags & CHAN_CLOSE_RCVD)) {		debug("channel %d: is dead", c->self);		return 1;	}	return 0;}/* helper */static voidchan_shutdown_write(Channel *c){	buffer_clear(&c->output);	if (compat20 && c->type == SSH_CHANNEL_LARVAL)		return;	/* shutdown failure is allowed if write failed already */	debug("channel %d: close_write", c->self);	if (c->sock != -1) {		if (shutdown(c->sock, SHUT_WR) < 0)			debug("channel %d: chan_shutdown_write: "			    "shutdown() failed for fd%d: %.100s",			    c->self, c->sock, strerror(errno));	} else {		if (channel_close_fd(&c->wfd) < 0)			log("channel %d: chan_shutdown_write: "			    "close() failed for fd%d: %.100s",			    c->self, c->wfd, strerror(errno));	}}static voidchan_shutdown_read(Channel *c){	if (compat20 && c->type == SSH_CHANNEL_LARVAL)		return;	debug("channel %d: close_read", c->self);	if (c->sock != -1) {		if (shutdown(c->sock, SHUT_RD) < 0)			error("channel %d: chan_shutdown_read: "			    "shutdown() failed for fd%d [i%d o%d]: %.100s",			    c->self, c->sock, c->istate, c->ostate,			    strerror(errno));	} else {		if (channel_close_fd(&c->rfd) < 0)			log("channel %d: chan_shutdown_read: "			    "close() failed for fd%d: %.100s",			    c->self, c->rfd, strerror(errno));	}}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩午夜在线影院| 色呦呦国产精品| 久久综合一区二区| 国产精品一区在线| 国产三级精品视频| 99视频一区二区| 亚洲一区二区三区精品在线| 在线观看国产日韩| 日韩福利视频导航| 久久人人超碰精品| 91色九色蝌蚪| 日韩国产精品久久久| 精品999久久久| 91麻豆精东视频| 亚洲成av人影院| 久久久综合网站| 色综合天天做天天爱| 日韩中文字幕不卡| 久久久.com| 色激情天天射综合网| 日产国产高清一区二区三区| 久久久久久一二三区| 色呦呦一区二区三区| 麻豆专区一区二区三区四区五区| 久久九九全国免费| 欧美三日本三级三级在线播放| 毛片基地黄久久久久久天堂| 日韩理论片在线| 欧美一区二区三区啪啪| 成人精品电影在线观看| 天堂影院一区二区| 国产精品色在线观看| 欧美日韩精品一二三区| 国产91精品免费| 午夜精品久久一牛影视| 国产人成一区二区三区影院| 欧美日韩国产a| 高清beeg欧美| 日韩电影在线观看网站| 国产精品久久久久7777按摩| 日韩亚洲欧美综合| 91久久精品网| 成人三级伦理片| 免费欧美高清视频| 亚洲欧美激情在线| 久久精品人人做人人综合| 欧美日韩一区二区三区在线 | 成人国产精品免费观看视频| 性做久久久久久| 国产精品看片你懂得| 欧美精品一区二区不卡 | 日韩一区二区在线看| 色综合网色综合| 成人午夜短视频| 狠狠色丁香婷婷综合久久片| 亚洲国产aⅴ天堂久久| 国产精品久久久久aaaa| 久久午夜免费电影| 日韩一区二区三区电影在线观看 | 成人高清免费观看| 激情深爱一区二区| 免费在线观看一区| 午夜精品久久一牛影视| 亚洲国产精品天堂| 亚洲中国最大av网站| 亚洲天堂精品在线观看| 国产农村妇女精品| 国产日韩欧美精品一区| 精品三级av在线| 精品久久久久久久久久久久久久久 | 欧美日韩视频在线观看一区二区三区| www.欧美亚洲| 大胆欧美人体老妇| 成人免费视频网站在线观看| 大尺度一区二区| 大桥未久av一区二区三区中文| 激情都市一区二区| 国内精品伊人久久久久av一坑 | 91精品在线免费观看| 欧美日韩国产影片| 56国语精品自产拍在线观看| 在线播放国产精品二区一二区四区| 欧美日韩国产色站一区二区三区| 欧美日韩不卡视频| 91精品国产综合久久精品麻豆| 日韩一区二区三区四区| 久久在线免费观看| 国产精品久久久久7777按摩 | 亚洲第一电影网| 亚洲福中文字幕伊人影院| 天天爽夜夜爽夜夜爽精品视频| 日韩成人免费在线| 国产精品一区二区久久不卡| 成人看片黄a免费看在线| jvid福利写真一区二区三区| 91美女片黄在线观看| 欧美日韩一卡二卡三卡| 日韩欧美精品三级| 国产性色一区二区| 亚洲卡通欧美制服中文| 亚洲mv在线观看| 久久激情五月婷婷| 国产精品一二三四五| 99在线热播精品免费| 欧美美女一区二区三区| 久久综合999| 一区二区高清视频在线观看| 日本视频中文字幕一区二区三区| 激情欧美一区二区| 91在线观看高清| 日韩一级成人av| 国产精品久久久99| 午夜精品福利视频网站| 国产美女主播视频一区| 91在线视频在线| 日韩欧美成人一区二区| 国产精品福利影院| 日本欧美肥老太交大片| 国产jizzjizz一区二区| 欧美美女黄视频| 国产日韩在线不卡| 日本欧美一区二区三区乱码| 成a人片国产精品| 日韩欧美另类在线| 一区二区久久久久| 国产激情视频一区二区在线观看 | 欧美性一区二区| 国产亚洲综合av| 同产精品九九九| 99精品视频一区| 337p日本欧洲亚洲大胆色噜噜| 一区二区三区欧美亚洲| 国产精品资源在线看| 欧美另类一区二区三区| 国产精品第四页| 国产精品自拍在线| 日韩一级片在线播放| 国产精品久久久久一区| 久久99热99| 91麻豆精品国产自产在线观看一区 | 久久久青草青青国产亚洲免观| 亚洲综合丝袜美腿| 成人精品国产免费网站| 欧美va亚洲va国产综合| 丝袜诱惑制服诱惑色一区在线观看 | 日韩女优av电影在线观看| 亚洲精品中文在线影院| 国产不卡高清在线观看视频| 欧美哺乳videos| 蜜桃传媒麻豆第一区在线观看| 欧美在线观看视频一区二区| 成人欧美一区二区三区黑人麻豆| 久久99久久久久| 欧美一区二区三区小说| 香蕉久久一区二区不卡无毒影院 | 国产91丝袜在线18| 精品国产网站在线观看| 婷婷国产在线综合| 欧洲av一区二区嗯嗯嗯啊| 亚洲视频免费观看| 91玉足脚交白嫩脚丫在线播放| 国产精品网站在线播放| 高清不卡一二三区| 国产精品免费久久久久| 国产99一区视频免费| 国产欧美日韩不卡免费| 大胆欧美人体老妇| 国产精品久久久久久久久果冻传媒 | 黄一区二区三区| 精品国产一区二区三区久久影院| 丝袜亚洲精品中文字幕一区| 欧美日韩一区二区在线视频| 婷婷开心久久网| 91精品欧美久久久久久动漫 | 日本一区二区三区久久久久久久久不 | 欧美日韩精品欧美日韩精品 | 亚洲人成在线播放网站岛国| 不卡在线观看av| 亚洲另类在线视频| 欧美色综合网站| 日韩精品每日更新| 日韩视频一区二区| 极品少妇一区二区| 欧美国产激情二区三区| 99re成人精品视频| 亚洲午夜视频在线| 日韩一区二区电影在线| 国产一区91精品张津瑜| 中文字幕一区二区三区精华液| 欧美性生交片4| 国产91精品露脸国语对白| 国产精品久久一卡二卡| 欧美中文一区二区三区| 免费久久99精品国产| 国产午夜精品美女毛片视频| 91捆绑美女网站| 日韩高清欧美激情| 国产亚洲福利社区一区| 色综合色狠狠天天综合色| 日韩不卡一二三区|