overflow checked snprintf(). for res_debug.c and res_query.c, convert
from sprintf() to snprintf().
tested scp and rcp fail properly with too-long paths.
tested getaddrinfo fails as expected for too-long domains.
tested dig and ping for similar (res_debug.c/res_query.c).
created a temporary fs with quotas to test edquota with a long EDITOR.
did not test ypserv directly, but it's the same pattern.
avoids GCC 12 snprintf() warnings, and reduces total code size.
Rename compiler-warning-disable variables from
GCC_NO_warning
to
CC_WNO_warning
where warning is the full warning name as used by the compiler.
GCC_NO_IMPLICIT_FALLTHRU is CC_WNO_IMPLICIT_FALLTHROUGH
Using the convention CC_compilerflag, where compilerflag
is based on the full compiler flag name.
Add GCC_NO_FORMAT_TRUNCATION makedbm.c to prevent build failure.
Error was reported when build.sh was run with MKLIBCSANITIZER=yes flag.
Reviewed by: kamil@
GCC_NO_FORMAT_TRUNCATION -Wno-format-truncation (GCC 7/8)
GCC_NO_STRINGOP_TRUNCATION -Wno-stringop-truncation (GCC 8)
GCC_NO_STRINGOP_OVERFLOW -Wno-stringop-overflow (GCC 8)
GCC_NO_CAST_FUNCTION_TYPE -Wno-cast-function-type (GCC 8)
use these to turn off warnings for most GCC-8 complaints. many
of these are false positives, most of the real bugs are already
commited, or are yet to come.
we plan to introduce versions of (some?) of these that use the
"-Wno-error=" form, which still displays the warnings but does
not make it an error, and all of the above will be re-considered
as either being "fix me" (warning still displayed) or "warning
is wrong."
and the man page, to reflect modern usage rather than some ancient style
that getopt[s] does not support (options, and their args when they exist)
always come before non-option agrs.
While here, update uses of test(1) to avoid obsolescent forms (and
even when still defined, prefer sh structures over test when possible).
Bring this script a little up to date - make it work with modern /bin/sh
(avoid HOSTNAME as a random variable) clean up trailing spaces on lines,
use $( ) instead of `` ...
(1) Do not serve UIDs below MINUID in master.passwd.* maps,
just like in passwd.* maps.
(2) Since stdethers(8) and stdhosts(8) strip comments, we do
not have to do it here, much less inconsistently.
1. add_interdomain and add_secure are optional... not all maps use these
keys. if we are unable to add them due to a YPERR_KEY (meaning they
are not being used), then we should not flag this as a general error.
2. if we have a failure (status <= 0) we unlink_db() the temp database
as part of error handling. but we should not overwrite our error
status code with the return value from unlink_db() because if the
unlink_db() works (likely true) than that success will wipe out our
error code and the calling yppush will think we worked.
(e.g. YPPUSH_SUCC, YPPUSH_NOMAP, etc.).
Functions like yp_master, yp_order_host, yp_master_host, and
yp_match_host return YPERR-style error codes. YPERR-style error
codes do not directly correspond to yppush_status codes, so it
is a bad idea to just directly YPERR codes into the yppush return
status value (it causes failing yppush runs to print confusing
error messages).
Change ypxfr.c to convert the YPERR codes to YPPUSH codes.
from usr.sbin/mopd/common/pf.c, where only the ad clause is removed,
because it has a shared UCB copyright) on Mats O Jansson's files.
thorpej OK'd usr.sbin/rpc.yppasswdd/yppasswdd_mkpw.c, where he shares
copyright.
as they can cause performance problems while ypserv is blocked
waiting for the DNS to respond. initially discussed here:
http://mail-index.netbsd.org/tech-userlevel/2006/11/01/0014.html
This diff is from Doug Needham who found an easy way to get
the desired behavior without having to change libwrap.
Provide a separate ypdb_mktemp() API to open a temporary file read-write.
Use mkstemp() instead of mktemp().
NOTE: makedbm & mkalias tested ok. I couldn't test ypxfer.