Increase YPMAXRECORD to 16M to be compatible with Linux.

Since YP protocol definition uses the constant to declare
variable-size opaque byte strings, the change should be binary
compatible with existing installations which do not expose keys or
values larger than 1024 bytes.

All uses of local variables with YPMAXRECORD sizes were removed to
avoid insane stack use.  On the other hand, variables with static
lifetime should be fine and only result in increased VA use.

Glibc made same change, increasing the allowed length for keys and
values in YP to 16M, in 2013.

Reviewed by:	markj
Discussed with:	ian
Sponsored by:	Mellanox Technologies
MFC after:	3 weeks
Differential revision:	https://reviews.freebsd.org/D20900
This commit is contained in:
Konstantin Belousov
2019-08-12 20:27:33 +00:00
parent 26b6a67b98
commit 6b462d2762
12 changed files with 119 additions and 54 deletions
+1 -1
View File
@@ -40,7 +40,7 @@
%__FBSDID("$FreeBSD$");
#endif
const YPMAXRECORD = 1024;
const YPMAXRECORD = 16777216;
const YPMAXDOMAIN = 64;
const YPMAXMAP = 64;
const YPMAXPEER = 64;
+1 -1
View File
@@ -79,7 +79,7 @@ typedef u_int bool;
#define YPPROG ((u_long)100004)
#define YPVERS ((u_long)2)
#define YPVERS_ORIG ((u_long)1)
#define YPMAXRECORD ((u_long)1024)
#define YPMAXRECORD ((u_long)16 * 1024 * 1024)
#define YPMAXDOMAIN ((u_long)64)
#define YPMAXMAP ((u_long)64)
#define YPMAXPEER ((u_long)256)
+1 -1
View File
@@ -70,7 +70,7 @@
#endif
/* XXX cribbed from yp.x */
const _YPMAXRECORD = 1024;
const _YPMAXRECORD = 16777216;
const _YPMAXDOMAIN = 64;
const _YPMAXMAP = 64;
const _YPMAXPEER = 64;