RPC: RQCRED_SIZE is not a public interface
RQCRED_SIZE macro is internal for
libnsl(3lib) and it should not be used by the
rpc(3nsl) man page it is documented that
rq_clntcred is a pointer to the read only cooked cred. IOW it means that the
rq_clntcred field contains a valid pointer to the appropriate structure with the auth parameters. The
libnsl(3lib) consumers have no reason to check (or assert) the size of such structures against any (arbitrary) values, like
RQCRED_SIZE. Unfortunately, with the #8085 fix many (if not all)
libnsl(3lib) consumers were modified to do such asserts. This is plain wrong. If there is any problem with the size of the auth parameters structure(s) the
libnsl(3lib) should act appropriately internally. If it does not, it should be fixed, similarly as it was done in #8085 by increasing of the
RQCRED_SIZE value from 400 to 700.
Updated by Joshua M. Clulow about 4 years ago
In this case, it seems like it's an invariant that the backing storage for
rq_clntcred needs to be big enough for all of the consumers which cast that storage to a particular type. Why would we not want to assert, at build time, that the code is correct?
The header file into which
RQCRED_SIZE was moved is probably not the best venue, and we could move it into an internal header file which we do not ship. But the software is otherwise entirely in-gate -- can you explain why we can't check, at compile time, that the invariant holds?