瀏覽代碼

remove testing Go 1.12 and address linting issues (#400)

Jonathan Turner 5 年之前
父節點
當前提交
107ea7fe30
共有 7 個文件被更改,包括 16 次插入12 次删除
  1. 1 1
      .github/workflows/testing.yml
  2. 1 1
      .github/workflows/testingv8.yml
  3. 3 1
      gssapi/wrapToken.go
  4. 0 1
      v8/README.md
  5. 3 1
      v8/gssapi/wrapToken.go
  6. 7 7
      v8/keytab/keytab.go
  7. 1 0
      v8/types/Cryptosystem.go

+ 1 - 1
.github/workflows/testing.yml

@@ -13,7 +13,7 @@ jobs:
     runs-on: ubuntu-latest
     strategy:
       matrix:
-        go: [ '1.12.x', '1.13.x', '1.14.x' ]
+        go: [ '1.13.x', '1.14.x' ]
     env:
       TEST_KDC_ADDR: 127.0.0.1
       TEST_HTTP_URL: http://cname.test.gokrb5

+ 1 - 1
.github/workflows/testingv8.yml

@@ -14,7 +14,7 @@ jobs:
     runs-on: ubuntu-latest
     strategy:
       matrix:
-        go: [ '1.12.x', '1.13.x', '1.14.x' ]
+        go: [ '1.13.x', '1.14.x' ]
     env:
       TEST_KDC_ADDR: 127.0.0.1
       TEST_HTTP_URL: http://cname.test.gokrb5

+ 3 - 1
gssapi/wrapToken.go

@@ -16,7 +16,9 @@ import (
 // RFC 4121, section 4.2.6.2
 
 const (
-	HdrLen          = 16 // Length of the Wrap Token's header
+	// HdrLen is the length of the Wrap Token's header
+	HdrLen = 16
+	// FillerByte is a filler in the WrapToken structure
 	FillerByte byte = 0xFF
 )
 

+ 0 - 1
v8/README.md

@@ -13,7 +13,6 @@ Development will be focused on the latest major version. New features will only
 #### Go Version Support
 ![Go version](https://img.shields.io/badge/Go-1.14-brightgreen.svg)
 ![Go version](https://img.shields.io/badge/Go-1.13-brightgreen.svg)
-![Go version](https://img.shields.io/badge/Go-1.12-brightgreen.svg)
 
 gokrb5 may work with other versions of Go but they are not tested.
 

+ 3 - 1
v8/gssapi/wrapToken.go

@@ -16,7 +16,9 @@ import (
 // RFC 4121, section 4.2.6.2
 
 const (
-	HdrLen          = 16 // Length of the Wrap Token's header
+	// HdrLen is the length of the Wrap Token's header
+	HdrLen = 16
+	// FillerByte is a filler in the WrapToken structure
 	FillerByte byte = 0xFF
 )
 

+ 7 - 7
v8/keytab/keytab.go

@@ -113,19 +113,19 @@ func newEntry() entry {
 	}
 }
 
-func (k Keytab) String() string {
+func (kt Keytab) String() string {
 	var s string
 	s = `KVNO Timestamp         Principal                                                ET Key
 ---- ----------------- -------------------------------------------------------- -- ----------------------------------------------------------------
 `
-	for _, entry := range k.Entries {
+	for _, entry := range kt.Entries {
 		s += entry.String() + "\n"
 	}
 	return s
 }
 
 // AddEntry adds an entry to the keytab. The password should be provided in plain text and it will be converted using the defined enctype to be stored.
-func (k *Keytab) AddEntry(principalName, realm, password string, ts time.Time, KVNO uint8, encType int32) error {
+func (kt *Keytab) AddEntry(principalName, realm, password string, ts time.Time, KVNO uint8, encType int32) error {
 	// Generate a key from the password
 	princ, _ := types.ParseSPNString(principalName)
 	key, _, err := crypto.GetKeyFromPassword(password, princ, realm, encType, types.PADataSequence{})
@@ -136,7 +136,7 @@ func (k *Keytab) AddEntry(principalName, realm, password string, ts time.Time, K
 	// Populate the keytab entry principal
 	ktep := newPrincipal()
 	ktep.NumComponents = int16(len(princ.NameString))
-	if k.version == 1 {
+	if kt.version == 1 {
 		ktep.NumComponents += 1
 	}
 
@@ -152,7 +152,7 @@ func (k *Keytab) AddEntry(principalName, realm, password string, ts time.Time, K
 	e.KVNO = uint32(KVNO)
 	e.Key = key
 
-	k.Entries = append(k.Entries, e)
+	kt.Entries = append(kt.Entries, e)
 	return nil
 }
 
@@ -521,8 +521,8 @@ func isNativeEndianLittle() bool {
 }
 
 // JSON return information about the keys held in the keytab in a JSON format.
-func (k *Keytab) JSON() (string, error) {
-	b, err := json.MarshalIndent(k, "", "  ")
+func (kt *Keytab) JSON() (string, error) {
+	b, err := json.MarshalIndent(kt, "", "  ")
 	if err != nil {
 		return "", err
 	}

+ 1 - 0
v8/types/Cryptosystem.go

@@ -57,6 +57,7 @@ func (a *Checksum) Unmarshal(b []byte) error {
 	return err
 }
 
+// GenerateEncryptionKey creates a new EncryptionKey with a random key value.
 func GenerateEncryptionKey(etype etype.EType) (EncryptionKey, error) {
 	k := EncryptionKey{
 		KeyType: etype.GetETypeID(),