NetBSD/usr.sbin/amd/hlfsd/hlfsd.h

174 lines
5.9 KiB
C
Raw Normal View History

1998-08-09 02:05:22 +04:00
/* $NetBSD: hlfsd.h,v 1.1.1.4 1998/08/08 22:05:34 christos Exp $ */
1997-10-26 03:02:11 +03:00
1997-07-25 01:19:53 +04:00
/*
1998-08-09 02:05:22 +04:00
* Copyright (c) 1997-1998 Erez Zadok
1997-07-25 01:19:53 +04:00
* Copyright (c) 1989 Jan-Simon Pendry
* Copyright (c) 1989 Imperial College of Science, Technology & Medicine
* Copyright (c) 1989 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Jan-Simon Pendry at Imperial College, London.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* %W% (Berkeley) %G%
*
1997-10-26 03:02:11 +03:00
* Id: hlfs.h,v 1.9 1993/09/13 15:11:00 ezk Exp
1997-07-25 01:19:53 +04:00
*
* HLFSD was written at Columbia University Computer Science Department, by
* Erez Zadok <ezk@cs.columbia.edu> and Alexander Dupuy <dupuy@cs.columbia.edu>
* It is being distributed under the same terms and conditions as amd does.
*/
#ifndef _HLFSD_HLFS_H
#define _HLFSD_HLFS_H
/*
* MACROS AND CONSTANTS:
*/
1998-08-09 02:05:22 +04:00
#define HLFSD_VERSION "hlfsd 1.1 (March 4, 1997-1998)"
1997-07-25 01:19:53 +04:00
#define PERS_SPOOLMODE 0755
#define OPEN_SPOOLMODE 01777
#define DOTSTRING "."
1997-09-23 01:11:12 +04:00
/*
* ROOTID and SLINKID are the fixed "faked" node IDs (inodes) for
* the '.' (also '..') and the one symlink within the hlfs.
* They must always be unique, and should never match what a UID
* could be.
* They used to be -1 and -2, respectively.
1998-08-09 02:05:22 +04:00
*
* I used to cast these to (uid_t) but it failed to compile
* with /opt/SUNWspro/bin/cc because uid_t is long, while struct fattr's
* uid field is u_int. Then it failed to compile on some linux systems
* which define uid_t to be unsigned short, so I used the lowest common
* size which is unsigned short.
*/
#ifdef EXPERIMENTAL_UID_SIZE
#define UID_SHIFT 30
# define ROOTID ((1 << UID_SHIFT) - 1)
# define SLINKID ((1 << UID_SHIFT) - 2)
# define INVALIDID ((1 << UID_SHIFT) - 3)
#else /* not EXPERIMENTAL_UID_SIZE */
/*
* XXX: this will cause problems to systems with UIDs greater than
* MAX_UNSIGNED_SHORT-3.
1997-09-23 01:11:12 +04:00
*/
1998-08-09 02:05:22 +04:00
# define ROOTID (((unsigned short) ~0) - 1)
# define SLINKID (((unsigned short) ~0) - 2)
# define INVALIDID (((unsigned short) ~0) - 3)
#endif /* not EXPERIMENTAL_UID_SIZE */
1997-09-23 01:11:12 +04:00
1997-07-25 01:19:53 +04:00
#define DOTCOOKIE 1
#define DOTDOTCOOKIE 2
#define SLINKCOOKIE 3
#define ALT_SPOOLDIR "/var/hlfs" /* symlink to use if others fail */
#define HOME_SUBDIR ".hlfsdir" /* dirname in user's home dir */
#define DEFAULT_DIRNAME "/hlfs/home"
#define DEFAULT_INTERVAL 900 /* secs b/t re-reads of the password maps */
#define DEFAULT_CACHE_INTERVAL 300 /* secs during which assume a link is up */
#define DEFAULT_HLFS_GROUP "hlfs" /* Group name for special hlfs_gid */
#define PROGNAMESZ (MAXHOSTNAMELEN - 5)
#ifdef HAVE_SYSLOG
# define DEFAULT_LOGFILE "syslog"
#else /* not HAVE)_SYSLOG */
# define DEFAULT_LOGFILE 0
#endif /* not HAVE)_SYSLOG */
#define ERRM ": %m"
#define fatalerror(str) \
(fatal (strcat (strnsave ((str), strlen ((str)) + sizeof (ERRM) - 1), ERRM)))
/*
* TYPDEFS:
*/
typedef struct uid2home_t uid2home_t;
typedef struct username2uid_t username2uid_t;
/*
* STRUCTURES:
*/
struct uid2home_t {
1998-08-09 02:05:22 +04:00
uid_t uid; /* XXX: with or without UID_OFFSET? */
1997-07-25 01:19:53 +04:00
pid_t child;
1998-08-09 02:05:22 +04:00
char *home; /* really allocated */
char *uname; /* an xref ptr to username2uid_t->username */
1997-07-25 01:19:53 +04:00
u_long last_access_time;
int last_status; /* 0=used $HOME/.hlfsspool; !0=used alt dir */
};
struct username2uid_t {
1998-08-09 02:05:22 +04:00
char *username; /* really allocated */
uid_t uid; /* XXX: with or without UID_OFFSET? */
char *home; /* an xref ptr to uid2home_t->home */
1997-07-25 01:19:53 +04:00
};
/*
* EXTERNALS:
*/
extern RETSIGTYPE cleanup(int);
extern RETSIGTYPE interlock(int);
extern SVCXPRT *nfs_program_2_transp; /* For quick_reply() */
extern SVCXPRT *nfsxprt;
extern char *alt_spooldir;
extern char *home_subdir;
extern char *homedir(int);
extern char *mailbox(int, char *);
1997-10-26 03:02:11 +03:00
extern char *passwdfile;
1997-07-25 01:19:53 +04:00
extern char *slinkname;
extern char mboxfile[];
1998-08-09 02:05:22 +04:00
extern gid_t hlfs_gid;
1997-07-25 01:19:53 +04:00
extern int cache_interval;
extern int noverify;
extern int serverpid;
extern int sys_nerr;
extern int untab_index(char *username);
extern am_nfs_fh *root_fhp;
extern am_nfs_fh root;
extern nfstime startup;
extern uid2home_t *plt_search(int);
extern username2uid_t *untab; /* user name table */
extern void fatal(char *);
1998-08-09 02:05:22 +04:00
extern void plt_init(void);
1997-09-23 01:11:12 +04:00
extern void hlfsd_init_filehandles(void);
1997-07-25 01:19:53 +04:00
#if defined(DEBUG) || defined(DEBUG_PRINT)
extern void plt_dump(uid2home_t *, pid_t);
extern void plt_print(int);
#endif /* defined(DEBUG) || defined(DEBUG_PRINT) */
#endif /* _HLFSD_HLFS_H */