3 * definitions used in the daemon's source code
5 * Copyright (C)1996-1997 Ian Jackson
7 * This is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with userv; if not, write to the Free Software
19 * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 #include <sys/types.h>
27 #define RESET_CONFIGURATION " \n\
28 cd " USERDIRPREFIX " \n\
30 no-set-environment \n\
33 allow-fd 1-2 write \n\
38 #ifndef SYSTEMCONFIGDIR
40 # define SYSTEMCONFIGDIR "slash-etc"
42 # define SYSTEMCONFIGDIR "/etc"
46 #define USERRCFILE "rc"
47 #define SYSTEMUSERVCONFIGDIR "userv"
48 #define SHELLLIST "shells"
49 #define SYSTEMRCFILEDEFAULT "system.default"
50 #define SYSTEMRCFILEOVERRIDE "system.override"
51 #define NONEINCLUDELOOKUP ":none"
52 #define DEFAULTINCLUDELOOKUP ":default"
53 #define EMPTYINCLUDELOOKUP ":empty"
55 #define USERDIRPREFIX USERDIR DIRSEP
56 #define USERCONFIGDIRBASE SYSTEMUSERVCONFIGDIR
57 #define USERCONFIGDIR HIDDENPREFIX USERCONFIGDIRBASE
58 #define USERUSERVCONFIGPATH USERDIR DIRSEP USERCONFIGDIR
59 #define USERRCFILEPATH USERUSERVCONFIGPATH DIRSEP USERRCFILE
60 #define SYSTEMUSERVCONFIGPATH SYSTEMCONFIGDIR DIRSEP SYSTEMUSERVCONFIGDIR
61 #define SYSTEMRCFILEDEFAULTPATH SYSTEMUSERVCONFIGPATH DIRSEP SYSTEMRCFILEDEFAULT
62 #define SYSTEMRCFILEOVERRIDEPATH SYSTEMUSERVCONFIGPATH DIRSEP SYSTEMRCFILEOVERRIDE
63 #define SHELLLISTPATH SYSTEMCONFIGDIR DIRSEP SHELLLIST
66 #define HIDDENPREFIX "."
68 #define USERVD_LOGIDENT "uservd"
69 #define USERVD_LOGFACILITY LOG_DAEMON
70 #define DEFUSERLOGFACILITY LOG_DAEMON
71 #define DEFUSERLOGLEVEL LOG_ERR
73 #define TOPLEVEL_CONFIGURATION " \n\
75 user-rcfile " USERRCFILEPATH " \n\
77 _include-sysconfig " SYSTEMRCFILEDEFAULTPATH " \n\
78 if grep service-user-shell " SHELLLISTPATH " \n\
81 _include-user-rcfile \n\
85 _include-sysconfig " SYSTEMRCFILEOVERRIDEPATH " \n\
89 #define TOPLEVEL_OVERRIDDEN_CONFIGURATION " \n\
92 _include-client-config \n\
96 #define MAX_INCLUDE_NEST 40
97 #define MAX_ERRMSG_LEN 2048
98 #define ERRMSG_RESERVE_ERRNO 128
100 int parse_string(const char *string, const char *descrip);
101 void parseerrprint(const char *fmt, ...) PRINTFFORMAT(1,2);
102 void ensurelogopen(int wantfacility);
103 void ensurefdarray(int fd);
104 const char *printtoken(int token);
105 void senderrmsgstderr(const char *errmsg);
106 void disconnect(int exitstatus) NONRETURNING;
108 void debug_dumprequest(pid_t mypid);
109 void debug_dumpexecsettings(void);
110 void debug_dumpparameter(const char *parm, char **values);
111 pid_t nondebug_fork(void);
112 const char *nondebug_serviceuserdir(const char *ifnondebug);
115 int iswrite, realfd, holdfd;
117 /* tokv_word_requirefd, tokv_word_allowfd, tokv_nullfd, tokv_word_rejectfd
118 * (all of which have tokt_wantfdstate set) */
120 /* tokv_word_read, tokv_word_write */
123 extern gid_t *gidarray;
124 extern char **argarray;
125 extern char *((*defvararray)[2]);
126 extern struct fdstate *fdarray; /* indexed by nominal fd */
127 extern int fdarraysize, fdarrayused;
128 extern int restfdwantstate, restfdwantrw;
129 extern struct request_msg request_mbuf;
130 extern char *serviceuser, *service, *logname, *cwd;
131 extern char *overridedata, *userrcfile;
132 extern char *serviceuser_dir, *serviceuser_shell, *callinguser_shell;
133 extern uid_t serviceuser_uid, callinguser_uid;
134 extern gid_t serviceuser_gid;
135 extern char *execpath, **execargs;
136 extern int execute; /* One of the execution modes tokt_execmode */
137 extern int setenvironment, suppressargs, disconnecthup;
138 extern int ehandling; /* One of the error handling modes tokt_ehandlemode */
139 extern int ehlogfacility, ehloglevel, syslogopenfacility, ehfilekeep;
141 extern char *ehfilename;