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 81965 2001-08-20 12:28:40Z markm $"; |
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 <sys/mman.h> |
64#include <libutil.h> |
65#include <paths.h> |
66#include <utmp.h> 67 68#if defined(_SC_CRAY_SECURE_SYS) 69#include <sys/sysv.h> 70#include <sys/secdev.h> 71# ifdef SO_SEC_MULTI /* 8.0 code */ 72#include <sys/secparm.h> 73#include <sys/usrv.h> --- 770 unchanged lines hidden (view full) --- 844 */ 845#ifndef convex 846 pty = getpty(&ptynum); 847 if (pty < 0) 848 fatal(net, "All network ports in use"); 849#else 850 for (;;) { 851 char *lp; |
852 853 if ((lp = getpty()) == NULL) 854 fatal(net, "Out of ptys"); 855 856 if ((pty = open(lp, 2)) >= 0) { 857 strlcpy(line,lp,sizeof(line)); 858 line[5] = 't'; 859 break; 860 } 861 } 862#endif 863 864#if defined(_SC_CRAY_SECURE_SYS) 865 /* 866 * set ttyp line security label 867 */ 868 if (secflag) { 869 char slave_dev[16]; 870 |
871 sprintf(tty_dev, "%spty/%03d", _PATH_DEV, ptynum); |
872 if (setdevs(tty_dev, &dv) < 0) 873 fatal(net, "cannot set pty security"); |
874 sprintf(slave_dev, "%sp%03d", _PATH_TTY, ptynum); |
875 if (setdevs(slave_dev, &dv) < 0) 876 fatal(net, "cannot set tty security"); 877 } 878#endif /* _SC_CRAY_SECURE_SYS */ 879 880 /* get name of connected client */ 881 if (realhostname_sa(remote_hostname, sizeof(remote_hostname) - 1, 882 who, who->sa_len) == HOSTNAME_INVALIDADDR && registerd_host_only) 883 fatal(net, "Couldn't resolve your address into a host name.\r\n\ |
884 Please contact your net administrator"); |
885 remote_hostname[sizeof(remote_hostname) - 1] = '\0'; 886 887 trimdomain(remote_hostname, UT_HOSTSIZE); 888 if (!isdigit(remote_hostname[0]) && strlen(remote_hostname) > utmp_len) 889 err = getnameinfo(who, who->sa_len, remote_hostname, 890 sizeof(remote_hostname), NULL, 0, 891 NI_NUMERICHOST|NI_WITHSCOPEID); 892 /* XXX: do 'err' check */ --- 727 unchanged lines hidden --- |