1#pragma ident	"%Z%%M%	%I%	%E% SMI"
2
3/****************************************************************************
4  Copyright (c) 1999,2000 WU-FTPD Development Group.
5  All rights reserved.
6
7  Portions Copyright (c) 1980, 1985, 1988, 1989, 1990, 1991, 1993, 1994
8    The Regents of the University of California.
9  Portions Copyright (c) 1993, 1994 Washington University in Saint Louis.
10  Portions Copyright (c) 1996, 1998 Berkeley Software Design, Inc.
11  Portions Copyright (c) 1989 Massachusetts Institute of Technology.
12  Portions Copyright (c) 1998 Sendmail, Inc.
13  Portions Copyright (c) 1983, 1995, 1996, 1997 Eric P.  Allman.
14  Portions Copyright (c) 1997 by Stan Barber.
15  Portions Copyright (c) 1997 by Kent Landfield.
16  Portions Copyright (c) 1991, 1992, 1993, 1994, 1995, 1996, 1997
17    Free Software Foundation, Inc.
18
19  Use and distribution of this software and its source code are governed
20  by the terms and conditions of the WU-FTPD Software License ("LICENSE").
21
22  If you did not receive a copy of the license, it may be obtained online
23  at http://www.wu-ftpd.org/license.html.
24
25  $Id: hostacc.h,v 1.9 2000/07/01 18:17:39 wuftpd Exp $
26
27****************************************************************************/
28/*
29 *  hostacc.h  -   Header file used in the implementation of
30 *                 host access for the WU-FTPD FTP daemon
31 *
32 * INITIAL AUTHOR - Bart Muijzer    <bartm@cv.ruu.nl>
33 */
34
35#ifdef  HOST_ACCESS
36
37#include <stdio.h>
38#ifdef HAVE_SYS_SYSLOG_H
39#include <sys/syslog.h>
40#endif
41#if defined(HAVE_SYSLOG_H) || (!defined(AUTOCONF) && !defined(HAVE_SYS_SYSLOG_H))
42#include <syslog.h>
43#endif
44#include <string.h>
45#include <stdlib.h>
46#include <errno.h>
47
48#include "pathnames.h"		/* From the ftpd sources    */
49
50/*
51 * Host Access types, as stored in the ha_type field,
52 * and some other constants. All of this is tunable as
53 * long as you don't depend on the values.
54 */
55
56#define ALLOW   1
57#define DENY    2
58
59#define MAXLEN  1024		/* Maximum length of one line in config file */
60#define MAXHST  12		/* Max. number of hosts allowed on one line  */
61
62/* ------------------------------------------------------------------------- */
63
64/*
65 * Structure holding all host-access information
66 */
67
68typedef struct {
69    short ha_type;		/* ALLOW | DENY             */
70    char *ha_login;		/* Loginname to investigate */
71    char *ha_hosts[MAXHST];	/* Array of hostnames       */
72} hacc_t;
73
74/* ------------------------------------------------------------------------ */
75
76static int sethacc(void);
77static int endhacc(void);
78static hacc_t *gethacc(void);
79static void fatalmsg(char *pcMsg);
80static char *strnsav(char *pcStr, int iLen);
81
82#endif /* HOST_ACCESS */
83