From b7de8535f899f2b88d61f4f1264fe6a272196536 Mon Sep 17 00:00:00 2001 From: Joseph Richey Date: Thu, 19 Oct 2017 03:15:28 -0700 Subject: util: Add better user lookup functions When looking up users in fscrypt, we often want to proceed even if the requested uid doesn't appear to be a valid user on the system. This mainly occurs when a user is deleted, but they still have a login protector on disk. Thus, GetUser() with a bad uid creates a fake user with a pretty placeholder name. The corresponding call sites of util.EffectiveUser are changed (often simplifying logic). Various documentation is updated and typos are fixed. --- crypto/crypto_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'crypto/crypto_test.go') diff --git a/crypto/crypto_test.go b/crypto/crypto_test.go index 444f847..a353052 100644 --- a/crypto/crypto_test.go +++ b/crypto/crypto_test.go @@ -62,10 +62,10 @@ var ( fakeInvalidPolicyKey, _ = makeKey(42, metadata.PolicyKeyLen-1) fakeWrappingKey, _ = makeKey(17, metadata.InternalKeyLen) - testUser, _ = util.EffectiveUser() + testUser = util.CurrentUser() ) -// As the passpharase hashing function clears the passphrase, we need to make +// As the passphrase hashing function clears the passphrase, we need to make // a new passphrase key for each test func fakePassphraseKey() (*Key, error) { return NewFixedLengthKeyFromReader(bytes.NewReader(fakePassword), len(fakePassword)) @@ -613,7 +613,7 @@ func BenchmarkUnwrap(b *testing.B) { } } -func BenchmarkUnwrapNolock(b *testing.B) { +func BenchmarkUnwrapNoLock(b *testing.B) { b.StopTimer() UseMlock = false -- cgit v1.2.3