From f5652ef83917f15b4bd6f2ff7f904f0c176e32c6 Mon Sep 17 00:00:00 2001 From: Ari Palo Date: Mon, 9 May 2022 03:16:39 +0300 Subject: [PATCH] feat: try fullname retrieval with lookup --- internal/assumecfg/resolvers.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/internal/assumecfg/resolvers.go b/internal/assumecfg/resolvers.go index e7ca1a8..b4dd56f 100644 --- a/internal/assumecfg/resolvers.go +++ b/internal/assumecfg/resolvers.go @@ -54,12 +54,16 @@ func getSessionIdentifier() string { // Let's first try getting user info if u, err := user.Current(); err == nil { - msg.Debug("🔴", "Fullname:"+u.Name) + if u2, err := user.Lookup(u.Username); err == nil { + + msg.Debug("🔴", "uFullname:"+u.Name) + msg.Debug("🔴", "u2Fullname:"+u2.Name) + // Return user full name if meaningful + if len(u2.Name) >= minLength { + msg.Trace("", "Fallback: Fullname") + return u2.Name + } - // Return user full name if meaningful - if len(u.Name) >= minLength { - msg.Trace("", "Fallback: Fullname") - return u.Name } // Return user (system) name if meaningful