diff options
Diffstat (limited to 'src/parabola_hackers')
-rw-r--r-- | src/parabola_hackers/nslcd_backend/check_password.go | 23 | ||||
-rw-r--r-- | src/parabola_hackers/nslcd_backend/db_config.go | 3 | ||||
-rw-r--r-- | src/parabola_hackers/nslcd_backend/db_group.go | 3 | ||||
-rw-r--r-- | src/parabola_hackers/nslcd_backend/db_pam.go | 12 | ||||
-rw-r--r-- | src/parabola_hackers/nslcd_backend/db_passwd.go | 5 | ||||
-rw-r--r-- | src/parabola_hackers/nslcd_backend/db_shadow.go | 5 | ||||
-rw-r--r-- | src/parabola_hackers/nslcd_backend/gid.go | 37 | ||||
-rw-r--r-- | src/parabola_hackers/nslcd_backend/hackers.go | 7 | ||||
-rw-r--r-- | src/parabola_hackers/nslcd_backend/util.go (renamed from src/parabola_hackers/nslcd_backend/hackers_parse.go) | 22 | ||||
-rw-r--r-- | src/parabola_hackers/password.go | 5 |
10 files changed, 47 insertions, 75 deletions
diff --git a/src/parabola_hackers/nslcd_backend/check_password.go b/src/parabola_hackers/nslcd_backend/check_password.go deleted file mode 100644 index 1458b6f..0000000 --- a/src/parabola_hackers/nslcd_backend/check_password.go +++ /dev/null @@ -1,23 +0,0 @@ -// 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 -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// This software is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public -// License along with this manual; if not, see -// <http://www.gnu.org/licenses/>. - -package hackers_nslcd_backend - -import "lukeshu.com/git/go/libgnulinux.git/crypt" - -func check_password(password string, hash string) bool { - return crypt.Crypt(password, hash) == hash -} diff --git a/src/parabola_hackers/nslcd_backend/db_config.go b/src/parabola_hackers/nslcd_backend/db_config.go index 934498d..e78643b 100644 --- a/src/parabola_hackers/nslcd_backend/db_config.go +++ b/src/parabola_hackers/nslcd_backend/db_config.go @@ -17,8 +17,9 @@ package hackers_nslcd_backend import ( - p "lukeshu.com/git/go/libnslcd.git/proto" s "syscall" + + p "lukeshu.com/git/go/libnslcd.git/proto" ) func (o *Hackers) Config_Get(cred s.Ucred, req p.Request_Config_Get) <-chan p.Config { diff --git a/src/parabola_hackers/nslcd_backend/db_group.go b/src/parabola_hackers/nslcd_backend/db_group.go index b6b0704..18e54b1 100644 --- a/src/parabola_hackers/nslcd_backend/db_group.go +++ b/src/parabola_hackers/nslcd_backend/db_group.go @@ -17,9 +17,10 @@ package hackers_nslcd_backend import ( - p "lukeshu.com/git/go/libnslcd.git/proto" "parabola_hackers" s "syscall" + + p "lukeshu.com/git/go/libnslcd.git/proto" ) func (o *Hackers) groupByName(name string, users bool) p.Group { 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 diff --git a/src/parabola_hackers/nslcd_backend/db_passwd.go b/src/parabola_hackers/nslcd_backend/db_passwd.go index b11f6af..3f32ddd 100644 --- a/src/parabola_hackers/nslcd_backend/db_passwd.go +++ b/src/parabola_hackers/nslcd_backend/db_passwd.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,8 +17,9 @@ package hackers_nslcd_backend import ( - p "lukeshu.com/git/go/libnslcd.git/proto" s "syscall" + + p "lukeshu.com/git/go/libnslcd.git/proto" ) /* Note that the output password hash value should be one of: diff --git a/src/parabola_hackers/nslcd_backend/db_shadow.go b/src/parabola_hackers/nslcd_backend/db_shadow.go index 6166cd9..abfff28 100644 --- a/src/parabola_hackers/nslcd_backend/db_shadow.go +++ b/src/parabola_hackers/nslcd_backend/db_shadow.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,8 +17,9 @@ package hackers_nslcd_backend import ( - p "lukeshu.com/git/go/libnslcd.git/proto" s "syscall" + + p "lukeshu.com/git/go/libnslcd.git/proto" ) func (o *Hackers) Shadow_ByName(cred s.Ucred, req p.Request_Shadow_ByName) <-chan p.Shadow { diff --git a/src/parabola_hackers/nslcd_backend/gid.go b/src/parabola_hackers/nslcd_backend/gid.go deleted file mode 100644 index eabdbd7..0000000 --- a/src/parabola_hackers/nslcd_backend/gid.go +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2015 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 -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// This software is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public -// License along with this manual; if not, see -// <http://www.gnu.org/licenses/>. - -package hackers_nslcd_backend - -import "lukeshu.com/git/go/libgnulinux.git/getgr" - -func name2gid(name string) int32 { - gr, err := getgr.ByName(name) - if gr == nil || err != nil { - return -1 - } else { - return int32(gr.Gid) - } -} - -func gid2name(gid int32) (string, bool) { - gr, err := getgr.ByGid(gid) - if gr == nil || err != nil { - return "", false - } else { - return gr.Name, true - } -} diff --git a/src/parabola_hackers/nslcd_backend/hackers.go b/src/parabola_hackers/nslcd_backend/hackers.go index 50d392b..f7d56e3 100644 --- a/src/parabola_hackers/nslcd_backend/hackers.go +++ b/src/parabola_hackers/nslcd_backend/hackers.go @@ -19,11 +19,12 @@ package hackers_nslcd_backend import ( - "lukeshu.com/git/go/libnslcd.git/proto/server" - "lukeshu.com/git/go/libnslcd.git/systemd" - "lukeshu.com/git/go/libsystemd.git/sd_daemon/logger" "parabola_hackers" "sync" + + nslcd_server "lukeshu.com/git/go/libnslcd.git/proto/server" + nslcd_systemd "lukeshu.com/git/go/libnslcd.git/systemd" + "lukeshu.com/git/go/libsystemd.git/sd_daemon/logger" ) type config struct { diff --git a/src/parabola_hackers/nslcd_backend/hackers_parse.go b/src/parabola_hackers/nslcd_backend/util.go index e6d31c8..4fb28f3 100644 --- a/src/parabola_hackers/nslcd_backend/hackers_parse.go +++ b/src/parabola_hackers/nslcd_backend/util.go @@ -17,11 +17,31 @@ package hackers_nslcd_backend import ( - yaml "gopkg.in/yaml.v2" "io/ioutil" "os" + + yaml "gopkg.in/yaml.v2" + "lukeshu.com/git/go/libgnulinux.git/getgr" ) +func name2gid(name string) int32 { + gr, err := getgr.ByName(name) + if gr == nil || err != nil { + return -1 + } else { + return int32(gr.Gid) + } +} + +func gid2name(gid int32) (string, bool) { + gr, err := getgr.ByGid(gid) + if gr == nil || err != nil { + return "", false + } else { + return gr.Name, true + } +} + var usersGid = name2gid("users") func parse_config(filename string) (cfg config, err error) { diff --git a/src/parabola_hackers/password.go b/src/parabola_hackers/password.go index 4ea345f..957de1f 100644 --- a/src/parabola_hackers/password.go +++ b/src/parabola_hackers/password.go @@ -17,11 +17,12 @@ package parabola_hackers import ( - "io/ioutil" - "lukeshu.com/git/go/libgnulinux.git/crypt" "fmt" + "io/ioutil" "os" "strings" + + "lukeshu.com/git/go/libgnulinux.git/crypt" ) /* Note that the password hash value should be one of: |