The previous commit broke compatibility with certain buggy third-party

CVS clients.  This commit fixes that and brings this file up-to-date
with CVS 1.1.16.

Obtained from:	ccvs.cvshome.org
This commit is contained in:
Dag-Erling Smørgrav 2004-05-20 13:11:32 +00:00
parent f6fb3b4a3a
commit b0e9f4d203
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/vendor/cvs/dist/; revision=129486

View File

@ -1638,8 +1638,18 @@ serve_unchanged (arg)
&& strncmp (arg, name, cp - name) == 0) && strncmp (arg, name, cp - name) == 0)
{ {
timefield = strchr (cp + 1, '/') + 1; timefield = strchr (cp + 1, '/') + 1;
/* If the time field is not currently empty, then one of
* serve_modified, serve_is_modified, & serve_unchanged were
* already called for this file. We would like to ignore the
* reinvocation silently or, better yet, exit with an error
* message, but we just avoid the copy-forward and overwrite the
* value from the last invocation instead. See the comment below
* for more.
*/
if (*timefield == '/') if (*timefield == '/')
{ {
/* Copy forward one character. Space was allocated for this
* already in serve_entry(). */
cp = timefield + strlen (timefield); cp = timefield + strlen (timefield);
cp[1] = '\0'; cp[1] = '\0';
while (cp > timefield) while (cp > timefield)
@ -1647,8 +1657,17 @@ serve_unchanged (arg)
*cp = cp[-1]; *cp = cp[-1];
--cp; --cp;
} }
*timefield = '=';
} }
/* If *TIMEFIELD wasn't "/", we assume that it was because of
* multiple calls to Is-Modified & Unchanged by the client and
* just overwrite the value from the last call. Technically, we
* should probably either ignore calls after the first or send the
* client an error, since the client/server protocol specification
* specifies that only one call to either Is-Modified or Unchanged
* is allowed, but broken versions of WinCVS & TortoiseCVS rely on
* this behavior.
*/
*timefield = '=';
break; break;
} }
} }
@ -1682,8 +1701,18 @@ serve_is_modified (arg)
&& strncmp (arg, name, cp - name) == 0) && strncmp (arg, name, cp - name) == 0)
{ {
timefield = strchr (cp + 1, '/') + 1; timefield = strchr (cp + 1, '/') + 1;
/* If the time field is not currently empty, then one of
* serve_modified, serve_is_modified, & serve_unchanged were
* already called for this file. We would like to ignore the
* reinvocation silently or, better yet, exit with an error
* message, but we just avoid the copy-forward and overwrite the
* value from the last invocation instead. See the comment below
* for more.
*/
if (*timefield == '/') if (*timefield == '/')
{ {
/* Copy forward one character. Space was allocated for this
* already in serve_entry(). */
cp = timefield + strlen (timefield); cp = timefield + strlen (timefield);
cp[1] = '\0'; cp[1] = '\0';
while (cp > timefield) while (cp > timefield)
@ -1691,8 +1720,17 @@ serve_is_modified (arg)
*cp = cp[-1]; *cp = cp[-1];
--cp; --cp;
} }
*timefield = 'M';
} }
/* If *TIMEFIELD wasn't "/", we assume that it was because of
* multiple calls to Is-Modified & Unchanged by the client and
* just overwrite the value from the last call. Technically, we
* should probably either ignore calls after the first or send the
* client an error, since the client/server protocol specification
* specifies that only one call to either Is-Modified or Unchanged
* is allowed, but broken versions of WinCVS & TortoiseCVS rely on
* this behavior.
*/
*timefield = 'M';
if (kopt != NULL) if (kopt != NULL)
{ {
if (alloc_pending (strlen (name) + 80)) if (alloc_pending (strlen (name) + 80))