From 1ff424c47193173b24d997293f8b0b0c4efcdd48 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 17 Jan 2017 01:36:54 -0500 Subject: Build against newer versions of libraries. --- .gitignore | 1 + .gitmodules | 3 + GNUmakefile | 13 ++++ LICENSE.bsd3.txt | 1 + LICENSE.txt | 26 +++---- Makefile | 99 +++++++++++++++----------- build-aux/Makefile.each.tail/09-generate.mk | 1 - build-aux/Makefile.head.mk | 8 +-- build-aux/Makefile.once.head/09-generate.mk | 1 - build-aux/Makefile.once.head/20-golang.mk | 30 -------- build-aux/Makefile.once.head/20-var.mk | 20 ------ go/cmd-nshd/main.go.in | 5 +- go/git.lukeshu.com/go/libgnulinux | 2 +- go/git.lukeshu.com/go/libnslcd | 2 +- go/git.lukeshu.com/go/libsystemd | 2 +- go/golang.org/x/sys | 1 + go/parabola_hackers/nslcd_backend/db_config.go | 5 +- go/parabola_hackers/nslcd_backend/db_group.go | 4 +- go/parabola_hackers/nslcd_backend/db_pam.go | 17 ++--- go/parabola_hackers/nslcd_backend/db_passwd.go | 5 +- go/parabola_hackers/nslcd_backend/db_shadow.go | 7 +- go/parabola_hackers/nslcd_backend/hackers.go | 19 ++--- go/parabola_hackers/nslcd_backend/util.go | 2 +- go/parabola_hackers/passwords.go.in | 8 +-- go/parabola_hackers/users.go.in | 6 +- 25 files changed, 137 insertions(+), 151 deletions(-) create mode 100644 GNUmakefile create mode 120000 LICENSE.bsd3.txt delete mode 100644 build-aux/Makefile.each.tail/09-generate.mk delete mode 100644 build-aux/Makefile.once.head/09-generate.mk delete mode 100644 build-aux/Makefile.once.head/20-golang.mk delete mode 100644 build-aux/Makefile.once.head/20-var.mk create mode 160000 go/golang.org/x/sys diff --git a/.gitignore b/.gitignore index 71c422e..c8c9ae9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /LICENSE.*.txt +!/LICENSE.bsd3.txt /nshd.service /nshd.sysusers diff --git a/.gitmodules b/.gitmodules index 8e9b8d8..434287e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -10,3 +10,6 @@ [submodule "go/git.lukeshu.com/go/libsystemd"] path = go/git.lukeshu.com/go/libsystemd url = https://git.lukeshu.com/go/libsystemd/ +[submodule "go/golang.org/x/sys"] + path = go/golang.org/x/sys + url = https://go.googlesource.com/sys diff --git a/GNUmakefile b/GNUmakefile new file mode 100644 index 0000000..cc5a40d --- /dev/null +++ b/GNUmakefile @@ -0,0 +1,13 @@ +# This file is a hack to let us pass whatever flags we want to Make, +# since adjusting MAKEFLAGS at runtime only half-works. +# +# Most of the complexity is dancing around to avoid having any +# possibly conflicting identifiers. + +MAKEFLAGS += --no-print-directory +rest = $(wordlist 2,$(words $1),$1) +target = $(or $(firstword $(MAKECMDGOALS)),default) +$(or $(call rest,$(MAKECMDGOALS)),_$(target)): $(target) + @: +$(target): + @+$(MAKE) -f Makefile --no-builtin-rules --no-builtin-variables $(MAKECMDGOALS) diff --git a/LICENSE.bsd3.txt b/LICENSE.bsd3.txt new file mode 120000 index 0000000..92d2b94 --- /dev/null +++ b/LICENSE.bsd3.txt @@ -0,0 +1 @@ +go/golang.org/x/sys/LICENSE \ No newline at end of file diff --git a/LICENSE.txt b/LICENSE.txt index 9e6ff48..57a0df1 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,17 +1,19 @@ The software in this repository is under a number of licenses: - scripts/ GPL v2+ - src/nshd/ GPL v2+ - test/ LGPL v2.1+ + scripts/ GPL v2+ + src/nshd/ GPL v2+ + test/ LGPL v2.1+ - src/gopkg.in/yaml.v2 LGPL v3, with linking exception - src/lukeshu.com/git/go/libgnulinux.git/dl GPL v2+, with documentation output clarification - src/lukeshu.com/git/go/libgnulinux.git/inotify LGPL v2.1+ - src/lukeshu.com/git/go/libgnulinux.git/getgr LGPL v2.1+ - src/lukeshu.com/git/go/libnslcd.git/ LGPL v2.1+ - src/lukeshu.com/git/go/libsystemd.git/ Apache v2.0 + go/gopkg.in/yaml.v2 LGPL v3, with linking exception + go/golang.org/x/sys/unix 3-clause BSD license - build-aux/ AGPL v3+ + go/git.lukeshu.com/go/libgnulinux/dl GPL v2+, with documentation output clarification + go/git.lukeshu.com/go/libgnulinux/inotify LGPL v2.1+ + go/git.lukeshu.com/go/libgnulinux/getgr LGPL v2.1+ + go/git.lukeshu.com/go/libnslcd/ LGPL v2.1+ + go/git.lukeshu.com/go/libsystemd/ Apache v2.0 + + build-aux/ AGPL v3+ The general notion is that the build system is AGPL (v3+), the core application is GPL (v2+), while supporting libraries that might be @@ -21,7 +23,7 @@ exceptions: CoreOS and Docker. - The dl package is GPL v2+ licensed because of wording in comments taken from the Linux Programmer's Manual. - - The YAML library uses v3 of the LGPL because it's a 3rd-party - library, and that's how the authors licensed it. + - The YAML and sys/unix libraries use other licenses because they are + 3rd-party libraries, and that's how the authors licensed them. For more details, see each individual file. diff --git a/Makefile b/Makefile index 35f181b..507c903 100644 --- a/Makefile +++ b/Makefile @@ -13,34 +13,38 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . --include config.mk -PACKAGE = parabola-hackers -sysusersdir=$(prefix)/lib/sysusers.d -systemunitdir=$(prefix)/lib/systemd/system -conf_file = $(sysconfdir)/$(PACKAGE).yml -shadow_file = $(sysconfdir)/nshd/shadow -NET ?= -#NET ?= FORCE -user = nshd -CFLAGS += -Wall -Wextra -Werror -pedantic -CC = gcc -std=c99 - -MAKEFLAGS += --no-builtin-rules -topsrcdir := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST)))) -topoutdir := $(topsrcdir) +include config.mk include $(topsrcdir)/build-aux/Makefile.head.mk +var = .var. +programs = nshd nshd-setuid nshd-tester common.rb +scripts = $(filter-out %.c %.o $(programs) common.rb common.rb.in,$(notdir $(wildcard $(srcdir)/bin/*))) + +.PHONY: FORCE +.SECONDARY: +.DELETE_ON_ERROR: + +# +# Go language noise + CGO_CPPFLAGS = $(CPPFLAGS) -U_FORTIFY_SOURCE CGO_CFLAGS = $(CFLAGS) -O0 -Wno-unused-parameter CGO_ENABLED = 1 -programs = nshd nshd-setuid nshd-tester common.rb -scripts = $(filter-out %.c %.o $(programs) common.rb common.rb.in,$(notdir $(wildcard $(srcdir)/bin/*))) +cgo_variables = CGO_ENABLED CGO_CFLAGS CGO_CPPFLAGS CGO_CXXFLAGS CGO_LDFLAGS CC CXX +$(foreach v,$(cgo_variables),$(eval $v ?=)) +export $(cgo_variables) + +$(outdir)/.gopath/src: + rm -rf -- $(@D) + mkdir $(@D) + ln -sr $(srcdir)/go $@ + touch $@ + +# +# Generate (pre-tarball) files.src.gen += LICENSE.lgpl-2.1.txt LICENSE.gpl-2.txt LICENSE.apache-2.0.txt -files.out.gen += $(addprefix bin/,$(programs)) nshd.service nshd.sysusers -files.out.int += bin/*.o .gopath/ .tmp* .var* -files.sys.all += $(addprefix $(bindir)/,$(programs) $(scripts)) $(systemunitdir)/nshd.socket $(systemunitdir)/nshd.service $(sysusersdir)/nshd.conf $(conf_file) $(shadow_file) $(srcdir)/LICENSE.lgpl-2.1.txt: $(NET) curl https://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt > $@ @@ -52,39 +56,57 @@ $(srcdir)/LICENSE.wtfpl-2.txt: $(NET) curl http://www.wtfpl.net/txt/copying/ > $@ files.generate: go-generate -go-generate: - +GOPATH=$$PWD go generate ./... +go-generate: .gopath + +GOPATH=$(abspath $(outdir)/.gopath) go generate git.lukeshu.com/... .PHONY: go-generate +at.targets += go-generate + +# +# Build (post-tarball) +files.out.all += $(addprefix bin/,$(programs)) nshd.service nshd.sysusers +files.out.int += bin/*.o .gopath/ .gopath/* .tmp* .var* + +# Dependencies +$(outdir)/bin/nshd-setuid: -ldl +$(outdir)/nshd.service: $(var)user $(var)bindir +$(outdir)/nshd.sysusers: $(var)user +$(outdir)/bin/common.rb: $(var)conf_file + +$(outdir)/.gopath/bin/cmd-nshd: \ + $(outdir)/go/cmd-nshd/main.go \ + $(outdir)/go/parabola_hackers/users.go \ + $(outdir)/go/parabola_hackers/passwords.go +$(outdir)/go/cmd-nshd/main.go: $(var)conf_file +$(outdir)/go/parabola_hackers/users.go: $(var)bindir +$(outdir)/go/parabola_hackers/passwords.go: $(var)shadow_file + +# Go: copy out of .gopath $(outdir)/bin/nshd: \ $(outdir)/bin/%: $(outdir)/.gopath/bin/cmd-% cp -T $< $@ -$(outdir)/.gopath/src: $(golang.var) - rm -rf -- $(@D) - mkdir $(@D) - ln -sr $(topsrcdir)/go $@ - touch $@ -$(outdir)/.gopath/bin/cmd-nshd: $(patsubst $(outdir)/.gopath/src/%,go/%,$(call golang.src,$(outdir)/.gopath)) $(_gen) $(_out) - $(call golang.install,$(topoutdir)/.gopath,cmd-nshd) +# Go: compile+link +$(outdir)/.gopath/bin/cmd-nshd: \ +$(outdir)/.gopath/bin/cmd-%: FORCE go-generate + GOPATH=$(abspath $(outdir)/.gopath) go install $(@F) +# C: compile $(outdir)/%.o: $(srcdir)/%.c $(var)CC $(var)CPPFLAGS $(var)CFLAGS $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $(filter-out $(var)%,$^) +# C: link $(outdir)/bin/nshd-tester $(outdir)/bin/nshd-setuid: \ $(outdir)/%: $(outdir)/%.o $(var)CC $(var)LDFLAGS $(CC) $(LDFLAGS) -o $@ $(filter-out $(var)%,$^) +# Basic variable substitution $(outdir)/%: $(srcdir)/%.in < $< sed $(foreach v,$(patsubst $(var)%,%,$(filter $(var)%,$^)), -e 's|@$v@|$($v)|g' ) > $@ -$(outdir)/bin/nshd-setuid: -ldl -$(outdir)/nshd.service: $(var)user $(var)bindir -$(outdir)/nshd.sysusers: $(var)user -$(outdir)/bin/common.rb: $(var)conf_file -$(outdir)/go/cmd-nshd/main.go: $(var)conf_file -$(outdir)/go/parabola_hackers/users.go: $(var)bindir -$(outdir)/go/parabola_hackers/passwords.go: $(var)shadow_file -# Patterns +# Install + +files.sys.all += $(addprefix $(bindir)/,$(programs) $(scripts)) $(systemunitdir)/nshd.socket $(systemunitdir)/nshd.service $(sysusersdir)/nshd.conf $(conf_file) $(shadow_file) + $(DESTDIR)$(bindir)/%: $(outdir)/bin/% $(NORMAL_INSTALL) install -TDm755 $< $@ @@ -113,7 +135,4 @@ $(DESTDIR)$(shadow_file): $(var)user $(DESTDIR)$(sysusersdir)/nshd.conf -systemd-sysusers -chown $(user):$(user) $(@D) $@ -.PHONY: FORCE -.SECONDARY: -.DELETE_ON_ERROR: include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/build-aux/Makefile.each.tail/09-generate.mk b/build-aux/Makefile.each.tail/09-generate.mk deleted file mode 100644 index 3a8566f..0000000 --- a/build-aux/Makefile.each.tail/09-generate.mk +++ /dev/null @@ -1 +0,0 @@ -$(outdir)/generate: $(std.gen_files) diff --git a/build-aux/Makefile.head.mk b/build-aux/Makefile.head.mk index e6b4a19..33ef9c1 100644 --- a/build-aux/Makefile.head.mk +++ b/build-aux/Makefile.head.mk @@ -13,8 +13,9 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +at.Makefile ?= Makefile _at.MAKEFILE_LIST ?= -_at.MAKEFILE_LIST := $(strip $(_at.MAKEFILE_LIST) $(abspath $(lastword $(filter-out %.mk,$(MAKEFILE_LIST))))) +_at.MAKEFILE_LIST := $(strip $(_at.MAKEFILE_LIST) $(lastword $(filter %/$(at.Makefile),$(abspath $(MAKEFILE_LIST))))) # This bit only gets evaluated once, at the very beginning ifeq ($(origin _at.NO_ONCE),undefined) @@ -86,9 +87,6 @@ define at.nl endef -# External configuration ############################################### -at.Makefile ?= Makefile - # Include modules ###################################################### include $(sort $(wildcard $(topsrcdir)/build-aux/Makefile.once.head/*.mk)) _at.tmp_targets = @@ -102,7 +100,7 @@ endif # _at.NO_ONCE outdir := $(call _at.path,$(dir $(lastword $(_at.MAKEFILE_LIST)))) ifeq ($(call _at.is_subdir,$(topoutdir),$(outdir)),) -$(error Autothing: not a subdirectory of topoutdir=$(topoutdir): $(outdir)) +$(error Autothing: not a subdirectory of topoutdir=«$(topoutdir)»: «$(outdir)») endif # Don't use at.out2src because we *know* that $(outdir) is inside $(topoutdir), diff --git a/build-aux/Makefile.once.head/09-generate.mk b/build-aux/Makefile.once.head/09-generate.mk deleted file mode 100644 index b07bb3f..0000000 --- a/build-aux/Makefile.once.head/09-generate.mk +++ /dev/null @@ -1 +0,0 @@ -at.phony += generate diff --git a/build-aux/Makefile.once.head/20-golang.mk b/build-aux/Makefile.once.head/20-golang.mk deleted file mode 100644 index 8e3835e..0000000 --- a/build-aux/Makefile.once.head/20-golang.mk +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright 2015-2016 Luke Shumaker -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program 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 Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . - -golang.Q ?= @ -golang.FLAGS ?= - -_golang.cgo_variables = CGO_ENABLED CGO_CFLAGS CGO_CPPFLAGS CGO_CXXFLAGS CGO_LDFLAGS CC CXX -$(foreach v,$(_golang.cgo_variables),$(eval $v ?=)) -export $(_golang.cgo_variables) - -_golang.src_cmd = find -L $1/src -name '.*' -prune -o \( -type f \( -false $(foreach e,go c s S cc cpp cxx h hh hpp hxx,-o -name '*.$e') \) -o -type d \) -print -golang.src = $1/src $(shell $(_golang.src_cmd) 2>/dev/null) -golang.var = $(addprefix $(var),$(_golang.cgo_variables)) - -define golang.install - GOPATH='$(abspath $1)' go install $(golang.FLAGS) $2 - $(golang.Q)true $(foreach e,$(notdir $2), && test -f $1/bin/$e -a -x $1/bin/$e && touch $1/bin/$e) -endef diff --git a/build-aux/Makefile.once.head/20-var.mk b/build-aux/Makefile.once.head/20-var.mk deleted file mode 100644 index b1de987..0000000 --- a/build-aux/Makefile.once.head/20-var.mk +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2015-2016 Luke Shumaker . -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program 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 Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . - -var = $(patsubst ./%,%,$(topoutdir)/.var.) - -$(var)%: FORCE - @printf '%s' '$(subst ','\'',$($*))' | sed 's|^|#|' | $(WRITE_IFCHANGED) $@ --include $(wildcard $(var)*) diff --git a/go/cmd-nshd/main.go.in b/go/cmd-nshd/main.go.in index b8c3e71..260f553 100644 --- a/go/cmd-nshd/main.go.in +++ b/go/cmd-nshd/main.go.in @@ -14,14 +14,15 @@ // License along with this manual; if not, see // . -// Command nshd is an implementation of nslcd that talks to hackers.git instead of LDAP. +// Command nshd is an implementation of nslcd that talks to +// hackers.git instead of LDAP. package main import ( "os" hackers_nslcd_backend "parabola_hackers/nslcd_backend" - nslcd_systemd "lukeshu.com/git/go/libnslcd.git/systemd" + "git.lukeshu.com/go/libnslcd/nslcd_systemd" ) func main() { diff --git a/go/git.lukeshu.com/go/libgnulinux b/go/git.lukeshu.com/go/libgnulinux index d8c4fd9..b2bae3c 160000 --- a/go/git.lukeshu.com/go/libgnulinux +++ b/go/git.lukeshu.com/go/libgnulinux @@ -1 +1 @@ -Subproject commit d8c4fd9aef9137b04e4311a1f50024ab88d4c6e3 +Subproject commit b2bae3c73817740b48a4698c6aa863d70234a64c diff --git a/go/git.lukeshu.com/go/libnslcd b/go/git.lukeshu.com/go/libnslcd index b97ad53..939ef44 160000 --- a/go/git.lukeshu.com/go/libnslcd +++ b/go/git.lukeshu.com/go/libnslcd @@ -1 +1 @@ -Subproject commit b97ad53c80372d3246220b8fdb5a7a4c1a4d3f09 +Subproject commit 939ef442f33dadf17f60ebf9f0c1fbaaa27f0c62 diff --git a/go/git.lukeshu.com/go/libsystemd b/go/git.lukeshu.com/go/libsystemd index 89efdfb..1ac9db6 160000 --- a/go/git.lukeshu.com/go/libsystemd +++ b/go/git.lukeshu.com/go/libsystemd @@ -1 +1 @@ -Subproject commit 89efdfbee5f9a22f9dd1083f7a383daba54d4f12 +Subproject commit 1ac9db65fda0693d13336e6471a858914348f2fc diff --git a/go/golang.org/x/sys b/go/golang.org/x/sys new file mode 160000 index 0000000..d75a526 --- /dev/null +++ b/go/golang.org/x/sys @@ -0,0 +1 @@ +Subproject commit d75a52659825e75fff6158388dddc6a5b04f9ba5 diff --git a/go/parabola_hackers/nslcd_backend/db_config.go b/go/parabola_hackers/nslcd_backend/db_config.go index e78643b..556aa76 100644 --- a/go/parabola_hackers/nslcd_backend/db_config.go +++ b/go/parabola_hackers/nslcd_backend/db_config.go @@ -17,9 +17,8 @@ package hackers_nslcd_backend import ( - s "syscall" - - p "lukeshu.com/git/go/libnslcd.git/proto" + p "git.lukeshu.com/go/libnslcd/nslcd_proto" + s "golang.org/x/sys/unix" ) func (o *Hackers) Config_Get(cred s.Ucred, req p.Request_Config_Get) <-chan p.Config { diff --git a/go/parabola_hackers/nslcd_backend/db_group.go b/go/parabola_hackers/nslcd_backend/db_group.go index 18e54b1..41f049e 100644 --- a/go/parabola_hackers/nslcd_backend/db_group.go +++ b/go/parabola_hackers/nslcd_backend/db_group.go @@ -18,9 +18,9 @@ package hackers_nslcd_backend import ( "parabola_hackers" - s "syscall" - p "lukeshu.com/git/go/libnslcd.git/proto" + p "git.lukeshu.com/go/libnslcd/nslcd_proto" + s "golang.org/x/sys/unix" ) func (o *Hackers) groupByName(name string, users bool) p.Group { diff --git a/go/parabola_hackers/nslcd_backend/db_pam.go b/go/parabola_hackers/nslcd_backend/db_pam.go index f770cc1..0538e70 100644 --- a/go/parabola_hackers/nslcd_backend/db_pam.go +++ b/go/parabola_hackers/nslcd_backend/db_pam.go @@ -1,4 +1,4 @@ -// Copyright 2015-2016 Luke Shumaker . +// Copyright 2015-2016 Luke Shumaker . // // This is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as @@ -20,11 +20,12 @@ import ( "fmt" "os" "parabola_hackers" - s "syscall" - "lukeshu.com/git/go/libgnulinux.git/crypt" - p "lukeshu.com/git/go/libnslcd.git/proto" - "lukeshu.com/git/go/libsystemd.git/sd_daemon/logger" + s "golang.org/x/sys/unix" + p "git.lukeshu.com/go/libnslcd/nslcd_proto" + + "git.lukeshu.com/go/libgnulinux/crypt" + "git.lukeshu.com/go/libsystemd/sd_daemon" ) func checkPassword(password string, hash string) bool { @@ -36,7 +37,7 @@ func hashPassword(newPassword string, oldHash string) string { if salt == "!" { str, err := parabola_hackers.RandomString(crypt.SaltAlphabet, 8) if err != nil { - logger.Err("Could not generate a random string") + sd_daemon.Log.Err("Could not generate a random string") str = "" } salt = "$6$" + str + "$" @@ -174,7 +175,7 @@ func (o *Hackers) PAM_PwMod(cred s.Ucred, req p.Request_PAM_PwMod) <-chan p.PAM_ // Update the PwHash in memory user.Passwd.PwHash = hashPassword(req.NewPassword, user.Passwd.PwHash) if len(user.Passwd.PwHash) == 0 { - logger.Err("Password hashing failed") + sd_daemon.Log.Err("Password hashing failed") return } @@ -186,7 +187,7 @@ func (o *Hackers) PAM_PwMod(cred s.Ucred, req p.Request_PAM_PwMod) <-chan p.PAM_ passwords[user.Passwd.Name] = user.Passwd.PwHash err := parabola_hackers.SaveAllPasswords(passwords) if err != nil { - logger.Err("Writing passwords to disk: %v", err) + sd_daemon.Log.Err(fmt.Sprintf("Writing passwords to disk: %v", err)) return } diff --git a/go/parabola_hackers/nslcd_backend/db_passwd.go b/go/parabola_hackers/nslcd_backend/db_passwd.go index 3f32ddd..c5faf5c 100644 --- a/go/parabola_hackers/nslcd_backend/db_passwd.go +++ b/go/parabola_hackers/nslcd_backend/db_passwd.go @@ -17,9 +17,8 @@ package hackers_nslcd_backend import ( - s "syscall" - - p "lukeshu.com/git/go/libnslcd.git/proto" + p "git.lukeshu.com/go/libnslcd/nslcd_proto" + s "golang.org/x/sys/unix" ) /* Note that the output password hash value should be one of: diff --git a/go/parabola_hackers/nslcd_backend/db_shadow.go b/go/parabola_hackers/nslcd_backend/db_shadow.go index abfff28..58b13ec 100644 --- a/go/parabola_hackers/nslcd_backend/db_shadow.go +++ b/go/parabola_hackers/nslcd_backend/db_shadow.go @@ -1,4 +1,4 @@ -// Copyright 2015-2016 Luke Shumaker . +// Copyright 2015-2016 Luke Shumaker . // // This is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as @@ -17,9 +17,8 @@ package hackers_nslcd_backend import ( - s "syscall" - - p "lukeshu.com/git/go/libnslcd.git/proto" + p "git.lukeshu.com/go/libnslcd/nslcd_proto" + s "golang.org/x/sys/unix" ) func (o *Hackers) Shadow_ByName(cred s.Ucred, req p.Request_Shadow_ByName) <-chan p.Shadow { diff --git a/go/parabola_hackers/nslcd_backend/hackers.go b/go/parabola_hackers/nslcd_backend/hackers.go index bb03862..9cff815 100644 --- a/go/parabola_hackers/nslcd_backend/hackers.go +++ b/go/parabola_hackers/nslcd_backend/hackers.go @@ -19,12 +19,13 @@ package hackers_nslcd_backend import ( + "fmt" "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" + "git.lukeshu.com/go/libnslcd/nslcd_server" + "git.lukeshu.com/go/libnslcd/nslcd_systemd" + "git.lukeshu.com/go/libsystemd/sd_daemon" ) type config struct { @@ -46,17 +47,17 @@ var _ nslcd_systemd.Backend = &Hackers{} var _ nslcd_server.Backend = &Hackers{} func (o *Hackers) Init() error { - logger.Debug("hackers.git: CfgFilename = %v", o.CfgFilename) + sd_daemon.Log.Debug(fmt.Sprintf("hackers.git: CfgFilename = %v", o.CfgFilename)) err := o.Reload() if err != nil { - logger.Err("hackers.git: Could not initialize: %v", err) + sd_daemon.Log.Err(fmt.Sprintf("hackers.git: Could not initialize: %v", err)) return err } return nil } func (o *Hackers) Close() { - logger.Info("hackers.git: Closing session") + sd_daemon.Log.Info("hackers.git: Closing session") o.lock.Lock() defer o.lock.Unlock() @@ -65,7 +66,7 @@ func (o *Hackers) Close() { } func (o *Hackers) Reload() error { - logger.Info("hackers.git: Loading session") + sd_daemon.Log.Info("hackers.git: Loading session") o.lock.Lock() defer o.lock.Unlock() @@ -74,9 +75,9 @@ func (o *Hackers) Reload() error { if err != nil { return err } - logger.Info("hackers.git: pam_password_prohibit_message: %#v", o.cfg.Pam_password_prohibit_message) + sd_daemon.Log.Info(fmt.Sprintf("hackers.git: pam_password_prohibit_message: %#v", o.cfg.Pam_password_prohibit_message)) - logger.Debug("hackers.git: Parsing user data") + sd_daemon.Log.Debug("hackers.git: Parsing user data") o.users, err = parabola_hackers.LoadAllUsers() if err != nil { return err diff --git a/go/parabola_hackers/nslcd_backend/util.go b/go/parabola_hackers/nslcd_backend/util.go index 4fb28f3..a3b2b5d 100644 --- a/go/parabola_hackers/nslcd_backend/util.go +++ b/go/parabola_hackers/nslcd_backend/util.go @@ -21,7 +21,7 @@ import ( "os" yaml "gopkg.in/yaml.v2" - "lukeshu.com/git/go/libgnulinux.git/getgr" + "git.lukeshu.com/go/libgnulinux/getgr" ) func name2gid(name string) int32 { diff --git a/go/parabola_hackers/passwords.go.in b/go/parabola_hackers/passwords.go.in index b9f93d9..7065eb1 100644 --- a/go/parabola_hackers/passwords.go.in +++ b/go/parabola_hackers/passwords.go.in @@ -23,8 +23,8 @@ import ( "sort" "strings" - "lukeshu.com/git/go/libgnulinux.git/crypt" - "lukeshu.com/git/go/libsystemd.git/sd_daemon/logger" + "git.lukeshu.com/go/libgnulinux/crypt" + "git.lukeshu.com/go/libsystemd/sd_daemon" ) /* Note that the password hash value should be one of: @@ -53,14 +53,14 @@ func LoadAllPasswords() (map[string]string, error) { } cols := strings.SplitN(line, ":", 2) if len(cols) != 2 { - logger.Err("hackers.git %s:%d: malformed line", shadow_file, i+1) + sd_daemon.Log.Err(fmt.Sprintf("hackers.git %s:%d: malformed line", shadow_file, i+1)) continue } username := cols[0] hash := cols[1] if hash != "!" && !crypt.SaltOk(hash) { hash = "!" - logger.Err("%s:%d: malformed hash for user: %s", shadow_file, i+1, username) + sd_daemon.Log.Err(fmt.Sprintf("%s:%d: malformed hash for user: %s", shadow_file, i+1, username)) } passwords[username] = hash } diff --git a/go/parabola_hackers/users.go.in b/go/parabola_hackers/users.go.in index e54de01..3a307be 100644 --- a/go/parabola_hackers/users.go.in +++ b/go/parabola_hackers/users.go.in @@ -21,8 +21,8 @@ import ( "os/exec" yaml "gopkg.in/yaml.v2" - p "lukeshu.com/git/go/libnslcd.git/proto" - "lukeshu.com/git/go/libsystemd.git/sd_daemon/logger" + p "git.lukeshu.com/go/libnslcd/nslcd_proto" + "git.lukeshu.com/go/libsystemd/sd_daemon" ) /* Note that the password hash value should be one of: @@ -67,7 +67,7 @@ func LoadAllUsers() (users map[int32]User, err error) { continue } user.Passwd.UID = int32(uid) - logger.Debug("hackers.git: -> User %d(%s) parsed", user.Passwd.UID, user.Passwd.Name) + sd_daemon.Log.Debug(fmt.Sprintf("hackers.git: -> User %d(%s) parsed", user.Passwd.UID, user.Passwd.Name)) users[user.Passwd.UID] = user } } -- cgit v1.2.2