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

Re: svn commit: rev 5232 - in trunk/subversion: bindings/swig libsvn_ra_dav libsvn_ra_local

From: Philip Martin <philip_at_codematters.co.uk>
Date: 2003-03-07 02:08:09 CET

philip@tigris.org writes:

> Author: philip
> Date: Thu Mar 6 18:36:38 2003
> New Revision: 5232
>
> Modified:
> trunk/subversion/bindings/swig/swigutil_py.c
> trunk/subversion/libsvn_ra_dav/session.c
> trunk/subversion/libsvn_ra_local/ra_plugin.c
> Log:
> Fix some gcc-3.4 warnings about C aliasing. Fix one leaky error.
>
> * subversion/libsvn_ra_dav/session.c (request_auth): Use void* variable
> and remove cast. Don't leak error.
>
> * subversion/libsvn_ra_local/ra_plugin.c (svn_ra_local__open): Use void*
> variable and remove cast.
>
> * subversion/bindings/swig/swigutil_py.c (acquire_py_lock): Use void*
> variable and remove cast.
>
>
> Modified: trunk/subversion/libsvn_ra_dav/session.c
> ==============================================================================
> --- trunk/subversion/libsvn_ra_dav/session.c (original)
> +++ trunk/subversion/libsvn_ra_dav/session.c Thu Mar 6 18:36:38 2003
> @@ -61,28 +61,33 @@
> {
> svn_error_t *err;
> svn_ra_session_t *ras = userdata;
> - svn_auth_cred_simple_t *creds;
> + void *creds;
> + svn_auth_cred_simple_t *simple_creds;
>
> /* No auth_baton? Give up. */
> if (! ras->callbacks->auth_baton)
> return -1;
>
> if (attempt == 0)
> - err = svn_auth_first_credentials ((void **) &creds,
> + err = svn_auth_first_credentials (&creds,
> &(ras->auth_iterstate),
> SVN_AUTH_CRED_SIMPLE,
> ras->callbacks->auth_baton,
> ras->pool);
> else /* attempt > 0 */
> - err = svn_auth_next_credentials ((void **) &creds,
> + err = svn_auth_next_credentials (&creds,
> ras->auth_iterstate,
> ras->pool);
> if (err || ! creds)
> - return -1;
> + {
> + svn_error_clear (err);
> + return -1;
> + }
> + simple_creds = creds;
>
> /* ### silently truncates username/password to 256 chars. */
> - apr_cpystrn(username, creds->username, NE_ABUFSIZ);
> - apr_cpystrn(password, creds->password, NE_ABUFSIZ);
> + apr_cpystrn(username, simple_creds->username, NE_ABUFSIZ);
> + apr_cpystrn(password, simple_creds->password, NE_ABUFSIZ);

While I was here I noticed that in this case there is no check for
username/password being NULL, but below...

> Modified: trunk/subversion/libsvn_ra_local/ra_plugin.c
> ==============================================================================
> --- trunk/subversion/libsvn_ra_local/ra_plugin.c (original)
> +++ trunk/subversion/libsvn_ra_local/ra_plugin.c Thu Mar 6 18:36:38 2003
> @@ -204,7 +204,6 @@
> apr_pool_t *pool)
> {
> svn_ra_local__session_baton_t *session;
> - svn_auth_cred_username_t *creds;
> svn_auth_iterstate_t *iterstate;
>
> /* Allocate and stash the session_baton args we have already. */
> @@ -220,7 +219,9 @@
> }
> else
> {
> - SVN_ERR (svn_auth_first_credentials ((void **) &creds, &iterstate,
> + void *creds;
> + svn_auth_cred_username_t *username_creds;
> + SVN_ERR (svn_auth_first_credentials (&creds, &iterstate,
> SVN_AUTH_CRED_USERNAME,
> callbacks->auth_baton,
> pool));
> @@ -229,11 +230,12 @@
> first_creds() somehow failed to authenticate. But there's no
> challenge going on, so we use whatever creds we get back on
> the first try. */
> - if (creds == NULL
> - || (creds->username == NULL))
> + username_creds = creds;
> + if (username_creds == NULL
> + || (username_creds->username == NULL))
> session->username = "";
> else
> - session->username = apr_pstrdup (pool, creds->username);
> + session->username = apr_pstrdup (pool, username_creds->username);

...in this case there is a check. I looked in svn_auth.h I could not
determine whether it is the provider's responsibility to ensure that
they are never NULL or the library's responsibility to check for NULL.

-- 
Philip Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Mar 7 02:09:02 2003

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.