Ticket #1902: mcserv.diff

File mcserv.diff, 760 bytes (added by pavlinux, 14 years ago)
  • vfs/mcserv.c

    diff --git a/vfs/mcserv.c b/vfs/mcserv.c
    index 3f38ac4..8aa836c 100644
    a b  
    5656#include <sys/types.h> 
    5757#include <sys/stat.h> 
    5858#include <sys/wait.h> 
     59#include <error.h> 
    5960#include <errno.h> 
    6061#include <signal.h> 
    6162#ifdef HAVE_GETOPT_H 
    do_auth (const char *username, const char *password) 
    10151016    if (getuid () != this->pw_uid) 
    10161017       return 0; 
    10171018 
    1018     if (strcmp (username, "ftp") == 0) 
    1019        chroot (this->pw_dir); 
    1020  
     1019    if (strncmp(username, "ftp", 3) == 0) { 
     1020       errno = 0; 
     1021       if (chroot(this->pw_dir) != 0 || errno != 0) { 
     1022           auth = errno; 
     1023           error(0, errno, strerror(errno)); 
     1024           return (-auth); 
     1025       } 
     1026    } 
    10211027    endpwent (); 
    10221028    return auth; 
    10231029}