Deleted Added
sdiff udiff text old ( 80224 ) new ( 81965 )
full compact
1/*
2 * Copyright (c) 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 28 unchanged lines hidden (view full) ---

37 The Regents of the University of California. All rights reserved.\n";
38#endif /* not lint */
39
40#ifndef lint
41#if 0
42static const char sccsid[] = "@(#)telnetd.c 8.4 (Berkeley) 5/30/95";
43#endif
44static const char rcsid[] =
45 "$FreeBSD: head/contrib/telnet/telnetd/telnetd.c 80224 2001-07-23 21:52:26Z kris $";
46#endif /* not lint */
47
48#include "telnetd.h"
49#include "pathnames.h"
50
51#if defined(_SC_CRAY_SECURE_SYS) && !defined(SCM_SECURITY)
52/*
53 * UNICOS 6.0/6.1 do not have SCM_SECURITY defined, so we can
54 * use it to tell us to turn off all the socket security code,
55 * since that is only used in UNICOS 7.0 and later.
56 */
57# undef _SC_CRAY_SECURE_SYS
58#endif
59
60#include <err.h>
61#include <arpa/inet.h>
62
63#include <libutil.h>
64#include <utmp.h>
65
66#if defined(_SC_CRAY_SECURE_SYS)
67#include <sys/sysv.h>
68#include <sys/secdev.h>
69# ifdef SO_SEC_MULTI /* 8.0 code */
70#include <sys/secparm.h>
71#include <sys/usrv.h>

--- 770 unchanged lines hidden (view full) ---

842 */
843#ifndef convex
844 pty = getpty(&ptynum);
845 if (pty < 0)
846 fatal(net, "All network ports in use");
847#else
848 for (;;) {
849 char *lp;
850 extern char *line, *getpty();
851
852 if ((lp = getpty()) == NULL)
853 fatal(net, "Out of ptys");
854
855 if ((pty = open(lp, 2)) >= 0) {
856 strlcpy(line,lp,sizeof(line));
857 line[5] = 't';
858 break;
859 }
860 }
861#endif
862
863#if defined(_SC_CRAY_SECURE_SYS)
864 /*
865 * set ttyp line security label
866 */
867 if (secflag) {
868 char slave_dev[16];
869
870 sprintf(tty_dev, "/dev/pty/%03d", ptynum);
871 if (setdevs(tty_dev, &dv) < 0)
872 fatal(net, "cannot set pty security");
873 sprintf(slave_dev, "/dev/ttyp%03d", ptynum);
874 if (setdevs(slave_dev, &dv) < 0)
875 fatal(net, "cannot set tty security");
876 }
877#endif /* _SC_CRAY_SECURE_SYS */
878
879 /* get name of connected client */
880 if (realhostname_sa(remote_hostname, sizeof(remote_hostname) - 1,
881 who, who->sa_len) == HOSTNAME_INVALIDADDR && registerd_host_only)
882 fatal(net, "Couldn't resolve your address into a host name.\r\n\
883 Please contact your net administrator");
884 remote_hostname[sizeof(remote_hostname) - 1] = '\0';
885
886 trimdomain(remote_hostname, UT_HOSTSIZE);
887 if (!isdigit(remote_hostname[0]) && strlen(remote_hostname) > utmp_len)
888 err = getnameinfo(who, who->sa_len, remote_hostname,
889 sizeof(remote_hostname), NULL, 0,
890 NI_NUMERICHOST|NI_WITHSCOPEID);
891 /* XXX: do 'err' check */

--- 727 unchanged lines hidden ---