Program: 152347
Project: 152347
Buggy source:
/** 
 * Execute command.
 */
public void execute(RequestHandler handler,FtpRequestImpl request,FtpWriter out) throws IOException, FtpException {
  boolean bSuccess=false;
  IFtpConfig fconfig=handler.getConfig();
  IConnectionManager conManager=fconfig.getConnectionManager();
  IFtpStatistics stat=(IFtpStatistics)fconfig.getFtpStatistics();
  try {
    request.resetState();
    String userName=request.getArgument();
    if (userName == null) {
      out.send(501,"String_Node_Str",null);
      return;
    }
    BaseUser user=(BaseUser)request.getUser();
    if (request.isLoggedIn()) {
      if (userName.equals(user.getName())) {
        out.send(230,"String_Node_Str",null);
        bSuccess=true;
      }
 else {
        out.send(530,"String_Node_Str",null);
      }
      return;
    }
    boolean bAnonymous=userName.equals("String_Node_Str");
    if (bAnonymous && (!conManager.isAnonymousLoginEnabled())) {
      out.send(530,"String_Node_Str",null);
      return;
    }
    int currAnonLogin=stat.getCurrentAnonymousLoginNumber();
    int maxAnonLogin=conManager.getMaxAnonymousLogins();
    if (bAnonymous && (currAnonLogin >= maxAnonLogin)) {
      out.send(421,"String_Node_Str",null);
      return;
    }
    int currLogin=stat.getCurrentLoginNumber();
    int maxLogin=conManager.getMaxLogins();
    if (currLogin >= maxLogin) {
      out.send(421,"String_Node_Str",null);
      return;
    }
    User configUser=handler.getConfig().getUserManager().getUserByName(userName);
    if (configUser != null) {
      int maxUserLoginNumber=configUser.getMaxLoginNumber();
      if (maxUserLoginNumber > 0) {
        int currUserLogin=stat.getCurrentUserLoginNumber(configUser);
        if (currUserLogin >= maxUserLoginNumber) {
          out.send(421,"String_Node_Str",null);
          return;
        }
      }
      int maxUserLoginPerIP=configUser.getMaxLoginPerIP();
      if (maxUserLoginPerIP > 0) {
        int currUserLoginPerIP=stat.getCurrentUserLoginNumber(configUser,request.getRemoteAddress());
        if (currUserLoginPerIP >= maxUserLoginPerIP) {
          out.send(421,"String_Node_Str",null);
          return;
        }
      }
    }
    bSuccess=true;
    request.setUserArgument(userName);
    if (bAnonymous) {
      out.send(331,"String_Node_Str",userName);
    }
 else {
      out.send(331,"String_Node_Str",userName);
    }
  }
  finally {
    if (!bSuccess) {
      conManager.closeConnection(handler);
    }
  }
}

Fixed version (ground truth):
/** 
 * Execute command.
 */
public void execute(RequestHandler handler,FtpRequestImpl request,FtpWriter out) throws IOException, FtpException {
  boolean success=false;
  IFtpConfig fconfig=handler.getConfig();
  IConnectionManager conManager=fconfig.getConnectionManager();
  IFtpStatistics stat=(IFtpStatistics)fconfig.getFtpStatistics();
  try {
    request.resetState();
    String userName=request.getArgument();
    if (userName == null) {
      out.send(501,"String_Node_Str",null);
      return;
    }
    BaseUser user=(BaseUser)request.getUser();
    if (request.isLoggedIn()) {
      if (userName.equals(user.getName())) {
        out.send(230,"String_Node_Str",null);
        success=true;
      }
 else {
        out.send(530,"String_Node_Str",null);
      }
      return;
    }
    boolean anonymous=userName.equals("String_Node_Str");
    if (anonymous && (!conManager.isAnonymousLoginEnabled())) {
      out.send(530,"String_Node_Str",null);
      return;
    }
    int currAnonLogin=stat.getCurrentAnonymousLoginNumber();
    int maxAnonLogin=conManager.getMaxAnonymousLogins();
    if (anonymous && (currAnonLogin >= maxAnonLogin)) {
      out.send(421,"String_Node_Str",null);
      return;
    }
    int currLogin=stat.getCurrentLoginNumber();
    int maxLogin=conManager.getMaxLogins();
    if (currLogin >= maxLogin) {
      out.send(421,"String_Node_Str",null);
      return;
    }
    User configUser=handler.getConfig().getUserManager().getUserByName(userName);
    if (configUser != null) {
      int maxUserLoginNumber=configUser.getMaxLoginNumber();
      if (maxUserLoginNumber > 0) {
        int currUserLogin=stat.getCurrentUserLoginNumber(configUser);
        if (currUserLogin >= maxUserLoginNumber) {
          out.send(421,"String_Node_Str",null);
          return;
        }
      }
      int maxUserLoginPerIP=configUser.getMaxLoginPerIP();
      if (maxUserLoginPerIP > 0) {
        int currUserLoginPerIP=stat.getCurrentUserLoginNumber(configUser,request.getRemoteAddress());
        if (currUserLoginPerIP >= maxUserLoginPerIP) {
          out.send(421,"String_Node_Str",null);
          return;
        }
      }
    }
    success=true;
    request.setUserArgument(userName);
    if (anonymous) {
      out.send(331,"String_Node_Str",userName);
    }
 else {
      out.send(331,"String_Node_Str",userName);
    }
  }
  finally {
    if (!success) {
      conManager.closeConnection(handler);
    }
  }
}