1 /* C K U P T Y . H -- Includes and definitions for ckupty.c */ 2 3 /* 4 Copyright 1995 by the Massachusetts Institute of Technology. 5 6 Modified for use in C-Kermit by: 7 8 Jeffrey E Altman <jaltman@secure-endpoints.com> 9 Secure Endpoints Inc., New York City 10 November 1999 11 */ 12 #ifndef __PTY_INT_H__ 13 #include <sys/types.h> 14 15 /* #define WANT_UTMP */ 16 /* We don't want all the utmp/wtmp stuff */ 17 18 #ifdef WANT_UTMP 19 #ifdef HAVE_UTMP_H 20 #include <utmp.h> 21 #endif /* HAVE_UTMP_H */ 22 #ifdef HAVE_UTMPX_H 23 #include <utmpx.h> 24 #endif /* HAVE_UTMPX_H */ 25 #endif /* WANT_UTMP */ 26 27 #ifdef HAVE_UNISTD_H 28 #include <unistd.h> 29 #endif /* HAVE_UNISTD_H */ 30 #ifdef __SCO__ 31 #include <sys/unistd.h> 32 #endif /* __SCO__ */ 33 #ifdef HAVE_STDLIB_H 34 #include <stdlib.h> 35 #endif /* HAVE_STDLIB_H */ 36 37 #include <stdio.h> 38 39 #include <sys/stat.h> 40 #ifndef SUNOS41 41 #include <sys/ioctl.h> 42 #endif /* SUNOS41 */ 43 #include <sys/file.h> 44 #include <sys/time.h> 45 #include <ctype.h> 46 #include <fcntl.h> 47 #include <netinet/in.h> 48 #include <errno.h> 49 #include <pwd.h> 50 51 #ifdef HAVE_SYS_LABEL_H 52 /* only SunOS 4? */ 53 #include <sys/label.h> 54 #include <sys/audit.h> 55 #include <pwdadj.h> 56 #endif /* HAVE_SYS_LABEL_H */ 57 58 #include <signal.h> 59 60 #ifdef HPUX 61 #include <sys/ptyio.h> 62 #endif /* HPUX */ 63 #ifdef sysvimp 64 #include <compat.h> 65 #endif /* sysvimp */ 66 67 #ifdef COMMENT 68 /* I don't think we actually use this for anything */ 69 /* and it kills Slackware builds, where there is no select.h. */ 70 #ifndef NO_SYS_SELECT_H 71 #ifdef HAVE_SYS_SELECT_H 72 #include <sys/select.h> 73 #endif /* HAVE_SYS_SELECT_H */ 74 #endif /* NO_SYS_SELECT_H */ 75 #endif /* COMMENT */ 76 77 #ifdef HAVE_STREAMS 78 #include <sys/stream.h> 79 #include <sys/stropts.h> 80 #endif /* HAVE_STREAMS */ 81 82 #ifdef POSIX_TERMIOS 83 #ifndef ultrix 84 #include <termios.h> 85 #else 86 #include <sgtty.h> 87 #endif /* ultrix */ 88 #else /* POSIX_TERMIOS */ 89 #include <sgtty.h> 90 #endif /* POSIX_TERMIOS */ 91 92 #include <netdb.h> 93 /* #include <syslog.h> */ 94 #ifndef ultrix 95 #include <string.h> 96 #endif /* ultrix */ 97 /* #include <sys/param.h> */ /* (now done in ckcdeb.h) */ 98 99 #ifdef HAVE_STREAMS 100 /* krlogin doesn't test sys/tty... */ 101 #ifdef HAVE_SYS_TTY_H 102 #include <sys/tty.h> 103 #endif /* HAVE_SYS_TTY_H */ 104 105 #ifdef HAVE_SYS_PTYVAR_H 106 /* Solaris actually uses packet mode, so the real macros are needed too */ 107 #include <sys/ptyvar.h> 108 #endif /* HAVE_SYS_PTYVAR_H */ 109 #endif /* HAVE_STREAMS */ 110 111 #ifdef COMMENT 112 /* This block moved to ckcdeb.h */ 113 #ifndef NO_OPENPTY 114 /* For NetBSD, see makefile */ 115 #ifndef HAVE_OPENPTY 116 #ifdef __FreeBSD__ 117 #define HAVE_OPENPTY 118 #else 119 #ifdef MACOSX10 120 #define HAVE_OPENPTY 121 #endif /* MACOSX10 */ 122 #endif /* __FreeBSD__ */ 123 #endif /* HAVE_OPENPTY */ 124 #endif /* NO_OPENPTY */ 125 #endif /* COMMENT */ 126 127 #ifdef HAVE_VHANGUP 128 #ifndef OPEN_CTTY_ONLY_ONCE 129 /* 130 Breaks under Ultrix and others where you cannot get controlling 131 terminal twice. 132 */ 133 #define VHANG_first 134 #define VHANG_LAST 135 #endif /* OPEN_CTTY_ONLY_ONCE */ 136 #endif /* HAVE_VHANGUP */ 137 138 /* Internal functions */ 139 _PROTOTYP(long ptyint_void_association,(void)); 140 _PROTOTYP(long ptyint_open_ctty ,(char *, int *)); 141 _PROTOTYP(VOID ptyint_vhangup, (void)); 142 143 #ifdef WANT_UTMP 144 _PROTOTYP(long ptyint_update_wtmp, (struct utmp *, char *, char *)); 145 #endif /* WANT_UTMP */ 146 147 #define __PTY_INT_H__ 148 #endif /* __PTY_INT_H__ */ 149 150 #ifndef __LIBPTY_H__ 151 152 #ifdef WANT_UTMP 153 /* Constants for pty_update_utmp */ 154 #define PTY_LOGIN_PROCESS 0 155 #define PTY_USER_PROCESS 1 156 #define PTY_DEAD_PROCESS 2 157 #define PTY_TTYSLOT_USABLE (0x1) /* flags to update_utmp*/ 158 #define PTY_UTMP_USERNAME_VALID (0x2) 159 #endif /* WANT_UTMP */ 160 161 _PROTOTYP(long pty_init,(void)); 162 _PROTOTYP(long pty_getpty, ( int *, char *, int)); 163 _PROTOTYP(long pty_open_slave, (char *, int *, int)); 164 _PROTOTYP(long pty_open_ctty, (char *, int *, int)); 165 _PROTOTYP(long pty_initialize_slave, (int)); 166 #ifdef WANT_UTMP 167 _PROTOTYP(long pty_update_utmp, (int, int, char *, char *, char *, int)); 168 _PROTOTYP(long pty_logwtmp, (char *, char *, char *)); 169 #endif /* WANT_UTMP */ 170 _PROTOTYP(long pty_cleanup, (char *, int, int)); 171 172 #define PTY_GETPTY_STREAMS (44806912L) 173 #define PTY_GETPTY_FSTAT (44806913L) 174 #define PTY_GETPTY_NOPTY (44806914L) 175 #define PTY_GETPTY_SLAVE_TOOLONG (44806915L) 176 #define PTY_OPEN_SLAVE_OPENFAIL (44806916L) 177 #define PTY_OPEN_SLAVE_CHMODFAIL (44806917L) 178 #define PTY_OPEN_SLAVE_NOCTTY (44806918L) 179 #define PTY_OPEN_SLAVE_CHOWNFAIL (44806919L) 180 #define PTY_OPEN_SLAVE_LINE_PUSHFAIL (44806920L) 181 #define PTY_OPEN_SLAVE_PUSH_FAIL (44806921L) 182 #define PTY_OPEN_SLAVE_REVOKEFAIL (44806922L) 183 #ifdef WANT_UTMP 184 #define PTY_UPDATE_UTMP_PROCTYPE_INVALID (44806923L) 185 #endif /* WANT_UTMP */ 186 #define PTY_OPEN_SLAVE_TOOSHORT (44806924L) 187 #define ERROR_TABLE_BASE_pty (44806912L) 188 189 extern struct error_table et_pty_error_table; 190 191 #define __LIBPTY_H__ 192 #endif /* __LIBPTY_H__ */ 193 194