chiark / gitweb /
Patch from Peter Benie.
[userv.git] / daemon.h
index 7b06bf7b77a6e6f3cc1c8a609059c7c433352623..b1e8622adad3d86fa47aa898cf7a5501724ef87c 100644 (file)
--- a/daemon.h
+++ b/daemon.h
@@ -2,7 +2,7 @@
  * userv - daemon.h
  * definitions used in the daemon's source code
  *
- * Copyright (C)1996-1997 Ian Jackson
+ * Copyright (C)1996-1997,1999 Ian Jackson
  *
  * This is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by
@@ -33,6 +33,7 @@
   allow-fd 1-2 write          \n\
   reject-fd 3-                \n\
   disconnect-hup              \n\
+  include-lookup-quote-new    \n\
 "
 
 #ifndef SYSTEMCONFIGDIR
@@ -65,8 +66,8 @@
 #define EMPTYINCLUDELOOKUP          ":empty"
 
 #define USERCONFIGDIRBASE           SYSTEMUSERVCONFIGDIR
-#define USERCONFIGDIR               HIDDENPREFIX USERCONFIGDIRBASE
-#define USERUSERVCONFIGPATH         USERDIR "/" USERCONFIGDIR
+#define USERCONFIGDIR               "." USERCONFIGDIRBASE
+#define USERUSERVCONFIGPATH         "~/" USERCONFIGDIR
 #define USERRCFILEPATH              USERUSERVCONFIGPATH "/" USERRCFILE
 #define SYSTEMUSERVCONFIGPATH       SYSTEMCONFIGDIR "/" SYSTEMUSERVCONFIGDIR
 #define SYSTEMRCFILEDEFAULTPATH     SYSTEMUSERVCONFIGPATH "/" SYSTEMRCFILEDEFAULT
 #define SHELLLISTPATH               SYSTEMCONFIGDIR "/" SHELLLIST
 #define SETENVIRONMENTPATH          SYSTEMCONFIGDIR "/" SETENVIRONMENT
 
-#define USERDIR                     "~"
-#define HIDDENPREFIX                "."
-
 #define USERVD_LOGIDENT "uservd"
+#define USERVDCHECK_LOGIDENT "uservd/check"
 #define USERVD_LOGFACILITY LOG_DAEMON
-#define DEFUSERLOGFACILITY LOG_DAEMON
+#define DEFUSERLOGFACILITY LOG_USER
 #define DEFUSERLOGLEVEL LOG_ERR
 
 #define TOPLEVEL_CONFIGURATION "                   \n\
   quit                                             \n\
 "
 
+#define USERVD_MYSELF_CHECK 3600
+#define USERVD_MYSELF_TIMEOUT 60
+#define USERVD_CHECKFORK_RETRY 60
 #define MAX_INCLUDE_NEST 40
-#define MAX_ERRMSG_LEN 2048
+#define MAX_ERRMSG_LEN (MAX_ERRMSG_STRING-1024)
 #define ERRMSG_RESERVE_ERRNO 128
 
 int parse_string(const char *string, const char *descrip, int isinternal);
-void parseerrprint(const char *fmt, ...) PRINTFFORMAT(1,2);
+int parseerrprint(const char *fmt, ...) PRINTFFORMAT(1,2);
 void ensurelogopen(int wantfacility);
 void ensurefdarray(int fd);
 const char *printtoken(int token);
@@ -128,9 +130,10 @@ const char *nondebug_serviceuserdir(const char *ifnondebug);
 
 typedef void builtinserviceexec_fnt(const char *const *args);
 builtinserviceexec_fnt NONRETURNING bisexec_environment, bisexec_parameter;
-builtinserviceexec_fnt NONRETURNING bisexec_version;
+builtinserviceexec_fnt NONRETURNING bisexec_version, bisexec_help;
 builtinserviceexec_fnt NONRETURNING bisexec_toplevel, bisexec_override, bisexec_reset;
-builtinserviceexec_fnt NONRETURNING bisexec_execute;
+builtinserviceexec_fnt NONRETURNING bisexec_execute, bisexec_shutdown;
+extern const char *const builtinservicehelpstrings[];
 
 void execservice(const int synchsocket[], int clientfd) NONRETURNING;
 void servicerequest(int sfd) NONRETURNING;
@@ -138,16 +141,17 @@ int synchread(int fd, int ch);
 const char *defaultpath(void);
 
 struct fdstate {
-  int iswrite, realfd, holdfd;
+  int iswrite; /* 0 or 1; -1 if not open */
+  int realfd, holdfd; /* -1 if not open */
   int wantstate;
   /* tokv_word_requirefd, tokv_word_allowfd, tokv_nullfd, tokv_word_rejectfd
    * (all of which have tokt_wantfdstate set) */
-  int wantrw;
-  /* tokv_word_read, tokv_word_write */
+  int wantrw; /* tokv_word_read, tokv_word_write, 0 for either/both */
 };
 
 struct keyvaluepair { char *key, *value; };
 
+extern pid_t overlordpid;
 extern struct request_msg request_mbuf;
 extern struct keyvaluepair *defvararray;
 extern struct fdstate *fdarray; /* indexed by nominal fd */
@@ -155,7 +159,7 @@ extern int fdarraysize, fdarrayused;
 extern int restfdwantstate, restfdwantrw;
 extern int service_ngids;
 extern char **argarray;
-extern char *serviceuser, *service, *logname, *cwd;
+extern char *serviceuser, *service, *loginname, *cwd;
 extern char *overridedata, *userrcfile;
 extern char *serviceuser_dir, *serviceuser_shell, *callinguser_shell;
 extern gid_t *calling_gids, *service_gids;