summaryrefslogtreecommitdiff
path: root/usr/src/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/cmd')
-rw-r--r--usr/src/cmd/svc/profile/Makefile35
-rw-r--r--usr/src/cmd/svc/profile/generic_limited_net.xml12
-rw-r--r--usr/src/cmd/svc/profile/listsvcs.pl81
3 files changed, 120 insertions, 8 deletions
diff --git a/usr/src/cmd/svc/profile/Makefile b/usr/src/cmd/svc/profile/Makefile
index 18b1e40f87..ffa60a6ab3 100644
--- a/usr/src/cmd/svc/profile/Makefile
+++ b/usr/src/cmd/svc/profile/Makefile
@@ -55,7 +55,17 @@ PROFILESRCS = \
PROFILES = $(PROFILESRCS:%=$(ROOTPROFILE)/%)
-install: $(PROFILES)
+PROFILES_open = generic_open.xml inetd_generic.xml
+PROFILES_limited = generic_limited_net.xml
+CHECK_OPEN = check_open
+CHECK_LMTD = check_limited
+
+COMM = /usr/bin/comm
+TEE = /usr/bin/tee
+TEST = /usr/bin/test
+LISTSVCS = listsvcs.pl
+
+install: all $(PROFILES)
$(RM) $(ROOTPROFILE)/platform.xml
# SUNW,Sun-Fire-V890
$(RM) $(ROOTPROFILE)/platform_SUNW,Sun-Fire-V890.xml
@@ -72,4 +82,25 @@ install: $(PROFILES)
$(ROOTPROFILE)/%: %
$(INS.file)
-all lint clobber clean _msg:
+all: $(CHECK_OPEN) $(CHECK_LMTD)
+
+#
+# Enforce consistency between open and limited profiles per README
+#
+$(CHECK_OPEN) := PROFILES_CHECKED = open
+$(CHECK_OPEN) := PROFILES_COVERING = limited
+$(CHECK_LMTD) := PROFILES_CHECKED = limited
+$(CHECK_LMTD) := PROFILES_COVERING = open
+$(CHECK_OPEN) $(CHECK_LMTD): \
+ $(LISTSVCS) $(PROFILES_open) $(PROFILES_limited)
+ @$(ECHO) Check for enabled $(PROFILES_CHECKED) services \
+ not covered by $(PROFILES_COVERING) profile
+ @$(PERL) -w $(LISTSVCS) -e $(PROFILES_$(PROFILES_CHECKED)) > $@.enabled
+ @$(PERL) -w $(LISTSVCS) $(PROFILES_$(PROFILES_COVERING)) > $@.all
+ @$(COMM) -23 $@.enabled $@.all | $(TEE) $@.notcovered
+ @$(TEST) ! -s $@.notcovered && $(TOUCH) $@
+
+lint _msg:
+
+clobber clean:
+ $(RM) $(CHECK_OPEN)* $(CHECK_LMTD)*
diff --git a/usr/src/cmd/svc/profile/generic_limited_net.xml b/usr/src/cmd/svc/profile/generic_limited_net.xml
index bb2b56d345..7493cba8a1 100644
--- a/usr/src/cmd/svc/profile/generic_limited_net.xml
+++ b/usr/src/cmd/svc/profile/generic_limited_net.xml
@@ -136,9 +136,6 @@
<service name='system/power' version='1' type='service'>
<instance name='default' enabled='true'/>
</service>
- <service name='network/pfil' version='1' type='service'>
- <instance name='default' enabled='true' />
- </service>
<service name='network/dhcp-server' version='1' type='service'>
<instance name='default' enabled='false' />
@@ -241,9 +238,6 @@
<service name='network/talk' version='1' type='service'>
<instance name='default' enabled='false'/>
</service>
- <service name='application/x11/xfs' version='1' type='service'>
- <instance name='default' enabled='false'/>
- </service>
<!--
default inetd(1M) RPC services enabled
@@ -302,6 +296,9 @@
<service name='application/cde-printinfo' version='1' type='service'>
<instance name='default' enabled='true' />
</service>
+ <service name='network/rpc/cde-ttdbserver' version='1' type='service'>
+ <instance name='tcp' enabled='true' />
+ </service>
<service name='application/graphical-login/cde-login' version='1'
type='service'>
<instance name='default' enabled='true' />
@@ -316,5 +313,8 @@
<service name='network/cde-spc' version='1' type='service'>
<instance name='default' enabled='false' />
</service>
+ <service name='application/x11/xfs' version='1' type='service'>
+ <instance name='default' enabled='false'/>
+ </service>
</service_bundle>
diff --git a/usr/src/cmd/svc/profile/listsvcs.pl b/usr/src/cmd/svc/profile/listsvcs.pl
new file mode 100644
index 0000000000..6deb7a5a27
--- /dev/null
+++ b/usr/src/cmd/svc/profile/listsvcs.pl
@@ -0,0 +1,81 @@
+#!/usr/bin/perl
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+
+#
+# ident "%Z%%M% %I% %E% SMI"
+#
+# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
+#
+
+#
+# listsvcs [-e] profile ...
+#
+# List all service instances in an SMF profile.
+# Options:
+# -e List enabled instances only
+#
+
+use XML::Parser;
+use Getopt::Std;
+use strict;
+
+my %opts;
+my $servicename; # name attribute of the enclosing service element
+my @svcs = (); # services list under construction
+
+if (!getopts("e", \%opts)) {
+ die "Usage: $0 [-e] profile ...\n";
+}
+my $list_all = !$opts{e};
+
+my $parser = new XML::Parser;
+$parser->setHandlers(Start => \&start_handler, End => \&end_handler);
+
+for my $file (@ARGV) {
+ $parser->parsefile($file);
+}
+print join("\n", sort(@svcs)), "\n";
+
+sub start_handler
+{
+ my ($p, $el, %attrs) = @_;
+ my $name;
+
+ return unless ($attrs{"name"});
+ $name = $attrs{"name"};
+
+ if ($el eq "service") {
+ $servicename = $name;
+ } elsif ($el eq "instance" && defined $servicename) {
+ push(@svcs, "$servicename:$name")
+ if ($list_all || $attrs{"enabled"} eq "true");
+ }
+}
+
+sub end_handler
+{
+ my ($p, $el) = @_;
+
+ if ($el eq "service") {
+ $servicename = undef;
+ }
+}