chiark / gitweb /
Internal code review complete.
[userv.git] / common.h
index 73e015275594688e67fb039c489d63d9c77cb0b6..2a2db41eb2c315b63ff26c0549b44ffca324f74a 100644 (file)
--- a/common.h
+++ b/common.h
@@ -43,7 +43,7 @@ static const unsigned char protocolchecksumversion[PCSUMSIZE]= {
 #ifndef PIPEFORMAT
 # define PIPEFORMAT "%lx.%lx.%x"
 # define PIPEPATTERN "[0-9a-f]*.[0-9a-f]*.*[0-9a-f]"
-# define PIPEFORMATEXTEND (sizeof(long)*2*2+sizeof(int)*2+1)
+# define PIPEFORMATEXTEND (sizeof(unsigned long)*2*2+sizeof(int)*2+3)
 # define PIPEMAXLEN (sizeof(PIPEFORMAT)+PIPEFORMATEXTEND)
 #endif
 
@@ -55,6 +55,7 @@ static const unsigned char protocolchecksumversion[PCSUMSIZE]= {
 #define MAX_ALLOW_FD 1024
 #define MAX_GENERAL_STRING (1024*1024)
 #define MAX_OVERRIDE_LEN MAX_GENERAL_STRING
+#define MAX_ERRMSG_STRING 4096
 #define MAX_ARGSDEFVAR 4096
 #define MAX_GIDS 1024
 
@@ -85,14 +86,16 @@ struct request_msg {
   int serviceuserlen;
   int servicelen;
   int lognamelen;
-  int cwdlen;
+  int cwdlen, overridelen;
   uid_t callinguid;
-  int ngids, nreadfds, nwritefds, nargs, nvars, overridelen;
+  int ngids, nreadfds, nwritefds, nargs, nvars;
   /* Followed by:
    *   serviceuserlen bytes for the service user (unterminated)
    *   servicelen bytes for the service (unterminated)
    *   lognamelen bytes for the login name (unterminated)
    *   cwdlen bytes for the cwd (unterminated)
+   *   overridelen bytes for the override data (with extra \n but unterminated),
+   *    or nothing if overridelen==-1
    *   ngids gid_ts for the primary group and supplementary groups
    *   nreadfds and then nwritefds ints for the file descriptors
    *   for each of the nargs arguments
@@ -115,10 +118,9 @@ struct progress_msg {
     struct { int status; } terminated;
   } data;
   /* follwed by variable-length part:
-   *  for ok: nothing
-   *  for errmsg: messagelen bytes for the error message (unterminated)
-   *              unsigned long PROGRESS_MAGIC
-   *  for terminated: nothing
+   *  for ok, failed, terminated: nothing
+   *  for errmsg: messagelen bytes for the error message (unterminated, no \n)
+   *              unsigned long PROGRESS_ERRMSG_END_MAGIC
    */
 };