Skip to content

Commit

Permalink
fix: add debug attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
alesz committed Nov 6, 2024
1 parent 7e2a650 commit 637bb54
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion osluc.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ func searchUser(l *ldap.Conn, cfg map[string]interface{}, username string) bool
0, // Time limit, 0 for no limit
false, // TypesOnly - don't return attribute values, only attribute types
searchFilter, // Search filter
[]string{"dn", "cn", "lastLogon", "accountExpires", "sAMAccountName", "lastLogonTimestamp"}, // Attributes to retrieve //
[]string{"dn", "cn", "lastLogon", "accountexpires", "samaccountname", "lastlogontimestamp"}, // Attributes to retrieve //
nil,
)

Expand All @@ -208,18 +208,23 @@ func searchUser(l *ldap.Conn, cfg map[string]interface{}, username string) bool
return true
} else {
slog.Debug("User found in LDAP, checking user attributes", "filter", searchFilter)
result.PrettyPrint(2)

for _, entry := range result.Entries {

slog.Debug("lastLogon", "Value", entry.GetAttributeValue("lastlogon"))
lastLogon, err := FileTimeToGoTime(entry.GetAttributeValue("lastlogon"))
if err != nil {
slog.Error("Cannot convert FileTime for lastLogon attribute", "error", err)
}

slog.Debug("lastLogonTimestamp", "Value", entry.GetAttributeValue("lastlogontimestamp"))
lastLogonTS, err := FileTimeToGoTime(entry.GetAttributeValue("lastlogontimestamp"))
if err != nil {
slog.Error("Cannot convert FileTime for lastLogonTimestamp attribute", "error", err)
}

slog.Debug("accountExpires", "Value", entry.GetAttributeValue("accountexpires"))
accountExpires, err := FileTimeToGoTime(entry.GetAttributeValue("accountexpires"))
if err != nil {
slog.Error("Cannot convert FileTime for accountExpires attribute", "error", err)
Expand Down

0 comments on commit 637bb54

Please sign in to comment.