|
9 | 9 | "encoding/hex" |
10 | 10 | "errors" |
11 | 11 | "fmt" |
12 | | - "net" |
13 | 12 | "strings" |
14 | 13 |
|
| 14 | + "github.com/RedTeamPentesting/adauth" |
15 | 15 | "github.com/RedTeamPentesting/adauth/compat" |
16 | 16 | "github.com/RedTeamPentesting/adauth/pkinit" |
17 | 17 | "github.com/jcmturner/gokrb5/v8/config" |
@@ -45,7 +45,7 @@ type gssapiClient struct { |
45 | 45 | } |
46 | 46 |
|
47 | 47 | func newClientFromCCache( |
48 | | - username string, domain string, ccachePath string, krb5Conf *config.Config, dialer Dialer, |
| 48 | + username string, domain string, ccachePath string, krb5Conf *config.Config, dialer adauth.Dialer, |
49 | 49 | ) (*gssapiClient, error) { |
50 | 50 | ccache, err := credentials.LoadCCache(ccachePath) |
51 | 51 | if err != nil { |
@@ -76,9 +76,9 @@ func newClientFromCCache( |
76 | 76 |
|
77 | 77 | func newPKINITClient( |
78 | 78 | ctx context.Context, username string, domain string, cert *x509.Certificate, key *rsa.PrivateKey, |
79 | | - krb5Conf *config.Config, dialer Dialer, |
| 79 | + krb5Conf *config.Config, dialer adauth.Dialer, |
80 | 80 | ) (*gssapiClient, error) { |
81 | | - ctxDialer := ContextDialer(dialer) |
| 81 | + ctxDialer := adauth.AsContextDialer(dialer) |
82 | 82 |
|
83 | 83 | ccache, err := pkinit.Authenticate(ctx, username, domain, cert, key, krb5Conf, pkinit.WithDialer(ctxDialer)) |
84 | 84 | if err != nil { |
@@ -374,18 +374,3 @@ func krb5TokenAuthenticator( |
374 | 374 |
|
375 | 375 | return auth, nil |
376 | 376 | } |
377 | | - |
378 | | -type nopContextDialer func(string, string) (net.Conn, error) |
379 | | - |
380 | | -func (f nopContextDialer) DialContext(ctx context.Context, net string, addr string) (net.Conn, error) { |
381 | | - return f(net, addr) |
382 | | -} |
383 | | - |
384 | | -func ContextDialer(d Dialer) pkinit.ContextDialer { |
385 | | - ctxDialer, ok := d.(pkinit.ContextDialer) |
386 | | - if !ok { |
387 | | - ctxDialer = nopContextDialer(d.Dial) |
388 | | - } |
389 | | - |
390 | | - return ctxDialer |
391 | | -} |
0 commit comments