From 1eb1677cf916c13e07f61efc464edca1c571684d Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 2 Sep 2015 12:58:58 -0600 Subject: Clean up --- src/nshd/hackers_git/hackers.go | 1 - src/nshd/hackers_git/hackers_parse.go | 3 +-- src/nshd/hackers_git/hackers_watch.go | 2 +- src/nslcd_proto/func_handlerequest.go.sh | 3 +++ src/nslcd_proto/nslcd_h.go | 32 +++++++++++++++++--------------- 5 files changed, 22 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/nshd/hackers_git/hackers.go b/src/nshd/hackers_git/hackers.go index 5c2ebd3..5876613 100644 --- a/src/nshd/hackers_git/hackers.go +++ b/src/nshd/hackers_git/hackers.go @@ -11,7 +11,6 @@ import ( type user struct { passwd nslcd_proto.Passwd - pwhash string groups []string } diff --git a/src/nshd/hackers_git/hackers_parse.go b/src/nshd/hackers_git/hackers_parse.go index b0ed91b..b446ba1 100644 --- a/src/nshd/hackers_git/hackers_parse.go +++ b/src/nshd/hackers_git/hackers_parse.go @@ -101,9 +101,8 @@ func load_user_yaml(filename string) (ret user, err error) { err = &yaml.TypeError{errs} } - ret.passwd.Password = "x" + ret.passwd.PwHash = "!" ret.passwd.GID = usersGid - ret.pwhash = "!" return } diff --git a/src/nshd/hackers_git/hackers_watch.go b/src/nshd/hackers_git/hackers_watch.go index 1b4f08d..a878f4c 100644 --- a/src/nshd/hackers_git/hackers_watch.go +++ b/src/nshd/hackers_git/hackers_watch.go @@ -68,7 +68,7 @@ func (o *Hackers) close() { func (o *Hackers) reload() (err error) { o.close() - o.in_fd, err = inotify.InotifyInit() ; if err != nil { return } + o.in_fd, err = inotify.InotifyInit() ; if err != nil { return } o.in_wd_home, err = o.in_fd.AddWatch("/home" , in_DIR|in_CHILD_ADD); if err != nil { return } o.in_wd_yaml, err = o.in_fd.AddWatch(o.cfg.Yamldir, in_DIR|in_CHILD_ANY); if err != nil { return } diff --git a/src/nslcd_proto/func_handlerequest.go.sh b/src/nslcd_proto/func_handlerequest.go.sh index 4008dd5..185db73 100755 --- a/src/nslcd_proto/func_handlerequest.go.sh +++ b/src/nslcd_proto/func_handlerequest.go.sh @@ -37,6 +37,9 @@ done < "$requests" default: panic(NslcdError(fmt.Sprintf("unknown request action: %#08x", action))) } + if res == nil { + return + } write(out, NSLCD_VERSION) write(out, action) diff --git a/src/nslcd_proto/nslcd_h.go b/src/nslcd_proto/nslcd_h.go index 394e91c..5d5bb06 100644 --- a/src/nslcd_proto/nslcd_h.go +++ b/src/nslcd_proto/nslcd_h.go @@ -113,10 +113,10 @@ const NSLCD_ACTION_ETHER_ALL int32 = 0x00030008; type Request_Ether_All /* Group and group membership related NSS requests. The result values for a single entry are: */ type Group struct { - Name string - Password string - ID int32 - Members []string + Name string + PwHash string + ID int32 + Members []string } /* (note that the BYMEMER call returns an emtpy members list) */ const NSLCD_ACTION_GROUP_BYNAME int32 = 0x00040001; type Request_Group_ByName string @@ -221,13 +221,13 @@ const NSLCD_ACTION_NETWORK_ALL int32 = 0x00070008; type Request_Network_Al /* User account (/etc/passwd) NSS requests. Result values are: */ type Passwd struct { - Name string - Password string - UID int32 - GID int32 - GECOS string - HomeDir string - Shell string + Name string + PwHash string + UID int32 + GID int32 + GECOS string + HomeDir string + Shell string } const NSLCD_ACTION_PASSWD_BYNAME int32 = 0x00080001; type Request_Passwd_ByName string const NSLCD_ACTION_PASSWD_BYUID int32 = 0x00080002; type Request_Passwd_ByUID int32 @@ -272,7 +272,7 @@ type Shadow struct { // It is my understanding that an empty value for an INT32 // field is expressed with a negative number. -- lukeshu Name string - Password string + PwHash string LastChangeDate int32 MinDays int32 MaxDays int32 @@ -298,7 +298,7 @@ type PAM_Base struct { /* PAM authentication check request. The extra request values are: */ type Request_PAM_Authentication struct { - Base PAM_Base + PAM_Base Password string } /* and the result value consists of: */ @@ -323,18 +323,19 @@ type PAM_Authorization struct { information. The authorisation error message, if supplied, will be used by the PAM module instead of a message that is generated by the PAM module itself. */ -const NSLCD_ACTION_PAM_AUTHORIZATION int32 = 0x000d0002; type Request_PAM_Authorization void +const NSLCD_ACTION_PAM_AUTHORIZATION int32 = 0x000d0002; type Request_PAM_Authorization PAM_Base /* PAM session open request. The result value consists of: */ type PAM_SessionOpen struct { SessionID string } /* This session id may be used to close this session with. */ -const NSLCD_ACTION_PAM_SESSIONOPEN int32 = 0x000d0003; type Request_PAM_SessionOpen void +const NSLCD_ACTION_PAM_SESSIONOPEN int32 = 0x000d0003; type Request_PAM_SessionOpen PAM_Base /* PAM session close request. This request has the following extra request value: */ type Request_PAM_SessionClose struct { + PAM_Base SessionID string } /* and this calls only returns an empty response value. */ @@ -344,6 +345,7 @@ const NSLCD_ACTION_PAM_SESSIONCLOSE int32 = 0x000d0004 /* PAM password modification request. This requests has the following extra request values: */ type Request_PAM_PwMod struct { + PAM_Base AsRoot int32 /* 0=oldpasswd is user passwd, 1=oldpasswd is root passwd */ OldPassword string NewPassword string -- cgit v1.2.2