diff options
-rw-r--r-- | nslcd_proto/.gitignore (renamed from proto/.gitignore) | 0 | ||||
-rw-r--r-- | nslcd_proto/Makefile (renamed from proto/Makefile) | 2 | ||||
-rw-r--r-- | nslcd_proto/common.mk (renamed from proto/common.mk) | 0 | ||||
-rw-r--r-- | nslcd_proto/doc.go (renamed from proto/doc.go) | 0 | ||||
-rw-r--r-- | nslcd_proto/io.go (renamed from proto/io.go) | 0 | ||||
-rw-r--r-- | nslcd_proto/nslcd_h.go (renamed from proto/nslcd_h.go) | 0 | ||||
-rw-r--r-- | nslcd_server/.gitignore (renamed from proto/server/.gitignore) | 0 | ||||
-rw-r--r-- | nslcd_server/Makefile (renamed from proto/server/Makefile) | 9 | ||||
-rw-r--r-- | nslcd_server/doc.go (renamed from proto/server/doc.go) | 0 | ||||
-rwxr-xr-x | nslcd_server/func_handlerequest.go.gen (renamed from proto/server/func_handlerequest.go.sh) | 2 | ||||
-rwxr-xr-x | nslcd_server/interface_backend.go.gen (renamed from proto/server/interface_backend.go.sh) | 2 | ||||
-rwxr-xr-x | nslcd_server/type_nilbackend.go.gen (renamed from proto/server/type_nilbackend.go.sh) | 2 | ||||
-rw-r--r-- | nslcd_systemd/disable_nss_module.go (renamed from systemd/disable_nss_module.go) | 10 | ||||
-rw-r--r-- | nslcd_systemd/nslcd_systemd.go (renamed from systemd/nslcd_systemd.go) | 34 |
14 files changed, 32 insertions, 29 deletions
diff --git a/proto/.gitignore b/nslcd_proto/.gitignore index 9330212..9330212 100644 --- a/proto/.gitignore +++ b/nslcd_proto/.gitignore diff --git a/proto/Makefile b/nslcd_proto/Makefile index 2716cbc..c031de4 100644 --- a/proto/Makefile +++ b/nslcd_proto/Makefile @@ -24,3 +24,5 @@ maintainer-clean: requests.txt: nslcd_h.go Makefile < $< grep -Eo '\btype Request_([^_ ]+)(_\S+)?' | sed 's/^type Request_//' > $@ + +.DELETE_ON_ERROR: diff --git a/proto/common.mk b/nslcd_proto/common.mk index 1496356..1496356 100644 --- a/proto/common.mk +++ b/nslcd_proto/common.mk diff --git a/proto/doc.go b/nslcd_proto/doc.go index 70929f3..70929f3 100644 --- a/proto/doc.go +++ b/nslcd_proto/doc.go diff --git a/proto/io.go b/nslcd_proto/io.go index fa40be3..fa40be3 100644 --- a/proto/io.go +++ b/nslcd_proto/io.go diff --git a/proto/nslcd_h.go b/nslcd_proto/nslcd_h.go index cb210cd..cb210cd 100644 --- a/proto/nslcd_h.go +++ b/nslcd_proto/nslcd_h.go diff --git a/proto/server/.gitignore b/nslcd_server/.gitignore index ff46733..ff46733 100644 --- a/proto/server/.gitignore +++ b/nslcd_server/.gitignore diff --git a/proto/server/Makefile b/nslcd_server/Makefile index 1bbfc58..f1ff20f 100644 --- a/proto/server/Makefile +++ b/nslcd_server/Makefile @@ -24,13 +24,14 @@ maintainer-clean: rm -f -- $(files.src.gen) .PHONY: files.generate maintainer-clean -%.go: %.go.sh +%.go: %.go.gen ./$^ > $@ -interface_backend.go: ../requests.txt -func_handlerequest.go: ../requests.txt +interface_backend.go: ../nslcd_proto/requests.txt +func_handlerequest.go: ../nslcd_proto/requests.txt type_nilbackend.go: interface_backend.go -../requests.txt: +../nslcd_proto/requests.txt: $(MAKE) -C $(@D) $(@F) +.DELETE_ON_ERROR: diff --git a/proto/server/doc.go b/nslcd_server/doc.go index 1cf7552..1cf7552 100644 --- a/proto/server/doc.go +++ b/nslcd_server/doc.go diff --git a/proto/server/func_handlerequest.go.sh b/nslcd_server/func_handlerequest.go.gen index ac61e76..4c58ae0 100755 --- a/proto/server/func_handlerequest.go.sh +++ b/nslcd_server/func_handlerequest.go.gen @@ -30,7 +30,7 @@ import ( "os" s "syscall" - p "lukeshu.com/git/go/libnslcd.git/proto" + p "lukeshu.com/git/go/libnslcd.git/nslcd_proto" ) var sensitive = "<omitted-from-log>" diff --git a/proto/server/interface_backend.go.sh b/nslcd_server/interface_backend.go.gen index 71745ba..94a0433 100755 --- a/proto/server/interface_backend.go.sh +++ b/nslcd_server/interface_backend.go.gen @@ -26,7 +26,7 @@ package nslcd_server import ( s "syscall" - p "lukeshu.com/git/go/libnslcd.git/proto" + p "lukeshu.com/git/go/libnslcd.git/nslcd_proto" ) // The Backend interface allows the backend store to be implemented diff --git a/proto/server/type_nilbackend.go.sh b/nslcd_server/type_nilbackend.go.gen index 3a94d6e..0127e51 100755 --- a/proto/server/type_nilbackend.go.sh +++ b/nslcd_server/type_nilbackend.go.gen @@ -26,7 +26,7 @@ package nslcd_server import ( s "syscall" - p "lukeshu.com/git/go/libnslcd.git/proto" + p "lukeshu.com/git/go/libnslcd.git/nslcd_proto" ) // NilBackend implements the Backend interface, but only returns empty diff --git a/systemd/disable_nss_module.go b/nslcd_systemd/disable_nss_module.go index 9a8b388..d13cb5f 100644 --- a/systemd/disable_nss_module.go +++ b/nslcd_systemd/disable_nss_module.go @@ -23,7 +23,7 @@ import ( "fmt" "lukeshu.com/git/go/libgnulinux.git/dl" - sd "lukeshu.com/git/go/libsystemd.git/sd_daemon" + "lukeshu.com/git/go/libsystemd.git/sd_daemon" ) //static char *strary(char **ary, unsigned int n) { return ary[n]; } @@ -40,22 +40,22 @@ func disable_nss_module() { if err == nil { defer handle.Close() } else { - sd.Log.Warning(fmt.Sprintf("NSS module %s not loaded: %v", nss_module_soname, err)) + sd_daemon.Log.Warning(fmt.Sprintf("NSS module %s not loaded: %v", nss_module_soname, err)) return } c_version_info, err := handle.Sym(nss_module_sym_version) if err == nil { g_version_info := (**C.char)(c_version_info) - sd.Log.Debug(fmt.Sprintf("NSS module %s version %s %s", nss_module_soname, + sd_daemon.Log.Debug(fmt.Sprintf("NSS module %s version %s %s", nss_module_soname, C.GoString(C.strary(g_version_info, 0)), C.GoString(C.strary(g_version_info, 1)))) } else { - sd.Log.Warning(fmt.Sprintf("NSS module %s version missing: %v", nss_module_soname, err)) + sd_daemon.Log.Warning(fmt.Sprintf("NSS module %s version missing: %v", nss_module_soname, err)) } c_enable_flag, err := handle.Sym(nss_module_sym_enablelookups) if err != nil { - sd.Log.Warning(fmt.Sprintf("Unable to disable NSS ldap module for nslcd process: %v", err)) + sd_daemon.Log.Warning(fmt.Sprintf("Unable to disable NSS ldap module for nslcd process: %v", err)) return } g_enable_flag := (*C.int)(c_enable_flag) diff --git a/systemd/nslcd_systemd.go b/nslcd_systemd/nslcd_systemd.go index c5c8c65..eb545c2 100644 --- a/systemd/nslcd_systemd.go +++ b/nslcd_systemd/nslcd_systemd.go @@ -40,8 +40,8 @@ import ( "sync" "syscall" - "lukeshu.com/git/go/libnslcd.git/proto/server" - sd "lukeshu.com/git/go/libsystemd.git/sd_daemon" + "lukeshu.com/git/go/libnslcd.git/nslcd_server" + "lukeshu.com/git/go/libsystemd.git/sd_daemon" "lukeshu.com/git/go/libsystemd.git/sd_daemon/lsb" ) @@ -55,7 +55,7 @@ type Backend interface { func get_socket() (socket net.Listener, err error) { socket = nil err = nil - fds := sd.ListenFds(true) + fds := sd_daemon.ListenFds(true) if fds == nil { err = fmt.Errorf("Failed to aquire sockets from systemd") return @@ -84,14 +84,14 @@ func handler(conn *net.UnixConn, backend nslcd_server.Backend) { defer conn.Close() cred, err := getpeercred(conn) if err != nil { - sd.Log.Debug("Connection from unknown client") + sd_daemon.Log.Debug("Connection from unknown client") } else { - sd.Log.Debug(fmt.Sprintf("Connection from pid=%v uid=%v gid=%v", + sd_daemon.Log.Debug(fmt.Sprintf("Connection from pid=%v uid=%v gid=%v", cred.Pid, cred.Uid, cred.Gid)) } err = nslcd_server.HandleRequest(backend, conn, conn, cred) if err != nil { - sd.Log.Notice(fmt.Sprintf("Error while handling request: %v", err)) + sd_daemon.Log.Notice(fmt.Sprintf("Error while handling request: %v", err)) } } @@ -105,16 +105,16 @@ func Main(backend Backend) uint8 { err = backend.Init() if err != nil { - sd.Log.Err(fmt.Sprintf("Could not initialize backend: %v", err)) - sd.Notify(0, false, "STOPPING=1", nil) + sd_daemon.Log.Err(fmt.Sprintf("Could not initialize backend: %v", err)) + sd_daemon.Notify(0, false, "STOPPING=1", nil) return lsb.EXIT_FAILURE } defer backend.Close() socket, err := get_socket() if err != nil { - sd.Log.Err(fmt.Sprintf("%v", err)) - sd.Notify(0, false, "STOPPING=1", nil) + sd_daemon.Log.Err(fmt.Sprintf("%v", err)) + sd_daemon.Notify(0, false, "STOPPING=1", nil) return lsb.EXIT_NOTRUNNING } defer socket.Close() @@ -124,7 +124,7 @@ func Main(backend Backend) uint8 { for { conn, err := socket.Accept() if err != nil { - sd.Log.Notice(fmt.Sprintf("%v", err)) + sd_daemon.Log.Notice(fmt.Sprintf("%v", err)) } if conn != nil { sock <- conn.(*net.UnixConn) @@ -134,23 +134,23 @@ func Main(backend Backend) uint8 { var wg sync.WaitGroup defer wg.Wait() - defer sd.Notify(0, false, "STOPPING=1", nil) - sd.Notify(0, false, "READY=1", nil) + defer sd_daemon.Notify(0, false, "STOPPING=1", nil) + sd_daemon.Notify(0, false, "READY=1", nil) for { select { case sig := <-sigs: switch sig { case syscall.SIGTERM: - sd.Log.Notice("Received SIGTERM, shutting down") + sd_daemon.Log.Notice("Received SIGTERM, shutting down") return lsb.EXIT_SUCCESS case syscall.SIGHUP: - sd.Notify(0, false, "RELOADING=1", nil) + sd_daemon.Notify(0, false, "RELOADING=1", nil) err := backend.Reload() if err != nil { - sd.Log.Notice(fmt.Sprintf("Could not reload backend: %s", err.Error())) + sd_daemon.Log.Notice(fmt.Sprintf("Could not reload backend: %s", err.Error())) return lsb.EXIT_NOTRUNNING } - sd.Notify(0, false, "READY=1", nil) + sd_daemon.Notify(0, false, "READY=1", nil) } case conn := <-sock: wg.Add(1) |