@@ -160,11 +160,10 @@ func (c *Client) NegotiateContext(host string) (keyname string, expiry time.Time
160160 var (
161161 input * gssapi.Buffer
162162 ctx * gssapi.CtxId
163- tkey * dns.TKEY
164163 )
165164
166165 for ok := true ; ok ; ok = c .lib .LastStatus .Major .ContinueNeeded () {
167- nctx , _ , output , _ , _ , err := c .lib .InitSecContext (
166+ nctx , _ , output , _ , duration , err := c .lib .InitSecContext (
168167 c .lib .GSS_C_NO_CREDENTIAL ,
169168 ctx , // nil initially
170169 service ,
@@ -174,7 +173,7 @@ func (c *Client) NegotiateContext(host string) (keyname string, expiry time.Time
174173 c .lib .GSS_C_NO_CHANNEL_BINDINGS ,
175174 input )
176175
177- ctx = nctx
176+ ctx , expiry = nctx , time . Now (). UTC (). Add ( duration )
178177
179178 defer func () {
180179 err = multierror .Append (err , output .Release ()).ErrorOrNil ()
@@ -190,7 +189,8 @@ func (c *Client) NegotiateContext(host string) (keyname string, expiry time.Time
190189 }
191190
192191 //nolint:lll
193- if tkey , _ , err = util .ExchangeTKEY (c .client , host , keyname , tsig .GSS , util .TkeyModeGSS , 3600 , output .Bytes (), nil , "" , "" ); err != nil {
192+ tkey , _ , err := util .ExchangeTKEY (c .client , host , keyname , tsig .GSS , util .TkeyModeGSS , 3600 , output .Bytes (), nil , "" , "" )
193+ if err != nil {
194194 return "" , time.Time {}, multierror .Append (err , ctx .DeleteSecContext ())
195195 }
196196
@@ -212,8 +212,6 @@ func (c *Client) NegotiateContext(host string) (keyname string, expiry time.Time
212212 }()
213213 }
214214
215- expiry = time .Unix (int64 (tkey .Expiration ), 0 )
216-
217215 c .m .Lock ()
218216 defer c .m .Unlock ()
219217
0 commit comments