summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorJoris Vink <joris@cvs.openbsd.org>2005-06-30 16:37:30 +0000
committerJoris Vink <joris@cvs.openbsd.org>2005-06-30 16:37:30 +0000
commite9f5e17f9f537f96f78fba8594079d35d781fe4a (patch)
tree820b7eaeed7b39885a21d3cecb68d78883686098 /usr.bin
parentcc5eb79462b233618d4ba96767c7f482c0784288 (diff)
missing method checks in pre_exec handler.
ok xsa@
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/cvs/history.c58
-rw-r--r--usr.bin/cvs/release.c8
-rw-r--r--usr.bin/cvs/update.c28
3 files changed, 51 insertions, 43 deletions
diff --git a/usr.bin/cvs/history.c b/usr.bin/cvs/history.c
index 225d943b05b..6b47c02e1ce 100644
--- a/usr.bin/cvs/history.c
+++ b/usr.bin/cvs/history.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: history.c,v 1.19 2005/06/28 14:34:56 xsa Exp $ */
+/* $OpenBSD: history.c,v 1.20 2005/06/30 16:37:29 joris Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -168,42 +168,46 @@ cvs_history_init(struct cvs_cmd *cmd, int argc, char **argv, int *arg)
static int
cvs_history_pre_exec(struct cvsroot *root)
{
- if ((flags & CVS_HF_A) && (cvs_sendarg(root, "-a", 0) < 0))
- return (CVS_EX_PROTO);
+ if (root->cr_method != CVS_METHOD_LOCAL) {
+ if ((flags & CVS_HF_A) && (cvs_sendarg(root, "-a", 0) < 0))
+ return (CVS_EX_PROTO);
- if ((flags & CVS_HF_C) && (cvs_sendarg(root, "-c", 0) < 0))
- return (CVS_EX_PROTO);
+ if ((flags & CVS_HF_C) && (cvs_sendarg(root, "-c", 0) < 0))
+ return (CVS_EX_PROTO);
- if ((flags & CVS_HF_O) && (cvs_sendarg(root, "-o", 0) < 0))
- return (CVS_EX_PROTO);
+ if ((flags & CVS_HF_O) && (cvs_sendarg(root, "-o", 0) < 0))
+ return (CVS_EX_PROTO);
- if ((date != NULL) && ((cvs_sendarg(root, "-D", 0) < 0) ||
- (cvs_sendarg(root, date, 0) < 0)))
- return (CVS_EX_PROTO);
+ if ((date != NULL) && ((cvs_sendarg(root, "-D", 0) < 0) ||
+ (cvs_sendarg(root, date, 0) < 0)))
+ return (CVS_EX_PROTO);
- if ((rev != NULL) && ((cvs_sendarg(root, "-r", 0) < 0) ||
- (cvs_sendarg(root, rev, 0) < 0)))
+ if ((rev != NULL) && ((cvs_sendarg(root, "-r", 0) < 0) ||
+ (cvs_sendarg(root, rev, 0) < 0)))
return (CVS_EX_PROTO);
- if ((tag != NULL) && ((cvs_sendarg(root, "-t", 0) < 0) ||
- (cvs_sendarg(root, tag, 0) < 0)))
+ if ((tag != NULL) && ((cvs_sendarg(root, "-t", 0) < 0) ||
+ (cvs_sendarg(root, tag, 0) < 0)))
return (CVS_EX_PROTO);
- /* if no user is specified, get login name of command issuer */
- if (!(flags & CVS_HF_A) && (user == NULL)) {
- if ((user = getlogin()) == NULL) {
- cvs_log(LP_ERRNO, "cannot get login name");
- return (CVS_EX_DATA);
+ /* if no user is specified, get login name of command issuer */
+ if (!(flags & CVS_HF_A) && (user == NULL)) {
+ if ((user = getlogin()) == NULL) {
+ cvs_log(LP_ERRNO, "cannot get login name");
+ return (CVS_EX_DATA);
+ }
+ }
+
+ if (!(flags & CVS_HF_A)) {
+ if ((cvs_sendarg(root, "-u", 0) < 0) ||
+ (cvs_sendarg(root, user, 0) < 0))
+ return (CVS_EX_PROTO);
}
- }
- if (!(flags & CVS_HF_A))
- if ((cvs_sendarg(root, "-u", 0) < 0) ||
- (cvs_sendarg(root, user, 0) < 0))
- return (CVS_EX_PROTO);
- if ((cvs_sendarg(root, "-z", 0) < 0) ||
- (cvs_sendarg(root, zone, 0) < 0))
- return (CVS_EX_PROTO);
+ if ((cvs_sendarg(root, "-z", 0) < 0) ||
+ (cvs_sendarg(root, zone, 0) < 0))
+ return (CVS_EX_PROTO);
+ }
return (0);
}
diff --git a/usr.bin/cvs/release.c b/usr.bin/cvs/release.c
index d2f4e3be8b0..294f316ff94 100644
--- a/usr.bin/cvs/release.c
+++ b/usr.bin/cvs/release.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: release.c,v 1.10 2005/05/31 14:02:15 xsa Exp $ */
+/* $OpenBSD: release.c,v 1.11 2005/06/30 16:37:29 joris Exp $ */
/*
* Copyright (c) 2005 Xavier Santolaria <xsa@openbsd.org>
* All rights reserved.
@@ -94,8 +94,10 @@ cvs_release_init(struct cvs_cmd *cmd, int argc, char **argv, int *arg)
static int
cvs_release_pre_exec(struct cvsroot *root)
{
- if (dflag && cvs_sendarg(root, "-d", 0) < 0)
- return (CVS_EX_PROTO);
+ if (root->cr_method != CVS_METHOD_LOCAL) {
+ if (dflag && cvs_sendarg(root, "-d", 0) < 0)
+ return (CVS_EX_PROTO);
+ }
return (0);
}
diff --git a/usr.bin/cvs/update.c b/usr.bin/cvs/update.c
index 0c90970cdb6..0328709d17f 100644
--- a/usr.bin/cvs/update.c
+++ b/usr.bin/cvs/update.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: update.c,v 1.35 2005/06/17 08:40:42 xsa Exp $ */
+/* $OpenBSD: update.c,v 1.36 2005/06/30 16:37:29 joris Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -134,21 +134,23 @@ cvs_update_init(struct cvs_cmd *cmd, int argc, char **argv, int *arg)
static int
cvs_update_pre_exec(struct cvsroot *root)
{
- if ((cvs_cmd_update.cmd_flags & CVS_CMD_PRUNEDIRS) &&
- (cvs_sendarg(root, "-P", 0) < 0))
- return (CVS_EX_PROTO);
- if (Aflag && cvs_sendarg(root, "-A", 0) < 0)
- return (CVS_EX_PROTO);
- if (dflag && cvs_sendarg(root, "-d", 0) < 0)
- return (CVS_EX_PROTO);
+ if (root->cr_method != CVS_METHOD_LOCAL) {
+ if ((cvs_cmd_update.cmd_flags & CVS_CMD_PRUNEDIRS) &&
+ (cvs_sendarg(root, "-P", 0) < 0))
+ return (CVS_EX_PROTO);
+ if (Aflag && cvs_sendarg(root, "-A", 0) < 0)
+ return (CVS_EX_PROTO);
+ if (dflag && cvs_sendarg(root, "-d", 0) < 0)
+ return (CVS_EX_PROTO);
- if ((rev != NULL) && ((cvs_sendarg(root, "-r", 0) < 0) ||
- (cvs_sendarg(root, rev, 0) < 0)))
+ if ((rev != NULL) && ((cvs_sendarg(root, "-r", 0) < 0) ||
+ (cvs_sendarg(root, rev, 0) < 0)))
return (CVS_EX_PROTO);
- if ((date != NULL) && ((cvs_sendarg(root, "-D", 0) < 0) ||
- (cvs_sendarg(root, date, 0) < 0)))
- return (CVS_EX_PROTO);
+ if ((date != NULL) && ((cvs_sendarg(root, "-D", 0) < 0) ||
+ (cvs_sendarg(root, date, 0) < 0)))
+ return (CVS_EX_PROTO);
+ }
return (0);
}