Skip to content

Commit

Permalink
Moved the C stuff out and renamed interfaces to live in v3
Browse files Browse the repository at this point in the history
  • Loading branch information
jake-scott committed Aug 27, 2024
1 parent 3bf9ae5 commit 53990a0
Show file tree
Hide file tree
Showing 53 changed files with 671 additions and 2,705 deletions.
39 changes: 0 additions & 39 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,39 +0,0 @@
run:
deadline: 10m

issues:
max-per-linter: 0
max-same-issues: 0
exclude-rules:
- linters:
- staticcheck
text: "SA1012:"

linters:
disable-all: true
enable:
- deadcode
- errcheck
- gocritic
- gofmt
- goimports
- gosimple
- govet
- ineffassign
- interfacer
- nakedret
- misspell
- staticcheck
- structcheck
- typecheck
- unused
- unconvert
- unparam
- varcheck
- vet
- vetshadow
- whitespace
- stylecheck

linters-settings: {}

44 changes: 44 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
current_dir := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
src_dir = v3
GO ?= go
GOBIN ?= $(shell go env GOBIN)
TOOLBIN := $(current_dir)/toolbin


ifeq (${GOBIN},)
GOBIN = $(shell go env GOPATH)/bin
endif


.DEFAULT: build

.PHONY: build
build: generate
./scripts/gofmt

.PHONY: generate
generate: $(src_dir)/names_gen.go $(src_dir)/mechs_gen.go

$(src_dir)/names_gen.go: build-tools/gen-gss-name-oids.go $(src_dir)/names.go
$(GO) generate $(src_dir)/names.go

$(src_dir)/mechs_gen.go: build-tools/gen-gss-mech-oids.go $(src_dir)/mechs.go
$(GO) generate $(src_dir)/mechs.go


.PHONY: test
test:
cd $(src_dir) && ../scripts/gofmt
${GO} test ./... -coverprofile=./cover.out -covermode=atomic


.PHONY: lint
lint: | $(TOOLBIN)/golangci-lint
cd $(src_dir) && $(TOOLBIN)/golangci-lint run

.PHONY: tools
tools: $(TOOLBIN)/golangci-lint
@echo "==> installing required tooling..."

$(TOOLBIN)/golangci-lint: | $(GOENV)
GOBIN=$(TOOLBIN) GO111MODULE=on $(GO) install github.com/golangci/golangci-lint/cmd/golangci-lint@v1
1 change: 0 additions & 1 deletion README.md

This file was deleted.

14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# GSSAPI interace for Go

