From bab7dfdf68075b345e4de3ae79ea685ca884668f Mon Sep 17 00:00:00 2001 From: "Joe Richey joerichey@google.com" Date: Tue, 17 Oct 2017 02:39:07 -0700 Subject: Move around and fscrypt refactor --- cmd/fscrypt/prompt.go | 29 ----------------------------- 1 file changed, 29 deletions(-) (limited to 'cmd/fscrypt/prompt.go') diff --git a/cmd/fscrypt/prompt.go b/cmd/fscrypt/prompt.go index bccf534..57d0fc7 100644 --- a/cmd/fscrypt/prompt.go +++ b/cmd/fscrypt/prompt.go @@ -23,22 +23,13 @@ import ( "fmt" "log" "os" - "os/user" "strconv" - "github.com/pkg/errors" - "github.com/google/fscrypt/actions" "github.com/google/fscrypt/metadata" "github.com/google/fscrypt/util" ) -const ( - // Suffixes for questions with a yes or no default - defaultYesSuffix = " [Y/n] " - defaultNoSuffix = " [y/N] " -) - // Descriptions for each of the protector sources var sourceDescriptions = map[metadata.SourceType]string{ metadata.SourceType_pam_passphrase: "Your login passphrase", @@ -46,26 +37,6 @@ var sourceDescriptions = map[metadata.SourceType]string{ metadata.SourceType_raw_key: "A raw 256-bit key", } -// usernameFromID returns the username for the provided UID. If the UID does not -// correspond to a user or the username is blank, an error is returned. -func usernameFromID(uid int64) (string, error) { - u, err := user.LookupId(strconv.Itoa(int(uid))) - if err != nil || u.Username == "" { - return "", errors.Wrapf(ErrUnknownUser, "uid %d", uid) - } - return u.Username, nil -} - -// formatUsername either returns the username for the provided UID, or a string -// containing the error for unknown UIDs. -func formatUsername(uid int64) string { - username, err := usernameFromID(uid) - if err != nil { - return fmt.Sprintf("[%v]", err) - } - return username -} - // formatInfo gives a string description of metadata.ProtectorData. func formatInfo(data actions.ProtectorInfo) string { switch data.Source() { -- cgit v1.2.3