Page MenuHomeFreeBSD

Increase YPMAXRECORD to 16M to be compatible with Linux.
ClosedPublic

Authored by kib on Jul 9 2019, 11:05 PM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 23 2024, 11:00 AM
Unknown Object (File)
Feb 23 2024, 11:00 AM
Unknown Object (File)
Feb 23 2024, 11:00 AM
Unknown Object (File)
Feb 23 2024, 11:00 AM
Unknown Object (File)
Feb 23 2024, 10:59 AM
Unknown Object (File)
Feb 23 2024, 10:59 AM
Unknown Object (File)
Feb 23 2024, 10:59 AM
Unknown Object (File)
Feb 23 2024, 10:59 AM

Details

Summary

Glibc made same change, increasing the allowed length for keys and values in YP to 16M, in 2013. We need this for compatibility with very large automounter maps.

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.

Sponsored by: Mellanox Technologies

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

ian added inline comments.
lib/libc/net/gethostbynis.c
92 ↗(On Diff #59596)

s/&ypbuf/ypbuf/

same change a few lines down in result= line

lib/libc/net/getnetbynis.c
81 ↗(On Diff #59596)

&ypbuf here and 3 lines down as well

In fact, it looks like this pattern of the old code using '&array' instead of just 'array' is repeated in more of the changes below, I'm not going to flag every one of them right now (because I was just doing a "quick glance" and have to get back to $work).

kib marked 2 inline comments as done.

Fix bugs pointed out by ian. I did not found other instances of it.

markj added inline comments.
usr.sbin/rpc.yppasswdd/yppasswdd_server.c
368 ↗(On Diff #60538)

Should this be a goto as well?

kib marked an inline comment as done.

Do not leak pwbuf.

There are no checks for memory allocation failures, but otherwise it looks ok to me.

This revision is now accepted and ready to land.Aug 8 2019, 1:12 AM
This revision now requires review to proceed.Aug 8 2019, 3:15 PM
markj added inline comments.
usr.sbin/yppush/yppush_main.c
448 ↗(On Diff #60581)

return YP_YPERR?

This revision is now accepted and ready to land.Aug 8 2019, 9:35 PM
usr.sbin/yppush/yppush_main.c
448 ↗(On Diff #60581)

I am not sure.

I returned 0 on principle that malloc might fail mostly due to insane size, not because app should handle real OOM situation. And then, returning 0 means that the iteration over the entries should continue, which is what I believe is the right action.

usr.sbin/yppush/yppush_main.c
448 ↗(On Diff #60581)

Ok. It might be worth a comment.

kib marked 2 inline comments as done.

Add comment hinting why we do not stop iteration on asprintf (malloc) failure.

This revision now requires review to proceed.Aug 9 2019, 8:30 PM
This revision is now accepted and ready to land.Aug 9 2019, 8:41 PM