From 78fae3526bfaf5c9de7bdc99c15e61acacecef27 Mon Sep 17 00:00:00 2001 From: lash Date: Wed, 15 Jan 2025 13:40:33 +0000 Subject: [PATCH] Fix flag count, remove session prefix from auth gdbm lookup --- cmd/ssh/main.go | 2 +- ssh/keystore.go | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/ssh/main.go b/cmd/ssh/main.go index 8397be8..c04252b 100644 --- a/cmd/ssh/main.go +++ b/cmd/ssh/main.go @@ -86,7 +86,7 @@ func main() { cfg := engine.Config{ Root: "root", OutputSize: uint32(size), - FlagCount: uint32(16), + FlagCount: uint32(128), } if stateDebug { cfg.StateDebug = true diff --git a/ssh/keystore.go b/ssh/keystore.go index 68bfe5d..85c703f 100644 --- a/ssh/keystore.go +++ b/ssh/keystore.go @@ -44,6 +44,8 @@ func(s *SshKeyStore) AddFromFile(ctx context.Context, fp string, sessionId strin return fmt.Errorf("Failed to parse public key: %v", err) } k := append([]byte{0x01}, pubKey.Marshal()...) + s.store.SetLanguage(nil) + s.store.SetSession("") s.store.SetPrefix(storage.DATATYPE_EXTEND) logg.Infof("Added key", "sessionId", sessionId, "public key", string(publicBytes)) return s.store.Put(ctx, k, []byte(sessionId)) @@ -51,6 +53,7 @@ func(s *SshKeyStore) AddFromFile(ctx context.Context, fp string, sessionId strin func(s *SshKeyStore) Get(ctx context.Context, pubKey ssh.PublicKey) (string, error) { s.store.SetLanguage(nil) + s.store.SetSession("") s.store.SetPrefix(storage.DATATYPE_EXTEND) k := append([]byte{0x01}, pubKey.Marshal()...) v, err := s.store.Get(ctx, k)