X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=userv.git;a=blobdiff_plain;f=common.h;h=6b287da54dc7f833065bcfc8fc88ee1c5e01f569;hp=5fdfd76670a356105e03710135dace489bb4c17a;hb=c7ad3b51358d0b7704e5670d973ad1a376caf4e1;hpb=9f56f874416db295bdb50d448bd99cdd34db969d diff --git a/common.h b/common.h index 5fdfd76..6b287da 100644 --- a/common.h +++ b/common.h @@ -2,7 +2,7 @@ * userv - common.h * definitions shared between client and daemon * - * 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 @@ -43,26 +43,26 @@ 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 PIPEMAXLEN (sizeof(PIPEFORMAT)+PIPEFORMATEXTEND) +# define PIPEFORMATEXTEND ((int)(sizeof(unsigned long)*2*2+(int)sizeof(int)*2+3)) +# define PIPEMAXLEN ((int)(sizeof(PIPEFORMAT)+PIPEFORMATEXTEND)) #endif #ifndef PIPEPATHFORMAT # define PIPEPATHFORMAT VARDIR "/" PIPEFORMAT -# define PIPEPATHMAXLEN (sizeof(PIPEPATHFORMAT)+PIPEFORMATEXTEND) +# define PIPEPATHMAXLEN ((int)(sizeof(PIPEPATHFORMAT)+PIPEFORMATEXTEND)) #endif #define MAX_ALLOW_FD 1024 -#define MAX_INCLUDE_NEST 40 #define MAX_GENERAL_STRING (1024*1024) #define MAX_OVERRIDE_LEN MAX_GENERAL_STRING -#define MAX_ARGSDEFVARS 4096 +#define MAX_ERRMSG_STRING 4096 +#define MAX_ARGSDEFVAR 4096 #define MAX_GIDS 1024 #ifdef DEBUG -# define BASE_MAGIC 0x5deb7567 /* "\x5d\xebug" */ +# define BASE_MAGIC 0x5deb7567UL /* "\x5d\xebug" */ #else -# define BASE_MAGIC 0x755e7276 /* "u\x5erv" */ +# define BASE_MAGIC 0x755e7276UL /* "u\x5erv" */ #endif enum { @@ -77,23 +77,25 @@ enum { struct opening_msg { unsigned long magic; unsigned char protocolchecksumversion[PCSUMSIZE]; - pid_t serverpid; + pid_t overlordpid, serverpid; }; struct request_msg { unsigned long magic; - pid_t clientpid; + pid_t clientpid; /* or -1 if no service is required and this was a version check */ int serviceuserlen; int servicelen; - int lognamelen; - int cwdlen; + int loginnamelen, spoofed; /* spoofed is 0 or 1 */ + 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) + * loginnamelen 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 @@ -116,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 */ };