Trying to test the custom logon script option using curl on the same machine that nxfilter is running on. I am not getting a success nor a failure response. After I get the success message, I will remove the localhost restriction.
When I run the following I get no output (janeway is an existing test user)
Here is the login_user.jsp contents. I plan on updating this to allow none local host IPs to connect, and then to get the IP using getRemoteAddr.
When I run the following I get no output (janeway is an existing test user)
Code:
curl "http://localhost/example/login_user.jsp?ip=192.168.0.100&uname=janeway"
Code:
<%@include file="../include/lib.jsp"%>
<%
/*
You can call this page using the following url.
http://localhost/example/login_user.jsp?ip=192.168.0.100&uname=john
It's limited to localhost for security reason but you can change it according
to your network environment.
*/
// Only localhost access allowed.
if(request.getRemoteAddr().startsWith("127.0.0.1")){
out.println(request.getRemoteAddr());
return;
}
// Get params.
String ip = paramString("ip");
String uname = paramString("uname");
/*
If you think there's a possibility of IP spoofing from your users then it's better
to get the IP address from the HTTP connection itself.
*/
//String ip = request.getRemoteAddr();
//String uname = paramString("uname");
UserLoginDao dao = new UserLoginDao(request);
if(dao.createIpSession(ip, uname)){
out.println("Login success.");
}
else{
out.println("Login error!");
}
%>
Comment