summarylogtreecommitdiffstats
path: root/doas.patch
blob: 53e4faa759b17dc277b5286f9fb2877c479a3b13 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
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