Accessing the NT security DB to veriy names and passwords 
Author Message
 Accessing the NT security DB to veriy names and passwords

Some time ago, I saw a thread about using the NetUserChangePassword()
function as a means to verify passwords in the NT Domain via a
front-end application. I took the advice and implemented a VB front
end to call this function. A return code of 2245 means that the
correct old password was supplied and an 86 means that a bogus old
password was used.

This works on almost all IDs defined to my system.  On a couple of the
IDs however, I am getting a return code of 1327(Logon failure -
Account restriction) come back from the NetUserChangePassword() API
call.  These IDs do not appear to be any different than the one that
work correctly.

Has anyone ever seen this error before? Is there something I could be
doing slightly differently? Also, should the server name be the domain
name (with or without the \\ in front, or should it be the server name
as defined in the network properties)

The code is listed below - thanks for any help.

db

Private Declare Function NetUserChangePassword Lib "netapi32" _
(Domain As Any, User As Any, OldPass As Byte, NewPass As Byte) As Long

Public Function verifyUser2(ByVal as_userName, ByVal as_password) As
Long
   Dim ll_rc As Long, ll_token As Long
   Dim yUserName() As Byte
   Dim yPassword() As Byte
   Dim yNewPassword() As Byte
   Dim yServer() As Byte

   yUserName = as_userName & vbNullChar
   yPassword = as_password & vbNullChar
   yNewPassword = as_password & "01234567890123" & vbNullChar
   yServer = "\\MYSERVER" & vbNullChar

   ll_rc = NetUserChangePassword(yServer(0), _
                                 yUserName(0), _
                                 yPassword(0), _
                                 yNewPassword(0))
   verifyUser2 = ll_rc
End Function



Sat, 14 Oct 2000 03:00:00 GMT  
 Accessing the NT security DB to veriy names and passwords

Could be that the account is restricted from changing password?

--
Mark Harr
LDA Systems, Inc.

Quote:

>Some time ago, I saw a thread about using the NetUserChangePassword()
>function as a means to verify passwords in the NT Domain via a
>front-end application. I took the advice and implemented a VB front
>end to call this function. A return code of 2245 means that the
>correct old password was supplied and an 86 means that a bogus old
>password was used.

>This works on almost all IDs defined to my system.  On a couple of the
>IDs however, I am getting a return code of 1327(Logon failure -
>Account restriction) come back from the NetUserChangePassword() API
>call.  These IDs do not appear to be any different than the one that
>work correctly.

>Has anyone ever seen this error before? Is there something I could be
>doing slightly differently? Also, should the server name be the domain
>name (with or without the \\ in front, or should it be the server name
>as defined in the network properties)

>The code is listed below - thanks for any help.

>db

>Private Declare Function NetUserChangePassword Lib "netapi32" _
>(Domain As Any, User As Any, OldPass As Byte, NewPass As Byte) As Long

>Public Function verifyUser2(ByVal as_userName, ByVal as_password) As
>Long
>   Dim ll_rc As Long, ll_token As Long
>   Dim yUserName() As Byte
>   Dim yPassword() As Byte
>   Dim yNewPassword() As Byte
>   Dim yServer() As Byte

>   yUserName = as_userName & vbNullChar
>   yPassword = as_password & vbNullChar
>   yNewPassword = as_password & "01234567890123" & vbNullChar
>   yServer = "\\MYSERVER" & vbNullChar

>   ll_rc = NetUserChangePassword(yServer(0), _
>                                 yUserName(0), _
>                                 yPassword(0), _
>                                 yNewPassword(0))
>   verifyUser2 = ll_rc
>End Function



Tue, 17 Oct 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Access Security - Changing DB password from VB?

2. how do i access a password protected MS-ACCESS db without the password

3. user name and password for access db

4. An application accessing an NT share and providing its own user name/password

5. An application accessing an NT share and providing its own user name/password

6. An application accessing an NT share and providing its own user name/password

7. Access Security - Deleting User Passwords from Access Basic

8. Create a db access db with password

9. Create a db access db with password

10. Windows Security - User Name and Password

11. NT User Accounts for dB security

12. Using NT security and user SID/login name

 

 
Powered by phpBB® Forum Software