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

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

?? pty.c

?? 一個使用des加密傳輸的unix下的login程序的服務器端和客戶端
?? C
字號:
/* * Interface to BSD-style (SYSV-style if -D_USE_STREAMS) Pseudo-ttys. * * You may want to lookup the pty ioctl's: * * HP-UX Only!: *     TIOCTRAP    - (disabled default) => no exceptional selects will happen. *                 = enabled => select detects open and close  *		     slave hangs on open or ioctl until master acks. *		     non-termio ioctl's detected. *		     termio ioctl's detected if TIOCTTY disabled. *     TIOCTTY     - enabled => termio ioctl's valid on slave *                              termio ioctl's detected only if TIOCMONITOR *                 - disabled => TIOCTRAP detects termio ioctl's. *     TIOCMONITOR - enabled  => termio ioctls detected if TIOCTRAP & TIOCTTY * *     if TIOCTRAP is enabled, then traps must be ack'd by a TIOCREQCHECK, *     TIOCREQSET pair in sequence. * *     TIOCSIGMODE - TIOCSIGBLOCK - Caught Slave signals are posponed on ioctl *                   TIOCSIGABORT - All slave signals return EINTR on ioctl *                   TIOSIGNORMAL - default, restarted requests => a new ioctl * * None of the above exists on any BSD implemenation I can find.  Some mention * is made of setting B0 baudrate causing the master to see a close. */#undef _POSIX_SOURCE		/* this is definitely *not* posix source */#include <unistd.h>		/* open close */#include <stdlib.h>		/* free malloc */#include <stdio.h>#include <string.h>		/* strerror */#include <errno.h>		/* errno */#include <fcntl.h>#if defined(DGUX)#define _USE_STREAMS#endif#if defined(_USE_STREAMS)#include <sys/stream.h>#include <sys/stropts.h>	/* I_PUSH I_FIND */#endif#if defined(__sgi) && !defined(_USE_STREAMS)#include <sys/types.h>#include <sys/stat.h>		/* S_IRUSR S_IWUSR */#endif#include "pty.h"#include "log.h"#if defined(_USE_STREAMS) /* { */#define MASTER_PTY	"/dev/ptmx"	/* __ALPHA __SOLARIS__ DGUX */#define SLAVE_PTY	"/dev/pts/n"	/* __ALPHA n = 0,1,...,47 */#define PTY_STREAM	"ptem"		/* see ptem(7) */#define LDIS_STREAM	"ldterm"	/* SYSV line discipline */#define COMPAT_STREAM	"ttycompat"	/* tty compatability stream */#if defined(_OSF_SOURCE)#undef  LDIS_STREAM#define LDIS_STREAM	0		/* OSF1 includes line discipline */#endif#if defined(__SOLARIS__) /* { */#undef	COMPAT_STREAM#define COMPAT_STREAM	0		/* no tty compatability stream reqd *//* * gcc gives an error on using ptsname.  The man page is ambiguous. */#if defined(__STDC__) || defined(__cplusplus)extern char *ptsname(int);		/* ptsname.3c says in stdio.h; isn't */#elseextern char *ptsname();#endif#endif	/* } __SOLARIS__ */#if defined(__sgi)#undef MASTER_PTY#define MASTER_PTY	"/dev/ptc"#undef SLAVE_PTY#define SLAVE_PTY	"/dev/ttyqn"	/* tty[q-z][0-99] */#endif#endif /* } _USE_STREAMS */#if !defined(MASTER_PTY) /* { */#if defined(__UNICOS__) /* { */			#define MASTER_PTY	"/dev/pty/0xx"		/* 0-132 */#define SLAVE_PTY	"/dev/ttyp0xx" 		/* still incorrect. */#endif/* } UNICOS */#if defined(__sgi)	/* { IRIX */#define MASTER_PTY	"/dev/ptc"    /* /dev/ptc==/dev/ptmx /dev/ptc[1234] */#define SLAVE_PTY	"/dev/pts/n"	/* n = 0,1,...,12 */	       /* IRIX man page also says: /dev/tty[qrstuvwxyz][0-99] */#endif	/* } __sgi */#endif /* } !MASTER_PTY */#if !defined(MASTER_PTY)#define USE_DEFAULT#define MASTER_PTY	"/dev/ptyxx"#endif#if !defined(SLAVE_PTY)#define SLAVE_PTY	"/dev/ttyxx"#endifstatic char defSlave[]    = SLAVE_PTY;static char defMaster[]   = MASTER_PTY;static char ptynum[]      = "0123456789abcdef";static char ptylet[]      = "pqrs";#define LOC	((sizeof defMaster) - 2)	/* index of last character */extern int debug;extern char *progName;#if defined(_USE_STREAMS) /* { */int pushStream(fd, module) int fd; char *module; {   int res;      if (module != (char *) 0) {      res = ioctl(fd, I_FIND, module);	/* see streamio(7) sys/stropt.h */      if (res < 0) {	 log("%s: ioctl(%d, I_FIND, \"%s\") failed--%s\n", 	    progName, fd, module, ERRMSG);	 close(fd);	 return -1;      }      if (res == 0) {	/* module not already pushed */	 res = ioctl(fd, I_PUSH, module);	 if (res < 0) {	    log("%s: pushStream(%d, \"%s\") failed--%s\n", 	       progName, fd, module, ERRMSG);	    close(fd);	    return -1;	 }      }   }   return fd;}#endif /* } *//* * This funcion is necessary so that re-open's of the slave pty can  * make sure to initialize it correctly on some machines which will lose * it if the slave is closed and  reopened again. */int openSlavePty(sname, mode) char *sname; int mode; {   int res, fd = open(sname, mode, 0);   if (fd < 0) {      log("%s: openSlavePty(\"%s\", 0%o) failed--%s\n", 	 progName, sname, mode, ERRMSG);      return -1;   }#if defined(_USE_STREAMS) /* { */   fd = pushStream(fd, PTY_STREAM);   if (fd >= 0) {      fd = pushStream(fd, LDIS_STREAM);      if (fd >= 0) {	 fd = pushStream(fd, COMPAT_STREAM);      }   }#endif /* } _USE_STREAMS */   return fd;}/* * Find an available unused pty.  Open the master side and slave side. * Return the fd and names for the master and slave sides. * * The reasons you must open the slave are: *   - The open must be atomic to opening the master to prevent another *     process from grabbing the slave and stealing control. * *   - The slave open may be impossible because of permissions.  The slave *     pty changes ownership when login processes grab it. * * This can cause problems because the slave could become the new controlling * terminal for this process under certain conditions. * HP-UX9.0:pty(7)manPage: * *    The slave side of the pty interprets opening or closing the master *    side as a modem connection or disconnection on a real terminal.  Only *    one open to the master side of a pty is permitted.  An attempt to open *    an already open master side returns -1 and sets the external variable *    errno to EBUSY.  An attempt to open the master side of a pty that has *    a slave with an open file descriptor returns -1 and sets errno to *    EBUSY...An ioctl() request made on the slave side of a pty after *    the master side is closed returns -1 and sets the external variable *    errno to EIO. * * Ultrix:pty(4): The slave device can be opened multiple times, while the  *    master half can be opened only once. * * Thus, at the instant the open succeeds, we are guarenteed that the slave * side was not open by any other process, and we are the exclusive holder * of the open fd for the master side.   * * Two questions remain:  What happens if a read occurs on the master * before any process has opened the slave?  and, how can the master prevent * multiple opens on the slave?  On my machine, the only thing that prevents * a sufficiently determined process from opening the slave (even if it's  * already open by another process as the controlling terminal) is the  * permissions on the slave pty filename. * * The DEC alpha provides an openpty(3) and forkpty(3) call, but they are not  * available on HP-UX or Ultrix.  SGI IRIX provides something called  _getpty. * * Actually, the slave opening code is not really required. All we want to do  * is make sure that the slave has the correct permisisons. */int openPty(mode, slaveName, masterName, size, slaveFd)   int mode;   char *slaveName, *masterName;   unsigned size;   int *slaveFd;{   register char *letp = ptylet, *nump;    char *sname = defSlave, *mname = defMaster;   int fd = -1, res;#if defined(__SOLARIS__) || defined(DGUX) /* { */   fd = open(mname, mode);   if (debug > 1) {      log("%s: open(\"%s\", 0%o) returned %d\n", progName, mname, mode, fd);   }   if (fd >= 0) {      /* grantpt does chmod(mfd, 0620); chown(mfd, geteuid()), via a fork.       * Failure of grantpt is not usually fatal; if we're root already        * then we'll do it later explicitly anyway        */      res = grantpt(fd);       if (debug > 1) {	 log("%s: grantpt(%d) returned %d\n", progName, fd, res);      }      res = unlockpt(fd); /* clear lock on slave w/master fd for open() */      if (debug > 1) {	 log("%s: unlockpt(%d) returned %d\n", progName, fd, res);      }      if (res < 0) goto ptyFail;      sname = ptsname(fd); /*  <stdio.h> "/dev/pts/N", N = non-negative int */      if (sname == 0) {	 log("%s: ptsname(%d) failed--%s\n", progName, fd);	 goto ptyFail;      }      if (debug > 1) {	 log("%s: ptsname(%d) returned \"%s\"\n", progName, fd, sname);      }      if (slaveFd != (int *) 0) {	 *slaveFd = openSlavePty(sname, mode);	 if (*slaveFd < 0) goto ptyFail;      }   }#endif /* } __SOLARIS__ || DGUX  */#if defined(__sgi) && !defined(_USE_STREAMS)	/* { */   sname = _getpty(&fd, mode, S_IRUSR | S_IWUSR | S_IWGRP, 1);   if (sname == 0) {      log("%s: _getpty(&fd, %o, %o, 1) failed--%s\n",          progName, mode, S_IRUSR | S_IWUSR | S_IWGRP, ERRMSG);      goto ptyFail;   }   if (slaveFd != (int *) 0) {      *slaveFd = openSlavePty(sname, mode);      if (*slaveFd <= 0) goto ptyFail;   }#endif 	/* } __sgi */#if defined(USE_DEFAULT)	/* { */   do {      mname[LOC-1] = sname[LOC-1] = *letp;      nump = ptynum;      do {	 mname[LOC] = sname[LOC] = *nump;	 fd = open(mname, mode, 0);	 if (fd >= 0) {	    if (slaveFd == (int *) 0) goto gotPty;	    *slaveFd = openSlavePty(sname, mode);	    if (*slaveFd >= 0) goto gotPty;	    close(fd);	    fd = -1;	 }      } while (*++nump != '\0');   } while (*++letp != '\0');#endif	/* } USE_DEFAULT */gotPty:   if (fd >= 0) {      if (masterName != (char *) 0) {	 strncpy(masterName, mname, size);      }      if (slaveName != (char *) 0) {	 strncpy(slaveName, sname, size);      }   }ptyRtn:   return fd;ptyFail:   close(fd);   fd = -1;   goto ptyRtn;}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲免费观看高清完整版在线观看 | 精品一区二区免费视频| 国产91精品一区二区麻豆网站| 一区二区三区日韩| 久久久久久久久伊人| 欧美日韩一区在线| 福利一区在线观看| 另类小说欧美激情| 一区二区三区欧美在线观看| 久久精品男人的天堂| 国产成人av一区二区三区在线 | 亚洲欧洲精品一区二区三区不卡| 欧美日韩精品高清| 91麻豆精品91久久久久同性| 91啪在线观看| 国产在线播精品第三| 日韩精品亚洲一区| 夜夜爽夜夜爽精品视频| 中文字幕一区二区在线播放| 久久免费国产精品| 不卡视频免费播放| 亚洲第一成年网| 亚洲精品福利视频网站| 中文字幕亚洲综合久久菠萝蜜| 337p粉嫩大胆色噜噜噜噜亚洲 | 欧美视频中文字幕| 91在线视频观看| 成人久久久精品乱码一区二区三区| 久久黄色级2电影| 免费高清在线一区| 日产国产高清一区二区三区| 亚洲图片自拍偷拍| 天使萌一区二区三区免费观看| 亚洲精品欧美激情| 亚洲精品乱码久久久久久| 亚洲欧美日韩国产一区二区三区| 综合欧美一区二区三区| 亚洲人成精品久久久久久| 亚洲天堂精品在线观看| 亚洲欧美视频在线观看| 亚洲欧美经典视频| 亚洲国产日韩a在线播放| 亚洲v精品v日韩v欧美v专区| 午夜精品福利一区二区三区蜜桃| 亚洲成人黄色影院| 视频一区二区三区中文字幕| 秋霞午夜av一区二区三区| 免费人成网站在线观看欧美高清| 免费成人av在线| 欧美一区二区三区视频在线观看| 国产一区二区三区| 国产成人鲁色资源国产91色综| 国产福利一区二区三区视频| 丁香激情综合国产| 91麻豆精品在线观看| 欧美日韩亚洲另类| 欧美大片一区二区三区| 国产三级精品视频| 亚洲色图在线看| 日韩电影在线观看一区| 麻豆免费精品视频| 欧美日韩国产一级| 日韩欧美一区在线| 久久婷婷久久一区二区三区| 欧美激情综合五月色丁香小说| 国产精品毛片高清在线完整版| 亚洲日本欧美天堂| 美女视频一区二区| 成人精品视频.| 欧美系列在线观看| 久久综合国产精品| 亚洲精品乱码久久久久久 | 99re免费视频精品全部| 在线免费av一区| 精品国产一区二区精华| 中文字幕中文字幕一区二区| 亚洲高清一区二区三区| 国产精品亚洲第一| 欧美日本免费一区二区三区| 国产欧美日韩三区| 亚洲二区在线观看| 成人免费观看视频| 懂色av中文字幕一区二区三区| 一区二区三区中文在线| 捆绑紧缚一区二区三区视频| 99re视频精品| 久久亚洲欧美国产精品乐播 | 日韩成人午夜电影| 成人一区二区在线观看| 欧美二区乱c少妇| 亚洲欧洲av另类| 国产在线视频一区二区| 在线观看日韩国产| 在线91免费看| av在线播放不卡| 欧美本精品男人aⅴ天堂| 国产精品久久久久久户外露出| 日韩国产欧美在线视频| 91免费看`日韩一区二区| 精品毛片乱码1区2区3区| 亚洲一二三四久久| www.在线成人| 精品国内片67194| 性感美女久久精品| 色综合久久综合| 国产欧美一区二区精品久导航| 91亚洲精品久久久蜜桃网站| 欧美视频中文一区二区三区在线观看| 337p日本欧洲亚洲大胆色噜噜| 亚洲第一二三四区| 欧美色视频在线| 日韩av电影天堂| 91激情五月电影| 亚洲视频香蕉人妖| 色婷婷综合久色| 中文字幕av资源一区| 久久99久久久欧美国产| 久久女同精品一区二区| 亚洲桃色在线一区| 色婷婷久久久综合中文字幕| 一区在线播放视频| 麻豆精品精品国产自在97香蕉| 在线免费视频一区二区| 国产精品久久久久精k8| 欧美日本一道本在线视频| 亚洲欧美日韩中文字幕一区二区三区| 欧美日韩另类一区| 日韩国产欧美在线播放| 欧美三级中文字幕| 国产精品无遮挡| 久久成人免费网站| 国产欧美日韩激情| 欧美综合视频在线观看| 99久久国产综合精品女不卡| 在线免费观看视频一区| 亚洲欧美色一区| 国产盗摄女厕一区二区三区| 久久综合国产精品| 精品国产在天天线2019| 亚洲人成伊人成综合网小说| 91在线免费看| 亚洲免费观看高清完整版在线观看 | 香蕉加勒比综合久久| 日韩欧美一级片| 97精品久久久久中文字幕| 夜色激情一区二区| 精品国产乱码久久久久久免费| 久久爱www久久做| 欧美国产97人人爽人人喊| 欧美日韩电影一区| 欧美理论片在线| 亚洲精品写真福利| 人人爽香蕉精品| 麻豆国产一区二区| 精品久久国产字幕高潮| 国产一区二区视频在线| 国产欧美日本一区视频| 99久久国产综合色|国产精品| 一区二区成人在线视频| 7777女厕盗摄久久久| 国产一区二区精品久久| 日韩理论电影院| 在线播放一区二区三区| 国产一区欧美一区| 亚洲男同1069视频| 欧美一区二区三区性视频| 国产激情视频一区二区在线观看| 国产精品入口麻豆九色| 在线一区二区三区四区五区| 日韩精品高清不卡| 国产婷婷一区二区| 91黄色免费版| 九九精品一区二区| 亚洲男人的天堂av| 欧美不卡一区二区三区| 99久久99久久久精品齐齐| 秋霞电影一区二区| 亚洲少妇中出一区| 欧美一区二区久久久| 成人ar影院免费观看视频| 日日夜夜精品视频天天综合网| 久久精品男人天堂av| 欧美日韩日本视频| 国产精品一区在线观看乱码| 亚洲婷婷在线视频| 2020国产精品自拍| 欧美精品在线一区二区三区| 国产69精品久久久久毛片| 午夜精品爽啪视频| 国产精品久久久久永久免费观看| 欧美日韩国产综合久久 | 激情欧美一区二区| 亚洲在线免费播放| 中文字幕乱码亚洲精品一区| 欧美精品在线观看一区二区| 成人美女在线视频| 韩国精品在线观看| 日韩精品一级二级 | 亚洲综合一区二区三区| 国产亲近乱来精品视频 |