From c4704ed0c8aae9d6704adea9ee537856a78777ac Mon Sep 17 00:00:00 2001 From: Jonathan Turner Date: Thu, 7 Feb 2019 20:41:34 +0000 Subject: [PATCH] set clients credential to new value on password change --- client/passwd.go | 1 + credentials/credentials.go | 2 ++ 2 files changed, 3 insertions(+) diff --git a/client/passwd.go b/client/passwd.go index 513caed0..e6d41805 100644 --- a/client/passwd.go +++ b/client/passwd.go @@ -46,6 +46,7 @@ func (cl *Client) ChangePasswd(newPasswd string) (bool, error) { if r.ResultCode != KRB5_KPASSWD_SUCCESS { return false, fmt.Errorf("error response from kdamin: %s", r.Result) } + cl.Credentials.WithPassword(newPasswd) return true, nil } diff --git a/credentials/credentials.go b/credentials/credentials.go index bbfe5e11..62acab7a 100644 --- a/credentials/credentials.go +++ b/credentials/credentials.go @@ -91,6 +91,7 @@ func NewFromPrincipalName(cname types.PrincipalName, realm string) *Credentials // WithKeytab sets the Keytab in the Credentials struct. func (c *Credentials) WithKeytab(kt *keytab.Keytab) *Credentials { c.keytab = kt + c.password = "" return c } @@ -110,6 +111,7 @@ func (c *Credentials) HasKeytab() bool { // WithPassword sets the password in the Credentials struct. func (c *Credentials) WithPassword(password string) *Credentials { c.password = password + c.keytab = keytab.New() // clear any keytab return c }