Ummm,
Let me take that back...
After examining quite a bit of code, I am now fairly convinced that a bug has been introduced at some point, and believe that the intention was always to bypass the second logon when NT authentication is used.
The NTUser function (in inc_functions.asp) is called when NT Authentication is on, and sets up the cookie information for the user.
It performs the following steps:
1. It searches for the member with M_USERNAME equal to the "userid" cookie set in the NTAuthenticate function.
2. It then sets the "Name" cookie to the retrieved M_NAME.
3. It then tries to obtain the M_LEVEL of the user (by calling the chkUser function).
4. If the value return from chkUser indicates they have admin rights (ie. =4), it sets the "Approval" cookie which allows access to the admin functions (which would mean bypassing the admin_login.asp screen).
The chkUser searches for a member with MEMBERS.<strDBNTSQLName> = the name passed in. In the case of NT Authentication, strDBNTSQLName is set (in config.asp) to "M_USERNAME".
The NTUser function calls chkUser as follows:
mLev = cint(chkUser(Request.Cookies(strUniqueID & "User")("Name"), Request.Cookies(strUniqueID & "User")("Pword")))
The trouble is that the "Name" cookie used in the line above was set to the M_NAME field (in step 2 above), whereas the chkUser function searches on M_USERNAME.
The chkUser code of course finds no match and return a value of 0 (meaning Invalid Password).
The NTUser function should instead pass the userID to the chkUser function. This is achieved by changing line 1216:
mLev = cint(chkUser(Request.Cookies(strUniqueID & "User")("Name"), Request.Cookies(strUniqueID & "User")("Pword")))
to:
mLev = cint(chkUser(Session(strCookieURL & "userID"), Request.Cookies(strUniqueID & "User")("Pword")))
Kym.
Edited by - mclek on 29 August 2001 01:52:28