Commit Graph

39 Commits

Author SHA1 Message Date
mrg f386908b27 convert explicit length check before unchecked snprintf() with just a
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.
2023-08-01 08:47:24 +00:00
christos 9009c648c6 need <sys/stat.h> 2017-01-10 21:04:06 +00:00
plunky 87d4f6076b Apply casts to cases where xdrproc_t is expected but is not
strictly passed, for example because the second argument is
a different kind of pointer.
2011-08-30 17:06:20 +00:00
snj 07ce40632e Follow upstream's lead and remove third and fourth clauses (except on
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.
2009-10-20 00:51:13 +00:00
lukem d3d3aa621a Fix WARNS=4 issues (-Wshadow -Wcast-qual -Wsign-compare) 2009-04-19 06:06:39 +00:00
lukem 66176dfdff Rename MKPRIVATELIB to LIBISPRIVATE, to make it clearer that this is
a variable that is used by in-tree Makefiles to control behaviour.
(MKsomevar variables are generally intended to be controlled by the end-user)
2008-05-03 14:48:30 +00:00
martin ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
lukem cea4b7cdfd Simplify ypdb_open() API and just use it for opening the DB for reading.
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.
2008-02-29 03:00:47 +00:00
lukem aa159e4a50 ypdb_open():
* Clarify what it does (adds YPDB_SUFFIX if it's missing).
* Add some explicit pathname length checks and display a warning if exceeded.
2005-06-20 00:29:42 +00:00
dsl 3cca093e74 Add (unsigned char) cast to ctype functions 2004-10-30 15:51:20 +00:00
lukem b817247988 Use MKPRIVATELIB=yes instead of providing an empty libinstall:: target and
setting NOLINT, NOPIC, NOPROFILE (etc)
2004-05-23 02:24:50 +00:00
agc 7db1d33cba Modify the licences of code written by Theo De Raadt from a 4-clause
to a 2-clause licence (retaining UCB clauses (1) and (2)), per PR
22409 from Joel Baker, approved by Theo de Raadt, and ratified by
myself - the only discrepancy being the handling of the original
clause 3 in src/usr.sbin/yppoll/yppoll.c.
2003-12-10 12:06:25 +00:00
grant cacf2d0f45 s/netbsd.org/NetBSD.org/i 2003-11-12 13:31:07 +00:00
agc 326b2259b7 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22366, verified by myself.
2003-08-07 11:25:11 +00:00
lukem c52b93f508 minor makefile delint 2002-09-18 13:31:52 +00:00
wiz 5c90fa6755 ANSIfy, remove __P(). 2002-07-06 21:30:26 +00:00
tv 8e6f7afb5b MKfoo=no -> NOfoo 2001-12-12 01:48:43 +00:00
thorpej c7b5409a74 Rewrite this to use getaddrinfo(), and to use the canonical name of the
host rather than the hostname as returned by gethostname() if the hostname
does not appear to be fully qualified.
2000-12-09 00:47:57 +00:00
lukem 81a3e76281 remove superfluous casts 1999-07-26 03:01:09 +00:00
lukem 275da9fc4d because the ypserv struct datum and the db(3) struct DBT are not exactly
the same (datum is { char *, int }, DBT is { void *, size_t /* u_int */ }),
copy info to appropriate temporary variables before calling underlying
db(3) operations.
1999-07-25 09:33:37 +00:00
thorpej 653c3855f5 Use pidfile(3). 1999-06-06 02:38:00 +00:00
lukem a3b1d07c9b set MKLINT=no. noted by NAKAJIMA Yoshihiro <nakayosh@kcn.ne.jp> 1999-03-13 23:16:55 +00:00
lukem dcab0210a0 convert from NOxxx= to MKxxx=no.
include <bsd.own.mk> if testing a MKxxx variable.
1999-02-13 02:54:17 +00:00
mrg 69dfc0e846 KNF nit. 1999-01-31 10:14:02 +00:00
thorpej 002a1e7cb7 Remove old access control list definitions, and remove the home-grown
logging code.
1999-01-22 02:37:00 +00:00
mrg 32f519716b - use an array MAXHOSTNAMELEN+1 size to hold hostnames
- ensure hostname from gethostname() is nul-terminated in all cases
- minor KNF
- use MAXHOSTNAMELEN over various other values/defines
- be safe will buffers that hold hostnames
1998-07-06 06:56:06 +00:00
kleink 1f491461e0 Need <time.h> for time(). 1998-06-24 10:26:08 +00:00
lukem 211a72a8dc convert from in-house read_line to fparseln() 1998-06-08 06:53:47 +00:00
kleink 70ae83a7e1 Use <sys/param.h> instead of <sys/types.h>: <netdb.h> and MAXHOSTNAMELEN are
not related to each other, and it should not be assumed that inclusion of the
former makes visible the latter.
1998-04-23 19:32:40 +00:00
lukem f4fb444bd9 * rewrite read_line(), partially based on get_line in netgroup_mkdb.c:
- use fgetln() instead of fgets()
	- store info in internal buffer
	- fix \\ support
	- count line numbers internally, so \\ lines don't mess up count
* ypdb_store():
	- ensure that the length of key or val doesn't exceed YPMAXRECORD
* makedbm, mknetid, revnetgroup, stdethers, stdhosts:
	- improve error handling
	- take advantage of rewritten read_line(), and cleanup line parsing
	- don't print trailing ` ' for key/val pairs with an empty val
* Makefile.yp:
	- fix up building of ypservers (from Chuck Cranor)
* ypinit.sh:
	- remove leading spaces in variable assignment (from Chuck Cranor)
1997-11-01 14:24:50 +00:00
lukem 652dc94093 - hack ypdb_open() to try the standard hash (for sendmail's aliases.db)
if the initial open fails with EFTYPE. if a different database
  format is found to be more efficient, just add the code to open it
  prior to that of the other formats; this maintains backward
  compatibility with older databases whilst providing new functionality...
- add rcsid's
1997-10-13 03:42:27 +00:00
mycroft 26a3dbe1c4 GC some garbage variables. 1997-10-11 20:26:58 +00:00
veego e288b27b29 Don't install this libraries, we only this during the build. 1997-10-11 19:42:34 +00:00
lukem c0495ebb45 nuke register & unnecessary extern's, factor out common code 1997-10-07 14:39:06 +00:00
lukem ac64718550 - build common/* once, into a library, rather than recompiling each of
the files multiple times in the other subdirectories (saves about
  10% on compilation time)
- clean up the manual pages
1997-10-02 14:16:12 +00:00
jtc 87f4ccd45f Fix files using old TNF copyright notice 1997-07-30 22:53:50 +00:00
thorpej 3d8138fc0e Fix compiler warnings (and an awful lot of annoying little bugs). 1997-07-18 21:57:00 +00:00
christos 32b4ce594c PR/3504: Brian Baird:
- Do what the manual page says; don't create the log file if it does not exist.
- Limited support for ypserv v1; apparently sunos4 clients use it and sunos5
  server provides the same.
1997-04-17 17:46:16 +00:00
thorpej 60aa689c94 A ypserv implementation, originally written by Mats O Jansson, with
some changes by me, including misc. cleanup, minor bug fixes, and
brand-new access control list code.
1996-08-09 10:14:49 +00:00