summaryrefslogtreecommitdiff
path: root/src/parabola_hackers/nslcd_backend/db_pam.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/parabola_hackers/nslcd_backend/db_pam.go')
-rw-r--r--src/parabola_hackers/nslcd_backend/db_pam.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/parabola_hackers/nslcd_backend/db_pam.go b/src/parabola_hackers/nslcd_backend/db_pam.go
index 19d4c79..303a66c 100644
--- a/src/parabola_hackers/nslcd_backend/db_pam.go
+++ b/src/parabola_hackers/nslcd_backend/db_pam.go
@@ -1,4 +1,4 @@
-// Copyright 2015 Luke Shumaker <lukeshu@sbcglobal.net>.
+// Copyright 2015-2016 Luke Shumaker <lukeshu@sbcglobal.net>.
//
// This is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
@@ -17,11 +17,17 @@
package hackers_nslcd_backend
import (
- p "lukeshu.com/git/go/libnslcd.git/proto"
"parabola_hackers"
s "syscall"
+
+ "lukeshu.com/git/go/libgnulinux.git/crypt"
+ p "lukeshu.com/git/go/libnslcd.git/proto"
)
+func checkPassword(password string, hash string) bool {
+ return crypt.Crypt(password, hash) == hash
+}
+
func (o *Hackers) PAM_Authentication(cred s.Ucred, req p.Request_PAM_Authentication) <-chan p.PAM_Authentication {
o.lock.RLock()
ret := make(chan p.PAM_Authentication)
@@ -41,7 +47,7 @@ func (o *Hackers) PAM_Authentication(cred s.Ucred, req p.Request_PAM_Authenticat
AuthorizationResult: p.NSLCD_PAM_AUTH_ERR,
AuthorizationError: "",
}
- if check_password(req.Password, user.Passwd.PwHash) {
+ if checkPassword(req.Password, user.Passwd.PwHash) {
obj.AuthenticationResult = p.NSLCD_PAM_SUCCESS
obj.AuthorizationResult = obj.AuthenticationResult
obj.UserName = user.Passwd.Name