From 9c32bdf16d5be5a9f0134f056522474a2edd0c93 Mon Sep 17 00:00:00 2001 From: Adrian Dombeck Date: Thu, 19 Sep 2024 15:18:30 +0200 Subject: [PATCH] Add debug output This should help us debug cases where users which should have been added to the database can not be found. refs: #536 --- internal/brokers/manager.go | 2 ++ internal/services/pam/pam.go | 2 ++ internal/users/cache/update.go | 3 +++ 3 files changed, 7 insertions(+) diff --git a/internal/brokers/manager.go b/internal/brokers/manager.go index 8f452616a..eed5b8197 100644 --- a/internal/brokers/manager.go +++ b/internal/brokers/manager.go @@ -163,6 +163,8 @@ func (m *Manager) NewSession(brokerID, username, lang, mode string) (sessionID s return "", "", err } + log.Debug(context.Background(), fmt.Sprintf("%s: New session for %q", sessionID, username)) + m.transactionsToBrokerMu.Lock() defer m.transactionsToBrokerMu.Unlock() m.transactionsToBroker[sessionID] = broker diff --git a/internal/services/pam/pam.go b/internal/services/pam/pam.go index 7ef9d598b..fc665c3ee 100644 --- a/internal/services/pam/pam.go +++ b/internal/services/pam/pam.go @@ -256,6 +256,8 @@ func (s Service) IsAuthenticated(ctx context.Context, req *authd.IARequest) (res data = "" } + log.Debug(ctx, fmt.Sprintf("%s: Authentication result: %s", sessionID, access)) + return &authd.IAResponse{ Access: access, Msg: data, diff --git a/internal/users/cache/update.go b/internal/users/cache/update.go index f03c114c4..430475adb 100644 --- a/internal/users/cache/update.go +++ b/internal/users/cache/update.go @@ -1,6 +1,7 @@ package cache import ( + "context" "encoding/json" "errors" "fmt" @@ -9,6 +10,7 @@ import ( "strconv" "time" + "github.com/ubuntu/authd/internal/log" "go.etcd.io/bbolt" ) @@ -75,6 +77,7 @@ func updateUser(buckets map[string]bucketWithName, userContent userDB) error { } // Update user buckets + log.Debug(context.Background(), fmt.Sprintf("Updating entry of user %q (UID: %d)", userContent.Name, userContent.UID)) updateBucket(buckets[userByIDBucketName], userContent.UID, userContent) updateBucket(buckets[userByNameBucketName], userContent.Name, userContent)