Tags: patch
thanks

The templates file has
  Template: wu-ftpd/anonymous
  Type: boolean
  Default: false
  _Description: Do you want to allow anonymous ftp access?
   Anonymous FTP allows users to log in to the server using the username
  ...

And the postinst does this
        db_get wu-ftpd/anonymous
        if [ "$RET" = "true" ]; then
                $ADDFTPUSER --configure
        else
                $RMFTPUSER --configure
        fi
where
  ADDFTPUSER="/usr/sbin/addftpuser"
  RMFTPUSER="/usr/sbin/rmftpuser"

and 'rmftpuser' does this:
  my $itshomedir = (getpwnam("ftp"))[7];
  exit(0) unless defined($itshomedir);

  system ("userdel", "ftp") == 0 or die "Removal failed!\n";

userdel fails because there is an 'ftp' user in our NIS passwd map,
which getpwnam() manages to find.

Possible solutions I can think of:
1.  Conflicts: nis   (ugh)
2.  default to allowing anonymous ftp   (ugh)
3.  exit(0) unless system("grep", $itshomedir, "/etc/passwd") == 0;

Patch for option 3 attached. Not pretty but it worked for me.

Cheers
Vince
Index: tags/2.6.2-30/debian/addftpuser
===================================================================
--- tags/2.6.2-30/debian/addftpuser	(revision 506)
+++ tags/2.6.2-30/debian/addftpuser	(working copy)
@@ -34,6 +34,8 @@
 
   my $itshomedir = (getpwnam("ftp"))[7];
   exit(0) unless defined($itshomedir);
+  # double-check ftp user is local to the machine
+  exit(0) unless system("grep", $itshomedir, "/etc/passwd") == 0;
   
   system ("userdel", "ftp") == 0 or die "Removal failed!\n";
   print STDERR "The anonymous FTP user has been successfully removed.\n";

Reply via email to