rpcbind.c (004388ebfdfe2ed7dfd2d153a876dfcc22d2c006) rpcbind.c (0ea5e3a571e3da934507bdd32924d11659c70704)
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

--- 104 unchanged lines hidden (view full) ---

113rpcblist_ptr list_rbl; /* A list of version 3/4 rpcbind services */
114char *loopback_dg; /* Datagram loopback transport, for set and unset */
115char *loopback_vc; /* COTS loopback transport, for set and unset */
116char *loopback_vc_ord; /* COTS_ORD loopback transport, for set and unset */
117
118boolean_t verboselog = B_FALSE;
119boolean_t wrap_enabled = B_FALSE;
120boolean_t allow_indirect = B_TRUE;
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

--- 104 unchanged lines hidden (view full) ---

113rpcblist_ptr list_rbl; /* A list of version 3/4 rpcbind services */
114char *loopback_dg; /* Datagram loopback transport, for set and unset */
115char *loopback_vc; /* COTS loopback transport, for set and unset */
116char *loopback_vc_ord; /* COTS_ORD loopback transport, for set and unset */
117
118boolean_t verboselog = B_FALSE;
119boolean_t wrap_enabled = B_FALSE;
120boolean_t allow_indirect = B_TRUE;
121boolean_t local_only = B_FALSE;
121
122/* Local Variable */
123static int warmstart = 0; /* Grab a old copy of registrations */
124
125#ifdef PORTMAP
126PMAPLIST *list_pml; /* A list of version 2 rpcbind services */
127char *udptrans; /* Name of UDP transport */
128char *tcptrans; /* Name of TCP transport */

--- 811 unchanged lines hidden (view full) ---

940 }
941 (void) mutex_unlock(&logmutex);
942 syslog(msg->log_pri, "%s", msg->log_msg);
943 free(msg);
944 }
945 /* NOTREACHED */
946}
947
122
123/* Local Variable */
124static int warmstart = 0; /* Grab a old copy of registrations */
125
126#ifdef PORTMAP
127PMAPLIST *list_pml; /* A list of version 2 rpcbind services */
128char *udptrans; /* Name of UDP transport */
129char *tcptrans; /* Name of TCP transport */

--- 811 unchanged lines hidden (view full) ---

941 }
942 (void) mutex_unlock(&logmutex);
943 syslog(msg->log_pri, "%s", msg->log_msg);
944 free(msg);
945 }
946 /* NOTREACHED */
947}
948
948/*
949 * Initialize: read the configuration parameters from the default file.
950 */
951static void
952rpcb_check_init(void)
949static boolean_t
950get_smf_prop(const char *var, boolean_t def_val)
953{
951{
954 thread_t tid;
955 scf_simple_prop_t *prop;
952 scf_simple_prop_t *prop;
956 uint8_t *bool;
953 uint8_t *val;
954 boolean_t res = def_val;
957
955
958 if ((prop = scf_simple_prop_get(NULL, NULL, "config",
959 "enable_tcpwrappers")) != NULL) {
960
961 if ((bool = scf_simple_prop_next_boolean(prop)) != NULL) {
962 wrap_enabled = (*bool == 0) ? B_FALSE : B_TRUE;
963 } else {
964 syslog(LOG_ALERT, "enable_tcpwrappers no value %s",
965 scf_strerror(scf_error()));
966 }
956 prop = scf_simple_prop_get(NULL, NULL, "config", var);
957 if (prop) {
958 if ((val = scf_simple_prop_next_boolean(prop)) != NULL)
959 res = (*val == 0) ? B_FALSE : B_TRUE;
967 scf_simple_prop_free(prop);
960 scf_simple_prop_free(prop);
968 } else {
969 syslog(LOG_ALERT, "unable to get enable_tcpwrappers %s",
970 scf_strerror(scf_error()));
971 }
961 }
972 if ((prop = scf_simple_prop_get(NULL, NULL, "config",
973 "verbose_logging")) != NULL) {
974
962
975 if ((bool = scf_simple_prop_next_boolean(prop)) != NULL) {
976 verboselog = (*bool == 0) ? B_FALSE : B_TRUE;
977 } else {
978 syslog(LOG_ALERT, "verboselog no value %s",
979 scf_strerror(scf_error()));
980 }
981 scf_simple_prop_free(prop);
982 } else {
983 syslog(LOG_ALERT, "unable to get verbose_logging %s",
984 scf_strerror(scf_error()));
963 if (prop == NULL || val == NULL) {
964 syslog(LOG_ALERT, "no value for config/%s (%s). "
965 "Using default \"%s\"", var, scf_strerror(scf_error()),
966 def_val ? "true" : "false");
985 }
967 }
986 if ((prop = scf_simple_prop_get(NULL, NULL, "config",
987 "allow_indirect")) != NULL) {
988
968
989 if ((bool = scf_simple_prop_next_boolean(prop)) != NULL) {
990 allow_indirect = (*bool == 0) ? B_FALSE : B_TRUE;
991 } else {
992 syslog(LOG_ALERT, "allow_indirect no value %s",
993 scf_strerror(scf_error()));
994 }
995 scf_simple_prop_free(prop);
996 } else {
997 syslog(LOG_ALERT, "unable to get allow_indirect %s",
998 scf_strerror(scf_error()));
999 }
969 return (res);
970}
1000
971
972/*
973 * Initialize: read the configuration parameters from SMF
974 */
975static void
976rpcb_check_init(void)
977{
978 thread_t tid;
979
980 wrap_enabled = get_smf_prop("enable_tcpwrappers", B_FALSE);
981 verboselog = get_smf_prop("verbose_logging", B_FALSE);
982 allow_indirect = get_smf_prop("allow_indirect", B_TRUE);
983 local_only = get_smf_prop("local_only", B_FALSE);
984
1001 if (wrap_enabled)
1002 (void) thr_create(NULL, 0, logthread, NULL, THR_DETACHED, &tid);
1003}
1004
1005/*
1006 * qsyslog() - queue a request for syslog(); if syslog blocks, the other
1007 * thread blocks; we make sure we don't run out of memory by allowing
1008 * only a limited number of outstandig syslog() requests.

--- 32 unchanged lines hidden ---
985 if (wrap_enabled)
986 (void) thr_create(NULL, 0, logthread, NULL, THR_DETACHED, &tid);
987}
988
989/*
990 * qsyslog() - queue a request for syslog(); if syslog blocks, the other
991 * thread blocks; we make sure we don't run out of memory by allowing
992 * only a limited number of outstandig syslog() requests.

--- 32 unchanged lines hidden ---