Index: ftpd.tcl
===================================================================
RCS file: /cvsroot/tcllib/tcllib/modules/ftpd/ftpd.tcl,v
retrieving revision 1.26
diff -c -r1.26 ftpd.tcl
*** ftpd.tcl	5 Oct 2004 19:15:52 -0000	1.26
--- ftpd.tcl	13 Mar 2006 23:41:11 -0000
***************
*** 527,565 ****
      variable CurrentSocket 
  
      set CurrentSocket $sock
!     if {[eof $sock]} {
! 	Finish $sock
! 	return
!     }
!     switch -exact -- $data(state) {
! 	command {
! 	    gets $sock command
! 	    set parts [split $command]
! 	    set cmd [string toupper [lindex  $parts 0]]
! 	    auto_load ::ftpd::command::$cmd
!             if {($data(access) == 0) && ((![info exists data(user)]) || \
! 	            ($data(user) == "")) && (![string equal $cmd "USER"])} {
!                 if {[string equal $cmd "PASS"]} {
! 		    puts $sock "503 Login with USER first."
!                 } else {
!                     puts $sock "530 Please login with USER and PASS."
  		}
! 	    } elseif {($data(access) == 0) && (![string equal $cmd "PASS"]) \
!                     && (![string equal $cmd "USER"]) \
!                     && (![string equal $cmd "QUIT"])} {
!                 puts $sock "530 Please login with USER and PASS."
! 	    } elseif {[info command ::ftpd::command::$cmd] != ""} {
! 		Log debug $command
! 		::ftpd::command::$cmd $sock [lrange $parts 1 end]
! 		catch {flush $sock}
! 	    } else {
! 		Log error "Unknown command: $cmd"
! 		puts $sock "500 Unknown command $cmd"
  	    }
  	}
! 	default {
! 	    error "Unknown state \"$data(state)\""
! 	}
      }
      return
  }
--- 527,567 ----
      variable CurrentSocket 
  
      set CurrentSocket $sock
!     set caught [catch {gets $sock command} err]
! 
!     if {!$caught && [string length $command]} {
! 	switch -exact -- $data(state) {
! 	    command {
! 		set parts [split $command]
! 		set cmd [string toupper [lindex  $parts 0]]
! 		auto_load ::ftpd::command::$cmd
! 		if {($data(access) == 0) && ((![info exists data(user)]) || \
! 			($data(user) == "")) && (![string equal $cmd "USER"])} {
! 		    if {[string equal $cmd "PASS"]} {
! 			puts $sock "503 Login with USER first."
! 		    } else {
! 			puts $sock "530 Please login with USER and PASS."
! 		    }
! 		} elseif {($data(access) == 0) && (![string equal $cmd "PASS"]) \
! 			&& (![string equal $cmd "USER"]) \
! 			&& (![string equal $cmd "QUIT"])} {
! 		    puts $sock "530 Please login with USER and PASS."
! 		} elseif {[info command ::ftpd::command::$cmd] != ""} {
! 		    Log debug $command
! 		    ::ftpd::command::$cmd $sock [lrange $parts 1 end]
! 		    catch {flush $sock}
! 		} else {
! 		    Log error "Unknown command: $cmd"
! 		    puts $sock "500 Unknown command $cmd"
  		}
! 	    }
! 	    default {
! 		error "Unknown state \"$data(state)\""
  	    }
  	}
!     }
!     if {[eof $sock]} {
! 	Finish $sock
      }
      return
  }

