summarylogtreecommitdiffstats
path: root/doas.patch
diff options
context:
space:
mode:
Diffstat (limited to 'doas.patch')
-rw-r--r--doas.patch145
1 files changed, 145 insertions, 0 deletions
diff --git a/doas.patch b/doas.patch
new file mode 100644
index 000000000000..53e4faa759b1
--- /dev/null
+++ b/doas.patch
@@ -0,0 +1,145 @@
+Hunk 1-2: Change doas.conf location
+Hunk 3: Rewrite Makefile
+ - Remove configs for non-Linux systems
+ - Collate all *FLAGS vars into one declaration
+ - Rewrite needed objects list
+ - Use gmake builting rules for yacc files
+ - Use install(1) in install rule
+ - Obey DESTDIR location
+diff -ura doas-6.2p1-old/doas.1 doas-6.2p1-new/doas.1
+--- doas-6.2p1-old/doas.1 2019-09-11 03:05:57.000000000 +1000
++++ doas-6.2p1-new/doas.1 2019-10-27 18:14:55.141354126 +1100
+@@ -91,7 +91,7 @@
+ .Bl -bullet -compact
+ .It
+ The config file
+-.Pa /usr/local/etc/doas.conf
++.Pa /etc/doas.conf
+ could not be parsed.
+ .It
+ The user attempted to run a command which is not permitted.
+diff -ura doas-6.2p1-old/doas.conf.5 doas-6.2p1-new/doas.conf.5
+--- doas-6.2p1-old/doas.conf.5 2019-09-11 03:05:57.000000000 +1000
++++ doas-6.2p1-new/doas.conf.5 2019-10-27 18:14:55.141354126 +1100
+@@ -20,7 +20,7 @@
+ .Nm doas.conf
+ .Nd doas configuration file
+ .Sh SYNOPSIS
+-.Nm /usr/local/etc/doas.conf
++.Nm doas.conf
+ .Sh DESCRIPTION
+ The
+ .Xr doas 1
+@@ -125,6 +125,11 @@
+ If quotes or backslashes are used in a word,
+ it is not considered a keyword.
+ .El
++.Sh FILES
++.Bl -tag -width "/etc/doas.conf"
++.It Pa /etc/doas.conf
++doas configuration file.
++.El
+ .Sh EXAMPLES
+ The following example permits users in group wsrc to build ports;
+ wheel to execute commands as any user while keeping the environment
+diff -ura doas-6.2p1-old/Makefile doas-6.2p1-new/Makefile
+--- doas-6.2p1-old/Makefile 2019-09-11 03:05:57.000000000 +1000
++++ doas-6.2p1-new/Makefile 2019-10-27 18:21:34.453259228 +1100
+@@ -1,61 +1,38 @@
+-CC?=clang
+-YACC?=yacc
+-BIN=doas
+-PREFIX?=/usr/local
+-MANDIR?=$(DESTDIR)$(PREFIX)/man
+-SYSCONFDIR?=$(DESTDIR)$(PREFIX)/etc
+-OBJECTS=doas.o env.o compat/execvpe.o compat/reallocarray.o y.tab.o
+-OPT?=-O2
+-# Can set GLOBAL_PATH here to set PATH for target user.
+-# TARGETPATH=-DGLOBAL_PATH=\"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:\"
+-CFLAGS+=-Wall $(OPT) -DUSE_PAM -DDOAS_CONF=\"${SYSCONFDIR}/doas.conf\" $(TARGETPATH)
+-CPPFLAGS+=-include compat/compat.h
+-LDFLAGS+=-lpam
+-UNAME_S := $(shell uname -s)
+-ifeq ($(UNAME_S),Linux)
+- LDFLAGS+=-lpam_misc
+- CPPFLAGS+=-Icompat
+- CFLAGS+=-D_GNU_SOURCE
+- COMPAT+=closefrom.o errc.o getprogname.o setprogname.o strlcat.o strlcpy.o strtonum.o verrc.o
+- OBJECTS+=$(COMPAT:%.o=compat/%.o)
+-endif
+-ifeq ($(UNAME_S),FreeBSD)
+- CFLAGS+=-DHAVE_LOGIN_CAP_H
+- LDFLAGS+=-lutil
+-endif
+-ifeq ($(UNAME_S),SunOS)
+- SAFE_PATH?=/bin:/sbin:/usr/bin:/usr/sbin:$(PREFIX)/bin:$(PREFIX)/sbin
+- GLOBAL_PATH?=/bin:/sbin:/usr/bin:/usr/sbin:$(PREFIX)/bin:$(PREFIX)/sbin
+- CPPFLAGS+=-Icompat
+- CFLAGS+=-DSOLARIS_PAM -DSAFE_PATH=\"$(SAFE_PATH)\" -DGLOBAL_PATH=\"$(GLOBAL_PATH)\"
+- COMPAT=errc.o pm_pam_conv.o setresuid.o verrc.o
+- OBJECTS+=$(COMPAT:%.o=compat/%.o)
+-endif
+-
+-all: $(OBJECTS)
+- $(CC) -o $(BIN) $(OBJECTS) $(LDFLAGS)
+-
+-env.o: doas.h env.c
+-
+-execvpe.o: doas.h execvpe.c
+-
+-doas.o: doas.h doas.c parse.y
+-
+-reallocarray.o: doas.h reallocarray.c
+-
+-y.tab.o: parse.y
+- $(YACC) parse.y
+- $(CC) $(CPPFLAGS) $(CFLAGS) -c y.tab.c
+-
+-install: $(BIN)
+- mkdir -p $(DESTDIR)$(PREFIX)/bin
+- cp $(BIN) $(DESTDIR)$(PREFIX)/bin/
+- chmod 4755 $(DESTDIR)$(PREFIX)/bin/$(BIN)
+- mkdir -p $(MANDIR)/man1
+- cp doas.1 $(MANDIR)/man1/
+- mkdir -p $(MANDIR)/man5
+- cp doas.conf.5 $(MANDIR)/man5/
++PREFIX := /usr
++BINDIR := $(PREFIX)/bin
++MANDIR := $(PREFIX)/share/man
++
++CPPFLAGS := $(CPPFLAGS) -include compat/compat.h -Icompat
++CFLAGS := $(CFLAGS) -DUSE_PAM -DDOAS_CONF=\"/etc/doas.conf\" -D_GNU_SOURCE
++LDFLAGS := -lpam -lpam_misc $(LDFLAGS)
++
++OBJS = \
++ compat/closefrom.o \
++ compat/errc.o \
++ compat/execvpe.o \
++ compat/getprogname.o \
++ compat/reallocarray.o \
++ compat/setprogname.o \
++ compat/strlcat.o \
++ compat/strlcpy.o \
++ compat/strtonum.o \
++ compat/verrc.o \
++ doas.o \
++ env.o \
++ parse.o
++
++doas: $(OBJS)
++ $(CC) $(LDFLAGS) -o $@ $(OBJS)
++
++compat/execvpe.o: doas.h
++compat/reallocarray.o: doas.h
++doas.o: doas.h
++env.o: doas.h
++
++install: doas
++ install -Dm4755 doas $(DESTDIR)$(BINDIR)/doas
++ install -Dm0644 doas.1 $(DESTDIR)$(MANDIR)/man1/doas.1
++ install -Dm0644 doas.conf.5 $(DESTDIR)$(MANDIR)/man1/doas.conf.5
+
+ clean:
+- rm -f $(BIN) $(OBJECTS) y.tab.c
+-
++ rm -f $(OBJS) doas