Skip to content

Commit 550f57d

Browse files
committed
Merge branch 'jake/channel-bindings' into dev
Interface support for channel bindings
2 parents df1d358 + bf1d7d3 commit 550f57d

File tree

6 files changed

+31
-8
lines changed

6 files changed

+31
-8
lines changed

examples/go/gss-client/gss-client

-3 MB
Binary file not shown.

examples/testvectors/rack.kt

0 Bytes
Binary file not shown.

examples/testvectors/robot.cc

0 Bytes
Binary file not shown.

v3/channelbinding.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ package gssapi
33

44
import "net"
55

6-
type gssAddressFamily int
6+
type GssAddressFamily int
77

88
const (
9-
GssAddrFamilyUNSPEC gssAddressFamily = 0
10-
GssAddrFamilyLOCAL gssAddressFamily = 1 << iota
9+
GssAddrFamilyUNSPEC GssAddressFamily = 0
10+
GssAddrFamilyLOCAL GssAddressFamily = 1 << iota
1111
GssAddrFamilyINET
1212
GssAddrFamilyIMPLINK
1313
GssAddrFamilyPUP

v3/ctxflags.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ const (
1414
ContextFlagConf // confidentiality available
1515
ContextFlagInteg // integrity available
1616
ContextFlagAnon // do not transfer initiator identity to acceptor
17+
18+
// extensions
19+
ContextFlagChannelBound = 0x800 // require channel bindings
20+
21+
// Microsoft extensions - see RFC 4757 § 7.1
22+
ContextFlagDceStyle = 0x1000 // add extra AP-REP from client to server after receiving server's AP-REP
23+
ContextFlagIdentify = 0x2000 // server should identify the client but not impersonate it
24+
ContextFlagExtendedError = 0x4000 // return Windows status code in Kerberos error messages
1725
)
1826

1927
// FlagList returns a slice of individual flags derived from the
@@ -48,6 +56,14 @@ func FlagName(f ContextFlag) string {
4856
return "Integrity"
4957
case ContextFlagAnon:
5058
return "Anonymous"
59+
case ContextFlagChannelBound:
60+
return "Channel Bindings"
61+
case ContextFlagDceStyle:
62+
return "DCE style"
63+
case ContextFlagIdentify:
64+
return "Identify only"
65+
case ContextFlagExtendedError:
66+
return "Extended errors"
5167
}
5268

5369
return "Unknown"

v3/provider.go

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,11 @@ func NewProvider(name string) Provider {
4343
type QoP uint
4444

4545
type InitSecContextOptions struct {
46-
Credential Credential
47-
Mech GssMech
48-
Flags ContextFlag
49-
Lifetime time.Duration
46+
Credential Credential
47+
Mech GssMech
48+
Flags ContextFlag
49+
Lifetime time.Duration
50+
ChannelBinding *ChannelBinding
5051
}
5152

5253
type InitSecContextOption func(o *InitSecContextOptions)
@@ -75,6 +76,12 @@ func WithInitiatorLifetime(life time.Duration) InitSecContextOption {
7576
}
7677
}
7778

79+
func WithChannelBinding(cb *ChannelBinding) InitSecContextOption {
80+
return func(o *InitSecContextOptions) {
81+
o.ChannelBinding = cb
82+
}
83+
}
84+
7885
// Provider is the interface that defines the top level GSSAPI functions that
7986
// create name, credential and security contexts
8087
type Provider interface {
@@ -125,7 +132,7 @@ type Provider interface {
125132
//
126133
// A partially established context may allow the creation of protected messages.
127134
// Check the [SecContextInfo.ProtectionReady] flag by calling [SecContext.Inquire()].
128-
AcceptSecContext(cred Credential, inputToken []byte) (SecContext, []byte, error) // RFC 2743 § 2.2.2
135+
AcceptSecContext(cred Credential, inputToken []byte, cb *ChannelBinding) (SecContext, []byte, error) // RFC 2743 § 2.2.2
129136

130137
// ImportSecContext corresponds to the GSS_Import_sec_context function from RFC 2743 § 2.2.9
131138
// Parameters:

0 commit comments

Comments
 (0)