diff options
-rw-r--r-- | usr.bin/cvs/client.c | 52 | ||||
-rw-r--r-- | usr.bin/cvs/remote.h | 4 | ||||
-rw-r--r-- | usr.bin/cvs/server.c | 6 |
3 files changed, 40 insertions, 22 deletions
diff --git a/usr.bin/cvs/client.c b/usr.bin/cvs/client.c index 80c50bf6693..c6b4ab9347e 100644 --- a/usr.bin/cvs/client.c +++ b/usr.bin/cvs/client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: client.c,v 1.65 2007/06/27 03:58:16 joris Exp $ */ +/* $OpenBSD: client.c,v 1.66 2007/06/27 20:42:19 joris Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * @@ -37,12 +37,17 @@ struct cvs_req cvs_requests[] = { { "Valid-responses", 1, cvs_server_validresp, REQ_NEEDED }, { "valid-requests", 1, cvs_server_validreq, REQ_NEEDED }, { "Directory", 0, cvs_server_directory, REQ_NEEDED }, - { "Static-directory", 0, cvs_server_static_directory, REQ_NEEDED }, - { "Sticky", 0, cvs_server_sticky, REQ_NEEDED }, - { "Entry", 0, cvs_server_entry, REQ_NEEDED }, - { "Modified", 0, cvs_server_modified, REQ_NEEDED }, + { "Static-directory", 0, cvs_server_static_directory, + REQ_NEEDED | REQ_NEEDDIR }, + { "Sticky", 0, cvs_server_sticky, + REQ_NEEDED | REQ_NEEDDIR }, + { "Entry", 0, cvs_server_entry, + REQ_NEEDED | REQ_NEEDDIR }, + { "Modified", 0, cvs_server_modified, + REQ_NEEDED | REQ_NEEDDIR }, { "UseUnchanged", 0, cvs_server_useunchanged, REQ_NEEDED }, - { "Unchanged", 0, cvs_server_unchanged, REQ_NEEDED }, + { "Unchanged", 0, cvs_server_unchanged, + REQ_NEEDED | REQ_NEEDDIR }, { "Questionable", 0, cvs_server_questionable, REQ_NEEDED }, { "Argument", 0, cvs_server_argument, REQ_NEEDED }, { "Argumentx", 0, cvs_server_argumentx, REQ_NEEDED }, @@ -69,22 +74,28 @@ struct cvs_req cvs_requests[] = { { "expand-modules", 0, NULL, 0 }, /* commands that might be supported */ - { "ci", 0, cvs_server_commit, 0 }, - { "co", 0, cvs_server_checkout, 0 }, - { "update", 0, cvs_server_update, 0 }, - { "diff", 0, cvs_server_diff, 0 }, - { "log", 0, cvs_server_log, 0 }, - { "rlog", 0, cvs_server_rlog, 0 }, - { "add", 0, cvs_server_add, 0 }, - { "remove", 0, cvs_server_remove, 0 }, + { "ci", 0, cvs_server_commit, + REQ_NEEDDIR }, + { "co", 0, cvs_server_checkout, + REQ_NEEDDIR }, + { "update", 0, cvs_server_update, + REQ_NEEDDIR }, + { "diff", 0, cvs_server_diff, REQ_NEEDDIR }, + { "log", 0, cvs_server_log, REQ_NEEDDIR }, + { "rlog", 0, cvs_server_rlog, REQ_NEEDDIR }, + { "add", 0, cvs_server_add, REQ_NEEDDIR }, + { "remove", 0, cvs_server_remove, + REQ_NEEDDIR }, { "update-patches", 0, cvs_server_update_patches, 0 }, { "gzip-file-contents", 0, NULL, 0 }, - { "status", 0, cvs_server_status, 0 }, + { "status", 0, cvs_server_status, + REQ_NEEDDIR }, { "rdiff", 0, NULL, 0 }, - { "tag", 0, cvs_server_tag, 0 }, + { "tag", 0, cvs_server_tag, REQ_NEEDDIR }, { "rtag", 0, NULL, 0 }, - { "import", 0, cvs_server_import, 0 }, - { "admin", 0, cvs_server_admin, 0 }, + { "import", 0, cvs_server_import, + REQ_NEEDDIR }, + { "admin", 0, cvs_server_admin, REQ_NEEDDIR }, { "export", 0, NULL, 0 }, { "history", 0, NULL, 0 }, { "release", 0, NULL, 0 }, @@ -94,8 +105,9 @@ struct cvs_req cvs_requests[] = { { "watch-remove", 0, NULL, 0 }, { "watchers", 0, NULL, 0 }, { "editors", 0, NULL, 0 }, - { "init", 0, cvs_server_init, 0 }, - { "annotate", 0, cvs_server_annotate, 0 }, + { "init", 0, cvs_server_init, REQ_NEEDDIR }, + { "annotate", 0, cvs_server_annotate, + REQ_NEEDDIR }, { "rannotate", 0, NULL, 0 }, { "noop", 0, NULL, 0 }, { "version", 0, cvs_server_version, 0 }, diff --git a/usr.bin/cvs/remote.h b/usr.bin/cvs/remote.h index 588acd80b66..08d537f8625 100644 --- a/usr.bin/cvs/remote.h +++ b/usr.bin/cvs/remote.h @@ -1,4 +1,4 @@ -/* $OpenBSD: remote.h,v 1.21 2007/06/26 02:24:10 niallo Exp $ */ +/* $OpenBSD: remote.h,v 1.22 2007/06/27 20:42:19 joris Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * @@ -35,6 +35,8 @@ struct cvs_resp { }; #define REQ_NEEDED 0x01 +#define REQ_NEEDDIR 0x02 + #define RESP_NEEDED 0x01 extern int server_response; diff --git a/usr.bin/cvs/server.c b/usr.bin/cvs/server.c index b0af3d74332..2499afeafe3 100644 --- a/usr.bin/cvs/server.c +++ b/usr.bin/cvs/server.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server.c,v 1.62 2007/06/26 02:24:10 niallo Exp $ */ +/* $OpenBSD: server.c,v 1.63 2007/06/27 20:42:19 joris Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * @@ -115,6 +115,10 @@ cvs_server(int argc, char **argv) if (req->hdlr == NULL) fatal("opencvs server does not support '%s'", cmd); + if ((req->flags & REQ_NEEDDIR) && (server_currentdir == NULL)) + fatal("`%s' needs a directory to be sent with " + "the `Directory` request first", cmd); + (*req->hdlr)(data); xfree(cmd); } |