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 $ */
41 #define KLOGIN_PARANOID
43 #define PASSWD_FALLBACK
49 /* Any better way to test NO_MOTD? */
50 #if (SunOS >= 50) || defined(__hpux)
77 #ifdef HAVE_SYS_TYPES_H
78 #include <sys/types.h>
80 #ifdef TIME_WITH_SYS_TIME
83 #elif defined(HAVE_SYS_TIME_H)
88 #ifdef HAVE_SYS_STAT_H
94 #define S_ISTXT S_ISVTX
107 #ifdef HAVE_SYS_RESOURCE_H
108 #include <sys/resource.h>
109 #endif /* HAVE_SYS_RESOURCE_H */
110 #ifdef HAVE_SYS_WAIT_H
111 #include <sys/wait.h>
113 #ifdef HAVE_SYS_PARAM_H
114 #include <sys/param.h>
118 #define NCARGS 0x100000 /* (absolute) max # characters in exec arglist */
131 #ifdef HAVE_SYS_SOCKET_H
132 #include <sys/socket.h>
134 #ifdef HAVE_NETINET_IN_H
135 #include <netinet/in.h>
137 #ifdef HAVE_NETINET_IN_SYSTM_H
138 #include <netinet/in_systm.h>
140 #ifdef HAVE_NETINET_IP_H
141 #include <netinet/ip.h>
143 #ifdef HAVE_NETINET_TCP_H
144 #include <netinet/tcp.h>
146 #ifdef HAVE_ARPA_INET_H
147 #include <arpa/inet.h>
153 #if defined(HAVE_SYS_IOCTL_H) && SunOS != 40
154 #include <sys/ioctl.h>
156 #ifdef HAVE_SYS_IOCCOM_H
157 #include <sys/ioccom.h>
160 #ifdef HAVE_SYS_SOCKIO_H
161 #include <sys/sockio.h>
164 #ifdef HAVE_SYS_SELECT_H
165 #include <sys/select.h>
168 #ifdef HAVE_SYS_FILIO_H
169 #include <sys/filio.h>
172 #ifdef HAVE_SYS_STREAM_H
173 #ifdef HAVE_SYS_UIO_H
175 #endif /* HAVE_SYS_UIO_H */
176 #include <sys/stream.h>
177 #endif /* HAVE_SYS_STREAM_H */
179 #ifdef HAVE_SYS_PTYVAR_H
180 #ifdef HAVE_SYS_PROC_H
181 #include <sys/proc.h>
183 #ifdef HAVE_SYS_TTY_H
186 #ifdef HAVE_SYS_PTYIO_H
187 #include <sys/ptyio.h>
189 #include <sys/ptyvar.h>
190 #endif /* HAVE_SYS_PTYVAR_H */
196 #ifdef HAVE_SYS_CATEGORY_H
197 #include <sys/category.h>
200 /* Strange ioctls that are not always defined */
202 #ifndef TIOCPKT_FLUSHWRITE
203 #define TIOCPKT_FLUSHWRITE 0x02
206 #ifndef TIOCPKT_NOSTOP
207 #define TIOCPKT_NOSTOP 0x10
210 #ifndef TIOCPKT_DOSTOP
211 #define TIOCPKT_DOSTOP 0x20
215 #define TIOCPKT _IOW('t', 112, int) /* pty: set/clear packet mode */
218 #ifdef HAVE_LASTLOG_H
230 #ifdef HAVE_STROPTS_H
237 #define UT_NAMESIZE sizeof(((struct utmp *)0)->ut_name)
247 #endif /* HAVE_USERPW_H */
249 #ifdef HAVE_USERSEC_H
252 #endif /* HAVE_USERSEC_H */
255 #include "/usr/include/prot.h"
259 #define PRIO_PROCESS 0
268 /* This doesn't belong here. */
269 struct tm *localtime(const time_t *);
270 struct hostent *gethostbyname(const char *);
273 #define OPENSSL_DES_LIBDES_COMPATIBILITY
274 #include <openssl/des.h>
278 int kcmd(int *sock, char **ahost, u_int16_t rport, char *locuser,
279 char *remuser, char *cmd, int *fd2p, KTEXT ticket,
280 char *service, char *realm, CREDENTIALS *cred,
281 Key_schedule schedule, MSG_DAT *msg_data,
282 struct sockaddr_in *laddr, struct sockaddr_in *faddr,
285 int krcmd(char **ahost, u_int16_t rport, char *remuser, char *cmd,
286 int *fd2p, char *realm);
288 int krcmd_mutual(char **ahost, u_int16_t rport, char *remuser,
289 char *cmd,int *fd2p, char *realm,
290 CREDENTIALS *cred, Key_schedule sched);
292 int klogin(struct passwd *pw, char *instance, char *localhost, char *password);
301 char *colon(char *cp);
302 int okname(char *cp0);
303 int susystem(char *s, int userid);
305 int forkpty(int *amaster, char *name,
306 struct termios *termp, struct winsize *winp);
308 int forkpty_truncate(int *amaster, char *name, size_t name_sz,
309 struct termios *termp, struct winsize *winp);
312 #define MODEMASK (S_ISUID|S_ISGID|S_ISTXT|S_IRWXU|S_IRWXG|S_IRWXO)
318 #ifdef HAVE_MAILLOCK_H
319 #include <maillock.h>
321 #include "pathnames.h"
323 void stty_default (void);
325 int utmpx_login(char *line, char *user, char *host);
327 extern char **environ;
329 void sysv_newenv(int argc, char **argv, struct passwd *pwd,
330 char *term, int pflag);
332 int login_access(struct passwd *user, char *from);
333 void fatal(int f, const char *msg, int syserr);
335 extern int LEFT_JUSTIFIED;
337 /* used in des_read and des_write */
338 #define DES_RW_MAXWRITE (1024*16)
339 #define DES_RW_BSIZE (DES_RW_MAXWRITE+4)
341 void sysv_defaults(void);
342 void utmp_login(char *tty, char *username, char *hostname);
343 void sleepexit (int);
345 #ifndef HAVE_SETPRIORITY
346 #define setpriority(which, who, niceval) 0
349 #ifndef HAVE_GETPRIORITY
350 #define getpriority(which, who) 0
353 #ifdef HAVE_TERMIOS_H
357 #ifndef _POSIX_VDISABLE
358 #define _POSIX_VDISABLE 0
359 #endif /* _POSIX_VDISABLE */
361 #include <sys/ttold.h>
364 #if defined(HAVE_SYS_TERMIO_H) && !defined(HAVE_TERMIOS_H)
365 #include <sys/termio.h>
372 /* concession to Sun */
377 #ifndef TIOCPKT_WINDOW
378 #define TIOCPKT_WINDOW 0x80
381 int get_shell_port(int kerberos, int encryption);
382 int get_login_port(int kerberos, int encryption);
383 int speed_t2int (speed_t);
384 speed_t int2speed_t (int);
385 void ip_options_and_die (int sock, struct sockaddr_in *);
386 void warning(const char *fmt, ...)
388 __attribute__ ((format (printf, 1, 2)))
392 char *clean_ttyname (char *tty);
393 char *make_id (char *tty);
395 void prepare_utmp (struct utmp *utmp, char *tty, char *username,
399 int do_osfc2_magic(uid_t);
401 void paranoid_setuid (uid_t uid);