Note that there are some explanatory texts on larger screens.

plurals
  1. POCheck if password never expired from code is not working on specific network
    primarykey
    data
    text
    <p>I got some code of a tool which does many security checks on client machines and I'm trying to understand some bug and solve it - need your help.</p> <p>There is a test which checks if the user password is set to "never expire". I tried this test offline and in 3 different networks and it seems to be working. There is some WIFI guest network in my company which return exception while executing the code. Here is the exception I'm getting:</p> <p><code>The network path was not found. at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail) at System.DirectoryServices.DirectoryEntry.Bind() at System.DirectoryServices.DirectoryEntry.get_NativeObject() at System.DirectoryServices.DirectoryEntry.InvokeGet(String propertyName) at Intel.HostCheck.Engine.Checks.PasswordAge.CheckPasswordNeverExpired()</code></p> <p>See the the following code for understanding the test implementation:</p> <pre><code> private CheckResult CheckPasswordNeverExpired() { try { DirectoryEntry de; Logger.Debug("Password Age: isCurrentUserLocalUser - " + HelpFunction.isCurrentUserLocalUser()); if (HelpFunction.isCurrentUserLocalUser()) de = new DirectoryEntry("WinNT://" + Environment.MachineName + "/" + Environment.UserName); else de = new DirectoryEntry("WinNT://" + Environment.UserDomainName + "/" + Environment.UserName); object currentUser = de.InvokeGet("UserFlags"); if (currentUser != null) { Logger.Debug("PasswordAge: " + currentUser); Logger.Debug("PasswordAge: " + Convert.ToBoolean((int)currentUser &amp; UF_DONT_EXPIRE_PASSWD).ToString()); } if (Convert.ToBoolean((int)currentUser &amp; UF_DONT_EXPIRE_PASSWD)) { Logger.Debug("Password Age: check result: fail "); return CheckResult.Fail; } Logger.Debug("Password Age: check result: pass "); return CheckResult.Pass; } catch (Exception ex) { Logger.LogException(ex, "Error in PasswordAge-&gt;Check()"); return CheckResult.Exception; } } } public static bool isCurrentUserLocalUser() { return Environment.MachineName == Environment.UserDomainName; } </code></pre> <p>Just for clarification, it's not my code so I'm not completely sure what the code owner did.</p> <hr> <p>I'm seeing that there are no responses. I will ask different question. Is there any option to obtain password age or password last set values without be depend on network connection? Is it possible to check it locally? I know this value also exists under "Local security policy" but I didn't find how to get it by code.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload