diff options
-rw-r--r-- | gnu/usr.bin/cvs/src/parseinfo.c | 23 | ||||
-rw-r--r-- | gnu/usr.bin/cvs/src/server.c | 25 | ||||
-rw-r--r-- | gnu/usr.bin/cvs/src/server.h | 133 |
3 files changed, 139 insertions, 42 deletions
diff --git a/gnu/usr.bin/cvs/src/parseinfo.c b/gnu/usr.bin/cvs/src/parseinfo.c index 9d501ffcb53..19a960c6c94 100644 --- a/gnu/usr.bin/cvs/src/parseinfo.c +++ b/gnu/usr.bin/cvs/src/parseinfo.c @@ -359,6 +359,29 @@ parse_config (cvsroot) } #endif /* BSD */ } + else if (strcmp (line, "DisableXProg") == 0) + { + if (strcmp (p, "no") == 0) +#ifdef AUTH_SERVER_SUPPORT + disable_x_prog = 0; +#else + /* Still parse the syntax but ignore the + option. That way the same config file can + be used for local and server. */ + ; +#endif + else if (strcmp (p, "yes") == 0) +#ifdef AUTH_SERVER_SUPPORT + disable_x_prog = 1; +#else + ; +#endif + else + { + error (0, 0, "unrecognized value '%s' for DisableXProg", p); + goto error_return; + } + } else if (strcmp (line, "PreservePermissions") == 0) { if (strcmp (p, "no") == 0) diff --git a/gnu/usr.bin/cvs/src/server.c b/gnu/usr.bin/cvs/src/server.c index 4a61b1dbf14..0fba6ee9f2a 100644 --- a/gnu/usr.bin/cvs/src/server.c +++ b/gnu/usr.bin/cvs/src/server.c @@ -115,6 +115,10 @@ static char *Pserver_Repos = NULL; CVSROOT/config. */ int system_auth = 1; +/* Should we disable Update-prog/Checkin-prog? Can be changed by + CVSROOT/config. */ +int disable_x_prog = 0; + # endif /* AUTH_SERVER_SUPPORT */ @@ -4629,6 +4633,17 @@ serve_checkin_prog (arg) char *arg; { FILE *f; + + /* Before we do anything we first check if this command is not + disabled. */ + if (disable_x_prog) + { + if (alloc_pending (80)) + sprintf (pending_error_text, "\ +E Checkin-prog disabled by configuration"); + return; + } + f = CVS_FOPEN (CVSADM_CIPROG, "w+"); if (f == NULL) { @@ -4663,6 +4678,16 @@ serve_update_prog (arg) { FILE *f; + /* Before we do anything we first check if this command is not + disabled. */ + if (disable_x_prog) + { + if (alloc_pending (80)) + sprintf (pending_error_text, "\ +E Update-prog disabled by configuration"); + return; + } + /* Before we do anything we need to make sure we are not in readonly mode. */ if (!check_command_legal_p ("commit")) diff --git a/gnu/usr.bin/cvs/src/server.h b/gnu/usr.bin/cvs/src/server.h index d0560be7661..a6055a36c7d 100644 --- a/gnu/usr.bin/cvs/src/server.h +++ b/gnu/usr.bin/cvs/src/server.h @@ -7,6 +7,16 @@ #define STDERR_FILENO 2 #endif + +/* + * Expand to `S', ` ', or the empty string. Used in `%s-> ...' trace printfs. + */ +#ifdef SERVER_SUPPORT +# define CLIENT_SERVER_STR ((server_active) ? "S" : " ") +#else +# define CLIENT_SERVER_STR "" +#endif + #ifdef SERVER_SUPPORT /* @@ -21,11 +31,19 @@ extern int server_expanding; /* Run the server. */ extern int server PROTO((int argc, char **argv)); +/* See server.c for description. */ +extern void server_pathname_check PROTO ((char *)); + /* We have a new Entries line for a file. TAG or DATE can be NULL. */ extern void server_register PROTO((char *name, char *version, char *timestamp, char *options, char *tag, char *date, char *conflict)); +/* Set the modification time of the next file sent. This must be + followed by a call to server_updated on the same file. */ +extern void server_modtime PROTO ((struct file_info *finfo, + Vers_TS *vers_ts)); + /* * We want to nuke the Entries line for a file, and (unless * server_scratch_entry_only is subsequently called) the file itself. @@ -49,19 +67,37 @@ extern void server_checked_in extern void server_copy_file PROTO((char *file, char *update_dir, char *repository, char *newfile)); -/* - * We just successfully updated FILE (bare filename, no directory). - * REPOSITORY is the directory for the repository. This is called - * after server_register or server_scratch, in the latter case the - * file is to be removed. UPDATED indicates whether the file is now - * up to date (SERVER_UPDATED, yes, SERVER_MERGED, no, SERVER_PATCHED, - * yes, but file is a diff from user version to repository version). - */ -enum server_updated_arg4 {SERVER_UPDATED, SERVER_MERGED, SERVER_PATCHED}; +/* Send the appropriate responses for a file described by FINFO and + VERS. This is called after server_register or server_scratch. In + the latter case the file is to be removed (and VERS can be NULL). + In the former case, VERS must be non-NULL, and UPDATED indicates + whether the file is now up to date (SERVER_UPDATED, yes, + SERVER_MERGED, no, SERVER_PATCHED, yes, but file is a diff from + user version to repository version, SERVER_RCS_DIFF, yes, like + SERVER_PATCHED but with an RCS style diff). MODE is the mode the + file should get, or (mode_t) -1 if this should be obtained from the + file itself. CHECKSUM is the MD5 checksum of the file, or NULL if + this need not be sent. If FILEBUF is not NULL, it holds the + contents of the file, in which case the file itself may not exist. + If FILEBUF is not NULL, server_updated will free it. */ +enum server_updated_arg4 +{ + SERVER_UPDATED, + SERVER_MERGED, + SERVER_PATCHED, + SERVER_RCS_DIFF +}; +#ifdef __STDC__ +struct buffer; +#endif + extern void server_updated - PROTO((char *file, char *update_dir, char *repository, - enum server_updated_arg4 updated, struct stat *, - unsigned char *checksum)); + PROTO((struct file_info *finfo, Vers_TS *vers, + enum server_updated_arg4 updated, mode_t mode, + unsigned char *checksum, struct buffer *filebuf)); + +/* Whether we should send RCS format patches. */ +extern int server_use_rcs_diff PROTO((void)); /* Set the Entries.Static flag. */ extern void server_set_entstat PROTO((char *update_dir, char *repository)); @@ -70,15 +106,33 @@ extern void server_clear_entstat PROTO((char *update_dir, char *repository)); /* Set or clear a per-directory sticky tag or date. */ extern void server_set_sticky PROTO((char *update_dir, char *repository, - char *tag, - char *date)); + char *tag, char *date, int nonbranch)); +/* Send Template response. */ +extern void server_template PROTO ((char *, char *)); extern void server_update_entries PROTO((char *file, char *update_dir, char *repository, - enum server_updated_arg4 updated)); + enum server_updated_arg4 updated)); + +/* Pointer to a malloc'd string which is the directory which + the server should prepend to the pathnames which it sends + to the client. */ +extern char *server_dir; enum progs {PROG_CHECKIN, PROG_UPDATE}; extern void server_prog PROTO((char *, char *, enum progs)); +extern void server_cleanup PROTO((int sig)); + +#ifdef SERVER_FLOWCONTROL +/* Pause if it's convenient to avoid memory blowout */ +extern void server_pause_check PROTO((void)); +#endif /* SERVER_FLOWCONTROL */ + +#ifdef AUTH_SERVER_SUPPORT +extern char *CVS_Username; +extern int system_auth; +extern int disable_x_prog; +#endif /* AUTH_SERVER_SUPPORT */ #endif /* SERVER_SUPPORT */ @@ -96,35 +150,30 @@ struct request void (*func) PROTO((char *args)); #endif - /* Stuff for use by the client. */ - enum { - /* - * Failure to implement this request can imply a fatal - * error. This should be set only for commands which were in the - * original version of the protocol; it should not be set for new - * commands. - */ - rq_essential, - - /* Some servers might lack this request. */ - rq_optional, - - /* - * Set by the client to one of the following based on what this - * server actually supports. - */ - rq_supported, - rq_not_supported, - - /* - * If the server supports this request, and we do too, tell the - * server by making the request. - */ - rq_enableme - } status; + /* One or more of the RQ_* flags described below. */ + int flags; + + /* If set, failure to implement this request can imply a fatal + error. This should be set only for commands which were in the + original version of the protocol; it should not be set for new + commands. */ +#define RQ_ESSENTIAL 1 + + /* Set by the client if the server we are talking to supports it. */ +#define RQ_SUPPORTED 2 + + /* If set, and client and server both support the request, the + client should tell the server by making the request. */ +#define RQ_ENABLEME 4 + + /* The server may accept this request before "Root". */ +#define RQ_ROOTLESS 8 }; /* Table of requests ending with an entry with a NULL name. */ extern struct request requests[]; -extern int use_unchanged; +/* Gzip library, see zlib.c. */ +extern int gunzip_and_write PROTO ((int, char *, unsigned char *, size_t)); +extern int read_and_gzip PROTO ((int, char *, unsigned char **, size_t *, + size_t *, int)); |