@@ -24,10 +24,10 @@ const persistent int = 1
24
24
// Keyctl handles secrets using Linux Kernel keyring mechanism
25
25
type Keyctl struct {}
26
26
27
+ // createDefaultPersistentKeyring creates the default persistent keyring. If the
28
+ // keyring for the user already exists, then it returns the id of the existing
29
+ // keyring.
27
30
func (k Keyctl ) createDefaultPersistentKeyring () (string , error ) {
28
- /* Create default persistent keyring. If the keyring for the user
29
- * already exists, then it returns the id of the existing keyring
30
- */
31
31
var errout , out bytes.Buffer
32
32
uid := os .Getuid ()
33
33
cmd := exec .Command ("keyctl" , "get_persistent" , "@u" , strconv .Itoa (uid ))
@@ -57,7 +57,7 @@ func (k Keyctl) getDefaultCredsStoreFromPersistent() (keyctl.NamedKeyring, error
57
57
}
58
58
59
59
defaultKeyring , err := keyctl .OpenKeyring (defaultSessionKeyring , defaultKeyringName )
60
- /* if already does not exist we create */
60
+ // create keyring if it does not exist
61
61
if err != nil || defaultKeyring == nil {
62
62
cmd := exec .Command ("keyctl" , "newring" , defaultKeyringName , strings .TrimSuffix (persistentKeyringID , "\n " ))
63
63
cmd .Stdout = & out
@@ -67,7 +67,7 @@ func (k Keyctl) getDefaultCredsStoreFromPersistent() (keyctl.NamedKeyring, error
67
67
return nil , fmt .Errorf ("cannot run keyctl command to created credstore keyring (%s): %s %s: %w" , cmd .String (), errout .String (), out .String (), err )
68
68
}
69
69
}
70
- /* Search for it again and return the default keyring*/
70
+ // Search for it again and return the default keyring
71
71
defaultKeyring , err = keyctl .OpenKeyring (defaultSessionKeyring , defaultKeyringName )
72
72
if err != nil {
73
73
return nil , fmt .Errorf ("failed to lookup default session keyring: %w" , err )
@@ -78,7 +78,7 @@ func (k Keyctl) getDefaultCredsStoreFromPersistent() (keyctl.NamedKeyring, error
78
78
79
79
// getDefaultCredsStore is a helper function to get the default credsStore keyring
80
80
func (k Keyctl ) getDefaultCredsStore () (keyctl.NamedKeyring , error ) {
81
- if persistent == 1 {
81
+ if persistent == 1 { // TODO(thaJeztah) persistent is a const, and always 1, what's this check for?
82
82
cs , err := k .getDefaultCredsStoreFromPersistent ()
83
83
if err != nil {
84
84
return nil , err
0 commit comments