summaryrefslogtreecommitdiffstats
path: root/usr.bin/cvs/client.c
diff options
context:
space:
mode:
authorjoris <joris@openbsd.org>2007-01-02 23:55:15 +0000
committerjoris <joris@openbsd.org>2007-01-02 23:55:15 +0000
commit0a6fb2eec679abb97daa3e2123bc701d5e17d124 (patch)
tree5720e8a7491f5d977ff3d4c19fa42a658ca00e81 /usr.bin/cvs/client.c
parentbetter support for IPv6 hostname/numeric representation. (diff)
downloadwireguard-openbsd-0a6fb2eec679abb97daa3e2123bc701d5e17d124.tar.xz
wireguard-openbsd-0a6fb2eec679abb97daa3e2123bc701d5e17d124.zip
- fix cvs_client_remove_entry to correctly handle the passed data
- when commiting in a remote setup, allow the opencvs server to send the correct response to the client when a file has been removed
Diffstat (limited to 'usr.bin/cvs/client.c')
-rw-r--r--usr.bin/cvs/client.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/usr.bin/cvs/client.c b/usr.bin/cvs/client.c
index 1caea4dd164..9ad18a2a966 100644
--- a/usr.bin/cvs/client.c
+++ b/usr.bin/cvs/client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: client.c,v 1.40 2006/12/21 22:32:30 xsa Exp $ */
+/* $OpenBSD: client.c,v 1.41 2007/01/02 23:55:15 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -741,24 +741,27 @@ cvs_client_removed(char *data)
void
cvs_client_remove_entry(char *data)
{
+ int l;
CVSENTRIES *entlist;
- struct cvs_ent *ent;
- char *dir, *entry;
+ char *filename, *rpath, *fpath;
- dir = cvs_remote_input();
- entry = cvs_remote_input();
- xfree(dir);
+ rpath = cvs_remote_input();
+ if ((filename = strrchr(rpath, '/')) == NULL)
+ fatal("bad rpath in cvs_client_remove_entry: %s", rpath);
+ *filename++;
+
+ fpath = xmalloc(MAXPATHLEN);
+ l = snprintf(fpath, MAXPATHLEN, "%s%s", data, filename);
+ if (l == -1 || l >= MAXPATHLEN)
+ fatal("cvs_client_remove_entry: overflow");
- if ((ent = cvs_ent_parse(entry)) == NULL)
- fatal("cvs_client_remove_entry: cvs_ent_parse failed");
+ xfree(rpath);
entlist = cvs_ent_open(data);
-
- cvs_ent_remove(entlist, ent->ce_name);
- cvs_ent_free(ent);
+ cvs_ent_remove(entlist, fpath);
cvs_ent_close(entlist, ENT_SYNC);
- xfree(entry);
+ xfree(fpath);
}
void