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