diff options
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/mountd/mountd.c | 49 |
1 files changed, 39 insertions, 10 deletions
diff --git a/usr.sbin/mountd/mountd.c b/usr.sbin/mountd/mountd.c index 5940c4d..3d0df88 100644 --- a/usr.sbin/mountd/mountd.c +++ b/usr.sbin/mountd/mountd.c @@ -196,7 +196,7 @@ void mntsrv(struct svc_req *, SVCXPRT *); void nextfield(char **, char **); void out_of_mem(void); void parsecred(char *, struct xucred *); -int put_exlist(struct dirlist *, XDR *, struct dirlist *, int *); +int put_exlist(struct dirlist *, XDR *, struct dirlist *, int *, int); void *sa_rawaddr(struct sockaddr *sa, int *nbytes); int sacmp(struct sockaddr *sa1, struct sockaddr *sa2, struct sockaddr *samask); @@ -204,6 +204,7 @@ int scan_tree(struct dirlist *, struct sockaddr *); static void usage(void); int xdr_dir(XDR *, char *); int xdr_explist(XDR *, caddr_t); +int xdr_explist_brief(XDR *, caddr_t); int xdr_fhs(XDR *, caddr_t); int xdr_mlist(XDR *, caddr_t); void terminate(int); @@ -540,7 +541,7 @@ mntsrv(rqstp, transp) ai = NULL; switch (rqstp->rq_proc) { case NULLPROC: - if (!svc_sendreply(transp, xdr_void, (caddr_t)NULL)) + if (!svc_sendreply(transp, xdr_void, NULL)) syslog(LOG_ERR, "can't send reply"); return; case RPCMNT_MOUNT: @@ -689,7 +690,8 @@ mntsrv(rqstp, transp) return; case RPCMNT_EXPORT: if (!svc_sendreply(transp, xdr_explist, (caddr_t)NULL)) - syslog(LOG_ERR, "can't send reply"); + if (!svc_sendreply(transp, xdr_explist_brief, (caddr_t)NULL)) + syslog(LOG_ERR, "can't send reply"); if (log) syslog(LOG_NOTICE, "export request succeeded from %s", @@ -774,9 +776,10 @@ xdr_mlist(xdrsp, cp) * Xdr conversion for export list */ int -xdr_explist(xdrsp, cp) +xdr_explist_common(xdrsp, cp, brief) XDR *xdrsp; caddr_t cp; + int brief; { struct exportlist *ep; int false = 0; @@ -789,11 +792,12 @@ xdr_explist(xdrsp, cp) ep = exphead; while (ep) { putdef = 0; - if (put_exlist(ep->ex_dirl, xdrsp, ep->ex_defdir, &putdef)) + if (put_exlist(ep->ex_dirl, xdrsp, ep->ex_defdir, + &putdef, brief)) goto errout; if (ep->ex_defdir && putdef == 0 && put_exlist(ep->ex_defdir, xdrsp, (struct dirlist *)NULL, - &putdef)) + &putdef, brief)) goto errout; ep = ep->ex_next; } @@ -811,11 +815,12 @@ errout: * directory paths. */ int -put_exlist(dp, xdrsp, adp, putdefp) +put_exlist(dp, xdrsp, adp, putdefp, brief) struct dirlist *dp; XDR *xdrsp; struct dirlist *adp; int *putdefp; + int brief; { struct grouplist *grp; struct hostlist *hp; @@ -825,7 +830,7 @@ put_exlist(dp, xdrsp, adp, putdefp) char *strp; if (dp) { - if (put_exlist(dp->dp_left, xdrsp, adp, putdefp)) + if (put_exlist(dp->dp_left, xdrsp, adp, putdefp, brief)) return (1); if (!xdr_bool(xdrsp, &true)) return (1); @@ -836,7 +841,13 @@ put_exlist(dp, xdrsp, adp, putdefp) gotalldir = 1; *putdefp = 1; } - if ((dp->dp_flag & DP_DEFSET) == 0 && + if (brief) { + if (!xdr_bool(xdrsp, &true)) + return (1); + strp = "(...)"; + if (!xdr_string(xdrsp, &strp, RPCMNT_PATHLEN)) + return (1); + } else if ((dp->dp_flag & DP_DEFSET) == 0 && (gotalldir == 0 || (adp->dp_flag & DP_DEFSET) == 0)) { hp = dp->dp_hosts; while (hp) { @@ -865,12 +876,30 @@ put_exlist(dp, xdrsp, adp, putdefp) } if (!xdr_bool(xdrsp, &false)) return (1); - if (put_exlist(dp->dp_right, xdrsp, adp, putdefp)) + if (put_exlist(dp->dp_right, xdrsp, adp, putdefp, brief)) return (1); } return (0); } +int +xdr_explist(xdrsp, cp) + XDR *xdrsp; + caddr_t cp; +{ + + return xdr_explist_common(xdrsp, cp, 0); +} + +int +xdr_explist_brief(xdrsp, cp) + XDR *xdrsp; + caddr_t cp; +{ + + return xdr_explist_common(xdrsp, cp, 1); +} + char *line; int linesize; FILE *exp_file; |