sys/rpc: UNIX auth: Do not log on bogus AUTH_SYS messages
Remove the printf() stances added in commitd4cc791f3b("sys/rpc: UNIX auth: Fix OOB reads on too short message"). Even if it can be helpful to know why an authentication message is rejected, printing explanatory messages on each request attempt is a remote log filler that could be triggered by accident, and the generic RPC code generally does not do that. These printf() calls should be restored only after some limiting or configuration mechanism is devised. MFC with:d4cc791f3b("sys/rpc: UNIX auth: Fix OOB reads on too short message") Sponsored by: The FreeBSD Foundation
This commit is contained in:
+3
-17
@@ -41,7 +41,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/systm.h>
|
|
||||||
#include <sys/ucred.h>
|
#include <sys/ucred.h>
|
||||||
|
|
||||||
#include <rpc/rpc.h>
|
#include <rpc/rpc.h>
|
||||||
@@ -70,11 +69,8 @@ _svcauth_unix(struct svc_req *rqst, struct rpc_msg *msg)
|
|||||||
const uint32_t min_len = 5 * BYTES_PER_XDR_UNIT;
|
const uint32_t min_len = 5 * BYTES_PER_XDR_UNIT;
|
||||||
uint32_t str_len, supp_ngroups;
|
uint32_t str_len, supp_ngroups;
|
||||||
|
|
||||||
if (auth_len < min_len) {
|
if (auth_len < min_len)
|
||||||
(void)printf("AUTH_SYS: Too short credentials (%u)\n",
|
|
||||||
auth_len);
|
|
||||||
goto badcred;
|
goto badcred;
|
||||||
}
|
|
||||||
time = IXDR_GET_UINT32(buf);
|
time = IXDR_GET_UINT32(buf);
|
||||||
str_len = IXDR_GET_UINT32(buf);
|
str_len = IXDR_GET_UINT32(buf);
|
||||||
if (str_len > AUTH_SYS_MAX_HOSTNAME)
|
if (str_len > AUTH_SYS_MAX_HOSTNAME)
|
||||||
@@ -85,12 +81,8 @@ _svcauth_unix(struct svc_req *rqst, struct rpc_msg *msg)
|
|||||||
* 'str_len' (and that it won't cause an overflow in additions
|
* 'str_len' (and that it won't cause an overflow in additions
|
||||||
* below) to protect access to the credentials part.
|
* below) to protect access to the credentials part.
|
||||||
*/
|
*/
|
||||||
if (auth_len < min_len + str_len) {
|
if (auth_len < min_len + str_len)
|
||||||
(void)printf("AUTH_SYS: Inconsistent credentials and "
|
|
||||||
"host name lengths (%u, %u)\n",
|
|
||||||
auth_len, str_len);
|
|
||||||
goto badcred;
|
goto badcred;
|
||||||
}
|
|
||||||
buf += str_len / sizeof (int32_t);
|
buf += str_len / sizeof (int32_t);
|
||||||
xcr->cr_uid = IXDR_GET_UINT32(buf);
|
xcr->cr_uid = IXDR_GET_UINT32(buf);
|
||||||
xcr->cr_gid = IXDR_GET_UINT32(buf);
|
xcr->cr_gid = IXDR_GET_UINT32(buf);
|
||||||
@@ -108,14 +100,8 @@ _svcauth_unix(struct svc_req *rqst, struct rpc_msg *msg)
|
|||||||
* read in total.
|
* read in total.
|
||||||
*/
|
*/
|
||||||
if (auth_len < min_len + str_len +
|
if (auth_len < min_len + str_len +
|
||||||
supp_ngroups * BYTES_PER_XDR_UNIT) {
|
supp_ngroups * BYTES_PER_XDR_UNIT)
|
||||||
(void)printf("AUTH_SYS: Inconsistent lengths "
|
|
||||||
"(credentials %u, machine name %u, "
|
|
||||||
"supplementary groups %u)\n",
|
|
||||||
auth_len, str_len,
|
|
||||||
supp_ngroups * BYTES_PER_XDR_UNIT);
|
|
||||||
goto badcred;
|
goto badcred;
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Note that 'xcr' is a 'struct xucred', which still has the
|
* Note that 'xcr' is a 'struct xucred', which still has the
|
||||||
|
|||||||
Reference in New Issue
Block a user