2 * Copyright (c) 1997-2014 Erez Zadok
3 * Copyright (c) 1989 Jan-Simon Pendry
4 * Copyright (c) 1989 Imperial College of Science, Technology & Medicine
5 * Copyright (c) 1989 The Regents of the University of California.
8 * This code is derived from software contributed to Berkeley by
9 * Jan-Simon Pendry at Imperial College, London.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 * 3. Neither the name of the University nor the names of its contributors
20 * may be used to endorse or promote products derived from this software
21 * without specific prior written permission.
23 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * File: am-utils/hlfsd/hlfsd.h
38 * HLFSD was written at Columbia University Computer Science Department, by
39 * Erez Zadok <ezk@cs.columbia.edu> and Alexander Dupuy <dupuy@cs.columbia.edu>
40 * It is being distributed under the same terms and conditions as amd does.
47 * MACROS AND CONSTANTS:
50 #define HLFSD_VERSION "hlfsd 1.2 (1993-2002)"
51 #define PERS_SPOOLMODE 0755
52 #define OPEN_SPOOLMODE 01777
56 * ROOTID and SLINKID are the fixed "faked" node IDs (inodes) for
57 * the '.' (also '..') and the one symlink within the hlfs.
58 * They must always be unique, and should never match what a UID
60 * They used to be -1 and -2, respectively.
62 * I used to cast these to (uid_t) but it failed to compile
63 * with /opt/SUNWspro/bin/cc because uid_t is long, while struct fattr's
64 * uid field is u_int. Then it failed to compile on some linux systems
65 * which define uid_t to be unsigned short, so I used the lowest common
66 * size which is unsigned short.
69 * XXX: this will cause problems to systems with UIDs greater than
70 * MAX_UNSIGNED_SHORT-3.
72 #define ROOTID (((unsigned short) ~0) - 1)
73 #define SLINKID (((unsigned short) ~0) - 2)
75 /* this is also defined in include/am_utils.h */
76 # define INVALIDID (((unsigned short) ~0) - 3)
77 #endif /* not INVALIDID */
80 #define DOTDOTCOOKIE 2
83 #define ALT_SPOOLDIR "/var/hlfs" /* symlink to use if others fail */
84 #define HOME_SUBDIR ".hlfsdir" /* dirname in user's home dir */
85 #define DEFAULT_DIRNAME "/hlfs/home"
86 #define DEFAULT_INTERVAL 900 /* secs b/t re-reads of the password maps */
87 #define DEFAULT_CACHE_INTERVAL 300 /* secs during which assume a link is up */
88 #define DEFAULT_HLFS_GROUP "hlfs" /* Group name for special hlfs_gid */
90 #define PROGNAMESZ (MAXHOSTNAMELEN - 5)
93 # define DEFAULT_LOGFILE "syslog"
94 #else /* not HAVE)_SYSLOG */
95 # define DEFAULT_LOGFILE 0
96 #endif /* not HAVE)_SYSLOG */
102 typedef struct uid2home_t uid2home_t;
103 typedef struct username2uid_t username2uid_t;
110 uid_t uid; /* XXX: with or without UID_OFFSET? */
112 char *home; /* really allocated */
113 char *uname; /* an xref ptr to username2uid_t->username */
114 u_long last_access_time;
115 int last_status; /* 0=used $HOME/.hlfsspool; !0=used alt dir */
118 struct username2uid_t {
119 char *username; /* really allocated */
120 uid_t uid; /* XXX: with or without UID_OFFSET? */
121 char *home; /* an xref ptr to uid2home_t->home */
127 extern RETSIGTYPE cleanup(int);
128 extern RETSIGTYPE interlock(int);
129 extern SVCXPRT *nfs_program_2_transp; /* For quick_reply() */
130 extern SVCXPRT *nfsxprt;
131 extern char *alt_spooldir;
132 extern char *home_subdir;
133 extern char *homedir(int, int);
134 extern char *mailbox(int, char *);
135 extern char *passwdfile;
136 extern char *slinkname;
137 extern gid_t hlfs_gid;
138 extern u_int cache_interval;
140 extern int serverpid;
141 extern int untab_index(char *username);
142 extern am_nfs_fh *root_fhp;
143 extern am_nfs_fh root;
144 extern nfstime startup;
145 extern uid2home_t *plt_search(u_int);
146 extern username2uid_t *untab; /* user name table */
147 extern void fatal(char *);
148 extern void plt_init(void);
149 extern void hlfsd_init_filehandles(void);
151 #if defined(DEBUG) || defined(DEBUG_PRINT)
152 extern void plt_dump(uid2home_t *, pid_t);
153 extern void plt_print(int);
154 #endif /* defined(DEBUG) || defined(DEBUG_PRINT) */
156 #endif /* _HLFSD_HLFS_H */