by johnmunro >> Tue, 10 Aug 2004 17:30:51 GMT
I am trying to write a very simple DevelopmentSecurityLibrary for our dev system. What I want it to do is just verify that the username and password the user has typed into the Jade dialog is a valid user on the domain. It's a fair medium term solution to the authentication issue we currently have.
The problem is, everything I know about C++ can be written on the back of a very small stamp...
I've finally managed to get my dll to export the required functions, and Jade is able to use them (if I just put return 0 in the function it lets you in, return 1 and it doesn't). Obviously a dll that either lets everyone in or lets nobody in isn't much use (but you wouldn't believe how long it took to get here).
So after some research, I found out that the way to verify login credentials with Windows is to call LogonUser. If the credentials are valid, it gives you a handle for use with other API calls, which we don't need for anything, but need to release using CloseHandle. I've changed the jadeDevelopmentUserInfo function to use these as best I can, but it won't compile. My function looks like this:
extern "C" DllExport int JOMAPI jadeDevelopmentUserInfo(const Character *userName, const Character *password)
{
PHANDLE phToken;
if(LogonUser(userName, "mydomain", password, LOGON32_LOGON_NETWORK, LOGON32_PROVIDER_DEFAULT, phToken))
{
CloseHandle phToken;
return 0; // access granted
}
else
{
return 1; // access denied
}
}
It gets a compile error on the LogonUser line - 'LogonUserA' : cannot convert parameter 1 from 'const char *' to 'char *'
Now I have no idea what it means or how to fix it, but I tried taking the "const"s off of the function signature. I don't know if this will cause other problems further down the line, but it allowed the compiler to take another half-step before falling down.
Now the compile error is on the PHANDLE line - syntax error : missing ';' before identifier 'phToken'
I'm lost - if anyone out there is a C++ whiz and can help me out, that would be great...
John Munro
FileVision UK Ltd.
The Bioscience Innovation Centre
Cowley Road, Cambridge, UK
CB4 0DS
Telephone: +44 (0) 1223 478200
Fax: +44 (0) 1223 477969
Email: john.munro@filevision.com
Web: http://www.filevision.com
The contents of this communication are confidential and are only intended to be read by the addressee. We apologize if you receive this communication in error and ask that you contact FileVision UK Ltd. immediately to arrange for its return. The use of any information contained in this communication by an unauthorized person is strictly prohibited. FileVision UK Ltd. cannot accept responsibility for the accuracy or completeness of this communication as it is being transmitted over a public network. If you suspect this message may have been intercepted or amended, please inform FileVision UK Ltd.