3.1.1.13.7 GetUserLogonInfoByUPNOrAccountName
-
procedure GetUserLogonInfoByUPNOrAccountName( UPNOrName: unicodestring, ExpandedSids: ARRAY(SID), MaxValidityTimeHint: LARGE_INTEGER) : NTSTATUS
UPNOrName: The principal whose logon information is to be retrieved.
ExpandedSids: Returns the set of expanded SIDs.
MaxValidityTimeHint: Returns a future timestamp that specifies when the returned results are no longer considered valid; a value of zero signifies that no hint is being returned.
Return Values: This procedure returns STATUS_SUCCESS ([MS-ERREF] section 2.3.1) to indicate success; otherwise, an NTSTATUS error code.
Note This procedure uses functions defined in [MS-DRSR] section 4.1.4.2.
Logical Processing:
-
Status: NTSTATUS; UserName: unicodestring /* Search on the userPrincipalName attribute first */ Status := GetUserLogonInfoByAttribute( UPNOrName, userPrincipalName, ExpandedSids, MaxValidityTimeHint); if Status == STATUS_SUCCESS return Status; endif /* Search on the sAMAccountName attribute next */ Status := GetUserLogonInfoByAttribute( UPNOrName, sAMAccountName, ExpandedSids, MaxValidityTimeHint); if Status == STATUS_SUCCESS return Status; endif /* Parse the input for the user name and search on that */ UserName := UserNameFromUPN(UPNOrName); if UserName != null Status := GetUserLogonInfoByAttribute( UserName, sAMAccountName, ExpandedSids, MaxValidityTimeHint); if Status == STATUS_SUCCESS return Status; endif endif return STATUS_NO_SUCH_USER;