@@ -24,10 +24,10 @@ const persistent int = 1
2424// Keyctl handles secrets using Linux Kernel keyring mechanism
2525type Keyctl struct {}
2626
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.
2730func (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- */
3131 var errout , out bytes.Buffer
3232 uid := os .Getuid ()
3333 cmd := exec .Command ("keyctl" , "get_persistent" , "@u" , strconv .Itoa (uid ))
@@ -57,7 +57,7 @@ func (k Keyctl) getDefaultCredsStoreFromPersistent() (keyctl.NamedKeyring, error
5757 }
5858
5959 defaultKeyring , err := keyctl .OpenKeyring (defaultSessionKeyring , defaultKeyringName )
60- /* if already does not exist we create */
60+ // create keyring if it does not exist
6161 if err != nil || defaultKeyring == nil {
6262 cmd := exec .Command ("keyctl" , "newring" , defaultKeyringName , strings .TrimSuffix (persistentKeyringID , "\n " ))
6363 cmd .Stdout = & out
@@ -67,7 +67,7 @@ func (k Keyctl) getDefaultCredsStoreFromPersistent() (keyctl.NamedKeyring, error
6767 return nil , fmt .Errorf ("cannot run keyctl command to created credstore keyring (%s): %s %s: %w" , cmd .String (), errout .String (), out .String (), err )
6868 }
6969 }
70- /* Search for it again and return the default keyring*/
70+ // Search for it again and return the default keyring
7171 defaultKeyring , err = keyctl .OpenKeyring (defaultSessionKeyring , defaultKeyringName )
7272 if err != nil {
7373 return nil , fmt .Errorf ("failed to lookup default session keyring: %w" , err )
@@ -78,7 +78,7 @@ func (k Keyctl) getDefaultCredsStoreFromPersistent() (keyctl.NamedKeyring, error
7878
7979// getDefaultCredsStore is a helper function to get the default credsStore keyring
8080func (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?
8282 cs , err := k .getDefaultCredsStoreFromPersistent ()
8383 if err != nil {
8484 return nil , err
0 commit comments