Skip to content

Commit

Permalink
set clients credential to new value on password change
Browse files Browse the repository at this point in the history
  • Loading branch information
jcmturner committed Feb 7, 2019
1 parent f1d155c commit c4704ed
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions client/passwd.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 2 additions & 0 deletions credentials/credentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -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
}

Expand Down

0 comments on commit c4704ed

Please sign in to comment.