17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate * CDDL HEADER START
37c478bd9Sstevel@tonic-gate *
47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the
5004388ebScasper * Common Development and Distribution License (the "License").
6004388ebScasper * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate *
87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate * and limitations under the License.
127c478bd9Sstevel@tonic-gate *
137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate *
197c478bd9Sstevel@tonic-gate * CDDL HEADER END
207c478bd9Sstevel@tonic-gate */
217c478bd9Sstevel@tonic-gate /*
22*80148899SSurya Prakki * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
237c478bd9Sstevel@tonic-gate * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate */
257c478bd9Sstevel@tonic-gate
267c478bd9Sstevel@tonic-gate #include "mhd_local.h"
277c478bd9Sstevel@tonic-gate
287c478bd9Sstevel@tonic-gate #include <grp.h>
297c478bd9Sstevel@tonic-gate #include <pwd.h>
307c478bd9Sstevel@tonic-gate #include <signal.h>
31004388ebScasper #include <stdio_ext.h>
327c478bd9Sstevel@tonic-gate #include <syslog.h>
337c478bd9Sstevel@tonic-gate #include <netdir.h>
347c478bd9Sstevel@tonic-gate #include <netdb.h>
357c478bd9Sstevel@tonic-gate #include <sys/resource.h>
367c478bd9Sstevel@tonic-gate #include <sys/priocntl.h>
377c478bd9Sstevel@tonic-gate #include <sys/rtpriocntl.h>
387c478bd9Sstevel@tonic-gate #include <sys/utsname.h>
397c478bd9Sstevel@tonic-gate
407c478bd9Sstevel@tonic-gate extern void nc_perror(const char *msg);
417c478bd9Sstevel@tonic-gate
427c478bd9Sstevel@tonic-gate /* daemon name */
437c478bd9Sstevel@tonic-gate static char *myname = "rpc.metamhd";
447c478bd9Sstevel@tonic-gate
457c478bd9Sstevel@tonic-gate /*
467c478bd9Sstevel@tonic-gate * reset and exit daemon
477c478bd9Sstevel@tonic-gate */
487c478bd9Sstevel@tonic-gate void
mhd_exit(int eval)497c478bd9Sstevel@tonic-gate mhd_exit(
507c478bd9Sstevel@tonic-gate int eval
517c478bd9Sstevel@tonic-gate )
527c478bd9Sstevel@tonic-gate {
537c478bd9Sstevel@tonic-gate /* log exit */
547c478bd9Sstevel@tonic-gate mhd_eprintf("exiting with %d\n", eval);
557c478bd9Sstevel@tonic-gate
567c478bd9Sstevel@tonic-gate /* exit with value */
577c478bd9Sstevel@tonic-gate exit(eval);
587c478bd9Sstevel@tonic-gate }
597c478bd9Sstevel@tonic-gate
607c478bd9Sstevel@tonic-gate /*
617c478bd9Sstevel@tonic-gate * signal catchers
627c478bd9Sstevel@tonic-gate */
637c478bd9Sstevel@tonic-gate static void
mhd_catcher(int sig)647c478bd9Sstevel@tonic-gate mhd_catcher(
657c478bd9Sstevel@tonic-gate int sig
667c478bd9Sstevel@tonic-gate )
677c478bd9Sstevel@tonic-gate {
687c478bd9Sstevel@tonic-gate char buf[128];
697c478bd9Sstevel@tonic-gate char *msg;
707c478bd9Sstevel@tonic-gate
717c478bd9Sstevel@tonic-gate /* log signal */
727c478bd9Sstevel@tonic-gate if ((msg = strsignal(sig)) == NULL) {
737c478bd9Sstevel@tonic-gate (void) sprintf(buf, "unknown signal %d", sig);
747c478bd9Sstevel@tonic-gate msg = buf;
757c478bd9Sstevel@tonic-gate }
767c478bd9Sstevel@tonic-gate mhd_eprintf("%s\n", msg);
777c478bd9Sstevel@tonic-gate
787c478bd9Sstevel@tonic-gate /* let default handler do it's thing */
797c478bd9Sstevel@tonic-gate (void) sigset(sig, SIG_DFL);
807c478bd9Sstevel@tonic-gate if (kill(getpid(), sig) != 0) {
817c478bd9Sstevel@tonic-gate mhd_perror("kill(getpid())");
827c478bd9Sstevel@tonic-gate mhd_exit(-sig);
837c478bd9Sstevel@tonic-gate }
847c478bd9Sstevel@tonic-gate }
857c478bd9Sstevel@tonic-gate
867c478bd9Sstevel@tonic-gate /*
877c478bd9Sstevel@tonic-gate * initialize daemon
887c478bd9Sstevel@tonic-gate */
897c478bd9Sstevel@tonic-gate static int
mhd_setup(mhd_error_t * mhep)907c478bd9Sstevel@tonic-gate mhd_setup(
917c478bd9Sstevel@tonic-gate mhd_error_t *mhep
927c478bd9Sstevel@tonic-gate )
937c478bd9Sstevel@tonic-gate {
947c478bd9Sstevel@tonic-gate struct rlimit rlimit;
957c478bd9Sstevel@tonic-gate pcinfo_t pcinfo;
967c478bd9Sstevel@tonic-gate pcparms_t pcparms;
977c478bd9Sstevel@tonic-gate rtparms_t *rtparmsp = (rtparms_t *)pcparms.pc_clparms;
987c478bd9Sstevel@tonic-gate
997c478bd9Sstevel@tonic-gate /* catch common signals */
1007c478bd9Sstevel@tonic-gate if ((sigset(SIGHUP, mhd_catcher) == SIG_ERR) ||
1017c478bd9Sstevel@tonic-gate (sigset(SIGINT, mhd_catcher) == SIG_ERR) ||
1027c478bd9Sstevel@tonic-gate (sigset(SIGABRT, mhd_catcher) == SIG_ERR) ||
1037c478bd9Sstevel@tonic-gate (sigset(SIGBUS, mhd_catcher) == SIG_ERR) ||
1047c478bd9Sstevel@tonic-gate (sigset(SIGSEGV, mhd_catcher) == SIG_ERR) ||
1057c478bd9Sstevel@tonic-gate (sigset(SIGPIPE, mhd_catcher) == SIG_ERR) ||
1067c478bd9Sstevel@tonic-gate (sigset(SIGTERM, mhd_catcher) == SIG_ERR)) {
1077c478bd9Sstevel@tonic-gate return (mhd_error(mhep, errno, "sigset"));
1087c478bd9Sstevel@tonic-gate }
1097c478bd9Sstevel@tonic-gate
1107c478bd9Sstevel@tonic-gate /* ignore SIGHUP (used in mhd_cv_timedwait) */
1117c478bd9Sstevel@tonic-gate if (sigset(SIGALRM, SIG_IGN) == SIG_ERR) {
1127c478bd9Sstevel@tonic-gate return (mhd_error(mhep, errno, "sigset"));
1137c478bd9Sstevel@tonic-gate }
1147c478bd9Sstevel@tonic-gate
1157c478bd9Sstevel@tonic-gate /* increase number of file descriptors */
1167c478bd9Sstevel@tonic-gate (void) memset(&rlimit, 0, sizeof (rlimit));
1177c478bd9Sstevel@tonic-gate if (getrlimit(RLIMIT_NOFILE, &rlimit) != 0)
1187c478bd9Sstevel@tonic-gate return (mhd_error(mhep, errno, "getrlimit(RLIMIT_NOFILE)"));
1197c478bd9Sstevel@tonic-gate rlimit.rlim_cur = rlimit.rlim_max = 1024;
1207c478bd9Sstevel@tonic-gate if (setrlimit(RLIMIT_NOFILE, &rlimit) != 0)
1217c478bd9Sstevel@tonic-gate return (mhd_error(mhep, errno, "setrlimit(RLIMIT_NOFILE)"));
122004388ebScasper (void) enable_extended_FILE_stdio(-1, -1);
1237c478bd9Sstevel@tonic-gate
1247c478bd9Sstevel@tonic-gate /* set default RT priority */
1257c478bd9Sstevel@tonic-gate (void) memset(&pcinfo, 0, sizeof (pcinfo));
1267c478bd9Sstevel@tonic-gate (void) strncpy(pcinfo.pc_clname, "RT", sizeof (pcinfo.pc_clname));
1277c478bd9Sstevel@tonic-gate if (priocntl(0, 0, PC_GETCID, (caddr_t)&pcinfo) < 0)
1287c478bd9Sstevel@tonic-gate return (mhd_error(mhep, errno, "priocntl(PC_GETCID): \"RT\""));
1297c478bd9Sstevel@tonic-gate (void) memset(&pcparms, 0, sizeof (pcparms));
1307c478bd9Sstevel@tonic-gate pcparms.pc_cid = pcinfo.pc_cid;
1317c478bd9Sstevel@tonic-gate rtparmsp->rt_pri = RT_NOCHANGE;
1327c478bd9Sstevel@tonic-gate rtparmsp->rt_tqsecs = (ulong_t)RT_NOCHANGE;
1337c478bd9Sstevel@tonic-gate rtparmsp->rt_tqnsecs = RT_NOCHANGE;
1347c478bd9Sstevel@tonic-gate if (priocntl(P_PID, getpid(), PC_SETPARMS, (caddr_t)&pcparms) != 0)
1357c478bd9Sstevel@tonic-gate return (mhd_error(mhep, errno, "priocntl(PC_SETPARMS)"));
1367c478bd9Sstevel@tonic-gate
1377c478bd9Sstevel@tonic-gate /* return success */
1387c478bd9Sstevel@tonic-gate return (0);
1397c478bd9Sstevel@tonic-gate }
1407c478bd9Sstevel@tonic-gate
1417c478bd9Sstevel@tonic-gate /*
1427c478bd9Sstevel@tonic-gate * (re)initalize daemon
1437c478bd9Sstevel@tonic-gate */
1447c478bd9Sstevel@tonic-gate static int
mhd_init_daemon(mhd_error_t * mhep)1457c478bd9Sstevel@tonic-gate mhd_init_daemon(
1467c478bd9Sstevel@tonic-gate mhd_error_t *mhep
1477c478bd9Sstevel@tonic-gate )
1487c478bd9Sstevel@tonic-gate {
1497c478bd9Sstevel@tonic-gate static int already = 0;
1507c478bd9Sstevel@tonic-gate
1517c478bd9Sstevel@tonic-gate /* setup */
1527c478bd9Sstevel@tonic-gate if (! already) {
1537c478bd9Sstevel@tonic-gate if (mhd_setup(mhep) != 0)
1547c478bd9Sstevel@tonic-gate return (-1);
1557c478bd9Sstevel@tonic-gate openlog(myname, LOG_CONS, LOG_DAEMON);
1567c478bd9Sstevel@tonic-gate already = 1;
1577c478bd9Sstevel@tonic-gate }
1587c478bd9Sstevel@tonic-gate
1597c478bd9Sstevel@tonic-gate /* return success */
1607c478bd9Sstevel@tonic-gate return (0);
1617c478bd9Sstevel@tonic-gate }
1627c478bd9Sstevel@tonic-gate
1637c478bd9Sstevel@tonic-gate /*
1647c478bd9Sstevel@tonic-gate * get my nodename
1657c478bd9Sstevel@tonic-gate */
1667c478bd9Sstevel@tonic-gate static char *
mynodename()1677c478bd9Sstevel@tonic-gate mynodename()
1687c478bd9Sstevel@tonic-gate {
1697c478bd9Sstevel@tonic-gate static struct utsname myuname;
1707c478bd9Sstevel@tonic-gate static int done = 0;
1717c478bd9Sstevel@tonic-gate
1727c478bd9Sstevel@tonic-gate if (! done) {
1737c478bd9Sstevel@tonic-gate if (uname(&myuname) == -1) {
1747c478bd9Sstevel@tonic-gate mhd_perror("uname");
1757c478bd9Sstevel@tonic-gate assert(0);
1767c478bd9Sstevel@tonic-gate }
1777c478bd9Sstevel@tonic-gate done = 1;
1787c478bd9Sstevel@tonic-gate }
1797c478bd9Sstevel@tonic-gate return (myuname.nodename);
1807c478bd9Sstevel@tonic-gate }
1817c478bd9Sstevel@tonic-gate
1827c478bd9Sstevel@tonic-gate /*
1837c478bd9Sstevel@tonic-gate * check for trusted host and user
1847c478bd9Sstevel@tonic-gate */
1857c478bd9Sstevel@tonic-gate static int
check_host(struct svc_req * rqstp)1867c478bd9Sstevel@tonic-gate check_host(
1877c478bd9Sstevel@tonic-gate struct svc_req *rqstp /* RPC stuff */
1887c478bd9Sstevel@tonic-gate )
1897c478bd9Sstevel@tonic-gate {
1907c478bd9Sstevel@tonic-gate struct authsys_parms *sys_credp;
1917c478bd9Sstevel@tonic-gate SVCXPRT *transp = rqstp->rq_xprt;
1927c478bd9Sstevel@tonic-gate struct netconfig *nconfp = NULL;
1937c478bd9Sstevel@tonic-gate struct nd_hostservlist *hservlistp = NULL;
1947c478bd9Sstevel@tonic-gate int i;
1957c478bd9Sstevel@tonic-gate int rval = -1;
1967c478bd9Sstevel@tonic-gate
1977c478bd9Sstevel@tonic-gate /* check for root */
1987c478bd9Sstevel@tonic-gate /*LINTED*/
1997c478bd9Sstevel@tonic-gate sys_credp = (struct authsys_parms *)rqstp->rq_clntcred;
2007c478bd9Sstevel@tonic-gate assert(sys_credp != NULL);
2017c478bd9Sstevel@tonic-gate if (sys_credp->aup_uid != 0)
2027c478bd9Sstevel@tonic-gate goto out;
2037c478bd9Sstevel@tonic-gate
2047c478bd9Sstevel@tonic-gate /* get hostnames */
2057c478bd9Sstevel@tonic-gate if (transp->xp_netid == NULL) {
2067c478bd9Sstevel@tonic-gate mhd_eprintf("transp->xp_netid == NULL\n");
2077c478bd9Sstevel@tonic-gate goto out;
2087c478bd9Sstevel@tonic-gate }
2097c478bd9Sstevel@tonic-gate if ((nconfp = getnetconfigent(transp->xp_netid)) == NULL) {
2107c478bd9Sstevel@tonic-gate #ifdef DEBUG
2117c478bd9Sstevel@tonic-gate nc_perror("getnetconfigent(transp->xp_netid)");
2127c478bd9Sstevel@tonic-gate #endif
2137c478bd9Sstevel@tonic-gate goto out;
2147c478bd9Sstevel@tonic-gate }
2157c478bd9Sstevel@tonic-gate if ((__netdir_getbyaddr_nosrv(nconfp, &hservlistp, &transp->xp_rtaddr)
2167c478bd9Sstevel@tonic-gate != 0) || (hservlistp == NULL)) {
2177c478bd9Sstevel@tonic-gate #ifdef DEBUG
2187c478bd9Sstevel@tonic-gate netdir_perror("netdir_getbyaddr(transp->xp_rtaddr)");
2197c478bd9Sstevel@tonic-gate #endif
2207c478bd9Sstevel@tonic-gate goto out;
2217c478bd9Sstevel@tonic-gate }
2227c478bd9Sstevel@tonic-gate
2237c478bd9Sstevel@tonic-gate /* check hostnames */
2247c478bd9Sstevel@tonic-gate for (i = 0; (i < hservlistp->h_cnt); ++i) {
2257c478bd9Sstevel@tonic-gate struct nd_hostserv *hservp = &hservlistp->h_hostservs[i];
2267c478bd9Sstevel@tonic-gate char *hostname = hservp->h_host;
2277c478bd9Sstevel@tonic-gate
2287c478bd9Sstevel@tonic-gate /* localhost is OK */
2297c478bd9Sstevel@tonic-gate if (strcmp(hostname, mynodename()) == 0) {
2307c478bd9Sstevel@tonic-gate rval = 0;
2317c478bd9Sstevel@tonic-gate goto out;
2327c478bd9Sstevel@tonic-gate }
2337c478bd9Sstevel@tonic-gate
2347c478bd9Sstevel@tonic-gate /* check for remote root access */
2357c478bd9Sstevel@tonic-gate if (ruserok(hostname, 1, "root", "root") == 0) {
2367c478bd9Sstevel@tonic-gate rval = 0;
2377c478bd9Sstevel@tonic-gate goto out;
2387c478bd9Sstevel@tonic-gate }
2397c478bd9Sstevel@tonic-gate }
2407c478bd9Sstevel@tonic-gate
2417c478bd9Sstevel@tonic-gate /* cleanup, return success */
2427c478bd9Sstevel@tonic-gate out:
2437c478bd9Sstevel@tonic-gate if (hservlistp != NULL)
2447c478bd9Sstevel@tonic-gate netdir_free(hservlistp, ND_HOSTSERVLIST);
2457c478bd9Sstevel@tonic-gate if (nconfp != NULL)
2467c478bd9Sstevel@tonic-gate Free(nconfp);
2477c478bd9Sstevel@tonic-gate return (rval);
2487c478bd9Sstevel@tonic-gate }
2497c478bd9Sstevel@tonic-gate
2507c478bd9Sstevel@tonic-gate /*
2517c478bd9Sstevel@tonic-gate * check for user in local group 14
2527c478bd9Sstevel@tonic-gate */
2537c478bd9Sstevel@tonic-gate static int
check_gid14(uid_t uid)2547c478bd9Sstevel@tonic-gate check_gid14(
2557c478bd9Sstevel@tonic-gate uid_t uid
2567c478bd9Sstevel@tonic-gate )
2577c478bd9Sstevel@tonic-gate {
2587c478bd9Sstevel@tonic-gate struct passwd *pwp;
2597c478bd9Sstevel@tonic-gate struct group *grp;
2607c478bd9Sstevel@tonic-gate char **namep;
2617c478bd9Sstevel@tonic-gate
2627c478bd9Sstevel@tonic-gate /* get user info, check default GID */
2637c478bd9Sstevel@tonic-gate if ((pwp = getpwuid(uid)) == NULL)
2647c478bd9Sstevel@tonic-gate return (-1);
2657c478bd9Sstevel@tonic-gate if (pwp->pw_gid == METAMHD_GID)
2667c478bd9Sstevel@tonic-gate return (0);
2677c478bd9Sstevel@tonic-gate
2687c478bd9Sstevel@tonic-gate /* check in group */
2697c478bd9Sstevel@tonic-gate if ((grp = getgrgid(METAMHD_GID)) == NULL)
2707c478bd9Sstevel@tonic-gate return (-1);
2717c478bd9Sstevel@tonic-gate for (namep = grp->gr_mem; ((*namep != NULL) && (**namep != '\0'));
2727c478bd9Sstevel@tonic-gate ++namep) {
2737c478bd9Sstevel@tonic-gate if (strcmp(*namep, pwp->pw_name) == 0)
2747c478bd9Sstevel@tonic-gate return (0);
2757c478bd9Sstevel@tonic-gate }
2767c478bd9Sstevel@tonic-gate return (-1);
2777c478bd9Sstevel@tonic-gate }
2787c478bd9Sstevel@tonic-gate
2797c478bd9Sstevel@tonic-gate /*
2807c478bd9Sstevel@tonic-gate * check AUTH_SYS
2817c478bd9Sstevel@tonic-gate */
2827c478bd9Sstevel@tonic-gate static int
check_sys(struct svc_req * rqstp,int amode,mhd_error_t * mhep)2837c478bd9Sstevel@tonic-gate check_sys(
2847c478bd9Sstevel@tonic-gate struct svc_req *rqstp, /* RPC stuff */
2857c478bd9Sstevel@tonic-gate int amode, /* R_OK | W_OK */
2867c478bd9Sstevel@tonic-gate mhd_error_t *mhep /* returned status */
2877c478bd9Sstevel@tonic-gate )
2887c478bd9Sstevel@tonic-gate {
2897c478bd9Sstevel@tonic-gate static mutex_t mx = DEFAULTMUTEX;
2907c478bd9Sstevel@tonic-gate struct authsys_parms *sys_credp;
2917c478bd9Sstevel@tonic-gate
2927c478bd9Sstevel@tonic-gate /* for read, anything is OK */
2937c478bd9Sstevel@tonic-gate if (! (amode & W_OK))
2947c478bd9Sstevel@tonic-gate return (0);
2957c478bd9Sstevel@tonic-gate
2967c478bd9Sstevel@tonic-gate /* single thread (not really needed if daemon stays single threaded) */
297*80148899SSurya Prakki (void) mutex_lock(&mx);
2987c478bd9Sstevel@tonic-gate
2997c478bd9Sstevel@tonic-gate /* check for remote root or METAMHD_GID */
3007c478bd9Sstevel@tonic-gate /*LINTED*/
3017c478bd9Sstevel@tonic-gate sys_credp = (struct authsys_parms *)rqstp->rq_clntcred;
3027c478bd9Sstevel@tonic-gate if ((check_gid14(sys_credp->aup_uid) == 0) ||
3037c478bd9Sstevel@tonic-gate (check_host(rqstp) == 0)) {
304*80148899SSurya Prakki (void) mutex_unlock(&mx);
3057c478bd9Sstevel@tonic-gate return (0);
3067c478bd9Sstevel@tonic-gate }
3077c478bd9Sstevel@tonic-gate
3087c478bd9Sstevel@tonic-gate /* return failure */
309*80148899SSurya Prakki (void) mutex_unlock(&mx);
3107c478bd9Sstevel@tonic-gate return (mhd_error(mhep, EACCES, myname));
3117c478bd9Sstevel@tonic-gate }
3127c478bd9Sstevel@tonic-gate
3137c478bd9Sstevel@tonic-gate /*
3147c478bd9Sstevel@tonic-gate * setup RPC service
3157c478bd9Sstevel@tonic-gate *
3167c478bd9Sstevel@tonic-gate * if can't authenticate return < 0
3177c478bd9Sstevel@tonic-gate * if any other error return > 0
3187c478bd9Sstevel@tonic-gate */
3197c478bd9Sstevel@tonic-gate int
mhd_init(struct svc_req * rqstp,int amode,mhd_error_t * mhep)3207c478bd9Sstevel@tonic-gate mhd_init(
3217c478bd9Sstevel@tonic-gate struct svc_req *rqstp, /* RPC stuff */
3227c478bd9Sstevel@tonic-gate int amode, /* R_OK | W_OK */
3237c478bd9Sstevel@tonic-gate mhd_error_t *mhep /* returned status */
3247c478bd9Sstevel@tonic-gate )
3257c478bd9Sstevel@tonic-gate {
3267c478bd9Sstevel@tonic-gate SVCXPRT *transp = rqstp->rq_xprt;
3277c478bd9Sstevel@tonic-gate
3287c478bd9Sstevel@tonic-gate /*
3297c478bd9Sstevel@tonic-gate * initialize
3307c478bd9Sstevel@tonic-gate */
3317c478bd9Sstevel@tonic-gate (void) memset(mhep, 0, sizeof (*mhep));
3327c478bd9Sstevel@tonic-gate
3337c478bd9Sstevel@tonic-gate /*
3347c478bd9Sstevel@tonic-gate * check credentials
3357c478bd9Sstevel@tonic-gate */
3367c478bd9Sstevel@tonic-gate switch (rqstp->rq_cred.oa_flavor) {
3377c478bd9Sstevel@tonic-gate
3387c478bd9Sstevel@tonic-gate /* UNIX flavor */
3397c478bd9Sstevel@tonic-gate case AUTH_SYS:
3407c478bd9Sstevel@tonic-gate {
3417c478bd9Sstevel@tonic-gate if (check_sys(rqstp, amode, mhep) != 0)
3427c478bd9Sstevel@tonic-gate return (1); /* error */
3437c478bd9Sstevel@tonic-gate break;
3447c478bd9Sstevel@tonic-gate }
3457c478bd9Sstevel@tonic-gate
3467c478bd9Sstevel@tonic-gate /* can't authenticate anything else */
3477c478bd9Sstevel@tonic-gate default:
3487c478bd9Sstevel@tonic-gate svcerr_weakauth(transp);
3497c478bd9Sstevel@tonic-gate return (-1); /* weak authentication */
3507c478bd9Sstevel@tonic-gate
3517c478bd9Sstevel@tonic-gate }
3527c478bd9Sstevel@tonic-gate
3537c478bd9Sstevel@tonic-gate /*
3547c478bd9Sstevel@tonic-gate * (re)initialize
3557c478bd9Sstevel@tonic-gate */
3567c478bd9Sstevel@tonic-gate if (mhd_init_daemon(mhep) != 0)
3577c478bd9Sstevel@tonic-gate return (1); /* error */
3587c478bd9Sstevel@tonic-gate
3597c478bd9Sstevel@tonic-gate /* return success */
3607c478bd9Sstevel@tonic-gate return (0);
3617c478bd9Sstevel@tonic-gate }
362