01.03.2023 23:31, Todd C. Miller пишет:
> The SIGHUP handler only sets a flag these days, there is no longer
> any need to block it while using the exports list.

Makes sense.

The TERM handler also just sets a flag today, but etc/rc.d/mountd still
has `rc_stop=NO' since 2013

    Do not allow stopping/restarting mountd using the rc.d(8) framework;
    if there is need to send a SIGTERM to mountd(8), it should be done
    manually as there is too much involved with RPC daemons to make it
    automagic.

Can this be flipped so `rcctl stop mountd' works again?


> 
>  - todd
> 
> Index: sbin/mountd/mountd.c
> ===================================================================
> RCS file: /cvs/src/sbin/mountd/mountd.c,v
> retrieving revision 1.90
> diff -u -p -u -r1.90 mountd.c
> --- sbin/mountd/mountd.c      1 Mar 2023 23:27:46 -0000       1.90
> +++ sbin/mountd/mountd.c      1 Mar 2023 23:29:18 -0000
> @@ -736,7 +736,6 @@ mntsrv(struct svc_req *rqstp, SVCXPRT *t
>       char rpcpath[RPCMNT_PATHLEN+1], dirpath[PATH_MAX];
>       struct hostent *hp = NULL;
>       struct exportlist *ep;
> -     sigset_t sighup_mask;
>       int defset, hostset;
>       struct fhreturn fhr;
>       struct dirlist *dp;
> @@ -746,8 +745,6 @@ mntsrv(struct svc_req *rqstp, SVCXPRT *t
>       u_short sport;
>       long bad = 0;
>  
> -     sigemptyset(&sighup_mask);
> -     sigaddset(&sighup_mask, SIGHUP);
>       saddr = transp->xp_raddr.sin_addr.s_addr;
>       sport = ntohs(transp->xp_raddr.sin_port);
>       switch (rqstp->rq_proc) {
> @@ -792,7 +789,6 @@ mntsrv(struct svc_req *rqstp, SVCXPRT *t
>               }
>  
>               /* Check in the exports list */
> -             sigprocmask(SIG_BLOCK, &sighup_mask, NULL);
>               ep = bad ? NULL : ex_search(&fsb.f_fsid);
>               hostset = defset = 0;
>               if (ep && (chk_host(ep->ex_defdir, saddr, &defset, &hostset) ||
> @@ -804,7 +800,6 @@ mntsrv(struct svc_req *rqstp, SVCXPRT *t
>                               if (!svc_sendreply(transp, xdr_long,
>                                   (caddr_t)&bad))
>                                       syslog(LOG_ERR, "Can't send reply");
> -                             sigprocmask(SIG_UNBLOCK, &sighup_mask, NULL);
>                               return;
>                       }
>                       if (hostset & DP_HOSTSET)
> @@ -820,7 +815,6 @@ mntsrv(struct svc_req *rqstp, SVCXPRT *t
>                               if (!svc_sendreply(transp, xdr_long,
>                                   (caddr_t)&bad))
>                                       syslog(LOG_ERR, "Can't send reply");
> -                             sigprocmask(SIG_UNBLOCK, &sighup_mask, NULL);
>                               return;
>                       }
>                       if (!svc_sendreply(transp, xdr_fhs, (caddr_t)&fhr))
> @@ -844,7 +838,6 @@ mntsrv(struct svc_req *rqstp, SVCXPRT *t
>  
>               if (bad && !svc_sendreply(transp, xdr_long, (caddr_t)&bad))
>                       syslog(LOG_ERR, "Can't send reply");
> -             sigprocmask(SIG_UNBLOCK, &sighup_mask, NULL);
>               return;
>       case RPCMNT_DUMP:
>               if (!svc_sendreply(transp, xdr_mlist, NULL))
> @@ -958,11 +951,7 @@ xdr_explist(XDR *xdrsp, caddr_t cp)
>  {
>       struct exportlist *ep;
>       int false = 0, putdef;
> -     sigset_t sighup_mask;
>  
> -     sigemptyset(&sighup_mask);
> -     sigaddset(&sighup_mask, SIGHUP);
> -     sigprocmask(SIG_BLOCK, &sighup_mask, NULL);
>       ep = exphead;
>       while (ep) {
>               putdef = 0;
> @@ -973,12 +962,10 @@ xdr_explist(XDR *xdrsp, caddr_t cp)
>                       goto errout;
>               ep = ep->ex_next;
>       }
> -     sigprocmask(SIG_UNBLOCK, &sighup_mask, NULL);
>       if (!xdr_bool(xdrsp, &false))
>               return (0);
>       return (1);
>  errout:
> -     sigprocmask(SIG_UNBLOCK, &sighup_mask, NULL);
>       return (0);
>  }
>  
> 

Reply via email to