diff options
Diffstat (limited to 'gnu/libexec/uucp')
-rw-r--r-- | gnu/libexec/uucp/common_sources/conf.h | 444 | ||||
-rw-r--r-- | gnu/libexec/uucp/common_sources/tcp.c | 477 | ||||
-rw-r--r-- | gnu/libexec/uucp/common_sources/tli.c | 582 | ||||
-rwxr-xr-x | gnu/libexec/uucp/contrib/uureroute | 91 | ||||
-rw-r--r-- | gnu/libexec/uucp/sample/call | 20 | ||||
-rw-r--r-- | gnu/libexec/uucp/sample/config | 88 | ||||
-rw-r--r-- | gnu/libexec/uucp/sample/dial | 35 | ||||
-rw-r--r-- | gnu/libexec/uucp/sample/dialcode | 19 | ||||
-rw-r--r-- | gnu/libexec/uucp/sample/passwd | 18 | ||||
-rw-r--r-- | gnu/libexec/uucp/sample/port | 41 | ||||
-rw-r--r-- | gnu/libexec/uucp/sample/sys1 | 44 | ||||
-rw-r--r-- | gnu/libexec/uucp/sample/sys2 | 51 |
12 files changed, 0 insertions, 1910 deletions
diff --git a/gnu/libexec/uucp/common_sources/conf.h b/gnu/libexec/uucp/common_sources/conf.h deleted file mode 100644 index 9053c4423e0a..000000000000 --- a/gnu/libexec/uucp/common_sources/conf.h +++ /dev/null @@ -1,444 +0,0 @@ -/* conf.h. Generated automatically by configure. */ -/* Configuration header file for Taylor UUCP. -*- C -*- */ - -/* Set MAIL_PROGRAM to a program which takes a mail address as an - argument and accepts a mail message to send to that address on - stdin (e.g. "/bin/mail"). */ -#define MAIL_PROGRAM "/usr/bin/mail" - -/* Set ECHO_PROGRAM to a program which echoes its arguments; if echo - is a shell builtin you can just use "echo". */ -#define ECHO_PROGRAM "echo" - -/* The following macros indicate what header files you have. Set the - macro to 1 if you have the corresponding header file, or 0 if you - do not. */ -#define HAVE_STDDEF_H 1 /* <stddef.h> */ -#define HAVE_STRING_H 1 /* <string.h> */ -#define HAVE_STRINGS_H 1 /* <strings.h> */ -#define HAVE_UNISTD_H 1 /* <unistd.h> */ -#define HAVE_STDLIB_H 1 /* <stdlib.h> */ -#define HAVE_LIMITS_H 1 /* <limits.h> */ -#define HAVE_TIME_H 1 /* <time.h> */ -#define HAVE_SYS_WAIT_H 1 /* <sys/wait.h> */ -#define HAVE_SYS_IOCTL_H 1 /* <sys/ioctl.h> */ -#define HAVE_DIRENT_H 1 /* <dirent.h> */ -#define HAVE_MEMORY_H 1 /* <memory.h> */ -#define HAVE_SYS_PARAM_H 1 /* <sys/param.h> */ -#define HAVE_UTIME_H 1 /* <utime.h> */ -#define HAVE_FCNTL_H 1 /* <fcntl.h> */ -#define HAVE_SYS_FILE_H 1 /* <sys/file.h> */ -#define HAVE_SYS_TIMES_H 1 /* <sys/times.h> */ -#define HAVE_LIBC_H 0 /* <libc.h> */ -#define HAVE_SYSEXITS_H 1 /* <sysexits.h> */ -#define HAVE_POLL_H 0 /* <poll.h> */ -#define HAVE_TIUSER_H 0 /* <tiuser.h> */ -#define HAVE_XTI_H 0 /* <xti.h> */ -#define HAVE_SYS_TLI_H 0 /* <sys/tli.h> */ -#define HAVE_STROPTS_H 0 /* <stropts.h> */ -#define HAVE_FTW_H 0 /* <ftw.h> */ -#define HAVE_GLOB_H 1 /* <glob.h> */ -#define HAVE_SYS_SELECT_H 0 /* <sys/select.h> */ -#define HAVE_SYS_TYPES_TCP_H 0 /* <sys/types.tcp.h> */ - -/* If major and minor are not defined in <sys/types.h>, but are in - <sys/mkdev.h>, set MAJOR_IN_MKDEV to 1. If they are in - <sys/sysmacros.h>, set MAJOR_IN_SYSMACROS to 1. */ -#define MAJOR_IN_MKDEV 0 -#define MAJOR_IN_SYSMACROS 0 - -/* If the macro offsetof is not defined in <stddef.h>, you may give it - a definition here. If you do not, the code will use a definition - (in uucp.h) that should be fairly portable. */ -/* #define offsetof */ - -/* Set RETSIGTYPE to the return type of a signal handler. On newer - systems this will be void; some older systems use int. */ -#define RETSIGTYPE void - -/* Set HAVE_SYS_TIME_AND_TIME_H to 1 if <time.h> and <sys/time.h> can both - be included in a single source file; if you don't have either or both of - them, it doesn't matter what you set this to. */ -#define HAVE_SYS_TIME_AND_TIME_H 1 - -/* Set HAVE_TERMIOS_AND_SYS_IOCTL_H to 1 if <termios.h> and <sys/ioctl.h> - can both be included in a single source file; if you don't have either - or both of them, it doesn't matter what you set this to. */ -#define HAVE_TERMIOS_AND_SYS_IOCTL_H 1 - -/* If you are configuring by hand, you should set one of the terminal - driver options in policy.h. If you are autoconfiguring, the script - will check whether your system defines CBREAK, which is a terminal - setting; if your system supports CBREAK, and you don't set a terminal - driver in policy.h, the code will assume that you have a BSD style - terminal driver. */ -#define HAVE_CBREAK 1 - -/* The package needs several standard types. If you are using the - configure script, it will look in standard places for these types, - and give default definitions for them here if it doesn't find them. - The default definitions should work on most systems, but you may - want to check them. If you are configuring by hand, you will have - to figure out whether the types are defined on your system, and - what they should be defined to. - - Any type that is not defined on your system should get a macro - definition. The definition should be of the name of the type in - all capital letters. For example, #define PID_T int. If the type - is defined in a standard header file, the macro name should not be - defined. */ - -/* The type pid_t is used to hold a process ID number. It is normally - defined in <sys/types.h>. This is the type returned by the - functions fork or getpid. Usually int will work fine. */ -#undef PID_T - -/* The type uid_t is used to hold a user ID number. It is normally - defined in <sys/types.h>. This is the type returned by the getuid - function. Usually int will work fine. */ -#undef UID_T - -/* The type gid_t is used to hold a group ID number. It is sometimes - defined in <sys/types.h>. This is the type returned by the getgid - function. Usually int will work fine. */ -#undef GID_T - -/* The type off_t is used to hold an offset in a file. It is sometimes - defined in <sys/types.h>. This is the type of the second argument to - the lseek function. Usually long will work fine. */ -#undef OFF_T - -/* Set HAVE_SIG_ATOMIC_T_IN_SIGNAL_H if the type sig_atomic_t is defined - in <signal.h> as required by ANSI C. */ -#define HAVE_SIG_ATOMIC_T_IN_SIGNAL_H 0 - -/* Set HAVE_SIG_ATOMIC_T_IN_TYPES_H if the type sig_atomic_t is defined - in <sys/types.h>. This is ignored if HAVE_SIG_ATOMIC_T_IN_SIGNAL_H is - set to 1. */ -#define HAVE_SIG_ATOMIC_T_IN_TYPES_H 0 - -/* The type sig_atomic_t is used to hold a value which may be - referenced in a single atomic operation. If it is not defined in - either <signal.h> or <sys/types.h>, you may want to give it a - definition here. If you don't, the code will use char. If your - compiler does not support sig_atomic_t, there is no type which is - really correct; fortunately, for this package it does not really - matter very much. */ -#undef SIG_ATOMIC_T - -/* Set HAVE_SIZE_T_IN_STDDEF_H to 1 if the type size_t is defined in - <stddef.h> as required by ANSI C. */ -#define HAVE_SIZE_T_IN_STDDEF_H 1 - -/* Set HAVE_SIZE_T_IN_TYPES_H to 1 if the type size_t is defined in - <sys/types.h>. This is ignored if HAVE_SIZE_T_IN_STDDEF_H is set - to 1. */ -#define HAVE_SIZE_T_IN_TYPES_H 1 - -/* The type size_t is used to hold the size of an object. In - particular, an argument of this type is passed as the size argument - to the malloc and realloc functions. If size_t is not defined in - either <stddef.h> or <sys/types.h>, you may want to give it a - definition here. If you don't, the code will use unsigned. */ -#undef SIZE_T - -/* Set HAVE_TIME_T_IN_TIME_H to 1 if the type time_t is defined in - <time.h>, as required by the ANSI C standard. */ -#define HAVE_TIME_T_IN_TIME_H 1 - -/* Set HAVE_TIME_T_IN_TYPES_H to 1 if the type time_t is defined in - <sys/types.h>. This is ignored if HAVE_TIME_T_IN_TIME_H is set to - 1. */ -#define HAVE_TIME_T_IN_TYPES_H 1 - -/* When Taylor UUCP is talking to another instance of itself, it will - tell the other side the size of a file before it is transferred. - If the package can determine how much disk space is available, it - will use this information to avoid filling up the disk. Define one - of the following macros to tell the code how to determine the - amount of available disk space. It is possible that none of these - are appropriate; it will do no harm to use none of them, but, of - course, nothing will then prevent the package from filling up the - disk. Note that this space check is only useful when talking to - another instance of Taylor UUCP. - - STAT_STATVFS statvfs function - STAT_STATFS2_BSIZE two argument statfs function with f_bsize field - STAT_STATFS2_FSIZE two argument statfs function with f_fsize field - STAT_STATFS2_FS_DATA two argument statfs function with fd_req field - STAT_STATFS4 four argument statfs function - STAT_USTAT the ustat function with 512 byte blocks. */ -#define STAT_STATVFS 0 -#define STAT_STATFS2_BSIZE 0 -#define STAT_STATFS2_FSIZE 1 -#define STAT_STATFS2_FS_DATA 0 -#define STAT_STATFS4 0 -#define STAT_USTAT 0 - -/* Set HAVE_VOID to 1 if the compiler supports declaring functions with - a return type of void and casting values to void. */ -#define HAVE_VOID 1 - -/* Set HAVE_UNSIGNED_CHAR to 1 if the compiler supports the type unsigned - char. */ -#define HAVE_UNSIGNED_CHAR 1 - -/* Set HAVE_ERRNO_DECLARATION to 1 if errno is declared in <errno.h>. */ -#define HAVE_ERRNO_DECLARATION 1 - -/* There are now a number of functions to check for. For each of - these, the macro HAVE_FUNC should be set to 1 if your system has - FUNC. For example, HAVE_VFPRINTF should be set to 1 if your system - has vfprintf, 0 otherwise. */ - -/* Taylor UUCP will take advantage of the following functions if they - are available, but knows how to deal with their absence. */ -#define HAVE_VFPRINTF 1 -#define HAVE_FTRUNCATE 1 -#define HAVE_LTRUNC 0 -#define HAVE_WAITPID 1 -#define HAVE_WAIT4 1 -#define HAVE_GLOB 1 -#define HAVE_SETREUID 1 - -/* There are several functions which are replaced in the subdirectory - lib. If they are missing, the configure script will automatically - add them to lib/Makefile to force them to be recompiled. If you - are configuring by hand, you will have to do this yourself. The - string @LIBOBJS@ in lib/Makefile.in should be replaced by a list of - object files in lib/Makefile. The following comments tell you - which object file names to add (they are generally fairly obvious, - given that the file names have no more than six characters before - the period). */ - -/* For each of these functions, if it does not exist, the indicated - object file should be added to lib/Makefile. */ -#define HAVE_BSEARCH 1 /* bsrch.o */ -#define HAVE_GETLINE 0 /* getlin.o */ -#define HAVE_MEMCHR 1 /* memchr.o */ -#define HAVE_STRDUP 1 /* strdup.o */ -#define HAVE_STRSTR 1 /* strstr.o */ -#define HAVE_STRTOL 1 /* strtol.o */ - -/* If neither of these functions exists, you should add bzero.o to - lib/Makefile. */ -#define HAVE_BZERO 1 -#define HAVE_MEMSET 1 - -/* If neither of these functions exists, you should add memcmp.o to - lib/Makefile. */ -#define HAVE_MEMCMP 1 -#define HAVE_BCMP 1 - -/* If neither of these functions exists, you should add memcpy.o to - lib/Makefile. */ -#define HAVE_MEMCPY 1 -#define HAVE_BCOPY 1 - -/* If neither of these functions exists, you should add strcas.o to - lib/Makefile. */ -#define HAVE_STRCASECMP 1 -#define HAVE_STRICMP 0 - -/* If neither of these functions exists, you should add strncs.o to - lib/Makefile. */ -#define HAVE_STRNCASECMP 1 -#define HAVE_STRNICMP 0 - -/* If neither of these functions exists, you should add strchr.o to - lib/Makefile. */ -#define HAVE_STRCHR 1 -#define HAVE_INDEX 1 - -/* If neither of these functions exists, you should add strrch.o to - lib/Makefile. */ -#define HAVE_STRRCHR 1 -#define HAVE_RINDEX 1 - -/* There are also Unix specific functions which are replaced in the - subdirectory unix. If they are missing, the configure script will - automatically add them to unix/Makefile to force them to be - recompiled. If you are configuring by hand, you will have to do - this yourself. The string @UNIXOBJS@ in unix/Makefile.in should be - replaced by a list of object files in unix/Makefile. The following - comments tell you which object file names to add. */ - -/* For each of these functions, if it does not exist, the indicated - object file should be added to unix/Makefile. */ -#define HAVE_OPENDIR 1 /* dirent.o */ -#define HAVE_DUP2 1 /* dup2.o */ -#define HAVE_FTW 0 /* ftw.o */ -#define HAVE_REMOVE 1 /* remove.o */ -#define HAVE_RENAME 1 /* rename.o */ -#define HAVE_STRERROR 1 /* strerr.o */ - -/* The code needs to know how to create directories. If you have the - mkdir function, set HAVE_MKDIR to 1 and replace @UUDIR@ in - Makefile.in with '# ' (the configure script will set @UUDIR@ - according to the variable UUDIR). Otherwise, set HAVE_MKDIR to 0, - remove @UUDIR@ from Makefile.in, set MKDIR_PROGRAM to the name of - the program which will create a directory named on the command line - (e.g., "/bin/mkdir"), and add mkdir.o to the @UNIXOBJS@ string in - unix/Makefile.in. */ -#define HAVE_MKDIR 1 -#define MKDIR_PROGRAM unused - -/* The code also needs to know how to remove directories. If you have - the rmdir function, set HAVE_RMDIR to 1. Otherwise, set - RMDIR_PROGRAM to the name of the program which will remove a - directory named on the command line (e.g., "/bin/rmdir") and add - rmdir.o to the @UNIXOBJS@ string in unix/Makefile.in. */ -#define HAVE_RMDIR 1 -#define RMDIR_PROGRAM unused - -/* The code needs to know to how to get the name of the current - directory. If getcwd is available it will be used, otherwise if - getwd is available it will be used. Otherwise, set PWD_PROGRAM to - the name of the program which will print the name of the current - working directory (e.g., "/bin/pwd") and add getcwd.o to the - @UNIXOBJS@ string in unix/Makefile.in. */ -#define HAVE_GETCWD 1 -#define HAVE_GETWD 1 -#define PWD_PROGRAM unused - -/* If you have either sigsetjmp or setret, it will be used instead of - setjmp. These functions will only be used if your system restarts - system calls after interrupts (see HAVE_RESTARTABLE_SYSCALLS, - below). */ -#define HAVE_SIGSETJMP 0 -#define HAVE_SETRET 0 - -/* The code needs to know what function to use to set a signal - handler. If will try to use each of the following functions in - turn. If none are available, it will use signal, which is assumed - to always exist. */ -#define HAVE_SIGACTION 1 -#define HAVE_SIGVEC 1 -#define HAVE_SIGSET 0 - -/* If the code is going to use sigvec (HAVE_SIGACTION is 0 and - HAVE_SIGVEC is 1), then HAVE_SIGVEC_SV_FLAGS must be set to 1 if - the sigvec structure contains the sv_flags field, or 0 if the - sigvec structure contains the sv_onstack field. If the code is not - going to use sigvec, it doesn't matter what this is set to. */ -#define HAVE_SIGVEC_SV_FLAGS 1 - -/* The code will try to use each of the following functions in turn - when blocking signals from delivery. If none are available, a - relatively unimportant race condition will exist. */ -#define HAVE_SIGPROCMASK 1 -#define HAVE_SIGBLOCK 1 -#define HAVE_SIGHOLD 0 - -/* If you have either of the following functions, it will be used to - determine the number of file descriptors which may be open. - Otherwise, the code will use OPEN_MAX if defined, then NOFILE if - defined, then 20. */ -#define HAVE_GETDTABLESIZE 1 -#define HAVE_SYSCONF 0 - -/* The code will use one of the following functions when detaching - from a terminal. One of these must exist. */ -#define HAVE_SETPGRP 0 -#define HAVE_SETSID 1 - -/* If you do not specify the local node name in the main configuration - file, Taylor UUCP will try to use each of the following functions - in turn. If neither is available, you must specify the local node - name in the configuration file. */ -#define HAVE_GETHOSTNAME 1 -#define HAVE_UNAME 0 - -/* The code will try to use each of the following functions in turn to - determine the current time. If none are available, it will use - time, which is assumed to always exist. */ -#define HAVE_GETTIMEOFDAY 1 -#define HAVE_FTIME 0 - -/* If neither gettimeofday nor ftime is available, the code will use - times (if available) to measure a span of time. See also the - discussion of TIMES_TICK in policy.h. */ -#define HAVE_TIMES 1 - -/* When a chat script requests a pause of less than a second with \p, - Taylor UUCP will try to use each of the following functions in - turn. If none are available, it will sleep for a full second. - Also, the (non-portable) tstuu program requires either select or - poll. */ -#define HAVE_NAPMS 0 -#define HAVE_NAP 0 -#define HAVE_USLEEP 1 -#define HAVE_POLL 0 -#define HAVE_SELECT 1 - -/* If the getgrent function is available, it will be used to determine - all the groups a user belongs to when checking file access - permissions. */ -#define HAVE_GETGRENT 1 - -/* If the socket function is available, TCP support code will be - compiled in. */ -#define HAVE_SOCKET 1 - -/* If the t_open function is available, TLI support code will be - compiled in. This may require adding a library, such as -lnsl or - -lxti, to the Makefile variables LIBS. */ -#define HAVE_T_OPEN 0 - -/* That's the end of the list of the functions. Now there are a few - last miscellaneous items. */ - -/* On some systems the following functions are declared in such a way - that the code cannot make a simple extern. On other systems, these - functions are not declared at all, and the extern is required. If - a declaration of the function, as shown, compiles on your system, - set the value to 1. Not all functions declared externally are - listed here, only the ones with which I have had trouble. */ -/* extern long times (); */ -#define TIMES_DECLARATION_OK 0 -/* extern struct passwd *getpwnam (); */ -#define GETPWNAM_DECLARATION_OK 1 -/* extern struct passwd *getpwuid (); */ -#define GETPWUID_DECLARATION_OK 0 -/* extern struct group *getgrent (); */ -#define GETGRENT_DECLARATION_OK 1 - -/* Set HAVE_BSD_PGRP to 1 if your getpgrp call takes 1 argument and - your setpgrp calls takes 2 arguments (on System V they generally - take no arguments). You can safely set this to 1 on System V, - provided the call will compile without any errors. */ -#define HAVE_BSD_PGRP 0 - -/* Set HAVE_UNION_WAIT to 1 if union wait is defined in the header - file <sys/wait.h>. */ -#define HAVE_UNION_WAIT 1 - -/* Set HAVE_LONG_FILE_NAMES to 1 if the system supports file names - longer than 14 characters. */ -#define HAVE_LONG_FILE_NAMES 1 - -/* If slow system calls are restarted after interrupts, set - HAVE_RESTARTABLE_SYSCALLS to 1. This is ignored if HAVE_SIGACTION - is 1 or if HAVE_SIGVEC is 1 and HAVE_SIGVEC_SV_FLAGS is 1 and - SV_INTERRUPT is defined in <signal.h>. In both of these cases - system calls can be prevented from restarting. */ -#define HAVE_RESTARTABLE_SYSCALLS 1 - -/* Some systems supposedly need the following macros to be defined. - These are handled by the configure script (it will turn #undef into - #define when appropriate, which is why the peculiar #ifndef #undef - construction is used). If you are configuring by hand, you may add - appropriate definitions here, or just add them to CFLAGS when - running make. */ -#ifndef _ALL_SOURCE -#undef _ALL_SOURCE -#endif -#ifndef _POSIX_SOURCE -#undef _POSIX_SOURCE -#endif -#ifndef _MINIX -#undef _MINIX -#endif -#ifndef _POSIX_1_SOURCE -#undef _POSIX_1_SOURCE -#endif diff --git a/gnu/libexec/uucp/common_sources/tcp.c b/gnu/libexec/uucp/common_sources/tcp.c deleted file mode 100644 index 161e5f9ed466..000000000000 --- a/gnu/libexec/uucp/common_sources/tcp.c +++ /dev/null @@ -1,477 +0,0 @@ -/* tcp.c - Code to handle TCP connections. - - Copyright (C) 1991, 1992, 1993 Ian Lance Taylor - - This file is part of the Taylor UUCP package. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - The author of the program may be contacted at ian@airs.com or - c/o Cygnus Support, Building 200, 1 Kendall Square, Cambridge, MA 02139. - */ - -#include "uucp.h" - -#if USE_RCS_ID -const char tcp_rcsid[] = "$Id: tcp.c,v 1.2 1994/05/07 18:09:01 ache Exp $"; -#endif - -#if HAVE_TCP - -#include "uudefs.h" -#include "uuconf.h" -#include "sysdep.h" -#include "conn.h" -#include "system.h" - -#include <errno.h> - -#if HAVE_SYS_TYPES_TCP_H -#include <sys/types.tcp.h> -#endif -#include <sys/socket.h> -#include <netdb.h> -#include <netinet/in.h> - -#if HAVE_FCNTL_H -#include <fcntl.h> -#else -#if HAVE_SYS_FILE_H -#include <sys/file.h> -#endif -#endif - -#ifndef FD_CLOEXEC -#define FD_CLOEXEC 1 -#endif - -/* This code handles TCP connections. It assumes a Berkeley socket - interface. */ - -/* The normal "uucp" port number. */ -#define IUUCP_PORT (540) - -/* Local functions. */ -static void utcp_free P((struct sconnection *qconn)); -static boolean ftcp_open P((struct sconnection *qconn, long ibaud, - boolean fwait)); -static boolean ftcp_close P((struct sconnection *qconn, - pointer puuconf, - struct uuconf_dialer *qdialer, - boolean fsuccess)); -static boolean ftcp_dial P((struct sconnection *qconn, pointer puuconf, - const struct uuconf_system *qsys, - const char *zphone, - struct uuconf_dialer *qdialer, - enum tdialerfound *ptdialer)); -static int itcp_port_number P((const char *zport)); - -/* The command table for a TCP connection. */ -static const struct sconncmds stcpcmds = -{ - utcp_free, - NULL, /* pflock */ - NULL, /* pfunlock */ - ftcp_open, - ftcp_close, - ftcp_dial, - fsysdep_conn_read, - fsysdep_conn_write, - fsysdep_conn_io, - NULL, /* pfbreak */ - NULL, /* pfset */ - NULL, /* pfcarrier */ - fsysdep_conn_chat, - NULL /* pibaud */ -}; - -/* Initialize a TCP connection. */ - -boolean -fsysdep_tcp_init (qconn) - struct sconnection *qconn; -{ - struct ssysdep_conn *q; - - q = (struct ssysdep_conn *) xmalloc (sizeof (struct ssysdep_conn)); - q->o = -1; - q->ord = -1; - q->owr = -1; - q->zdevice = NULL; - q->iflags = -1; - q->iwr_flags = -1; - q->fterminal = FALSE; - q->ftli = FALSE; - q->ibaud = 0; - - qconn->psysdep = (pointer) q; - qconn->qcmds = &stcpcmds; - return TRUE; -} - -/* Free a TCP connection. */ - -static void -utcp_free (qconn) - struct sconnection *qconn; -{ - xfree (qconn->psysdep); -} - -/* Open a TCP connection. If the fwait argument is TRUE, we are - running as a server. Otherwise we are just trying to reach another - system. */ - -static boolean -ftcp_open (qconn, ibaud, fwait) - struct sconnection *qconn; - long ibaud; - boolean fwait; -{ - struct ssysdep_conn *qsysdep; - struct sockaddr_in s; - const char *zport; - uid_t iuid, ieuid; - - ulog_device ("TCP"); - - qsysdep = (struct ssysdep_conn *) qconn->psysdep; - - qsysdep->o = socket (AF_INET, SOCK_STREAM, 0); - if (qsysdep->o < 0) - { - ulog (LOG_ERROR, "socket: %s", strerror (errno)); - return FALSE; - } - - if (fcntl (qsysdep->o, F_SETFD, - fcntl (qsysdep->o, F_GETFD, 0) | FD_CLOEXEC) < 0) - { - ulog (LOG_ERROR, "fcntl (FD_CLOEXEC): %s", strerror (errno)); - (void) close (qsysdep->o); - qsysdep->o = -1; - return FALSE; - } - - qsysdep->iflags = fcntl (qsysdep->o, F_GETFL, 0); - if (qsysdep->iflags < 0) - { - ulog (LOG_ERROR, "fcntl: %s", strerror (errno)); - (void) close (qsysdep->o); - qsysdep->o = -1; - return FALSE; - } - - /* We save our process ID in the qconn structure. This is checked - in ftcp_close. */ - qsysdep->ipid = getpid (); - - /* If we aren't waiting for a connection, we're done. */ - if (! fwait) - return TRUE; - - /* Run as a server and wait for a new connection. The code in - uucico.c has already detached us from our controlling terminal. - From this point on if the server gets an error we exit; we only - return if we have received a connection. It would be more robust - to respawn the server if it fails; someday. */ - bzero ((pointer) &s, sizeof s); - s.sin_family = AF_INET; - zport = qconn->qport->uuconf_u.uuconf_stcp.uuconf_zport; - s.sin_port = itcp_port_number (zport); - s.sin_addr.s_addr = htonl (INADDR_ANY); - - /* Swap to our real user ID when doing the bind call. This will - permit the server to use privileged TCP ports when invoked by - root. We only swap if our effective user ID is not root, so that - the program can also be made suid root in order to get privileged - ports when invoked by anybody. */ - iuid = getuid (); - ieuid = geteuid (); - if (ieuid != 0) - { -#if HAVE_SETREUID - /* Swap the effective user id and the real user id. We can then - swap them back again when we want to return to the uucp - user's permissions. */ - if (setreuid (ieuid, iuid) < 0) - { - ulog (LOG_ERROR, "setreuid (%ld, %ld): %s", - (long) ieuid, (long) iuid, strerror (errno)); - (void) close (qsysdep->o); - qsysdep->o = -1; - return FALSE; - } -#else /* ! HAVE_SETREUID */ -#if HAVE_SAVED_SETUID - /* Set the effective user id to the real user id. Since the - effective user id is the saved setuid we will able to set - back to it later. If the real user id is root we will not be - able to switch back and forth, but that doesn't matter since - we only want to switch once. */ - if (setuid (iuid) < 0) - { - ulog (LOG_ERROR, "setuid (%ld): %s", (long) iuid, - strerror (errno)); - (void) close (qsysdep->o); - qsysdep->o = -1; - return FALSE; - } -#else /* ! HAVE_SAVED_SETUID */ - /* There's no way to switch between real permissions and - effective permissions. Just try the bind with the uucp - permissions. */ -#endif /* ! HAVE_SAVED_SETUID */ -#endif /* ! HAVE_SETREUID */ - } - - if (bind (qsysdep->o, (struct sockaddr *) &s, sizeof s) < 0) - ulog (LOG_FATAL, "bind: %s", strerror (errno)); - - /* Now swap back to the uucp user ID. */ - if (ieuid != 0) - { -#if HAVE_SETREUID - if (setreuid (iuid, ieuid) < 0) - { - ulog (LOG_ERROR, "setreuid (%ld, %ld): %s", - (long) iuid, (long) ieuid, strerror (errno)); - (void) close (qsysdep->o); - qsysdep->o = -1; - return FALSE; - } -#else /* ! HAVE_SETREUID */ -#if HAVE_SAVED_SETUID - /* Set ourselves back to our original effective user id. */ - if (setuid ((uid_t) ieuid) < 0) - { - ulog (LOG_ERROR, "setuid (%ld): %s", (long) ieuid, - strerror (errno)); - (void) close (qsysdep->o); - qsysdep->o = -1; - return FALSE; - } -#else /* ! HAVE_SAVED_SETUID */ - /* We didn't switch, no need to switch back. */ -#endif /* ! HAVE_SAVED_SETUID */ -#endif /* ! HAVE_SETREUID */ - } - - if (listen (qsysdep->o, 5) < 0) - ulog (LOG_FATAL, "listen: %s", strerror (errno)); - - while (! FGOT_SIGNAL ()) - { - size_t clen; - int onew; - pid_t ipid; - - DEBUG_MESSAGE0 (DEBUG_PORT, - "ftcp_open: Waiting for connections"); - - clen = sizeof s; - onew = accept (qsysdep->o, (struct sockaddr *) &s, &clen); - if (onew < 0) - ulog (LOG_FATAL, "accept: %s", strerror (errno)); - - DEBUG_MESSAGE0 (DEBUG_PORT, - "ftcp_open: Got connection; forking"); - - ipid = ixsfork (); - if (ipid < 0) - ulog (LOG_FATAL, "fork: %s", strerror (errno)); - if (ipid == 0) - { - (void) close (qsysdep->o); - qsysdep->o = onew; - - /* Now we fork and let our parent die, so that we become - a child of init. This lets the main server code wait - for its child and then continue without accumulating - zombie children. */ - ipid = ixsfork (); - if (ipid < 0) - { - ulog (LOG_ERROR, "fork: %s", strerror (errno)); - _exit (EXIT_FAILURE); - } - - if (ipid != 0) - _exit (EXIT_SUCCESS); - - ulog_id (getpid ()); - - return TRUE; - } - - (void) close (onew); - - /* Now wait for the child. */ - (void) ixswait ((unsigned long) ipid, (const char *) NULL); - } - - /* We got a signal. */ - usysdep_exit (FALSE); - - /* Avoid compiler warnings. */ - return FALSE; -} - -/* Close the port. */ - -/*ARGSUSED*/ -static boolean -ftcp_close (qconn, puuconf, qdialer, fsuccess) - struct sconnection *qconn; - pointer puuconf; - struct uuconf_dialer *qdialer; - boolean fsuccess; -{ - struct ssysdep_conn *qsysdep; - boolean fret; - - qsysdep = (struct ssysdep_conn *) qconn->psysdep; - fret = TRUE; - if (qsysdep->o >= 0 && close (qsysdep->o) < 0) - { - ulog (LOG_ERROR, "close: %s", strerror (errno)); - fret = FALSE; - } - qsysdep->o = -1; - - /* If the current pid is not the one we used to open the port, then - we must have forked up above and we are now the child. In this - case, we are being called from within the fendless loop in - uucico.c. We return FALSE to force the loop to end and the child - to exit. This should be handled in a cleaner fashion. */ - if (qsysdep->ipid != getpid ()) - fret = FALSE; - - return fret; -} - -/* Dial out on a TCP port, so to speak: connect to a remote computer. */ - -/*ARGSUSED*/ -static boolean -ftcp_dial (qconn, puuconf, qsys, zphone, qdialer, ptdialer) - struct sconnection *qconn; - pointer puuconf; - const struct uuconf_system *qsys; - const char *zphone; - struct uuconf_dialer *qdialer; - enum tdialerfound *ptdialer; -{ - struct ssysdep_conn *qsysdep; - const char *zhost; - struct hostent *q; - struct sockaddr_in s; - const char *zport; - char **pzdialer; - - qsysdep = (struct ssysdep_conn *) qconn->psysdep; - - *ptdialer = DIALERFOUND_FALSE; - - zhost = zphone; - if (zhost == NULL) - { - if (qsys == NULL) - { - ulog (LOG_ERROR, "No address for TCP connection"); - return FALSE; - } - zhost = qsys->uuconf_zname; - } - - errno = 0; - q = gethostbyname ((char *) zhost); - if (q == NULL) - { - if (errno == 0) - ulog (LOG_ERROR, "%s: unknown host name", zhost); - else - ulog (LOG_ERROR, "gethostbyname (%s): %s", zhost, strerror (errno)); - return FALSE; - } - - s.sin_family = q->h_addrtype; - memcpy (&s.sin_addr.s_addr, q->h_addr, (size_t) q->h_length); - zport = qconn->qport->uuconf_u.uuconf_stcp.uuconf_zport; - s.sin_port = itcp_port_number (zport); - - if (connect (qsysdep->o, (struct sockaddr *) &s, sizeof s) < 0) - { - ulog (LOG_ERROR, "connect: %s", strerror (errno)); - return FALSE; - } - - /* Handle the dialer sequence, if any. */ - pzdialer = qconn->qport->uuconf_u.uuconf_stcp.uuconf_pzdialer; - if (pzdialer != NULL && *pzdialer != NULL) - { - if (! fconn_dial_sequence (qconn, puuconf, pzdialer, qsys, zphone, - qdialer, ptdialer)) - return FALSE; - } - - return TRUE; -} - -/* Get the port number given a name. The argument will almost always - be "uucp" so we cache that value. The return value is always in - network byte order. This returns -1 on error. */ - -static int -itcp_port_number (zname) - const char *zname; -{ - boolean fuucp; - static int iuucp; - int i; - char *zend; - struct servent *q; - - fuucp = strcmp (zname, "uucp") == 0; - if (fuucp && iuucp != 0) - return iuucp; - - /* Try it as a number first. */ - i = strtol ((char *) zname, &zend, 10); - if (i != 0 && *zend == '\0') - return htons (i); - - q = getservbyname ((char *) zname, (char *) "tcp"); - if (q == NULL) - { - /* We know that the "uucp" service should be 540, even if isn't - in /etc/services. */ - if (fuucp) - { - iuucp = htons (IUUCP_PORT); - return iuucp; - } - ulog (LOG_ERROR, "getservbyname (%s): %s", zname, strerror (errno)); - return -1; - } - - if (fuucp) - iuucp = q->s_port; - - return q->s_port; -} - -#endif /* HAVE_TCP */ diff --git a/gnu/libexec/uucp/common_sources/tli.c b/gnu/libexec/uucp/common_sources/tli.c deleted file mode 100644 index db3491a20ac7..000000000000 --- a/gnu/libexec/uucp/common_sources/tli.c +++ /dev/null @@ -1,582 +0,0 @@ -/* tli.c - Code to handle TLI connections. - - Copyright (C) 1992, 1993, 1994 Ian Lance Taylor - - This file is part of the Taylor UUCP package. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - The author of the program may be contacted at ian@airs.com or - c/o Cygnus Support, Building 200, 1 Kendall Square, Cambridge, MA 02139. - */ - -#include "uucp.h" - -#if USE_RCS_ID -const char tli_rcsid[] = "$Id: tli.c,v 1.2 1994/05/07 18:09:03 ache Exp $"; -#endif - -#if HAVE_TLI - -#include "sysdep.h" -#include "uudefs.h" -#include "uuconf.h" -#include "conn.h" -#include "system.h" - -#include <errno.h> - -#if HAVE_SYS_IOCTL_H -#include <sys/ioctl.h> -#endif - -#if HAVE_TIUSER_H -#include <tiuser.h> -#else -#if HAVE_XTI_H -#include <xti.h> -#else -#if HAVE_SYS_TLI_H -#include <sys/tli.h> -#endif -#endif -#endif - -#if HAVE_STROPTS_H -#include <stropts.h> -#endif - -#if HAVE_FCNTL_H -#include <fcntl.h> -#else -#if HAVE_SYS_FILE_H -#include <sys/file.h> -#endif -#endif - -#ifndef O_RDONLY -#define O_RDONLY 0 -#define O_WRONLY 1 -#define O_RDWR 2 -#endif - -#ifndef FD_CLOEXEC -#define FD_CLOEXEC 1 -#endif - -/* The arguments to t_alloca have two different names. I want the - SVID ones, not the XPG3 ones. */ -#ifndef T_BIND -#define T_BIND T_BIND_STR -#endif -#ifndef T_CALL -#define T_CALL T_CALL_STR -#endif - -/* Hopefully these externs will not cause any trouble. This is how - they are shown in the SVID. */ -extern int t_errno; -extern char *t_errlist[]; -extern int t_nerr; - -#ifndef HAVE_TIUSER_H -#ifndef t_alloc -extern pointer t_alloc (); -#endif -#endif - -/* This code handles TLI connections. It's Unix specific. It's - largely based on code from Unix Network Programming, by W. Richard - Stevens. */ - -/* Local functions. */ -static const char *ztlierror P((void)); -static void utli_free P((struct sconnection *qconn)); -static boolean ftli_push P((struct sconnection *qconn)); -static boolean ftli_open P((struct sconnection *qconn, long ibaud, - boolean fwait)); -static boolean ftli_close P((struct sconnection *qconn, - pointer puuconf, - struct uuconf_dialer *qdialer, - boolean fsuccess)); -static boolean ftli_dial P((struct sconnection *qconn, pointer puuconf, - const struct uuconf_system *qsys, - const char *zphone, - struct uuconf_dialer *qdialer, - enum tdialerfound *ptdialer)); - -/* The command table for a TLI connection. */ -static const struct sconncmds stlicmds = -{ - utli_free, - NULL, /* pflock */ - NULL, /* pfunlock */ - ftli_open, - ftli_close, - ftli_dial, - fsysdep_conn_read, - fsysdep_conn_write, - fsysdep_conn_io, - NULL, /* pfbreak */ - NULL, /* pfset */ - NULL, /* pfcarrier */ - fsysdep_conn_chat, - NULL /* pibaud */ -}; - -/* Get a TLI error string. */ - -static const char * -ztlierror () -{ - if (t_errno == TSYSERR) - return strerror (errno); - if (t_errno < 0 || t_errno >= t_nerr) - return "Unknown TLI error"; - return t_errlist[t_errno]; -} - -/* Initialize a TLI connection. This may be called with qconn->qport - NULL, when opening standard input as a TLI connection. */ - -boolean -fsysdep_tli_init (qconn) - struct sconnection *qconn; -{ - struct ssysdep_conn *q; - - q = (struct ssysdep_conn *) xmalloc (sizeof (struct ssysdep_conn)); - q->o = -1; - q->ord = -1; - q->owr = -1; - q->zdevice = NULL; - q->iflags = -1; - q->iwr_flags = -1; - q->fterminal = FALSE; - q->ftli = TRUE; - q->ibaud = 0; - - qconn->psysdep = (pointer) q; - qconn->qcmds = &stlicmds; - return TRUE; -} - -/* Free a TLI connection. */ - -static void -utli_free (qconn) - struct sconnection *qconn; -{ - xfree (qconn->psysdep); -} - -/* Push all desired modules onto a TLI stream. If the user requests a - STREAMS connection without giving a list of modules, we just push - tirdwr. If the I_PUSH ioctl is not defined on this system, we just - ignore any list of modules. */ - -static boolean -ftli_push (qconn) - struct sconnection *qconn; -{ -#ifdef I_PUSH - - struct ssysdep_conn *qsysdep; - - qsysdep = (struct ssysdep_conn *) qconn->psysdep; - - if (qconn->qport->uuconf_u.uuconf_stli.uuconf_pzpush != NULL) - { - char **pz; - - for (pz = qconn->qport->uuconf_u.uuconf_stli.uuconf_pzpush; - *pz != NULL; - pz++) - { - if (ioctl (qsysdep->o, I_PUSH, *pz) < 0) - { - ulog (LOG_ERROR, "ioctl (I_PUSH, %s): %s", *pz, - strerror (errno)); - return FALSE; - } - } - } - else if (qconn->qport->uuconf_u.uuconf_stli.uuconf_fstream) - { - if (ioctl (qsysdep->o, I_PUSH, "tirdwr") < 0) - { - ulog (LOG_ERROR, "ioctl (I_PUSH, tirdwr): %s", - strerror (errno)); - return FALSE; - } - } - - /* If we have just put the connection into stream mode, we must turn - off the TLI flag to avoid using TLI calls on it. */ - if (qconn->qport->uuconf_u.uuconf_stli.uuconf_fstream) - qsysdep->ftli = FALSE; - -#endif /* defined (I_PUSH) */ - - return TRUE; -} - -/* Open a TLI connection. If the fwait argument is TRUE, we are - running as a server. Otherwise we are just trying to reach another - system. */ - -static boolean -ftli_open (qconn, ibaud, fwait) - struct sconnection *qconn; - long ibaud; - boolean fwait; -{ - struct ssysdep_conn *qsysdep; - const char *zdevice; - char *zfreedev; - const char *zservaddr; - char *zfreeaddr; - struct t_bind *qtbind; - struct t_call *qtcall; - - /* Unlike most other device types, we don't bother to call - ulog_device here, because fconn_open calls it with the name of - the port anyhow. */ - - qsysdep = (struct ssysdep_conn *) qconn->psysdep; - - zdevice = qconn->qport->uuconf_u.uuconf_stli.uuconf_zdevice; - if (zdevice == NULL) - zdevice = qconn->qport->uuconf_zname; - - zfreedev = NULL; - if (*zdevice != '/') - { - zfreedev = zbufalc (sizeof "/dev/" + strlen (zdevice)); - sprintf (zfreedev, "/dev/%s", zdevice); - zdevice = zfreedev; - } - - qsysdep->o = t_open (zdevice, O_RDWR, (struct t_info *) NULL); - if (qsysdep->o < 0) - { - ulog (LOG_ERROR, "t_open (%s): %s", zdevice, ztlierror ()); - ubuffree (zfreedev); - return FALSE; - } - - if (fcntl (qsysdep->o, F_SETFD, - fcntl (qsysdep->o, F_GETFD, 0) | FD_CLOEXEC) < 0) - { - ulog (LOG_ERROR, "fcntl (FD_CLOEXEC): %s", strerror (errno)); - ubuffree (zfreedev); - (void) t_close (qsysdep->o); - qsysdep->o = -1; - return FALSE; - } - - qsysdep->iflags = fcntl (qsysdep->o, F_GETFL, 0); - if (qsysdep->iflags < 0) - { - ulog (LOG_ERROR, "fcntl: %s", strerror (errno)); - ubuffree (zfreedev); - (void) t_close (qsysdep->o); - qsysdep->o = -1; - return FALSE; - } - - /* We save our process ID in the qconn structure. This is checked - in ftli_close. */ - qsysdep->ipid = getpid (); - - /* If we aren't waiting for a connection, we can bind to any local - address, and then we're finished. */ - if (! fwait) - { - ubuffree (zfreedev); - if (t_bind (qsysdep->o, (struct t_bind *) NULL, - (struct t_bind *) NULL) < 0) - { - ulog (LOG_ERROR, "t_bind: %s", ztlierror ()); - (void) t_close (qsysdep->o); - qsysdep->o = -1; - return FALSE; - } - return TRUE; - } - - /* Run as a server and wait for a new connection. The code in - uucico.c has already detached us from our controlling terminal. - From this point on if the server gets an error we exit; we only - return if we have received a connection. It would be more robust - to respawn the server if it fails; someday. */ - qtbind = (struct t_bind *) t_alloc (qsysdep->o, T_BIND, T_ALL); - if (qtbind == NULL) - ulog (LOG_FATAL, "t_alloc (T_BIND): %s", ztlierror ()); - - zservaddr = qconn->qport->uuconf_u.uuconf_stli.uuconf_zservaddr; - if (zservaddr == NULL) - ulog (LOG_FATAL, "Can't run as TLI server; no server address"); - - zfreeaddr = zbufcpy (zservaddr); - qtbind->addr.len = cescape (zfreeaddr); - if (qtbind->addr.len > qtbind->addr.maxlen) - ulog (LOG_FATAL, "%s: TLI server address too long (max %d)", - zservaddr, qtbind->addr.maxlen); - memcpy (qtbind->addr.buf, zfreeaddr, qtbind->addr.len); - ubuffree (zfreeaddr); - - qtbind->qlen = 5; - - if (t_bind (qsysdep->o, qtbind, (struct t_bind *) NULL) < 0) - ulog (LOG_FATAL, "t_bind (%s): %s", zservaddr, ztlierror ()); - - (void) t_free ((pointer) qtbind, T_BIND); - - qtcall = (struct t_call *) t_alloc (qsysdep->o, T_CALL, T_ALL); - if (qtcall == NULL) - ulog (LOG_FATAL, "t_alloc (T_CALL): %s", ztlierror ()); - - while (! FGOT_SIGNAL ()) - { - int onew; - pid_t ipid; - - DEBUG_MESSAGE0 (DEBUG_PORT, - "ftli_open: Waiting for connections"); - - if (t_listen (qsysdep->o, qtcall) < 0) - ulog (LOG_FATAL, "t_listen: %s", ztlierror ()); - - onew = t_open (zdevice, O_RDWR, (struct t_info *) NULL); - if (onew < 0) - ulog (LOG_FATAL, "t_open (%s): %s", zdevice, ztlierror ()); - - if (fcntl (onew, F_SETFD, - fcntl (onew, F_GETFD, 0) | FD_CLOEXEC) < 0) - ulog (LOG_FATAL, "fcntl (FD_CLOEXEC): %s", strerror (errno)); - - if (t_bind (onew, (struct t_bind *) NULL, (struct t_bind *) NULL) < 0) - ulog (LOG_FATAL, "t_bind: %s", ztlierror ()); - - if (t_accept (qsysdep->o, onew, qtcall) < 0) - { - /* We may have received a disconnect. */ - if (t_errno != TLOOK) - ulog (LOG_FATAL, "t_accept: %s", ztlierror ()); - if (t_rcvdis (qsysdep->o, (struct t_discon *) NULL) < 0) - ulog (LOG_FATAL, "t_rcvdis: %s", ztlierror ()); - (void) t_close (onew); - continue; - } - - DEBUG_MESSAGE0 (DEBUG_PORT, - "ftli_open: Got connection; forking"); - - ipid = ixsfork (); - if (ipid < 0) - ulog (LOG_FATAL, "fork: %s", strerror (errno)); - if (ipid == 0) - { - ulog_close (); - - (void) t_close (qsysdep->o); - qsysdep->o = onew; - - /* Push any desired modules. */ - if (! ftli_push (qconn)) - _exit (EXIT_FAILURE); - - /* Now we fork and let our parent die, so that we become - a child of init. This lets the main server code wait - for its child and then continue without accumulating - zombie children. */ - ipid = ixsfork (); - if (ipid < 0) - { - ulog (LOG_ERROR, "fork: %s", strerror (errno)); - _exit (EXIT_FAILURE); - } - - if (ipid != 0) - _exit (EXIT_SUCCESS); - - ulog_id (getpid ()); - - return TRUE; - } - - (void) t_close (onew); - - /* Now wait for the child. */ - (void) ixswait ((unsigned long) ipid, (const char *) NULL); - } - - /* We got a signal. */ - usysdep_exit (FALSE); - - /* Avoid compiler warnings. */ - return FALSE; -} - -/* Close the port. */ - -/*ARGSUSED*/ -static boolean -ftli_close (qconn, puuconf, qdialer, fsuccess) - struct sconnection *qconn; - pointer puuconf; - struct uuconf_dialer *qdialer; - boolean fsuccess; -{ - struct ssysdep_conn *qsysdep; - boolean fret; - - qsysdep = (struct ssysdep_conn *) qconn->psysdep; - - fret = TRUE; - if (qsysdep->o >= 0) - { - if (qsysdep->ftli) - { - if (t_close (qsysdep->o) < 0) - { - ulog (LOG_ERROR, "t_close: %s", ztlierror ()); - fret = FALSE; - } - } - else - { - if (close (qsysdep->o) < 0) - { - ulog (LOG_ERROR, "close: %s", strerror (errno)); - fret = FALSE; - } - } - - qsysdep->o = -1; - } - - /* If the current pid is not the one we used to open the port, then - we must have forked up above and we are now the child. In this - case, we are being called from within the fendless loop in - uucico.c. We return FALSE to force the loop to end and the child - to exit. This should be handled in a cleaner fashion. */ - if (qsysdep->ipid != getpid ()) - fret = FALSE; - - return fret; -} - -/* Dial out on a TLI port, so to speak: connect to a remote computer. */ - -/*ARGSUSED*/ -static boolean -ftli_dial (qconn, puuconf, qsys, zphone, qdialer, ptdialerfound) - struct sconnection *qconn; - pointer puuconf; - const struct uuconf_system *qsys; - const char *zphone; - struct uuconf_dialer *qdialer; - enum tdialerfound *ptdialerfound; -{ - struct ssysdep_conn *qsysdep; - char **pzdialer; - const char *zaddr; - struct t_call *qtcall; - char *zescape; - - qsysdep = (struct ssysdep_conn *) qconn->psysdep; - - *ptdialerfound = DIALERFOUND_FALSE; - - pzdialer = qconn->qport->uuconf_u.uuconf_stli.uuconf_pzdialer; - if (*pzdialer == NULL) - pzdialer = NULL; - - /* If the first dialer is "TLI" or "TLIS", we use the first token - (pzdialer[1]) as the address to connect to. */ - zaddr = zphone; - if (pzdialer != NULL - && (strcmp (pzdialer[0], "TLI") == 0 - || strcmp (pzdialer[0], "TLIS") == 0)) - { - if (pzdialer[1] == NULL) - ++pzdialer; - else - { - if (strcmp (pzdialer[1], "\\D") != 0 - && strcmp (pzdialer[1], "\\T") != 0) - zaddr = pzdialer[1]; - pzdialer += 2; - } - } - - if (zaddr == NULL) - { - ulog (LOG_ERROR, "No address for TLI connection"); - return FALSE; - } - - qtcall = (struct t_call *) t_alloc (qsysdep->o, T_CALL, T_ADDR); - if (qtcall == NULL) - { - ulog (LOG_ERROR, "t_alloc (T_CALL): %s", ztlierror ()); - return FALSE; - } - - zescape = zbufcpy (zaddr); - qtcall->addr.len = cescape (zescape); - if (qtcall->addr.len > qtcall->addr.maxlen) - { - ulog (LOG_ERROR, "%s: TLI address too long (max %d)", zaddr, - qtcall->addr.maxlen); - ubuffree (zescape); - return FALSE; - } - memcpy (qtcall->addr.buf, zescape, qtcall->addr.len); - ubuffree (zescape); - - if (t_connect (qsysdep->o, qtcall, (struct t_call *) NULL) < 0) - { - if (t_errno != TLOOK) - ulog (LOG_ERROR, "t_connect: %s", ztlierror ()); - else - { - if (t_rcvdis (qsysdep->o, (struct t_discon *) NULL) < 0) - ulog (LOG_ERROR, "t_rcvdis: %s", ztlierror ()); - else - ulog (LOG_ERROR, "Connection refused"); - } - return FALSE; - } - - /* We've connected to the remote. Push any desired modules. */ - if (! ftli_push (qconn)) - return FALSE; - - /* Handle the rest of the dialer sequence. */ - if (pzdialer != NULL && *pzdialer != NULL) - { - if (! fconn_dial_sequence (qconn, puuconf, pzdialer, qsys, zphone, - qdialer, ptdialerfound)) - return FALSE; - } - - return TRUE; -} - -#endif /* HAVE_TLI */ diff --git a/gnu/libexec/uucp/contrib/uureroute b/gnu/libexec/uucp/contrib/uureroute deleted file mode 100755 index 3eeb654e1e27..000000000000 --- a/gnu/libexec/uucp/contrib/uureroute +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/local/bin/perl -eval ' exec /usr/local/bin/perl $0 "$@" ' - if $running_under_some_shell; - -# From a script by <Bill.Campbell@celestial.com> -# Newsgroups: comp.sources.misc -# Subject: v28i073: uureroute - Reroute HDB queued mail, Part01/01 -# Date: 26 Feb 92 02:28:37 GMT -# -# This is a Honey DanBer specific routine written in perl to reroute all -# mail queued up for a specific host. It needs to be run as "root" since -# uucp will not allow itself to remove others requests. -# -# Revision *** 92/21/09: Francois Pinard <pinard@iro.umontreal.ca> -# 1. adapted for Taylor UUCP -# -# Revision 1.3 91/10/08 09:01:21 src -# 1. Rewritten in perl -# 2. Add -v option for debugging. -# -# Revision 1.2 91/10/07 23:57:42 root -# 1. Fix mail program path. -# 2. Truncate directory name to 7 characters - -($progname = $0) =~ s!.*/!!; # save this very early - -$USAGE = " -# Reroute uucp mail -# -# Usage: $progname [-v] host [host...] -# -# Options Argument Description -# -v Verbose (doesn't execute /bin/sh) -# -"; - -$UUSTAT = "/usr/local/bin/uustat"; -$SHELL = "/bin/sh"; -$SMAIL = "/bin/smail"; - -sub usage -{ - die join ("\n", @_) . "\n$USAGE\n"; -} - -do "getopts.pl"; - -&usage ("Invalid Option") unless do Getopts ("vV"); - -$verbose = ($opt_v ? '-v' : ()); -$suffix = ($verbose ? '' : $$); - -&usage ("No system specified") if $#ARGV < 0; - -if (!$verbose) -{ - open (SHELL, "| $SHELL"); - select SHELL; -} - -while ($system = shift) -{ - $sysprefix = substr ($system, 0, 7); - $directory = "/usr/spool/uucp/$sysprefix"; - open (UUSTAT, "$UUSTAT -s $system -c rmail |"); - print "set -ex\n"; - while (<UUSTAT>) - { - ($jobid, ) = split; - ($cfile) = substr ($jobid, length ($jobid) - 5); - $cfilename = "$directory/C./C.$cfile"; - open (CFILE, $cfilename) || die "Cannot open $cfilename\n"; - $_ = <CFILE>; - close CFILE; - if (/^E D\.(....) [^ ]+ [^ ]+ -CR D\.\1 0666 [^ ]+ 0 rmail (.*)/) - { - $datafile = "$directory/D./D.$1"; - $address = $2; - } - else - { - print STDERR; - die "Cannot parse previous line from $cfilename\n"; - } - print "$SMAIL -R $system!$address < $datafile && $UUSTAT -k $jobid\n"; - } - close UUSTAT; -} -close SHELL unless $verbose; - -exit 0; diff --git a/gnu/libexec/uucp/sample/call b/gnu/libexec/uucp/sample/call deleted file mode 100644 index de4190ce6125..000000000000 --- a/gnu/libexec/uucp/sample/call +++ /dev/null @@ -1,20 +0,0 @@ -# This is an example of call, the call out password file for Taylor -# UUCP. To use it, you must compile the package with -# HAVE_TAYLOR_CONFIG set to 1 in policy.h (that is the default), copy -# this file to newconfigdir as set in Makefile.in (the default is -# /usr/local/conf/uucp), and edit it as appropriate for your system. - -# Everything after a '#' character is a comment. To uncomment any of -# the sample lines below, just delete the '#'. - -# This file is used when the ``call-login'' or ``call-password'' -# commands are used in the sys file with a "*" argument (e.g., -# ``call-login *''). The system name is looked up in this file, and -# the login name and password are used. - -# The point of this is that the sys file may then be publically -# readable, while still concealing the login names and passwords used -# to connect to the remote system. - -# The format is just system-name login-name password. -uunet Uairs foobar diff --git a/gnu/libexec/uucp/sample/config b/gnu/libexec/uucp/sample/config deleted file mode 100644 index e7d683bb0367..000000000000 --- a/gnu/libexec/uucp/sample/config +++ /dev/null @@ -1,88 +0,0 @@ -# This is an example of config, the main configuration file for Taylor -# UUCP. To use it, you must compile the package with -# HAVE_TAYLOR_CONFIG set to 1 in policy.h (that is the default), copy -# this file to newconfigdir as set in Makefile.in (the default is -# /usr/local/conf/uucp), and edit it as appropriate for your system. - -# You need not use this file at all; all the important commands have -# defaults which will be used if this file can not be found. - -# Everything after a '#' character is a comment. To uncomment any of -# the sample lines below, just delete the '#'. - -# You must choose a UUCP name. If your system is going to be -# communicating with other systems outside your organization, the name -# must be unique in the entire world. The usual method is to pick a -# name, and then search the UUCP maps (in the newsgroup -# comp.mail.maps) to see whether it has already been taken. See the -# README posting in comp.mail.maps for more information. If the name -# of your system as returned by "uuname -n" or "hostname" is the name -# you want to use, you do not need to set the name in this file. -# Otherwise uncomment and edit the following line. -# nodename uucp # The UUCP name of this system - -# The default spool directory is set in policy.h (the default is -# /usr/spool/uucp). All UUCP jobs and status information are kept in -# the spool directory. If you wish to change it, use the spool -# command. -# spool /usr/spool/uucp # The UUCP spool directory - -# The default public directory is set in policy.h (the default is -# /usr/spool/uucppublic). Remote systems may refer to a file in this -# directory using "~/FILE". By default, the public directory is the -# only directory which remote systems may transfer files in and out -# of. If you wish to change the public directory, use the pubdir -# command. -# pubdir /usr/spool/uucppublic # The UUCP public directory - -# The names of the UUCP log files are set in policy.h. The default -# names depend on the logging option you have chosen. If -# HAVE_TAYLOR_LOGGING is set in policy.h, the default log file name is -# /usr/spool/uucp/Log, the default statistics file name is -# /usr/spool/uucp/Stats, and the default debugging file name is -# /usr/spool/uucp/Debug. These file names may be set by the following -# commands. -# logfile /usr/spool/uucp/Log # The UUCP log file -# statfile /usr/spool/uucp/Stats # The UUCP statistics file -# debugfile /usr/spool/uucp/Debug # The UUCP debugging file - -# uuxqt is the program which executes UUCP requests from other -# systems. Normally one is started after each run of uucico, the -# communications daemon. You may control the maximum number of uuxqt -# programs run at the same time with the following command. The -# default is to have no maximum. -# max-uuxqts 1 # The maximum number of uuxqts - -# There are several files that uucico uses. By default it looks for -# them in newconfigdir, as set in Makefile.in. You may name one or -# more of each type of file using the following commands. -# sysfile FILES # Default "sys" -# portfile FILES # Default "port" -# dialfile FILES # Default "dial" -# dialcodefile FILES # Default "dialcode" -# callfile FILES # Default "call" -# passwdfile FILES # Default "passwd" - -# The ``timetable'' command may be used to declare timetables. These -# may then be referred to in time strings in the other files. -# timetable Day Wk0905-1655 - -# The ``unknown'' command is followed by any command which may appear -# in a sys file. These commands are taken together to describe what -# is permitted to a system which is not listed in any sys file. If -# the ``unknown'' command, then unknown systems are not permitted to -# connect. - -# Here is an example which permits unknown systems to download files -# from /usr/spool/anonymous, and to upload them to -# /usr/spool/anonymous/upload. -# -# No commands may be executed (the list of permitted commands is empty) -# unknown commands -# The public directory is /usr/spool/anonymous -# unknown pubdir /usr/spool/anonymous -# Only files in the public directory may be sent; users may not download -# files from the upload directory -# unknown remote-send ~ !~/upload -# May only upload files into /usr/spool/anonymous/upload -# unknown remote-receive ~/upload diff --git a/gnu/libexec/uucp/sample/dial b/gnu/libexec/uucp/sample/dial deleted file mode 100644 index f0d4bdd8aa54..000000000000 --- a/gnu/libexec/uucp/sample/dial +++ /dev/null @@ -1,35 +0,0 @@ -# This is an example of dial, the dialer configuration file for Taylor -# UUCP. To use it, you must compile the package with -# HAVE_TAYLOR_CONFIG set to 1 in policy.h (that is the default), copy -# this file to newconfigdir as set in Makefile.in (the default is -# /usr/local/conf/uucp), and edit it as appropriate for your system. - -# Everything after a '#' character is a comment. To uncomment any of -# the sample lines below, just delete the '#'. - -# All dialers named in the port (or sys) file must be described in the -# dial file. It is also possible to describe a dialer directly in the -# port (or sys) file. - -# This is a typical Hayes modem definition. -dialer hayes - -# The chat script used to dial the phone. -# This means: -# 1) expect nothing (i.e., continue with step 2) -# 2) send "ATZ", then a carriage return, then sleep for 1 to 2 -# seconds. The \c means to not send a final carriage return. -# 3) wait until the modem echoes "OK" -# 4) send "ATDT", then the telephone number (after translating any -# dialcodes). -# 5) wait until the modem echoes "CONNECT" -chat "" ATZ\r\d\c OK ATDT\T CONNECT - -# If we get "BUSY" or "NO CARRIER" during the dial chat script we -# abort the dial immediately. -chat-fail BUSY -chat-fail NO\sCARRIER - -# When the call is over, we make sure we hangup the modem. -complete \d\d+++\d\dATH\r\c -abort \d\d+++\d\dATH\r\c diff --git a/gnu/libexec/uucp/sample/dialcode b/gnu/libexec/uucp/sample/dialcode deleted file mode 100644 index 710a07bf7343..000000000000 --- a/gnu/libexec/uucp/sample/dialcode +++ /dev/null @@ -1,19 +0,0 @@ -# This is an example of dialcode, the dialcode configuration file for -# Taylor UUCP. To use it, you must compile the package with -# HAVE_TAYLOR_CONFIG set to 1 in policy.h (that is the default), copy -# this file to newconfigdir as set in Makefile.in (the default is -# /usr/local/conf/uucp), and edit it as appropriate for your system. - -# Everything after a '#' character is a comment. To uncomment any of -# the sample lines below, just delete the '#'. - -# The dialcode file is used if \T is used in the dialer chat script -# and the telephone number begins with alphabetic characters. The -# alphabetic characters are looked up and translated in dialcode. - -# Here are a couple of sample dialcodes. -MA 617 -CA 415 - -# For example, if the phone number (from the sys file) is MA7389449, -# then the string sent to the modem will be 6177389449. diff --git a/gnu/libexec/uucp/sample/passwd b/gnu/libexec/uucp/sample/passwd deleted file mode 100644 index 2b04e13a3435..000000000000 --- a/gnu/libexec/uucp/sample/passwd +++ /dev/null @@ -1,18 +0,0 @@ -# This is an example of passwd, the call in password file for Taylor -# UUCP. To use it, you must compile the package with -# HAVE_TAYLOR_CONFIG set to 1 in policy.h (that is the default), copy -# this file to newconfigdir as set in Makefile.in (the default is -# /usr/local/conf/uucp), and edit it as appropriate for your system. - -# Everything after a '#' character is a comment. To uncomment any of -# the sample lines below, just delete the '#'. - -# This file is used when uucico is invoked with the -l or -e argument. -# uucico will then prompt for a login name and password. The login -# name is looked up in this file to check the password (the system -# password file, /etc/passwd, is not checked). This permits uucico to -# completely take over a port, allowing UUCP access to remote systems -# but not permitting remote users to actually log in to the system. - -# The format is just login-name password. -Uairs foobar diff --git a/gnu/libexec/uucp/sample/port b/gnu/libexec/uucp/sample/port deleted file mode 100644 index 8e481869b568..000000000000 --- a/gnu/libexec/uucp/sample/port +++ /dev/null @@ -1,41 +0,0 @@ -# This is an example of port, the port configuration file for Taylor -# UUCP. To use it, you must compile the package with -# HAVE_TAYLOR_CONFIG set to 1 in policy.h (that is the default), copy -# this file to newconfigdir as set in Makefile.in (the default is -# /usr/local/conf/uucp), and edit it as appropriate for your system. - -# Everything after a '#' character is a comment. To uncomment any of -# the sample lines below, just delete the '#'. - -# All ports named in the sys file must be described in a port file. -# It is also possible to describe the port directly in the sys file. - -# Commands that appears before the first ``port'' command are defaults -# for all ports that appear later in the file. In this case all ports -# will default to being modems (other possible types are direct, tcp -# and tli). -type modem - -# Now we describe two ports. - -# This is the name of the port. This name may be used in the sys file -# to select the port, or the sys file may just specify a baud rate in -# which case the first matching unlocked port will be used. -port port1 - -# This is the device name to open to dial out. -device /dev/ttyd0 - -# This is the dialer to use, as described in the dialer file. -dialer hayes - -# This is the baud rate to dial out at. -speed 2400 - -# Here is a second port. This is like the first, except that it uses -# a different device. It also permits a range of speeds, which is -# mainly useful if the system specifies a particular baud rate. -port port2 -device /dev/ttyd1 -dialer hayes -speed-range 2400 9600 diff --git a/gnu/libexec/uucp/sample/sys1 b/gnu/libexec/uucp/sample/sys1 deleted file mode 100644 index fa9e7709e1cf..000000000000 --- a/gnu/libexec/uucp/sample/sys1 +++ /dev/null @@ -1,44 +0,0 @@ -# This is an example of a sys file, the file(s) which describe remote -# systems for Taylor UUCP. To use it, you must compile the package -# with HAVE_TAYLOR_CONFIG set to 1 in policy.h (that is the default), -# copy this file to newconfigdir as set in Makefile.in (the default is -# /usr/local/conf/uucp), and edit it as appropriate for your system. - -# If you do not use the ``unknown'' command in the config file, then -# each system that you communicate with must be listed in a sys file. - -# Everything after a '#' character is a comment. To uncomment any of -# the sample lines below, just delete the '#'. - -# This is a sample sys file that might be used in a leaf system. A -# leaf system is one that only contacts one other system. sys2 -# provides another example. - -# The name of the remote system that we call. -system uunet - -# The login name and password are kept in the callout password file -# (by default this is the file "call" in newconfigdir). -call-login * -call-password * - -# We can send anything at any time. -time any - -# During the day we only accept grade 'Z' or above; at other times -# (not mentioned here) we accept all grades. uunet queues up news -# at grade 'd', which is lower than 'Z'. -call-timegrade Z Wk0755-2305,Su1655-2305 - -# The phone number to call. -phone 7389449 - -# uunet tends to be slow, so we increase the timeout -chat-timeout 120 - -# The port we use to dial out. -port serial - -# Increase the timeout and the number of retries. -protocol-parameter g timeout 20 -protocol-parameter g retries 10 diff --git a/gnu/libexec/uucp/sample/sys2 b/gnu/libexec/uucp/sample/sys2 deleted file mode 100644 index 856529a500a0..000000000000 --- a/gnu/libexec/uucp/sample/sys2 +++ /dev/null @@ -1,51 +0,0 @@ -# This is an example of a sys file, the file(s) which describe remote -# systems for Taylor UUCP. To use it, you must compile the package -# with HAVE_TAYLOR_CONFIG set to 1 in policy.h (that is the default), -# copy this file to newconfigdir as set in Makefile.in (the default is -# /usr/local/conf/uucp), and edit it as appropriate for your system. - -# If you do not use the ``unknown'' command in the config file, then -# each system that you communicate with must be listed in a sys file. - -# Everything after a '#' character is a comment. To uncomment any of -# the sample lines below, just delete the '#'. - -# This is a sample sys file that might be used by a system that -# contacts a couple of other systems, both of which are treated the -# same. sys1 provides another example. - -# Commands that appear before the first ``system'' commands are -# defaults for all systems listed in the file. - -# Get the login name and password to use from the call-out file. By -# default this is the file "call" in newconfigdir. -call-login * -call-password * - -# The systems must use a particular login -called-login Ulocal - -# Permit local users to send any world readable file -local-send / - -# Permit local uses to request into any world writable directory -local-receive / - -# Call at any time -time any - -# Use port1, then port2 -port port1 - -alternate - -port port2 - -# Now define the systems themselves. Because of all the defaults we -# used, there is very little to specify for the systems themselves. - -system comton -phone 5551212 - -system bugs -phone 5552424 |