Procházet zdrojové kódy

set clients credential to new value on password change

Jonathan Turner před 7 roky
rodič
revize
c4704ed0c8
2 změnil soubory, kde provedl 3 přidání a 0 odebrání
  1. 1 0
      client/passwd.go
  2. 2 0
      credentials/credentials.go

+ 1 - 0
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
 }
 

+ 2 - 0
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
 }