Problems with IAccount

delphi package - easy access to security apis

Problems with IAccount

Postby sundance » Tue Nov 05, 2013 11:45 am

Hi,
I'm trying to set access rights to a folder for an ActiveDirectory account that has just been created (using ADSI).
It seems it sometimes takes some time for the account to become available for madSecurity.

I'm using this code:
Code: Select all
var
  UserAccount: IAccount;
  Security: ISecurityObject;
begin
  Security := madSecurity.FileSecurity(aPathname);
  if not Security.Success then Exit;

  UserAccount := madSecurity.Account(aUsernameNT4);
  if not UserAccount.Success then Exit;  // this returns false!

Maybe it's an issue asking a different domain controller with mad.

Is there a way to solve this problem? It's not very helpful to insert "Sleep(5000)" here...
Maybe a dedicated DC can be specified?

.sundance.
sundance
 
Posts: 1
Joined: Mon Mar 05, 2012 7:45 am

Re: Problems with IAccount

Postby madshi » Tue Nov 05, 2013 1:01 pm

I'm not sure how to solve this. If the user account isn't accessible for a few seconds that sounds like a Windows or API issue. You can check the documentation of LookupAccountName. There's an additional "lpSystemName" parameter I'm currently not using. But the documentation says:

Generally, specify a value for lpSystemName only when the account is in an untrusted domain and the name of a computer in that domain is known.

That doesn't sound like your situation, so I would say it's an issue with the win32 API or something else, and outside of madSecurity's control.
madshi
Site Admin
 
Posts: 9618
Joined: Sun Mar 21, 2004 5:25 pm


Return to madSecurity

Who is online

Users browsing this forum: No registered users and 1 guest