2 * Copyright (c) 1995 - 2000 Kungliga Tekniska Högskolan
3 * (Royal Institute of Technology, Stockholm, Sweden).
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
17 * 3. Neither the name of the Institute nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 /* $Id: bsd_locl.h,v 1.111 1999/12/02 16:58:28 joda Exp $ */
35 /* $FreeBSD: src/crypto/kerberosIV/appl/bsd/bsd_locl.h,v 1.4.2.2 2003/02/13 21:34:35 nectar Exp $ */
36 /* $DragonFly: src/crypto/kerberosIV/appl/bsd/Attic/bsd_locl.h,v 1.2 2003/06/17 04:24:36 dillon Exp $ */
42 #define KLOGIN_PARANOID
44 #define PASSWD_FALLBACK
50 /* Any better way to test NO_MOTD? */
51 #if (SunOS >= 50) || defined(__hpux)
78 #ifdef HAVE_SYS_TYPES_H
79 #include <sys/types.h>
81 #ifdef TIME_WITH_SYS_TIME
84 #elif defined(HAVE_SYS_TIME_H)
89 #ifdef HAVE_SYS_STAT_H
95 #define S_ISTXT S_ISVTX
108 #ifdef HAVE_SYS_RESOURCE_H
109 #include <sys/resource.h>
110 #endif /* HAVE_SYS_RESOURCE_H */
111 #ifdef HAVE_SYS_WAIT_H
112 #include <sys/wait.h>
114 #ifdef HAVE_SYS_PARAM_H
115 #include <sys/param.h>
119 #define NCARGS 0x100000 /* (absolute) max # characters in exec arglist */
132 #ifdef HAVE_SYS_SOCKET_H
133 #include <sys/socket.h>
135 #ifdef HAVE_NETINET_IN_H
136 #include <netinet/in.h>
138 #ifdef HAVE_NETINET_IN_SYSTM_H
139 #include <netinet/in_systm.h>
141 #ifdef HAVE_NETINET_IP_H
142 #include <netinet/ip.h>
144 #ifdef HAVE_NETINET_TCP_H
145 #include <netinet/tcp.h>
147 #ifdef HAVE_ARPA_INET_H
148 #include <arpa/inet.h>
154 #if defined(HAVE_SYS_IOCTL_H) && SunOS != 40
155 #include <sys/ioctl.h>
157 #ifdef HAVE_SYS_IOCCOM_H
158 #include <sys/ioccom.h>
161 #ifdef HAVE_SYS_SOCKIO_H
162 #include <sys/sockio.h>
165 #ifdef HAVE_SYS_SELECT_H
166 #include <sys/select.h>
169 #ifdef HAVE_SYS_FILIO_H
170 #include <sys/filio.h>
173 #ifdef HAVE_SYS_STREAM_H
174 #ifdef HAVE_SYS_UIO_H
176 #endif /* HAVE_SYS_UIO_H */
177 #include <sys/stream.h>
178 #endif /* HAVE_SYS_STREAM_H */
180 #ifdef HAVE_SYS_PTYVAR_H
181 #ifdef HAVE_SYS_PROC_H
182 #include <sys/proc.h>
184 #ifdef HAVE_SYS_TTY_H
187 #ifdef HAVE_SYS_PTYIO_H
188 #include <sys/ptyio.h>
190 #include <sys/ptyvar.h>
191 #endif /* HAVE_SYS_PTYVAR_H */
197 #ifdef HAVE_SYS_CATEGORY_H
198 #include <sys/category.h>
201 /* Strange ioctls that are not always defined */
203 #ifndef TIOCPKT_FLUSHWRITE
204 #define TIOCPKT_FLUSHWRITE 0x02
207 #ifndef TIOCPKT_NOSTOP
208 #define TIOCPKT_NOSTOP 0x10
211 #ifndef TIOCPKT_DOSTOP
212 #define TIOCPKT_DOSTOP 0x20
216 #define TIOCPKT _IOW('t', 112, int) /* pty: set/clear packet mode */
219 #ifdef HAVE_LASTLOG_H
231 #ifdef HAVE_STROPTS_H
238 #define UT_NAMESIZE sizeof(((struct utmp *)0)->ut_name)
248 #endif /* HAVE_USERPW_H */
250 #ifdef HAVE_USERSEC_H
253 #endif /* HAVE_USERSEC_H */
256 #include "/usr/include/prot.h"
260 #define PRIO_PROCESS 0
269 /* This doesn't belong here. */
270 struct tm *localtime(const time_t *);
271 struct hostent *gethostbyname(const char *);
274 #define OPENSSL_DES_LIBDES_COMPATIBILITY
275 #include <openssl/des.h>
279 int kcmd(int *sock, char **ahost, u_int16_t rport, char *locuser,
280 char *remuser, char *cmd, int *fd2p, KTEXT ticket,
281 char *service, char *realm, CREDENTIALS *cred,
282 Key_schedule schedule, MSG_DAT *msg_data,
283 struct sockaddr_in *laddr, struct sockaddr_in *faddr,
286 int krcmd(char **ahost, u_int16_t rport, char *remuser, char *cmd,
287 int *fd2p, char *realm);
289 int krcmd_mutual(char **ahost, u_int16_t rport, char *remuser,
290 char *cmd,int *fd2p, char *realm,
291 CREDENTIALS *cred, Key_schedule sched);
293 int klogin(struct passwd *pw, char *instance, char *localhost, char *password);
302 char *colon(char *cp);
303 int okname(char *cp0);
304 int susystem(char *s, int userid);
306 int forkpty(int *amaster, char *name,
307 struct termios *termp, struct winsize *winp);
309 int forkpty_truncate(int *amaster, char *name, size_t name_sz,
310 struct termios *termp, struct winsize *winp);
313 #define MODEMASK (S_ISUID|S_ISGID|S_ISTXT|S_IRWXU|S_IRWXG|S_IRWXO)
319 #ifdef HAVE_MAILLOCK_H
320 #include <maillock.h>
322 #include "pathnames.h"
324 void stty_default (void);
326 int utmpx_login(char *line, char *user, char *host);
328 extern char **environ;
330 void sysv_newenv(int argc, char **argv, struct passwd *pwd,
331 char *term, int pflag);
333 int login_access(struct passwd *user, char *from);
334 void fatal(int f, const char *msg, int syserr);
336 extern int LEFT_JUSTIFIED;
338 /* used in des_read and des_write */
339 #define DES_RW_MAXWRITE (1024*16)
340 #define DES_RW_BSIZE (DES_RW_MAXWRITE+4)
342 void sysv_defaults(void);
343 void utmp_login(char *tty, char *username, char *hostname);
344 void sleepexit (int);
346 #ifndef HAVE_SETPRIORITY
347 #define setpriority(which, who, niceval) 0
350 #ifndef HAVE_GETPRIORITY
351 #define getpriority(which, who) 0
354 #ifdef HAVE_TERMIOS_H
358 #ifndef _POSIX_VDISABLE
359 #define _POSIX_VDISABLE 0
360 #endif /* _POSIX_VDISABLE */
362 #include <sys/ttold.h>
365 #if defined(HAVE_SYS_TERMIO_H) && !defined(HAVE_TERMIOS_H)
366 #include <sys/termio.h>
373 /* concession to Sun */
378 #ifndef TIOCPKT_WINDOW
379 #define TIOCPKT_WINDOW 0x80
382 int get_shell_port(int kerberos, int encryption);
383 int get_login_port(int kerberos, int encryption);
384 int speed_t2int (speed_t);
385 speed_t int2speed_t (int);
386 void ip_options_and_die (int sock, struct sockaddr_in *);
387 void warning(const char *fmt, ...)
389 __attribute__ ((format (printf, 1, 2)))
393 char *clean_ttyname (char *tty);
394 char *make_id (char *tty);
396 void prepare_utmp (struct utmp *utmp, char *tty, char *username,
400 int do_osfc2_magic(uid_t);
402 void paranoid_setuid (uid_t uid);