Fix for WARNS=1 and remove WARNS override from Makefile
This commit is contained in:
parent
9f6d6708f4
commit
d6ddaab4e6
|
@ -1,6 +1,5 @@
|
|||
# $NetBSD: Makefile,v 1.6 1997/10/09 14:36:28 lukem Exp $
|
||||
# $NetBSD: Makefile,v 1.7 1997/10/09 21:20:16 christos Exp $
|
||||
|
||||
WARNS=0
|
||||
LIB= wrap
|
||||
|
||||
SRCS= hosts_access.c options.c shell_cmd.c rfc931.c eval.c hosts_ctl.c \
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* $NetBSD: clean_exit.c,v 1.2 1997/10/09 21:20:19 christos Exp $ */
|
||||
|
||||
/*
|
||||
* clean_exit() cleans up and terminates the program. It should be called
|
||||
* instead of exit() when for some reason the real network daemon will not or
|
||||
|
@ -8,13 +10,18 @@
|
|||
* Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#) clean_exit.c 1.4 94/12/28 17:42:19";
|
||||
#else
|
||||
__RCSID("$NetBSD: clean_exit.c,v 1.2 1997/10/09 21:20:19 christos Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
extern void exit();
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "tcpd.h"
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* $NetBSD: diag.c,v 1.3 1997/10/09 21:20:21 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Routines to report various classes of problems. Each report is decorated
|
||||
* with the current context (file name and line number), if available.
|
||||
|
@ -9,8 +11,13 @@
|
|||
* Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#) diag.c 1.1 94/12/28 17:42:20";
|
||||
#else
|
||||
__RCSID("$NetBSD: diag.c,v 1.3 1997/10/09 21:20:21 christos Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* System libraries */
|
||||
|
@ -27,6 +34,8 @@ static char sccsid[] = "@(#) diag.c 1.1 94/12/28 17:42:20";
|
|||
struct tcpd_context tcpd_context;
|
||||
jmp_buf tcpd_buf;
|
||||
|
||||
static void tcpd_diag __P((int, char *, char *, va_list));
|
||||
|
||||
/* tcpd_diag - centralize error reporter */
|
||||
|
||||
static void tcpd_diag(severity, tag, format, ap)
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* $NetBSD: eval.c,v 1.3 1997/10/09 21:20:24 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Routines for controlled evaluation of host names, user names, and so on.
|
||||
* They are, in fact, wrappers around the functions that are specific for
|
||||
|
@ -18,8 +20,13 @@
|
|||
* Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#) eval.c 1.3 95/01/30 19:51:45";
|
||||
#else
|
||||
__RCSID("$NetBSD: eval.c,v 1.3 1997/10/09 21:20:24 christos Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* System libraries. */
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* $NetBSD: fix_options.c,v 1.3 1997/10/09 21:20:26 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Routine to disable IP-level socket options. This code was taken from 4.4BSD
|
||||
* rlogind source, but all mistakes in it are my fault.
|
||||
|
@ -5,21 +7,29 @@
|
|||
* Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#) fix_options.c 1.3 94/12/28 17:42:22";
|
||||
#else
|
||||
__RCSID("$NetBSD: fix_options.c,v 1.3 1997/10/09 21:20:26 christos Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
#include <stdio.h>
|
||||
#include <syslog.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include "tcpd.h"
|
||||
|
||||
/* fix_options - get rid of IP-level socket options */
|
||||
|
||||
void
|
||||
fix_options(request)
|
||||
struct request_info *request;
|
||||
{
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* $NetBSD: hosts_access.c,v 1.2 1997/10/09 21:20:30 christos Exp $ */
|
||||
|
||||
/*
|
||||
* This module implements a simple access control language that is based on
|
||||
* host (or domain) names, NIS (host) netgroup names, IP addresses (or
|
||||
|
@ -17,8 +19,13 @@
|
|||
* Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#) hosts_access.c 1.20 96/02/11 17:01:27";
|
||||
#else
|
||||
__RCSID("$NetBSD: hosts_access.c,v 1.2 1997/10/09 21:20:30 christos Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* System libraries. */
|
||||
|
@ -34,7 +41,6 @@ static char sccsid[] = "@(#) hosts_access.c 1.20 96/02/11 17:01:27";
|
|||
#include <setjmp.h>
|
||||
#include <string.h>
|
||||
|
||||
extern char *fgets();
|
||||
extern int errno;
|
||||
|
||||
#ifndef INADDR_NONE
|
||||
|
@ -75,13 +81,14 @@ int resident = (-1); /* -1, 0: unknown; +1: yes */
|
|||
|
||||
/* Forward declarations. */
|
||||
|
||||
static int table_match();
|
||||
static int list_match();
|
||||
static int server_match();
|
||||
static int client_match();
|
||||
static int host_match();
|
||||
static int string_match();
|
||||
static int masked_match();
|
||||
static int table_match __P((char *, struct request_info *));
|
||||
static int list_match __P((char *, struct request_info *,
|
||||
int (*)(char *, struct request_info *)));
|
||||
static int server_match __P((char *, struct request_info *));
|
||||
static int client_match __P((char *, struct request_info *));
|
||||
static int host_match __P((char *, struct host_info *));
|
||||
static int string_match __P((char *, char *));
|
||||
static int masked_match __P((char *, char *, char *));
|
||||
|
||||
/* Size of logical line buffer. */
|
||||
|
||||
|
@ -129,7 +136,7 @@ struct request_info *request;
|
|||
FILE *fp;
|
||||
char sv_list[BUFLEN]; /* becomes list of daemons */
|
||||
char *cl_list; /* becomes list of clients */
|
||||
char *sh_cmd; /* becomes optional shell command */
|
||||
char *sh_cmd = NULL; /* becomes optional shell command */
|
||||
int match = NO;
|
||||
struct tcpd_context saved_context;
|
||||
|
||||
|
@ -184,7 +191,7 @@ struct request_info *request;
|
|||
static int list_match(list, request, match_fn)
|
||||
char *list;
|
||||
struct request_info *request;
|
||||
int (*match_fn) ();
|
||||
int (*match_fn) __P((char *, struct request_info *));
|
||||
{
|
||||
char *tok;
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* $NetBSD: hosts_ctl.c,v 1.2 1997/10/09 21:20:32 christos Exp $ */
|
||||
|
||||
/*
|
||||
* hosts_ctl() combines common applications of the host access control
|
||||
* library routines. It bundles its arguments then calls the hosts_access()
|
||||
|
@ -11,8 +13,13 @@
|
|||
* Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#) hosts_ctl.c 1.4 94/12/28 17:42:27";
|
||||
#else
|
||||
__RCSID("$NetBSD: hosts_ctl.c,v 1.2 1997/10/09 21:20:32 christos Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
|
|
@ -1,11 +1,18 @@
|
|||
/* $NetBSD: misc.c,v 1.2 1997/10/09 21:20:35 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Misc routines that are used by tcpd and by tcpdchk.
|
||||
*
|
||||
* Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsic[] = "@(#) misc.c 1.2 96/02/11 17:01:29";
|
||||
#else
|
||||
__RCSID("$NetBSD: misc.c,v 1.2 1997/10/09 21:20:35 christos Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
@ -17,8 +24,6 @@ static char sccsic[] = "@(#) misc.c 1.2 96/02/11 17:01:29";
|
|||
|
||||
#include "tcpd.h"
|
||||
|
||||
extern char *fgets();
|
||||
|
||||
#ifndef INADDR_NONE
|
||||
#define INADDR_NONE (-1) /* XXX should be 0xffffffff */
|
||||
#endif
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* $NetBSD: mystdarg.h,v 1.2 1997/10/09 21:20:37 christos Exp $ */
|
||||
|
||||
/*
|
||||
* What follows is an attempt to unify varargs.h and stdarg.h. I'd rather
|
||||
|
@ -15,5 +16,3 @@
|
|||
#define VASTART(ap,type,name) {type name; va_start(ap); name = va_arg(ap, type)
|
||||
#define VAEND(ap) va_end(ap);}
|
||||
#endif
|
||||
|
||||
extern char *percent_m();
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* $NetBSD: options.c,v 1.3 1997/10/09 21:20:39 christos Exp $ */
|
||||
|
||||
/*
|
||||
* General skeleton for adding options to the access control language. The
|
||||
* features offered by this module are documented in the hosts_options(5)
|
||||
|
@ -28,8 +30,13 @@
|
|||
* course of action.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#) options.c 1.17 96/02/11 17:01:31";
|
||||
#else
|
||||
__RCSID("$NetBSD: options.c,v 1.3 1997/10/09 21:20:39 christos Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* System libraries. */
|
||||
|
@ -42,6 +49,8 @@ static char sccsid[] = "@(#) options.c 1.17 96/02/11 17:01:31";
|
|||
#include <netdb.h>
|
||||
#include <stdio.h>
|
||||
#include <syslog.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <pwd.h>
|
||||
#include <grp.h>
|
||||
#include <ctype.h>
|
||||
|
@ -66,31 +75,51 @@ extern jmp_buf tcpd_buf; /* tcpd_jump() support */
|
|||
static char whitespace_eq[] = "= \t\r\n";
|
||||
#define whitespace (whitespace_eq + 1)
|
||||
|
||||
static char *get_field(); /* chew :-delimited field off string */
|
||||
static char *chop_string(); /* strip leading and trailing blanks */
|
||||
static char *get_field /* chew :-delimited field off string */
|
||||
__P((char *));
|
||||
static char *chop_string /* strip leading and trailing blanks */
|
||||
__P((char *));
|
||||
struct syslog_names;
|
||||
static int severity_map
|
||||
__P((struct syslog_names *, char *));
|
||||
|
||||
/* List of functions that implement the options. Add yours here. */
|
||||
|
||||
static void user_option(); /* execute "user name.group" option */
|
||||
static void group_option(); /* execute "group name" option */
|
||||
static void umask_option(); /* execute "umask mask" option */
|
||||
static void linger_option(); /* execute "linger time" option */
|
||||
static void keepalive_option(); /* execute "keepalive" option */
|
||||
static void spawn_option(); /* execute "spawn command" option */
|
||||
static void twist_option(); /* execute "twist command" option */
|
||||
static void rfc931_option(); /* execute "rfc931" option */
|
||||
static void setenv_option(); /* execute "setenv name value" */
|
||||
static void nice_option(); /* execute "nice" option */
|
||||
static void severity_option(); /* execute "severity value" */
|
||||
static void allow_option(); /* execute "allow" option */
|
||||
static void deny_option(); /* execute "deny" option */
|
||||
static void banners_option(); /* execute "banners path" option */
|
||||
static void user_option /* execute "user name.group" option */
|
||||
__P((char *, struct request_info *));
|
||||
static void group_option /* execute "group name" option */
|
||||
__P((char *, struct request_info *));
|
||||
static void umask_option /* execute "umask mask" option */
|
||||
__P((char *, struct request_info *));
|
||||
static void linger_option /* execute "linger time" option */
|
||||
__P((char *, struct request_info *));
|
||||
static void keepalive_option /* execute "keepalive" option */
|
||||
__P((char *, struct request_info *));
|
||||
static void spawn_option /* execute "spawn command" option */
|
||||
__P((char *, struct request_info *));
|
||||
static void twist_option /* execute "twist command" option */
|
||||
__P((char *, struct request_info *));
|
||||
static void rfc931_option /* execute "rfc931" option */
|
||||
__P((char *, struct request_info *));
|
||||
static void setenv_option /* execute "setenv name value" */
|
||||
__P((char *, struct request_info *));
|
||||
static void nice_option /* execute "nice" option */
|
||||
__P((char *, struct request_info *));
|
||||
static void severity_option /* execute "severity value" */
|
||||
__P((char *, struct request_info *));
|
||||
static void allow_option /* execute "allow" option */
|
||||
__P((char *, struct request_info *));
|
||||
static void deny_option /* execute "deny" option */
|
||||
__P((char *, struct request_info *));
|
||||
static void banners_option /* execute "banners path" option */
|
||||
__P((char *, struct request_info *));
|
||||
|
||||
/* Structure of the options table. */
|
||||
|
||||
struct option {
|
||||
char *name; /* keyword name, case is ignored */
|
||||
void (*func) (); /* function that does the real work */
|
||||
void (*func) /* function that does the real work */
|
||||
__P((char *, struct request_info *));
|
||||
int flags; /* see below... */
|
||||
};
|
||||
|
||||
|
@ -108,21 +137,21 @@ struct option {
|
|||
/* List of known keywords. Add yours here. */
|
||||
|
||||
static struct option option_table[] = {
|
||||
"user", user_option, NEED_ARG,
|
||||
"group", group_option, NEED_ARG,
|
||||
"umask", umask_option, NEED_ARG,
|
||||
"linger", linger_option, NEED_ARG,
|
||||
"keepalive", keepalive_option, 0,
|
||||
"spawn", spawn_option, NEED_ARG | EXPAND_ARG,
|
||||
"twist", twist_option, NEED_ARG | EXPAND_ARG | USE_LAST,
|
||||
"rfc931", rfc931_option, OPT_ARG,
|
||||
"setenv", setenv_option, NEED_ARG | EXPAND_ARG,
|
||||
"nice", nice_option, OPT_ARG,
|
||||
"severity", severity_option, NEED_ARG,
|
||||
"allow", allow_option, USE_LAST,
|
||||
"deny", deny_option, USE_LAST,
|
||||
"banners", banners_option, NEED_ARG,
|
||||
0,
|
||||
{ "user", user_option, NEED_ARG },
|
||||
{ "group", group_option, NEED_ARG },
|
||||
{ "umask", umask_option, NEED_ARG },
|
||||
{ "linger", linger_option, NEED_ARG },
|
||||
{ "keepalive", keepalive_option, 0 },
|
||||
{ "spawn", spawn_option, NEED_ARG | EXPAND_ARG },
|
||||
{ "twist", twist_option, NEED_ARG | EXPAND_ARG | USE_LAST },
|
||||
{ "rfc931", rfc931_option, OPT_ARG },
|
||||
{ "setenv", setenv_option, NEED_ARG | EXPAND_ARG },
|
||||
{ "nice", nice_option, OPT_ARG },
|
||||
{ "severity", severity_option, NEED_ARG },
|
||||
{ "allow", allow_option, USE_LAST },
|
||||
{ "deny", deny_option, USE_LAST },
|
||||
{ "banners", banners_option, NEED_ARG },
|
||||
{ NULL, NULL, 0 }
|
||||
};
|
||||
|
||||
/* process_options - process access control options */
|
||||
|
@ -250,7 +279,6 @@ char *value;
|
|||
struct request_info *request;
|
||||
{
|
||||
struct group *grp;
|
||||
struct group *getgrnam();
|
||||
|
||||
if ((grp = getgrnam(value)) == 0)
|
||||
tcpd_jump("unknown group: \"%s\"", value);
|
||||
|
@ -269,7 +297,6 @@ char *value;
|
|||
struct request_info *request;
|
||||
{
|
||||
struct passwd *pwd;
|
||||
struct passwd *getpwnam();
|
||||
char *group;
|
||||
|
||||
if ((group = split_at(value, '.')) != 0)
|
||||
|
@ -447,85 +474,85 @@ struct syslog_names {
|
|||
|
||||
static struct syslog_names log_fac[] = {
|
||||
#ifdef LOG_KERN
|
||||
"kern", LOG_KERN,
|
||||
{ "kern", LOG_KERN },
|
||||
#endif
|
||||
#ifdef LOG_USER
|
||||
"user", LOG_USER,
|
||||
{ "user", LOG_USER },
|
||||
#endif
|
||||
#ifdef LOG_MAIL
|
||||
"mail", LOG_MAIL,
|
||||
{ "mail", LOG_MAIL },
|
||||
#endif
|
||||
#ifdef LOG_DAEMON
|
||||
"daemon", LOG_DAEMON,
|
||||
{ "daemon", LOG_DAEMON },
|
||||
#endif
|
||||
#ifdef LOG_AUTH
|
||||
"auth", LOG_AUTH,
|
||||
{ "auth", LOG_AUTH },
|
||||
#endif
|
||||
#ifdef LOG_LPR
|
||||
"lpr", LOG_LPR,
|
||||
{ "lpr", LOG_LPR },
|
||||
#endif
|
||||
#ifdef LOG_NEWS
|
||||
"news", LOG_NEWS,
|
||||
{ "news", LOG_NEWS },
|
||||
#endif
|
||||
#ifdef LOG_UUCP
|
||||
"uucp", LOG_UUCP,
|
||||
{ "uucp", LOG_UUCP },
|
||||
#endif
|
||||
#ifdef LOG_CRON
|
||||
"cron", LOG_CRON,
|
||||
{ "cron", LOG_CRON },
|
||||
#endif
|
||||
#ifdef LOG_LOCAL0
|
||||
"local0", LOG_LOCAL0,
|
||||
{ "local0", LOG_LOCAL0 },
|
||||
#endif
|
||||
#ifdef LOG_LOCAL1
|
||||
"local1", LOG_LOCAL1,
|
||||
{ "local1", LOG_LOCAL1 },
|
||||
#endif
|
||||
#ifdef LOG_LOCAL2
|
||||
"local2", LOG_LOCAL2,
|
||||
{ "local2", LOG_LOCAL2 },
|
||||
#endif
|
||||
#ifdef LOG_LOCAL3
|
||||
"local3", LOG_LOCAL3,
|
||||
{ "local3", LOG_LOCAL3 },
|
||||
#endif
|
||||
#ifdef LOG_LOCAL4
|
||||
"local4", LOG_LOCAL4,
|
||||
{ "local4", LOG_LOCAL4 },
|
||||
#endif
|
||||
#ifdef LOG_LOCAL5
|
||||
"local5", LOG_LOCAL5,
|
||||
{ "local5", LOG_LOCAL5 },
|
||||
#endif
|
||||
#ifdef LOG_LOCAL6
|
||||
"local6", LOG_LOCAL6,
|
||||
{ "local6", LOG_LOCAL6 },
|
||||
#endif
|
||||
#ifdef LOG_LOCAL7
|
||||
"local7", LOG_LOCAL7,
|
||||
{ "local7", LOG_LOCAL7 },
|
||||
#endif
|
||||
0,
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
static struct syslog_names log_sev[] = {
|
||||
#ifdef LOG_EMERG
|
||||
"emerg", LOG_EMERG,
|
||||
{ "emerg", LOG_EMERG },
|
||||
#endif
|
||||
#ifdef LOG_ALERT
|
||||
"alert", LOG_ALERT,
|
||||
{ "alert", LOG_ALERT },
|
||||
#endif
|
||||
#ifdef LOG_CRIT
|
||||
"crit", LOG_CRIT,
|
||||
{ "crit", LOG_CRIT },
|
||||
#endif
|
||||
#ifdef LOG_ERR
|
||||
"err", LOG_ERR,
|
||||
{ "err", LOG_ERR },
|
||||
#endif
|
||||
#ifdef LOG_WARNING
|
||||
"warning", LOG_WARNING,
|
||||
{ "warning", LOG_WARNING },
|
||||
#endif
|
||||
#ifdef LOG_NOTICE
|
||||
"notice", LOG_NOTICE,
|
||||
{ "notice", LOG_NOTICE },
|
||||
#endif
|
||||
#ifdef LOG_INFO
|
||||
"info", LOG_INFO,
|
||||
{ "info", LOG_INFO },
|
||||
#endif
|
||||
#ifdef LOG_DEBUG
|
||||
"debug", LOG_DEBUG,
|
||||
{ "debug", LOG_DEBUG },
|
||||
#endif
|
||||
0,
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
/* severity_map - lookup facility or severity value */
|
||||
|
@ -541,6 +568,7 @@ char *name;
|
|||
return (t->value);
|
||||
tcpd_jump("bad syslog facility or severity: \"%s\"", name);
|
||||
/* NOTREACHED */
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* severity_option - change logging severity for this event (Dave Mitchell) */
|
||||
|
@ -586,7 +614,7 @@ char *string;
|
|||
if (src[0] == 0)
|
||||
return (0);
|
||||
|
||||
while (ch = *src) {
|
||||
while ((ch = *src) != '\0') {
|
||||
if (ch == ':') {
|
||||
if (*++src == 0)
|
||||
tcpd_warn("rule ends in \":\"");
|
||||
|
@ -606,8 +634,8 @@ char *string;
|
|||
static char *chop_string(string)
|
||||
register char *string;
|
||||
{
|
||||
char *start = 0;
|
||||
char *end;
|
||||
char *start = NULL;
|
||||
char *end = NULL;
|
||||
char *cp;
|
||||
|
||||
for (cp = string; *cp; cp++) {
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* $NetBSD: percent_x.c,v 1.2 1997/10/09 21:20:41 christos Exp $ */
|
||||
|
||||
/*
|
||||
* percent_x() takes a string and performs %<char> expansions. It aborts the
|
||||
* program when the expansion would overflow the output buffer. The result
|
||||
|
@ -10,18 +12,23 @@
|
|||
* Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#) percent_x.c 1.4 94/12/28 17:42:37";
|
||||
#else
|
||||
__RCSID("$NetBSD: percent_x.c,v 1.2 1997/10/09 21:20:41 christos Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* System libraries. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <syslog.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
extern void exit();
|
||||
|
||||
/* Local stuff. */
|
||||
|
||||
#include "tcpd.h"
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* $NetBSD: refuse.c,v 1.2 1997/10/09 21:20:44 christos Exp $ */
|
||||
|
||||
/*
|
||||
* refuse() reports a refused connection, and takes the consequences: in
|
||||
* case of a datagram-oriented service, the unread datagram is taken from
|
||||
|
@ -7,8 +9,13 @@
|
|||
* Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#) refuse.c 1.5 94/12/28 17:42:39";
|
||||
#else
|
||||
__RCSID("$NetBSD: refuse.c,v 1.2 1997/10/09 21:20:44 christos Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* System libraries. */
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* $NetBSD: rfc931.c,v 1.2 1997/10/09 21:20:46 christos Exp $ */
|
||||
|
||||
/*
|
||||
* rfc931() speaks a common subset of the RFC 931, AUTH, TAP, IDENT and RFC
|
||||
* 1413 protocols. It queries an RFC 931 etc. compatible daemon on a remote
|
||||
|
@ -9,8 +11,13 @@
|
|||
* Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#) rfc931.c 1.10 95/01/02 16:11:34";
|
||||
#else
|
||||
__RCSID("$NetBSD: rfc931.c,v 1.2 1997/10/09 21:20:46 christos Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* System libraries. */
|
||||
|
@ -20,6 +27,8 @@ static char sccsid[] = "@(#) rfc931.c 1.10 95/01/02 16:11:34";
|
|||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <setjmp.h>
|
||||
#include <signal.h>
|
||||
#include <string.h>
|
||||
|
@ -35,6 +44,9 @@ int rfc931_timeout = RFC931_TIMEOUT;/* Global so it can be changed */
|
|||
|
||||
static jmp_buf timebuf;
|
||||
|
||||
static FILE *fsocket __P((int, int, int));
|
||||
static void timeout __P((int));
|
||||
|
||||
/* fsocket - open stdio stream on top of socket */
|
||||
|
||||
static FILE *fsocket(domain, type, protocol)
|
||||
|
@ -82,6 +94,10 @@ char *dest;
|
|||
char *result = unknown;
|
||||
FILE *fp;
|
||||
|
||||
#ifdef __GNUC__
|
||||
(void) &result; /* Avoid longjmp clobbering */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Use one unbuffered stdio stream for writing to and for reading from
|
||||
* the RFC931 etc. server. This is done because of a bug in the SunOS
|
||||
|
@ -152,8 +168,8 @@ char *dest;
|
|||
* protocol, not part of the data.
|
||||
*/
|
||||
|
||||
if (cp = strchr(user, '\r'))
|
||||
*cp = 0;
|
||||
if ((cp = strchr(user, '\r')) != NULL)
|
||||
*cp = '\0';
|
||||
result = user;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* $NetBSD: shell_cmd.c,v 1.2 1997/10/09 21:20:48 christos Exp $ */
|
||||
|
||||
/*
|
||||
* shell_cmd() takes a shell command after %<character> substitutions. The
|
||||
* command is executed by a /bin/sh child process, with standard input,
|
||||
|
@ -8,28 +10,35 @@
|
|||
* Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#) shell_cmd.c 1.5 94/12/28 17:42:44";
|
||||
#else
|
||||
__RCSID("$NetBSD: shell_cmd.c,v 1.2 1997/10/09 21:20:48 christos Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* System libraries. */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/wait.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <syslog.h>
|
||||
#include <string.h>
|
||||
|
||||
extern void exit();
|
||||
|
||||
/* Local stuff. */
|
||||
|
||||
#include "tcpd.h"
|
||||
|
||||
/* Forward declarations. */
|
||||
|
||||
static void do_child();
|
||||
static void do_child __P((char *));
|
||||
|
||||
/* shell_cmd - execute shell command */
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* $NetBSD: socket.c,v 1.3 1997/10/09 21:20:50 christos Exp $ */
|
||||
|
||||
/*
|
||||
* This module determines the type of socket (datagram, stream), the client
|
||||
* socket address and port, the server socket address and port. In addition,
|
||||
|
@ -15,8 +17,13 @@
|
|||
* Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#) socket.c 1.14 95/01/30 19:51:50";
|
||||
#else
|
||||
__RCSID("$NetBSD: socket.c,v 1.3 1997/10/09 21:20:50 christos Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* System libraries. */
|
||||
|
@ -29,8 +36,7 @@ static char sccsid[] = "@(#) socket.c 1.14 95/01/30 19:51:50";
|
|||
#include <stdio.h>
|
||||
#include <syslog.h>
|
||||
#include <string.h>
|
||||
|
||||
extern char *inet_ntoa();
|
||||
#include <arpa/inet.h>
|
||||
|
||||
/* Local stuff. */
|
||||
|
||||
|
@ -38,9 +44,10 @@ extern char *inet_ntoa();
|
|||
|
||||
/* Forward declarations. */
|
||||
|
||||
static void sock_sink();
|
||||
static void sock_sink __P((int));
|
||||
|
||||
#ifdef APPEND_DOT
|
||||
static struct hostent *gethostbyname_dot __P((char *));
|
||||
|
||||
/*
|
||||
* Speed up DNS lookups by terminating the host name with a dot. Should be
|
||||
|
|
|
@ -25,10 +25,14 @@ struct request_info {
|
|||
char pid[10]; /* access via eval_pid(request) */
|
||||
struct host_info client[1]; /* client endpoint info */
|
||||
struct host_info server[1]; /* server endpoint info */
|
||||
void (*sink) (); /* datagram sink function or 0 */
|
||||
void (*hostname) (); /* address to printable hostname */
|
||||
void (*hostaddr) (); /* address to printable address */
|
||||
void (*cleanup) (); /* cleanup function or 0 */
|
||||
void (*sink) /* datagram sink function or 0 */
|
||||
__P((int));
|
||||
void (*hostname) /* address to printable hostname */
|
||||
__P((struct host_info *));
|
||||
void (*hostaddr) /* address to printable address */
|
||||
__P((struct host_info *));
|
||||
void (*cleanup) /* cleanup function or 0 */
|
||||
__P((void));
|
||||
struct netconfig *config; /* netdir handle */
|
||||
};
|
||||
|
||||
|
@ -61,20 +65,32 @@ extern char paranoid[];
|
|||
/* Global functions. */
|
||||
|
||||
#if defined(TLI) || defined(PTX) || defined(TLI_SEQUENT)
|
||||
extern void fromhost(); /* get/validate client host info */
|
||||
extern void fromhost /* get/validate client host info */
|
||||
__P((struct request_info *));
|
||||
#else
|
||||
#define fromhost sock_host /* no TLI support needed */
|
||||
#endif
|
||||
|
||||
extern int hosts_access(); /* access control */
|
||||
extern void shell_cmd(); /* execute shell command */
|
||||
extern char *percent_x(); /* do %<char> expansion */
|
||||
extern void rfc931(); /* client name from RFC 931 daemon */
|
||||
extern void clean_exit(); /* clean up and exit */
|
||||
extern void refuse(); /* clean up and exit */
|
||||
extern char *xgets(); /* fgets() on steroids */
|
||||
extern char *split_at(); /* strchr() and split */
|
||||
extern unsigned long dot_quad_addr(); /* restricted inet_addr() */
|
||||
extern int hosts_access /* access control */
|
||||
__P((struct request_info *));
|
||||
extern int hosts_ctl /* limited interface to hosts_access */
|
||||
__P((char *, char *, char *, char *));
|
||||
extern void shell_cmd /* execute shell command */
|
||||
__P((char *));
|
||||
extern char *percent_x /* do %<char> expansion */
|
||||
__P((char *, int, char *, struct request_info *));
|
||||
extern void rfc931 /* client name from RFC 931 daemon */
|
||||
__P((struct sockaddr_in *, struct sockaddr_in *, char *));
|
||||
extern void clean_exit /* clean up and exit */
|
||||
__P((struct request_info *));
|
||||
extern void refuse /* clean up and exit */
|
||||
__P((struct request_info *));
|
||||
extern char *xgets /* fgets() on steroids */
|
||||
__P((char *, int, FILE *));
|
||||
extern char *split_at /* strchr() and split */
|
||||
__P((char *, int));
|
||||
extern unsigned long dot_quad_addr /* restricted inet_addr() */
|
||||
__P((char *));
|
||||
|
||||
/* Global variables. */
|
||||
|
||||
|
@ -91,13 +107,10 @@ extern int resident; /* > 0 if resident process */
|
|||
* attributes. Each attribute has its own key.
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
extern struct request_info *request_init(struct request_info *,...);
|
||||
extern struct request_info *request_set(struct request_info *,...);
|
||||
#else
|
||||
extern struct request_info *request_init(); /* initialize request */
|
||||
extern struct request_info *request_set(); /* update request structure */
|
||||
#endif
|
||||
extern struct request_info *request_init /* initialize request */
|
||||
__P((struct request_info *,...));
|
||||
extern struct request_info *request_set /* update request structure */
|
||||
__P((struct request_info *,...));
|
||||
|
||||
#define RQ_FILE 1 /* file descriptor */
|
||||
#define RQ_DAEMON 2 /* server process (argv[0]) */
|
||||
|
@ -117,27 +130,37 @@ extern struct request_info *request_set(); /* update request structure */
|
|||
* host_info structures serve as caches for the lookup results.
|
||||
*/
|
||||
|
||||
extern char *eval_user(); /* client user */
|
||||
extern char *eval_hostname(); /* printable hostname */
|
||||
extern char *eval_hostaddr(); /* printable host address */
|
||||
extern char *eval_hostinfo(); /* host name or address */
|
||||
extern char *eval_client(); /* whatever is available */
|
||||
extern char *eval_server(); /* whatever is available */
|
||||
extern char *eval_user /* client user */
|
||||
__P((struct request_info *));
|
||||
extern char *eval_hostname /* printable hostname */
|
||||
__P((struct host_info *));
|
||||
extern char *eval_hostaddr /* printable host address */
|
||||
__P((struct host_info *));
|
||||
extern char *eval_hostinfo /* host name or address */
|
||||
__P((struct host_info *));
|
||||
extern char *eval_client /* whatever is available */
|
||||
__P((struct request_info *));
|
||||
extern char *eval_server /* whatever is available */
|
||||
__P((struct request_info *));
|
||||
#define eval_daemon(r) ((r)->daemon) /* daemon process name */
|
||||
#define eval_pid(r) ((r)->pid) /* process id */
|
||||
|
||||
/* Socket-specific methods, including DNS hostname lookups. */
|
||||
|
||||
extern void sock_host(); /* look up endpoint addresses */
|
||||
extern void sock_hostname(); /* translate address to hostname */
|
||||
extern void sock_hostaddr(); /* address to printable address */
|
||||
extern void sock_host /* look up endpoint addresses */
|
||||
__P((struct request_info *));
|
||||
extern void sock_hostname /* translate address to hostname */
|
||||
__P((struct host_info *));
|
||||
extern void sock_hostaddr /* address to printable address */
|
||||
__P((struct host_info *));
|
||||
#define sock_methods(r) \
|
||||
{ (r)->hostname = sock_hostname; (r)->hostaddr = sock_hostaddr; }
|
||||
|
||||
/* The System V Transport-Level Interface (TLI) interface. */
|
||||
|
||||
#if defined(TLI) || defined(PTX) || defined(TLI_SEQUENT)
|
||||
extern void tli_host(); /* look up endpoint addresses etc. */
|
||||
extern void tli_host /* look up endpoint addresses etc. */
|
||||
__P((struct request_info *));
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -146,13 +169,10 @@ extern void tli_host(); /* look up endpoint addresses etc. */
|
|||
* everyone would have to include <setjmp.h>.
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
extern void tcpd_warn(char *, ...); /* report problem and proceed */
|
||||
extern void tcpd_jump(char *, ...); /* report problem and jump */
|
||||
#else
|
||||
extern void tcpd_warn();
|
||||
extern void tcpd_jump();
|
||||
#endif
|
||||
extern void tcpd_warn /* report problem and proceed */
|
||||
__P((char *, ...));
|
||||
extern void tcpd_jump /* report problem and jump */
|
||||
__P((char *, ...));
|
||||
|
||||
struct tcpd_context {
|
||||
char *file; /* current file */
|
||||
|
@ -178,42 +198,44 @@ extern struct tcpd_context tcpd_context;
|
|||
* behavior.
|
||||
*/
|
||||
|
||||
extern void process_options(); /* execute options */
|
||||
extern void process_options /* execute options */
|
||||
__P((char *, struct request_info *));
|
||||
extern int dry_run; /* verification flag */
|
||||
|
||||
extern void fix_options /* get rid of IP-level socket options */
|
||||
__P((struct request_info *));
|
||||
/* Bug workarounds. */
|
||||
|
||||
#ifdef INET_ADDR_BUG /* inet_addr() returns struct */
|
||||
#define inet_addr fix_inet_addr
|
||||
extern long fix_inet_addr();
|
||||
extern long fix_inet_addr __P((char *));
|
||||
#endif
|
||||
|
||||
#ifdef BROKEN_FGETS /* partial reads from sockets */
|
||||
#define fgets fix_fgets
|
||||
extern char *fix_fgets();
|
||||
extern char *fix_fgets __P((char *, int, FILE *));
|
||||
#endif
|
||||
|
||||
#ifdef RECVFROM_BUG /* no address family info */
|
||||
#define recvfrom fix_recvfrom
|
||||
extern int fix_recvfrom();
|
||||
extern int fix_recvfrom __P((int, char *, int, int, struct sockaddr *, int *));
|
||||
#endif
|
||||
|
||||
#ifdef GETPEERNAME_BUG /* claims success with UDP */
|
||||
#define getpeername fix_getpeername
|
||||
extern int fix_getpeername();
|
||||
extern int fix_getpeername __P((int, struct sockaddr *, int *));
|
||||
#endif
|
||||
|
||||
#ifdef SOLARIS_24_GETHOSTBYNAME_BUG /* lists addresses as aliases */
|
||||
#define gethostbyname fix_gethostbyname
|
||||
extern struct hostent *fix_gethostbyname();
|
||||
extern struct hostent *fix_gethostbyname __P((char *));
|
||||
#endif
|
||||
|
||||
#ifdef USE_STRSEP /* libc calls strtok() */
|
||||
#define strtok fix_strtok
|
||||
extern char *fix_strtok();
|
||||
extern char *fix_strtok __P((char *, char *));
|
||||
#endif
|
||||
|
||||
#ifdef LIBC_CALLS_STRTOK /* libc calls strtok() */
|
||||
#define strtok my_strtok
|
||||
extern char *my_strtok();
|
||||
extern char *my_strtok __P((char *, char *));
|
||||
#endif
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* $NetBSD: update.c,v 1.3 1997/10/09 21:20:55 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Routines for controlled update/initialization of request structures.
|
||||
*
|
||||
|
@ -13,8 +15,13 @@
|
|||
* Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#) update.c 1.1 94/12/28 17:42:56";
|
||||
#else
|
||||
__RCSID("$NetBSD: update.c,v 1.3 1997/10/09 21:20:55 christos Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* System libraries */
|
||||
|
@ -22,12 +29,15 @@ static char sccsid[] = "@(#) update.c 1.1 94/12/28 17:42:56";
|
|||
#include <stdio.h>
|
||||
#include <syslog.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/* Local stuff. */
|
||||
|
||||
#include "mystdarg.h"
|
||||
#include "tcpd.h"
|
||||
|
||||
static struct request_info *request_fill __P((struct request_info *, va_list));
|
||||
|
||||
/* request_fill - request update engine */
|
||||
|
||||
static struct request_info *request_fill(request, ap)
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* $NetBSD: workarounds.c,v 1.2 1997/10/09 21:20:58 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Workarounds for known system software bugs. This module provides wrappers
|
||||
* around library functions and system calls that are known to have problems
|
||||
|
@ -7,8 +9,13 @@
|
|||
* Author: Wietse Venema, Eindhoven University of Technology, The Netherlands.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
char sccsid[] = "@(#) workarounds.c 1.6 96/03/19 16:22:25";
|
||||
#else
|
||||
__RCSID("$NetBSD: workarounds.c,v 1.2 1997/10/09 21:20:58 christos Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
|
Loading…
Reference in New Issue