diff options
Diffstat (limited to 'gnu/libexec/uucp/libunix/spool.c')
-rw-r--r-- | gnu/libexec/uucp/libunix/spool.c | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/gnu/libexec/uucp/libunix/spool.c b/gnu/libexec/uucp/libunix/spool.c index a3e50f7747f1..fa1d8e6b34c2 100644 --- a/gnu/libexec/uucp/libunix/spool.c +++ b/gnu/libexec/uucp/libunix/spool.c @@ -1,7 +1,7 @@ /* spool.c Find a file in the spool directory. - Copyright (C) 1991, 1992 Ian Lance Taylor + Copyright (C) 1991, 1992, 1993 Ian Lance Taylor This file is part of the Taylor UUCP package. @@ -20,13 +20,13 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. The author of the program may be contacted at ian@airs.com or - c/o Infinity Development Systems, P.O. Box 520, Waltham, MA 02254. + c/o Cygnus Support, Building 200, 1 Kendall Square, Cambridge, MA 02139. */ #include "uucp.h" #if USE_RCS_ID -const char spool_rcsid[] = "$Id: spool.c,v 1.1 1993/08/05 18:24:31 conklin Exp $"; +const char spool_rcsid[] = "$Id: spool.c,v 1.2 1994/05/07 18:11:24 ache Exp $"; #endif #include "uudefs.h" @@ -194,7 +194,12 @@ zsfind_file (zsimple, zsystem, bgrade) const char *zsystem; int bgrade; { - if (! fspool_file (zsimple)) + /* zsysdep_spool_commands calls this with TMPXXX which we must treat + as a C. file. */ + if ((zsimple[0] != 'T' + || zsimple[1] != 'M' + || zsimple[2] != 'P') + && ! fspool_file (zsimple)) { ulog (LOG_ERROR, "Unrecognized file name %s", zsimple); return NULL; @@ -203,7 +208,9 @@ zsfind_file (zsimple, zsystem, bgrade) #if ! SPOOLDIR_HDB && ! SPOOLDIR_SVR4 && ! SPOOLDIR_TAYLOR if (*zsimple == 'X') { - size_t clen; + static char *zbuf; + static size_t cbuf; + size_t clen, cwant; /* Files beginning with X. are execute files. It is important for security reasons that we know the system which created @@ -216,22 +223,19 @@ zsfind_file (zsimple, zsystem, bgrade) too short, but hopefully no problem will occur since any System V systems will be using HDB or SVR4 or TAYLOR. */ clen = strlen (zsimple); - if (clen <= 7 || strncmp (zsimple + 2, zsystem, clen - 7) != 0) + if (clen < 5) { - static char *zbuf; - static size_t cbuf; - size_t cwant; - - cwant = strlen (zsystem) + 8; - if (cwant > cbuf) - { - zbuf = (char *) xrealloc ((pointer) zbuf, cwant); - cbuf = cwant; - } - sprintf (zbuf, "X.%s%s", zsystem, - clen < 5 ? zsimple : zsimple + clen - 5); - zsimple = zbuf; + ulog (LOG_ERROR, "Bad file name (too short) %s", zsimple); + return NULL; } + cwant = strlen (zsystem) + 8; + if (cwant > cbuf) + { + zbuf = (char *) xrealloc ((pointer) zbuf, cwant); + cbuf = cwant; + } + sprintf (zbuf, "X.%s%s", zsystem, zsimple + clen - 5); + zsimple = zbuf; } #endif /* ! SPOOLDIR_HDB && ! SPOOLDIR_SVR4 && ! SPOOLDIR_TAYLOR */ @@ -264,6 +268,7 @@ zsfind_file (zsimple, zsystem, bgrade) switch (*zsimple) { case 'C': + case 'T': #if SPOOLDIR_BSD42 || SPOOLDIR_BSD43 return zsysdep_in_dir ("C.", zsimple); #endif /* SPOOLDIR_BSD42 || SPOOLDIR_BSD43 */ |