xref: /titanic_44/usr/src/cmd/tcpd/Makefile (revision 8eea8e29cc4374d1ee24c25a07f45af132db3499)
1#
2# Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
3# Use is subject to license terms.
4#
5# ident	"%Z%%M%	%I%	%E% SMI"
6#
7
8PROG =		safe_finger tcpd tcpdchk tcpdmatch try-from
9
10include ../Makefile.cmd
11
12ERROFF =	-erroff=E_FUNC_HAS_NO_RETURN_STMT \
13		-erroff=E_IMPLICIT_DECL_FUNC_RETURN_INT
14CFLAGS +=	$(CCVERBOSE) $(ERROFF)
15CPPFLAGS +=	$(ACCESS) $(PARANOID) $(NETGROUP) $(TLI) \
16		$(UMASK) $(STYLE) $(TABLES) $(KILL_OPT) $(BUGS) \
17		-DRFC931_TIMEOUT=$(RFC931_TIMEOUT) \
18		-DFACILITY=$(FACILITY) -DSEVERITY=$(SEVERITY) \
19		-DREAL_DAEMON_DIR=\"$(REAL_DAEMON_DIR)\" \
20		-I$(ROOTSFWINCLUDE) -I../../lib/libwrap
21tcpd tcpdmatch try-from := \
22	LDLIBS += -R$(SFW_ROOT)/lib -L$(ROOTSFWLIB) -lwrap
23tcpdchk := \
24	LDLIBS += -R$(SFW_ROOT)/lib -L$(ROOTSFWLIB) -lwrap -lnsl
25
26# SRCONLY files are not used for building but are included in the source code
27# package SUNWtcpdS for consistency and completeness with respect to the
28# public tcp_wrappers distribution.
29SRCONLY =	BLURB Banners.Makefile CHANGES DISCLAIMER Makefile \
30		Makefile.dist Makefile.org README README.IRIX README.NIS \
31		README.ipv6 hosts_access.c.org misc.c.org miscd.c myvsyslog.c \
32		ncr.c printf.ck ptx.c rfc931.c.org scaffold.c.org \
33		socket.c.diff socket.c.org strcasecmp.c tags tcpd.h.org \
34		tcpdchk.c.org tcpdmatch.c.org tli-sequent.c tli-sequent.h \
35		tli.c.org update.c.org vfprintf.c
36
37MANDIRS =	man3 man4 man1m
38MANPAGES =	man3/hosts_access.3 man3/libwrap.3 man4/hosts_access.4 \
39		man4/hosts_options.4 man4/hosts.allow.4 man4/hosts.deny.4 \
40		man1m/tcpd.1m man1m/tcpdchk.1m man1m/tcpdmatch.1m
41DISTFILES =	environ.c fakelog.c hosts_access.3 hosts_access.4 \
42		hosts_options.4 inetcf.c inetcf.h safe_finger.c scaffold.c \
43		scaffold.h tcpd.1m tcpd.c tcpdchk.1m tcpdchk.c tcpdmatch.1m \
44		tcpdmatch.c try-from.c README.sfw $(SRCONLY)
45
46ROOTSFWSRC =	$(ROOTSFWSHSRC)/tcp_wrappers
47ROOTSFWSBINPROG = $(PROG:%=$(ROOTSFWSBIN)/%)
48ROOTSFWMANPAGES = $(MANPAGES:%=$(ROOTSFWMAN)/%)
49ROOTSFWMANDIRS = $(MANDIRS:%=$(ROOTSFWMAN)/%)
50ROOTSFWSRCFILES = $(DISTFILES:%=$(ROOTSFWSRC)/%)
51
52.KEEP_STATE:
53
54all: $(PROG)
55
56install: all $(ROOTSFWSBINPROG) $(ROOTSFWMANPAGES) $(ROOTSFWSRCFILES)
57
58clean:
59	$(RM) *.o
60	$(RM) -r sunman
61
62lint:	lint_PROG
63
64$(ROOTSFWSBINPROG): $(ROOTSFWSBIN)
65$(ROOTSFWSBIN): $(ROOTSFW)
66	$(INS.dir)
67$(ROOTSFWSBIN)/% : %
68	$(INS.file)
69
70# These Solaris-specific man page aliases are installed verbatim.
71sunman/libwrap.3: libwrap.3
72	mkdir -p sunman; cat libwrap.3 > $@
73sunman/hosts.allow.4: hosts.allow.4
74	mkdir -p sunman; cat hosts.allow.4 > $@
75sunman/hosts.deny.4: hosts.deny.4
76	mkdir -p sunman; cat hosts.deny.4 > $@
77
78# The rest of the man pages are in the form provided in the original
79# distribution, but get edited and renamed to follow Solaris man page
80# conventions.  E.g. tcpd.8 gets installed as /usr/sfw/man/man1m/tcpd.1m.
81# Create temporary copies in the sunman directory with modified names
82# and contents.  The sed program man.sed contains the content edits.
83
84sunman/%.1m: %.8
85	mkdir -p sunman; sed -f man.sed < $< > $@
86sunman/%.4: %.5
87	mkdir -p sunman; sed -f man.sed < $< > $@
88sunman/%.3: %.3
89	mkdir -p sunman; sed -f man.sed < $< > $@
90
91$(ROOTSFWMANPAGES) := FILEMODE = 0444
92$(ROOTSFWMANPAGES): $(ROOTSFWMANDIRS) $(ROOTSFW)/man
93$(ROOTSFWMANDIRS): $(ROOTSFWMAN)
94	$(INS.dir)
95$(ROOTSFWMAN): $(ROOTSFW)/share
96	$(INS.dir)
97$(ROOTSFW)/man: $(ROOTSFW)
98	$(SYMLINK) share/man $@ $(CHOWNLINK) $(CHGRPLINK)
99$(ROOTSFWMAN)/man1m/% $(ROOTSFWMAN)/man3/% $(ROOTSFWMAN)/man4/%: sunman/%
100	$(INS.file)
101
102$(ROOTSFWSRCFILES) := FILEMODE = 0444
103$(ROOTSFWSRCFILES): $(ROOTSFWSRC)
104$(ROOTSFWSRC): $(ROOTSFWSHSRC)
105	$(INS.dir)
106$(ROOTSFWSHSRC): $(ROOTSFW)/share
107	$(INS.dir)
108$(ROOTSFWSRC)/%: %.sfwsrc
109	$(INS.rename)
110$(ROOTSFWSRC)/%: sunman/%
111	$(INS.file)
112$(ROOTSFWSRC)/%: %
113	$(INS.file)
114
115$(ROOTSFW)/share: $(ROOTSFW)
116	$(INS.dir)
117$(ROOTSFW):
118	$(INS.dir)
119
120TCPDMATCH_OBJ = tcpdmatch.o fakelog.o inetcf.o scaffold.o
121
122tcpdmatch: $(TCPDMATCH_OBJ) $(LIB)
123	$(LINK.c) -o $@ $(TCPDMATCH_OBJ) $(LDLIBS)
124	$(POST_PROCESS)
125
126try-from: try-from.o fakelog.o $(LIB)
127	$(LINK.c) -o $@ try-from.o fakelog.o $(LDLIBS)
128	$(POST_PROCESS)
129
130TCPDCHK_OBJ = tcpdchk.o fakelog.o inetcf.o scaffold.o
131
132tcpdchk: $(TCPDCHK_OBJ) $(LIB)
133	$(LINK.c) -o $@ $(TCPDCHK_OBJ) $(LDLIBS)
134	$(POST_PROCESS)
135
136include ../Makefile.targ
137
138
139# The rest of this file contains definitions more-or-less directly from the
140# original Makefile of the tcp_wrappers distribution.
141
142##############################
143# System parameters appropriate for Solaris 9
144
145REAL_DAEMON_DIR	= /usr/sbin
146TLI		= -DTLI
147NETGROUP	= -DNETGROUP
148
149##############################
150# Start of the optional stuff.
151
152###########################################
153# Optional: Turning on language extensions
154#
155# Instead of the default access control language that is documented in
156# the hosts_access.5 document, the wrappers can be configured to
157# implement an extensible language documented in the hosts_options.5
158# document.  This language is implemented by the "options.c" source
159# module, which also gives hints on how to add your own extensions.
160# Uncomment the next definition to turn on the language extensions
161# (examples: allow, deny, banners, twist and spawn).
162#
163STYLE	= -DPROCESS_OPTIONS	# Enable language extensions.
164
165################################################################
166# Optional: Changing the default disposition of logfile records
167#
168# By default, logfile entries are written to the same file as used for
169# sendmail transaction logs. See your /etc/syslog.conf file for actual
170# path names of logfiles. The tutorial section in the README file
171# gives a brief introduction to the syslog daemon.
172#
173# Change the FACILITY definition below if you disagree with the default
174# disposition. Some syslog versions (including Ultrix 4.x) do not provide
175# this flexibility.
176#
177# If nothing shows up on your system, it may be that the syslog records
178# are sent to a dedicated loghost. It may also be that no syslog daemon
179# is running at all. The README file gives pointers to surrogate syslog
180# implementations for systems that have no syslog library routines or
181# no syslog daemons. When changing the syslog.conf file, remember that
182# there must be TABs between fields.
183#
184# The LOG_XXX names below are taken from the /usr/include/syslog.h file.
185
186FACILITY= LOG_MAIL	# LOG_MAIL is what most sendmail daemons use
187
188# The syslog priority at which successful connections are logged.
189
190SEVERITY= LOG_INFO	# LOG_INFO is normally not logged to the console
191
192######################################################
193# Optional: Changing the default file protection mask
194#
195# On many systems, network daemons and other system processes are started
196# with a zero umask value, so that world-writable files may be produced.
197# It is a good idea to edit your /etc/rc* files so that they begin with
198# an explicit umask setting.  On our site we use `umask 022' because it
199# does not break anything yet gives adequate protection against tampering.
200#
201# The following macro specifies the default umask for processes run under
202# control of the daemon wrappers. Comment it out only if you are certain
203# that inetd and its children are started with a safe umask value.
204
205UMASK	= -DDAEMON_UMASK=022
206
207#######################################
208# Optional: Turning off access control
209#
210# By default, host access control is enabled.  To disable host access
211# control, comment out the following definition.  Host access control
212# can also be turned off at runtime by providing no or empty access
213# control tables.
214
215ACCESS	= -DHOSTS_ACCESS
216
217####################################################
218# Optional: dealing with host name/address conflicts
219#
220# By default, the software tries to protect against hosts that claim to
221# have someone elses host name. This is relevant for network services
222# whose authentication depends on host names, such as rsh and rlogin.
223#
224# With paranoid mode on, connections will be rejected when the host name
225# does not match the host address. Connections will also be rejected when
226# the host name is available but cannot be verified.
227#
228# Comment out the following definition if you want more control over such
229# requests. When paranoid mode is off and a host name double check fails,
230# the client can be matched with the PARANOID access control pattern.
231#
232# Paranoid mode implies hostname lookup. In order to disable hostname
233# lookups altogether, see the next section.
234
235PARANOID= -DPARANOID
236
237# The default username lookup timeout is 10 seconds. This may not be long
238# enough for slow hosts or networks, but is enough to irritate PC users.
239
240RFC931_TIMEOUT = 10
241
242########################################################
243# Optional: Changing the access control table pathnames
244#
245# The HOSTS_ALLOW and HOSTS_DENY macros define where the programs will
246# look for access control information. Watch out for the quotes and
247# backslashes when you make changes.
248
249TABLES	= -DHOSTS_DENY=\"/etc/hosts.deny\" -DHOSTS_ALLOW=\"/etc/hosts.allow\"
250
251#############################################
252# Optional: Turning on host ADDRESS checking
253#
254# Optionally, the software tries to protect against hosts that pretend to
255# have someone elses host address. This is relevant for network services
256# whose authentication depends on host names, such as rsh and rlogin,
257# because the network address is used to look up the remote host name.
258#
259# The protection is to refuse TCP connections with IP source routing
260# options.
261#
262# This feature cannot be used with SunOS 4.x because of a kernel bug in
263# the implementation of the getsockopt() system call. Kernel panics have
264# been observed for SunOS 4.1.[1-3]. Symptoms are "BAD TRAP" and "Data
265# fault" while executing the tcp_ctloutput() kernel function.
266#
267# Reportedly, Sun patch 100804-03 or 101790 fixes this for SunOS 4.1.x.
268#
269# Uncomment the following macro definition if your getsockopt() is OK.
270#
271# -DKILL_IP_OPTIONS is not needed on modern UNIX systems that can stop
272# source-routed traffic in the kernel. Examples: 4.4BSD derivatives,
273# Solaris 2.x, and Linux. See your system documentation for details.
274#
275# KILL_OPT= -DKILL_IP_OPTIONS
276
277## End configuration options
278############################
279