summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjfb <jfb@openbsd.org>2005-04-20 23:11:30 +0000
committerjfb <jfb@openbsd.org>2005-04-20 23:11:30 +0000
commit5be71afa79e43a07b241b25a06c2c4bedab13dc5 (patch)
tree39252d6171d61bea1f7a9b5e38ec90d70bb8d992
parentMake vlan(4) aware of its physical interface link state. (diff)
downloadwireguard-openbsd-5be71afa79e43a07b241b25a06c2c4bedab13dc5.tar.xz
wireguard-openbsd-5be71afa79e43a07b241b25a06c2c4bedab13dc5.zip
check the validity of tag names passed to the tag command, and print
an abort message if the tag is invalid. also, match gnu cvs behaviour with regards to command usage output on usage errors. ok joris
-rw-r--r--usr.bin/cvs/cvs.c16
-rw-r--r--usr.bin/cvs/cvs.h3
-rw-r--r--usr.bin/cvs/rcs.c4
-rw-r--r--usr.bin/cvs/rcs.h5
-rw-r--r--usr.bin/cvs/tag.c9
5 files changed, 21 insertions, 16 deletions
diff --git a/usr.bin/cvs/cvs.c b/usr.bin/cvs/cvs.c
index 761de4aef2f..560a52da034 100644
--- a/usr.bin/cvs/cvs.c
+++ b/usr.bin/cvs/cvs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cvs.c,v 1.54 2005/04/16 19:05:02 xsa Exp $ */
+/* $OpenBSD: cvs.c,v 1.55 2005/04/20 23:11:30 jfb Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -421,29 +421,23 @@ main(int argc, char **argv)
cmd_argv[cmd_argc++] = argv[ret];
ret = cvs_startcmd(cmdp, cmd_argc, cmd_argv);
- if (ret > 0)
- fprintf(stderr, "%s [%s aborted]: ", __progname, cvs_command);
-
switch (ret) {
case CVS_EX_USAGE:
- fprintf(stderr, "Usage: %s", cmdp->cmd_synopsis);
+ fprintf(stderr, "Usage: %s\n", cmdp->cmd_synopsis);
break;
case CVS_EX_DATA:
- fprintf(stderr, "internal data error");
+ cvs_log(LP_ABORT, "internal data error");
break;
case CVS_EX_PROTO:
- fprintf(stderr, "protocol error");
+ cvs_log(LP_ABORT, "protocol error");
break;
case CVS_EX_FILE:
- fprintf(stderr, "an operation on a file or directory failed");
+ cvs_log(LP_ABORT, "an operation on a file or directory failed");
break;
default:
break;
}
- if (ret > 0)
- fprintf(stderr, "\n");
-
if (cmdp->cmd_info->cmd_cleanup != NULL)
cmdp->cmd_info->cmd_cleanup();
if (cvs_files != NULL)
diff --git a/usr.bin/cvs/cvs.h b/usr.bin/cvs/cvs.h
index 4f9a8bc3fea..7a4c1773551 100644
--- a/usr.bin/cvs/cvs.h
+++ b/usr.bin/cvs/cvs.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cvs.h,v 1.51 2005/04/20 18:33:30 jfb Exp $ */
+/* $OpenBSD: cvs.h,v 1.52 2005/04/20 23:11:30 jfb Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -51,6 +51,7 @@
#define CVS_EX_DATA 2
#define CVS_EX_PROTO 3
#define CVS_EX_FILE 4
+#define CVS_EX_BADTAG 5
/* operations */
#define CVS_OP_UNKNOWN 0
diff --git a/usr.bin/cvs/rcs.c b/usr.bin/cvs/rcs.c
index 77d8b51c8a3..b9f763f787a 100644
--- a/usr.bin/cvs/rcs.c
+++ b/usr.bin/cvs/rcs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcs.c,v 1.48 2005/04/19 19:30:18 jfb Exp $ */
+/* $OpenBSD: rcs.c,v 1.49 2005/04/20 23:11:30 jfb Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -113,7 +113,7 @@ struct rcs_foo {
/* invalid characters in RCS symbol names */
-static const char rcs_sym_invch[] = "$,.:;@";
+static const char rcs_sym_invch[] = RCS_SYM_INVALCHAR;
#ifdef notyet
static struct rcs_kfl {
diff --git a/usr.bin/cvs/rcs.h b/usr.bin/cvs/rcs.h
index 80bab8b715d..2934e3c0bc5 100644
--- a/usr.bin/cvs/rcs.h
+++ b/usr.bin/cvs/rcs.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcs.h,v 1.22 2005/04/19 19:22:31 jfb Exp $ */
+/* $OpenBSD: rcs.h,v 1.23 2005/04/20 23:11:30 jfb Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -46,6 +46,9 @@
#define RCS_HEAD_REV ((RCSNUM *)(-1))
+#define RCS_SYM_INVALCHAR "$,.:;@"
+
+
#define RCS_STATE_EXP "Exp"
#define RCS_STATE_DEAD "dead"
diff --git a/usr.bin/cvs/tag.c b/usr.bin/cvs/tag.c
index 276c0b58c92..651fc76863c 100644
--- a/usr.bin/cvs/tag.c
+++ b/usr.bin/cvs/tag.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tag.c,v 1.14 2005/04/19 18:51:30 jfb Exp $ */
+/* $OpenBSD: tag.c,v 1.15 2005/04/20 23:11:30 jfb Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* Copyright (c) 2004 Joris Vink <joris@openbsd.org>
@@ -104,6 +104,13 @@ cvs_tag_options(char *opt, int argc, char **argv, int *arg)
*arg += 1;
}
+ if (!rcs_sym_check(tag_name)) {
+ cvs_log(LP_ABORT,
+ "tag `%s' must not contain the characters `%s'",
+ tag_name, RCS_SYM_INVALCHAR);
+ return (CVS_EX_BADTAG);
+ }
+
if (tag_branch && tag_delete) {
cvs_log(LP_WARN, "ignoring -b with -d options");
tag_branch = 0;