Upto this point there have been several GSSAPI implementations for Go,
either native or C bindings. Developers needed to make a choice
of implementation because their interfaces were not unified. This
contrasts to the C language, where the bindings are specified
[in RFC 2744](https://datatracker.ietf.org/doc/html/rfc2744).

The interface specified in this package aims to fill that gap, albeit
without an RFC. The aim is to provide developers with a common, idomatic
programming interface, allowing users to switch out the actual implementation
depending on preference or local policy.


Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,17 @@ var namesToOids = []struct {
{"GSS_MECH_KRB5", "1.2.840.113554.1.2.2", []string{"1.3.6.1.5.2", "1.2.840.48018.1.2.2"}},
{"GSS_MECH_IAKERB", "1.3.6.1.5.2.5", []string{}},
{"GSS_MECH_SPNEGO", "1.3.6.1.5.5.2", []string{}},
{"GSS_MECH_SPKM-1", "1.3.6.1.5.5.1.1", []string{}},
{"GSS_MECH_SPKM-2", "1.3.6.1.5.5.1.2", []string{}},
{"GSS_MECH_SPKM-3", "1.3.6.1.5.5.1.3", []string{}},
}

var codeTemplate = `package gsscommon
var codeTemplate = `package gssapi
// GENERATED CODE: DO NOT EDIT
var mechs = []struct {
id GssMech
id gssMechImpl
mech string
oidString string
oid Oid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,12 @@ var namesToOids = []struct {
{"GSS_KRB5_NT_PRINCIPAL_NAME", "1.2.840.113554.1.2.2.1", []string{"1.2.840.48018.1.2.2"}},
{"GSS_KRB5_NT_ENTERPRISE_NAME", "1.2.840.113554.1.2.2.6", []string{}},
{"GSS_KRB5_NT_X509_CERT", "1.2.840.113554.1.2.2.7", []string{}},
{"GSS_SPKM_NT_USER_NAME", "1.2.840.113554.1.2.1.1", []string{}},
{"GSS_SPKM_NT_MACHINE_UID_NAME", "1.2.840.113554.1.2.1.2", []string{}},
{"GSS_SPKM_NT_STRING_UID_NAME", "1.2.840.113554.1.2.1.3", []string{}},
}

var codeTemplate = `package gsscommon
var codeTemplate = `package gssapi
// GENERATED CODE: DO NOT EDIT
Expand Down
11 changes: 8 additions & 3 deletions examples/go/go.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
module examples

go 1.15
go 1.22.4

require github.com/golang-auth/go-gssapi/v2 v2.0.0
replace github.com/golang-auth/go-gssapi/v3 => ../../v3

replace github.com/golang-auth/go-gssapi/v2 => ../../v2
replace github.com/golang-auth/go-gssapi-c => ../../../go-gssapi-c

require (
github.com/golang-auth/go-gssapi-c v0.0.0-00010101000000-000000000000
github.com/golang-auth/go-gssapi/v3 v3.0.0-00010101000000-000000000000
)
45 changes: 0 additions & 45 deletions examples/go/go.sum
Original file line number Diff line number Diff line change
@@ -1,53 +1,8 @@
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/golang-auth/go-gssapi/v2 v2.0.0-alpha h1:VaEryQglvHLqei96KDVYSPFEmZwCL1U6Vt6WhzefWms=
github.com/golang-auth/go-gssapi/v2 v2.0.0-alpha/go.mod h1:xudSyaQAYd7OkqVuSa41IdDz9afznhZGeDE7ayfgKlM=
github.com/golang-auth/go-gssapi/v2 v2.1.2-alpha h1:Jy2LBO8z90pXnaX8T495d1AfB+6vKlCafi9Fj3CCmgY=
github.com/golang-auth/go-gssapi/v2 v2.1.2-alpha/go.mod h1:UqoquhP+nQRAlW2ay9zAiD5Sa/WVc+MuCgIyute6kuU=
github.com/gorilla/securecookie v1.1.1 h1:miw7JPhV+b/lAHSXz4qd/nN9jRiAFV5FwjeKyCS8BvQ=
github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4=
github.com/gorilla/sessions v1.2.1 h1:DHd3rPN5lE3Ts3D8rKkQ8x/0kqfeNmBAaiSi+o7FsgI=
github.com/gorilla/sessions v1.2.1/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM=
github.com/hashicorp/go-uuid v1.0.2 h1:cfejS+Tpcp13yd5nYHWDI6qVCny6wyX2Mt5SGur2IGE=
github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/jcmturner/aescts/v2 v2.0.0 h1:9YKLH6ey7H4eDBXW8khjYslgyqG2xZikXP0EQFKrle8=
github.com/jcmturner/aescts/v2 v2.0.0/go.mod h1:AiaICIRyfYg35RUkr8yESTqvSy7csK90qZ5xfvvsoNs=
github.com/jcmturner/dnsutils/v2 v2.0.0 h1:lltnkeZGL0wILNvrNiVCR6Ro5PGU/SeBvVO/8c/iPbo=
github.com/jcmturner/dnsutils/v2 v2.0.0/go.mod h1:b0TnjGOvI/n42bZa+hmXL+kFJZsFT7G4t3HTlQ184QM=
github.com/jcmturner/gofork v1.0.0 h1:J7uCkflzTEhUZ64xqKnkDxq3kzc96ajM1Gli5ktUem8=
github.com/jcmturner/gofork v1.0.0/go.mod h1:MK8+TM0La+2rjBD4jE12Kj1pCCxK7d2LK/UM3ncEo0o=
github.com/jcmturner/goidentity/v6 v6.0.1 h1:VKnZd2oEIMorCTsFBnJWbExfNN7yZr3EhJAxwOkZg6o=
github.com/jcmturner/goidentity/v6 v6.0.1/go.mod h1:X1YW3bgtvwAXju7V3LCIMpY0Gbxyjn/mY9zx4tFonSg=
github.com/jcmturner/gokrb5 v8.4.2+incompatible h1:MQW70Fbazv31g6URAXCjO2bGenIL0wVt3wqcpc0EjHI=
github.com/jcmturner/gokrb5 v8.4.2+incompatible/go.mod h1:0Q5eFyVvYsEsZ8xl1A/jUqhXvxUp/X9ELrJm+zieq5E=
github.com/jcmturner/gokrb5/v8 v8.4.2 h1:6ZIM6b/JJN0X8UM43ZOM6Z4SJzla+a/u7scXFJzodkA=
github.com/jcmturner/gokrb5/v8 v8.4.2/go.mod h1:sb+Xq/fTY5yktf/VxLsE3wlfPqQjp0aWNYyvBVK62bc=
github.com/jcmturner/rpc/v2 v2.0.3 h1:7FXXj8Ti1IaVFpSAziCZWNzbNuZmnvw/i6CqLNdWfZY=
github.com/jcmturner/rpc/v2 v2.0.3/go.mod h1:VUJYCIDm3PVOEHw8sgt091/20OJjskO/YJki3ELg/Hc=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20201112155050-0c6587e931a9 h1:umElSU9WZirRdgu2yFHY0ayQkEnKiOC1TtM3fWXFnoU=
golang.org/x/crypto v0.0.0-20201112155050-0c6587e931a9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210326220855-61e056675ecf h1:WUcCxqQqDT0aXO4VnQbfMvp4zh7m1Gb2clVuHUAGGRE=
golang.org/x/net v0.0.0-20210326220855-61e056675ecf/go.mod h1:uSPa2vr4CLtc/ILN5odXGNXS6mhrKVzTaCXzk9m6W3k=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
Binary file added examples/go/gss-client/gss-client
Binary file not shown.
Loading

0 comments on commit 53990a0

Please sign in to comment.