Various fixes in login sources (#10428)
This commit is contained in:
parent
542bd59239
commit
09dbd85a3a
15 changed files with 66 additions and 21 deletions
|
@ -13,7 +13,7 @@ import (
|
|||
)
|
||||
|
||||
// Auth pam auth service
|
||||
func Auth(serviceName, userName, passwd string) error {
|
||||
func Auth(serviceName, userName, passwd string) (string, error) {
|
||||
t, err := pam.StartFunc(serviceName, userName, func(s pam.Style, msg string) (string, error) {
|
||||
switch s {
|
||||
case pam.PromptEchoOff:
|
||||
|
@ -25,12 +25,14 @@ func Auth(serviceName, userName, passwd string) error {
|
|||
})
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
return "", err
|
||||
}
|
||||
|
||||
if err = t.Authenticate(0); err != nil {
|
||||
return err
|
||||
return "", err
|
||||
}
|
||||
|
||||
return nil
|
||||
// PAM login names might suffer transformations in the PAM stack.
|
||||
// We should take whatever the PAM stack returns for it.
|
||||
return t.GetItem(pam.User)
|
||||
}
|
||||
|
|
|
@ -11,6 +11,6 @@ import (
|
|||
)
|
||||
|
||||
// Auth not supported lack of pam tag
|
||||
func Auth(serviceName, userName, passwd string) error {
|
||||
return errors.New("PAM not supported")
|
||||
func Auth(serviceName, userName, passwd string) (string, error) {
|
||||
return "", errors.New("PAM not supported")
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ func TestIncludesAllRepositoriesTeams(t *testing.T) {
|
|||
|
||||
// Create org.
|
||||
org := &models.User{
|
||||
Name: "All repo",
|
||||
Name: "All_repo",
|
||||
IsActive: true,
|
||||
Type: models.UserTypeOrganization,
|
||||
Visibility: structs.VisibleTypePublic,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue