-/* $OpenBSD: nfs_serv.c,v 1.127 2024/08/17 07:02:13 jsg Exp $ */
+/* $OpenBSD: nfs_serv.c,v 1.128 2024/09/10 18:44:04 miod Exp $ */
/* $NetBSD: nfs_serv.c,v 1.34 1997/05/12 23:37:12 fvdl Exp $ */
/*
if (tl == NULL)
return 1;
len = fxdr_unsigned(int32_t, *tl);
- if (len > NFS_MAXNAMLEN)
+ if (len > NFS_MAXNAMLEN) {
*infop->nmi_errorp = NFSERR_NAMETOL;
- else if (len <= 0)
+ *lenp = 0;
+ } else if (len <= 0) {
*infop->nmi_errorp = EBADRPC;
- else {
+ *lenp = 0;
+ } else {
*infop->nmi_errorp = 0;
*lenp = len;
}
if (nfsm_srvnamesiz(&info, &len) != 0)
goto nfsmout;
if (error) {
- if (nfsm_reply(&info, nfsd, slp, mrq, error, 0) != 0)
- return 0;
+ /*
+ * nfsm_reply would return zero if v3 and an error different
+ * from EBADRPC. But it does not make sense to continue
+ * anyway if the error set in nfsm_srvnamesiz is NFSERR_NAMETOL.
+ */
+ (void)nfsm_reply(&info, nfsd, slp, mrq, error, 0);
+ return 0;
}
NDINIT(&nd, LOOKUP, LOCKLEAF | SAVESTART, UIO_SYSSPACE, NULL, procp);
if (nfsm_srvnamesiz(&info, &len) != 0)
return error;
if (error) {
- if (nfsm_reply(&info, nfsd, slp, mrq, error, 0) != 0)
- return 0;
+ /*
+ * nfsm_reply would return zero if v3 and an error different
+ * from EBADRPC. But it does not make sense to continue
+ * anyway if the error set in nfsm_srvnamesiz is NFSERR_NAMETOL.
+ */
+ (void)nfsm_reply(&info, nfsd, slp, mrq, error, 0);
+ return 0;
}
NDINIT(&nd, CREATE, LOCKPARENT | LOCKLEAF | SAVESTART, UIO_SYSSPACE,
if (nfsm_srvnamesiz(&info, &len) != 0)
return error;
if (error) {
- if (nfsm_reply(&info, nfsd, slp, mrq, error, 0) != 0)
- return 0;
+ /*
+ * nfsm_reply would return zero if v3 and an error different
+ * from EBADRPC. But it does not make sense to continue
+ * anyway if the error set in nfsm_srvnamesiz is NFSERR_NAMETOL.
+ */
+ (void)nfsm_reply(&info, nfsd, slp, mrq, error, 0);
+ return 0;
}
NDINIT(&nd, CREATE, LOCKPARENT | LOCKLEAF | SAVESTART, UIO_SYSSPACE,
if (nfsm_srvnamesiz(&info, &len) != 0)
goto nfsmout;
if (error) {
- if (nfsm_reply(&info, nfsd, slp, mrq, error, 0) != 0)
- return 0;
+ /*
+ * nfsm_reply would return zero if v3 and an error different
+ * from EBADRPC. But it does not make sense to continue
+ * anyway if the error set in nfsm_srvnamesiz is NFSERR_NAMETOL.
+ */
+ (void)nfsm_reply(&info, nfsd, slp, mrq, error, 0);
+ return 0;
}
NDINIT(&nd, DELETE, LOCKPARENT | LOCKLEAF, UIO_SYSSPACE, NULL, procp);
if (nfsm_srvnamesiz(&info, &len) != 0)
return error;
if (error) {
- if (nfsm_reply(&info, nfsd, slp, mrq, error, 0) != 0)
- return 0;
+ /*
+ * nfsm_reply would return zero if v3 and an error different
+ * from EBADRPC. But it does not make sense to continue
+ * anyway if the error set in nfsm_srvnamesiz is NFSERR_NAMETOL.
+ */
+ (void)nfsm_reply(&info, nfsd, slp, mrq, error, 0);
+ return 0;
}
/*
if (nfsm_srvnamesiz(&info, &len) != 0)
goto nfsmout;
if (error) {
- if (nfsm_reply(&info, nfsd, slp, mrq, error, 0) != 0)
- return 0;
+ /*
+ * nfsm_reply would return zero if v3 and an error different
+ * from EBADRPC. But it does not make sense to continue
+ * anyway if the error set in nfsm_srvnamesiz is NFSERR_NAMETOL.
+ */
+ (void)nfsm_reply(&info, nfsd, slp, mrq, error, 0);
+ return 0;
}
error = nfsrv_fhtovp(fhp, 0, &vp, cred, slp, nam, &rdonly);
if (nfsm_srvnamesiz(&info, &len) != 0)
return error;
if (error) {
- if (nfsm_reply(&info, nfsd, slp, mrq, error, 0) != 0)
- return 0;
+ /*
+ * nfsm_reply would return zero if v3 and an error different
+ * from EBADRPC. But it does not make sense to continue
+ * anyway if the error set in nfsm_srvnamesiz is NFSERR_NAMETOL.
+ */
+ (void)nfsm_reply(&info, nfsd, slp, mrq, error, 0);
+ return 0;
}
NDINIT(&nd, CREATE, LOCKPARENT | SAVESTART, UIO_SYSSPACE, NULL, procp);
if (nfsm_srvnamesiz(&info, &len) != 0)
return error;
if (error) {
- if (nfsm_reply(&info, nfsd, slp, mrq, error, 0) != 0)
- return 0;
+ /*
+ * nfsm_reply would return zero if v3 and an error different
+ * from EBADRPC. But it does not make sense to continue
+ * anyway if the error set in nfsm_srvnamesiz is NFSERR_NAMETOL.
+ */
+ (void)nfsm_reply(&info, nfsd, slp, mrq, error, 0);
+ return 0;
}
NDINIT(&nd, CREATE, LOCKPARENT, UIO_SYSSPACE, NULL, procp);
if (nfsm_srvnamesiz(&info, &len) != 0)
goto nfsmout;
if (error) {
- if (nfsm_reply(&info, nfsd, slp, mrq, error, 0) != 0)
- return 0;
+ /*
+ * nfsm_reply would return zero if v3 and an error different
+ * from EBADRPC. But it does not make sense to continue
+ * anyway if the error set in nfsm_srvnamesiz is NFSERR_NAMETOL.
+ */
+ (void)nfsm_reply(&info, nfsd, slp, mrq, error, 0);
+ return 0;
}
NDINIT(&nd, DELETE, LOCKPARENT | LOCKLEAF, UIO_SYSSPACE, NULL, procp);