1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-25 11:37:56 +00:00

If an RPC fails, try a shorter reply in case the fault lies with the

size of the response.

PR: misc/26320
MFC After: 2 weeks
This commit is contained in:
Alfred Perlstein 2002-07-15 18:34:27 +00:00
parent abe6ff15e1
commit 91acb349c9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=100117

View File

@ -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 @@ xdr_explist(xdrsp, cp)
* 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;