[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r12662 - in branches/locking/subversion: include libsvn_fs libsvn_fs_base libsvn_fs_fs libsvn_ra_local libsvn_ra_svn libsvn_repos mod_dav_svn svnadmin svnserve tests/libsvn_fs

From: Peter N. Lundblad <peter_at_famlundblad.se>
Date: 2005-01-10 22:45:46 CET

On Mon, 10 Jan 2005 sussman@tigris.org wrote:

> Modified: branches/locking/subversion/svnserve/serve.c
> Url: http://svn.collab.net/viewcvs/svn/branches/locking/subversion/svnserve/serve.c?view=diff&rev=12662&p1=branches/locking/subversion/svnserve/serve.c&r1=12661&p2=branches/locking/subversion/svnserve/serve.c&r2=12662
> ==============================================================================
> --- branches/locking/subversion/svnserve/serve.c (original)
> +++ branches/locking/subversion/svnserve/serve.c Mon Jan 10 14:37:02 2005
> @@ -592,7 +592,7 @@
>
> /* Add the LOCK_TOKENS to the filesystem access context if any. LOCK_TOKENS is
> an array of svn_ra_svn_item_t structs. Return an error if they are
> - not strings. */
> + not a list of lists. */
> static svn_error_t *add_lock_tokens(apr_array_header_t *lock_tokens,
> server_baton_t *sb,
> apr_pool_t *pool)
> @@ -608,19 +608,28 @@
>
> for (i = 0; i < lock_tokens->nelts; ++i)
> {
> + const char *token;
> + svn_ra_svn_item_t *token_item;
> svn_ra_svn_item_t *item = &APR_ARRAY_IDX(lock_tokens, i,
> svn_ra_svn_item_t);
> - if (item->kind != SVN_RA_SVN_STRING)
> + if (item->kind != SVN_RA_SVN_LIST)
> return svn_error_create(SVN_ERR_RA_SVN_MALFORMED_DATA, NULL,
> - "Lock token not a string");
> - SVN_ERR(svn_fs_access_add_lock_token(fs_access, item->u.string->data));
> + "Lock tokens aren't a list of lists.");
> +
> + token_item = &APR_ARRAY_IDX(item->u.list, 1, svn_ra_svn_item_t);
> + if (token_item->kind != SVN_RA_SVN_STRING)
> + return svn_error_create(SVN_ERR_RA_SVN_MALFORMED_DATA, NULL,
> + "Lock token isn't a string.");

Trailing dot.

> +
> + token = token_item->u.string->data;
> + SVN_ERR(svn_fs_access_add_lock_token(fs_access, token));
> }
>
PLease check the path here too, even if it isn't used here. (See below.)

> return SVN_NO_ERROR;
> }
>
> /* Unlock the paths with lock tokens in LOCK_TOKENS, ignoring any errors.
> - LOCK_TOKENS contais svn_ra_svn_item_t elements, assumed to be strings. */
> + LOCK_TOKENS contais svn_ra_svn_item_t elements, assumed to be lists. */
> static svn_error_t *unlock_paths(apr_array_header_t *lock_tokens,
> server_baton_t *sb,
> apr_pool_t *pool)
> @@ -632,15 +641,33 @@
>
> for (i = 0; i < lock_tokens->nelts; ++i)
> {
> - svn_ra_svn_item_t *item;
> -
> + svn_ra_svn_item_t *item, *path_item, *token_item;
> + const char *path, *token;
> svn_pool_clear(iterpool);
> +
> item = &APR_ARRAY_IDX(lock_tokens, i, svn_ra_svn_item_t);
> + if (item->kind != SVN_RA_SVN_LIST)
> + return svn_error_create(SVN_ERR_RA_SVN_MALFORMED_DATA, NULL,
> + "Lock tokens aren't a list of lists.");
> +
> + path_item = &APR_ARRAY_IDX(item->u.list, 0, svn_ra_svn_item_t);
> + if (token_item->kind != SVN_RA_SVN_STRING)
Woops. Typo. Don't just copy-paste when you move:-)

> + return svn_error_create(SVN_ERR_RA_SVN_MALFORMED_DATA, NULL,
> + "Lock path isn't a string.");
Trailing dot.
> +
> + token_item = &APR_ARRAY_IDX(item->u.list, 1, svn_ra_svn_item_t);
> + if (token_item->kind != SVN_RA_SVN_STRING)
> + return svn_error_create(SVN_ERR_RA_SVN_MALFORMED_DATA, NULL,
> + "Lock token isn't a string.");
> +
> + path = path_item->u.string->data;
> + token = token_item->u.string->data;
> +
> /* The lock may have been defunct after the commit, so ignore such
> errors.
> ### What is the best thing to do with other errors (see comment
> ### libsvn_ra_local/ra_plugin.c. */
> - svn_error_clear(svn_repos_fs_unlock(sb->repos, item->u.string->data,
> + svn_error_clear(svn_repos_fs_unlock(sb->repos, path, token,
> FALSE, pool));
> }
>
add_lock_tokens has been called on this list. There is no need to do the
checks here. Moving the checks to add_lock_tokens will validate the input
before the commit is completed.

Also, please keep libsvn_ra_svn/protocol up-to-date. Else, it becomes
useless.

Regards,
//Peter

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Jan 10 22:46:54 2005

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.