Hello,
I'm trying to create a basic authentication system on my embedded http server.
I'v barely made it work but the problem is, when my program try to generate some XML file for the client to read after the anthentication, it return an empty file and finaly, the whole http server crashes.
If I try to access the xml files before login in, no problem.
Here is my code :
UINT authentication_check(struct NX_HTTP_SERVER_STRUCT *server_ptr, UINT request_type, CHAR *resource, CHAR **name, CHAR **password, CHAR **realm)
{
SSP_PARAMETER_NOT_USED(server_ptr);
SSP_PARAMETER_NOT_USED(request_type);
/*SSP_PARAMETER_NOT_USED(resource);
SSP_PARAMETER_NOT_USED(name);
SSP_PARAMETER_NOT_USED(password);
SSP_PARAMETER_NOT_USED(realm);*/
if(strcmp((const char*)resource, "/settings.html")==0)
{
(*name)[0] = 't';
(*name)[1] = 'e';
(*name)[2] = 's';
(*name)[3] = 't';
(*name)[4] = '\0';
(*password)[0] = '2';
(*password)[1] = '0';
(*password)[2] = '1';
(*password)[3] = '8';
(*password)[4] = '\0';
(*realm)[0] = 's';
(*realm)[1] = 'e';
(*realm)[2] = 't';
(*realm)[3] = 't';
(*realm)[4] = 'i';
(*realm)[5] = 'n';
(*realm)[6] = 'g';
(*realm)[7] = '\0';
return (NX_HTTP_BASIC_AUTHENTICATE);
}
else
{
return (NX_SUCCESS);
}
}
Is there some example with this authentication system or some problem with my code ?
Thanks in advance,
Clément.