b4a640674a
This is a hacked-up port of the ypserv-0.11 server from the NYS project written by Peter Eriksson. The original package included some map creating and dumping tools and was based on GDBM. This version has been modified in the following ways: - GDBM replaced with DB and many weird hacks made to the read_database() function because of this. - implimented the ypxfr service (using ypxfr from the yps-0.21 package, aso from the NYS project) - added code to check the TCP port from which NIS requests originate: the server will refuse to serve the master.passwd.{byname|byuid} maps if the request doesn't come from a privileged port. Normally, only the superuser can issue such a request. Requests for the passwd.{bynam|byuid} maps aren't affected. There will be a small change made to getpwent.c in libc to complement this. - added code to do DNS lookups via actual resolver queries instead of relying on gethostbyname() and friends. The author noted in the original documentation that a loop condition could arise where the server would query itself for hostsname lookups. Using direct DNS lookups prevents this from happening. - added code to properly fork() the server into the background unless invoked with the -debug flag. - Added combined syslog/perror function. - fixed a few bugs (which were probably introduced by all the other changes) - Created a bmake Makefile. Note that this package can be linked against the tcp_wrapper package to provide address-based authentication, but this isn't done by default since the tcp_wrapper package isn't part of FreeBSD.
68 lines
1.4 KiB
C
68 lines
1.4 KiB
C
/*
|
|
* $Id$
|
|
*/
|
|
|
|
#if (defined(__sun__) || defined(sun)) && !defined(__svr4__)
|
|
|
|
/* Stupid SunOS 4 doesn't have prototypes in the header files */
|
|
|
|
/* Some includes just to make the compiler be quiet */
|
|
#include <stdio.h>
|
|
#include <sys/types.h>
|
|
#include <sys/socket.h>
|
|
|
|
extern int fprintf(FILE *fp, const char *format, ...);
|
|
extern int _flsbuf(unsigned char c, FILE *fp);
|
|
extern int puts(const char *str);
|
|
extern int printf(const char *format, ...);
|
|
|
|
extern int chdir(const char *path);
|
|
extern int gethostname(char *buf, int bufsize);
|
|
extern int atoi(const char *str);
|
|
extern int perror(const char *str);
|
|
|
|
extern int socket (int af, int type, int protocol);
|
|
extern int bind (int s, struct sockaddr *name, int namelen);
|
|
extern int chdir (const char *path);
|
|
|
|
#endif
|
|
|
|
|
|
#if (defined(__sun__) || defined(sun)) && defined(__svr4__)
|
|
|
|
extern char *strdup(const char *str);
|
|
|
|
#define NEED_GETHOSTNAME
|
|
#define NEED_SVCSOC_H
|
|
|
|
#endif
|
|
|
|
|
|
#if defined(hpux) || defined(__hpux__)
|
|
|
|
/* HP is really... Ah well. */
|
|
|
|
#define _INCLUDE_HPUX_SOURCE
|
|
#define _INCLUDE_XOPEN_SOURCE
|
|
#define _INCLUDE_POSIX_SOURCE
|
|
#define _INCLUDE_AES_SOURCE
|
|
|
|
extern void svcerr_systemerr();
|
|
#endif
|
|
|
|
|
|
#if defined(linux) || defined(__linux__)
|
|
|
|
/* Need this because some header files doesn't check for __linux__ */
|
|
#if !defined(linux)
|
|
#define linux linux
|
|
#endif
|
|
|
|
/* Needed for non-ANSI prototypes */
|
|
#define _SVID_SOURCE
|
|
|
|
/* Needed for gethostname() */
|
|
#define _BSD_SOURCE
|
|
|
|
#endif
|