WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Networks - Servers
plus
plus
plus
plus
plus
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

How to Validate a Userid and Password

Keywords: 	 Validate a Userid and Password  invalid credentials 

Question:

I want to valid username and password on Domain. Which function I must use to make this verification.

Context, I want to valid de username : jpare with de password : hav2car on a BRMLAN3 domain controler, this domain is a NT Domain.

I just want to know if this username an his password are good! And after, i can take action...

Answer:

  1. There is no function to exactly verify a userid/password.

    However on an NT box you can try to map a network drive using the ID and password. If it maps correctly....they must be good.

    For NT use the "WWWNT34I.DLL" network extender and the wntAddDrive function.

    You may need to...

    ErrorMode(@off)
    flag=wntAddDrive(...
    ErrorMode(@cancel)
    ;Do NOT leave ErrorMode turned off for more than 1-2 lines of code.
    
    For Windows 95? No idea. It only supports one userid, so if they are logged in...

  2. On NT, I've mapped a connection to IPC$ to tell if the username and Password are correct - essentially testing whether the user entered the correct credentials at a gina-like dialog box (username, password, domain). Since Everyone has access to IPC$, the connection will fail if any invalid credentials are given. I've tested this against accounts in a local account database and against a domain but this was by no means extensive testing. I used this with a Winbatch program running as a service as System (no network user ID) connecting to another winbatch program over sockets.

    IPC$ is a share on every machine - so if I have a domain DM, user USER1 (dm/User1 is the fully qualified name), with Password PW and Workstation Ws in domain DM, you can use the:

     
    wntAdddrive("DM\User1","PW", "\\WS",@none, @false) 
    
    to connect to the IPC$ share. Errors codes tell you whether they used accurate domain credentials - I believe they are 500 - series errors. If you get no error, then the username and password are correct. I always attempt to delete this connection with a wntcancelcon("\\ws",@true,@true) before making the test above. I believe there are problems with actually declaring \\WS\IPC$ in the wntaddrive command. You get the same result with just \\WS.

    This has not been tested with trusts, but it has been tested where users do not have the right to log on locally. This works independent of the users right to logon locally and only validates the username against the password in the account database.


Article ID:   W14631
Filename:   Validate a Userid and Password.txt
File Created: 2001:03:01:13:43:46
Last Updated: 2001:03:01:13:43:46