       @reply 202
     
     # 仮実装しているもの
-    #"USER": (username)->
-    #"PASS": (password)->
     #"RETR": ()->
     #"PWD": ()->
     #"NLST": ()->
     
     # 各コマンドの処理
     "USER": (username)->
+      @userName = username
       @reply 331
     
     "PASS": (password)->
-      @reply 230
+      userPass = authUser[@userName]
+      if userPass? and userPass is password
+        @reply 230
+      else
+        @reply 530
     
     "PWD": ()->
       @reply 257, '"/"'

      socket.setNoDelay()
      socket.dataEncoding = "binary"
      socket.passive = false
      
      # Socket response
      socket.reply = (status, message, callback)->

net = require("net")

module.exports = class BabyFtpd
  authUser = {}
  constructor: (option = {})->
    @piServer = undefined
  
  addUser: (userName, userPass)->
    authUser[userName] = userPass
  
  listen: (port = 21, host = "0.0.0.0")->
    @piServer = net.createServer()
