Subject: [254] Segment violation when ftp service was closed

From: Andreas Schuch <[email-masked]>
Date: Tue, 02 Aug 1994 20:32:08 +0200 (MET DST)

When the ftp service has been closed via ftpshut with a message
containing "%U" each new try to establish an ftp connection will lead
ftpd to abort with a segment violation error (signal 11).

ftpd expands the magic cookies of the shutdown message without having
requested a user name. Therefore "pw" (normally a pointer to a structure
containing the user name) is a NULL pointer.
My patch (see below) changes the behaviour of "%U" a bit: the RFC931 request
user name is used if available.

Andreas Schuch

--- cut here ---
*** extensions.c.orig	Wed Apr 13 23:02:46 1994
--- extensions.c	Tue Aug  2 18:21:20 1994
***************
*** 98,101 ****
--- 98,104 ----
  int show_fullinfo;
  
+ extern char authuser[];
+ extern int authenticated;
+ 
  check_newer(char *path, struct stat *st, int flag)
  {
***************
*** 194,198 ****
  
              case 'U':
!                 strcpy(outptr, pw->pw_name);
                  break;
  
--- 197,202 ----
  
              case 'U':
!                 strcpy(outptr, authenticated ?
! 		  authuser : pw!=NULL ? pw->pw_name : "*unknown*");
                  break;