diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2015-09-12 12:55:42 -0600 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2015-09-12 12:55:42 -0600 |
commit | 8e35809d4c3529dc622047c29ada0283987cc362 (patch) | |
tree | ce102b56c8ea93dd1fd6879f4255b60948776e97 | |
parent | 8e49597e479f878b5e9aff6d738717eaa11c5cb7 (diff) |
psncd_proto:handleRequest: clean up logging
-rwxr-xr-x | src/nslcd_proto/func_handlerequest.go.sh | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/nslcd_proto/func_handlerequest.go.sh b/src/nslcd_proto/func_handlerequest.go.sh index de9a6b7..c0e3052 100755 --- a/src/nslcd_proto/func_handlerequest.go.sh +++ b/src/nslcd_proto/func_handlerequest.go.sh @@ -7,13 +7,14 @@ package nslcd_proto import ( "fmt" "io" + "os" ) func handleRequest(backend Backend, in io.Reader, out io.Writer, cred Ucred) { var version int32 read(in, &version) if version != NSLCD_VERSION { - panic(NslcdError(fmt.Sprintf("version mismatch: server=%#08x client=%#08x", NSLCD_VERSION, version))) + panic(NslcdError(fmt.Sprintf("Version mismatch: server=%#08x client=%#08x", NSLCD_VERSION, version))) } var action int32 read(in, &action) @@ -26,7 +27,15 @@ while read -r request; do case NSLCD_ACTION_${request^^}: var req Request_${request} read(in, &req) - fmt.Printf("request: %#v\n", req) + $( + if [[ $request == PAM_Authentication ]]; then + echo '_req := req' + echo '_req.Password = "<omitted-from-log>"' + echo 'fmt.Fprintf(os.Stderr, "Request: %#v\n", _req)' + else + echo 'fmt.Fprintf(os.Stderr, "Request: %#v\n", req)' + fi + ) _res := backend.${request}(cred, req) go func() { o, ok := <-_res |