Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
krisdb2009 committed Jul 10, 2024
1 parent 2fe8c04 commit 7ef6784
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions SuperLauncher/CredentialExpirationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public static class CredentialExpirationService
private static Timer CheckTimer = new();
private static Timer NotifyTimer = new();
public static DateTime PasswordLastSet = DateTime.MaxValue;
public static TimeSpan MaxPasswordAge = TimeSpan.Zero;
public static TimeSpan MaxPasswordAge = TimeSpan.MaxValue;
private static ExpStat Status = ExpStat.Unknown;
public static string PasswordExpirationMessage
{
Expand All @@ -34,6 +34,7 @@ public static DateTime PasswordExpirationDate
{
get
{
if (MaxPasswordAge == TimeSpan.MaxValue) return DateTime.MaxValue;
return PasswordLastSet.Add(MaxPasswordAge);
}
}
Expand Down Expand Up @@ -80,7 +81,7 @@ private static void CheckTimer_Elapsed(object sender, ElapsedEventArgs e)
ds.Filter = "";
SearchResult root = ds.FindOne();
MaxPasswordAge = TimeSpan.FromMicroseconds((long)root.Properties["maxPwdAge"][0] / 10 * -1);
if (MaxPasswordAge == TimeSpan.Zero) { Status = ExpStat.NeverExpires; return; }
if (MaxPasswordAge == TimeSpan.MaxValue || MaxPasswordAge == TimeSpan.Zero) { Status = ExpStat.NeverExpires; return; }
ds.SearchScope = SearchScope.Subtree;
ds.PropertiesToLoad.Clear();
ds.PropertiesToLoad.Add("userAccountControl");
Expand Down

0 comments on commit 7ef6784

Please sign in to comment.