示例#1
0
  @Override
  public void doPost(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {

    String param = request.getHeader("foo");

    String bar = new Test().doSomething(param);

    try {
      javax.naming.directory.InitialDirContext idc =
          org.owasp.benchmark.helpers.Utils.getInitialDirContext();
      idc.search("name", bar, new javax.naming.directory.SearchControls());
    } catch (javax.naming.NamingException e) {
      throw new ServletException(e);
    }
  } // end doPost
示例#2
0
  @Override
  public void doPost(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {

    org.owasp.benchmark.helpers.SeparateClassRequest scr =
        new org.owasp.benchmark.helpers.SeparateClassRequest(request);
    String param = scr.getTheParameter("foo");

    String bar = doSomething(param);

    try {
      javax.naming.directory.InitialDirContext idc =
          org.owasp.benchmark.helpers.Utils.getInitialDirContext();
      Object[] filterArgs = {"a", "b"};
      idc.search("name", bar, filterArgs, new javax.naming.directory.SearchControls());
    } catch (javax.naming.NamingException e) {
      throw new ServletException(e);
    }
  } // end doPost
示例#3
0
  @Override
  public void doPost(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {

    String param = "";
    java.util.Enumeration<String> headers = request.getHeaders("foo");
    if (headers.hasMoreElements()) {
      param = headers.nextElement(); // just grab first element
    }

    String bar = new Test().doSomething(param);

    try {
      javax.naming.directory.InitialDirContext idc =
          org.owasp.benchmark.helpers.Utils.getInitialDirContext();
      idc.search("name", bar, new javax.naming.directory.SearchControls());
    } catch (javax.naming.NamingException e) {
      throw new ServletException(e);
    }
  } // end doPost
示例#4
0
  @Override
  public void doPost(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {

    java.util.Map<String, String[]> map = request.getParameterMap();
    String param = "";
    if (!map.isEmpty()) {
      param = map.get("foo")[0];
    }

    String bar = new Test().doSomething(param);

    try {
      javax.naming.directory.InitialDirContext idc =
          org.owasp.benchmark.helpers.Utils.getInitialDirContext();
      idc.search("name", bar, new javax.naming.directory.SearchControls());
    } catch (javax.naming.NamingException e) {
      throw new ServletException(e);
    }
  } // end doPost
示例#5
0
  @Override
  public void doPost(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {

    javax.servlet.http.Cookie[] cookies = request.getCookies();

    String param = null;
    boolean foundit = false;
    if (cookies != null) {
      for (javax.servlet.http.Cookie cookie : cookies) {
        if (cookie.getName().equals("foo")) {
          param = cookie.getValue();
          foundit = true;
        }
      }
      if (!foundit) {
        // no cookie found in collection
        param = "";
      }
    } else {
      // no cookies
      param = "";
    }

    String bar;

    // Simple if statement that assigns constant to bar on true condition
    int i = 86;
    if ((7 * 42) - i > 200) bar = "This_should_always_happen";
    else bar = param;

    try {
      javax.naming.directory.InitialDirContext idc =
          org.owasp.benchmark.helpers.Utils.getInitialDirContext();
      idc.search("name", bar, new javax.naming.directory.SearchControls());
    } catch (javax.naming.NamingException e) {
      throw new ServletException(e);
    }
  }
示例#6
0
  @Override
  public void doPost(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {

    org.owasp.benchmark.helpers.SeparateClassRequest scr =
        new org.owasp.benchmark.helpers.SeparateClassRequest(request);
    String param = scr.getTheParameter("foo");

    String bar = param;
    if (param.length() > 1) {
      StringBuilder sbxyz98541 = new StringBuilder(param);
      bar = sbxyz98541.replace(param.length() - "Z".length(), param.length(), "Z").toString();
    }

    try {
      javax.naming.directory.InitialDirContext idc =
          org.owasp.benchmark.helpers.Utils.getInitialDirContext();
      idc.search("name", bar, new javax.naming.directory.SearchControls());
    } catch (javax.naming.NamingException e) {
      throw new ServletException(e);
    }
  }