Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to find out when password expires -NTLM

Status
Not open for further replies.

Demonpiggies

Programmer
Apr 9, 2007
42
US
As stated in the subject, I need to find the expiration date or time of a user's password using NTLM. I have to access Active Directory using NTLM because the rest of the code uses that "standard." One of my team members is trying to use LDAP but we're not really supposed to use that sooo....
anyway I'm using SECPKG_ATTR_PASSWORD_EXPIRY which returns (after formatting) Friday Dec. 30, 1899. Granted MY password will not expire but we tried it on a personal server with a password and login that will expire tommorrow and it still returns Dec 1899.
Code:
	//Get experation date of password if applicable
	FILETIME     tsExpirationDate;
	SYSTEMTIME   stReadableExpirationDate;
	
	//Retrieve password expiration date.hContext
	ss = g_pFuncs->QueryContextAttributes( &asClient.hContext, SECPKG_ATTR_PASSWORD_EXPIRY, (PVOID)(&tsExpirationDate) ); 

	if( ss == SEC_E_OK )
	{
		//Convert FILETIME to SYSTEMTIME
		FileTimeToSystemTime( &tsExpirationDate, &stReadableExpirationDate );

		//And set the expiration members
		SetExpirationDate( stReadableExpirationDate );
	}

	CString blah;
	int days = GetExpirationDays();
	CString bleh;
	bleh = "hahah: %d ";
	blah.Format( bleh, days);
	AfxMessageBox( blah, MB_OK | MB_ICONSTOP | MB_APPLMODAL );
Does anyone know of NTLM's ways or another way to return the expiration date?
ASSUME: GetExpirationDays() works (because it does) it returns the number of days from today that teh password will expire.
PLEASE help if you can we've been on this and nothing else for 4 days now and have almosts nothing.....
 
We found that we cannot use LDAP because we as "users" do not have access to an ADMIN's tag (password's last change attribute/tag)...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top