You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2013/02/07 16:31:47 UTC

svn commit: r1443556 - in /subversion/trunk/subversion: include/svn_auth.h libsvn_subr/simple_providers.c

Author: rhuijben
Date: Thu Feb  7 15:31:46 2013
New Revision: 1443556

URL: http://svn.apache.org/viewvc?rev=1443556&view=rev
Log:
Fix a simple to trigger, but never reported segfault in the auth helper code.

* subversion/include/svn_auth.h
  (SVN_AUTH_PARAM_STORE_PLAINTEXT_PASSWORDS,
   SVN_AUTH_PARAM_DONT_STORE_SSL_CLIENT_CERT_PP,
   SVN_AUTH_PARAM_STORE_SSL_CLIENT_CERT_PP_PLAINTEXT): Mark as new in 1.6.

* subversion/libsvn_subr/simple_providers.c
  (svn_auth__simple_creds_cache_set): If nobody has set
     SVN_AUTH_PARAM_STORE_PLAINTEXT_PASSWORDS (introduced in 1.6),
     we shouldn't segfault.

Modified:
    subversion/trunk/subversion/include/svn_auth.h
    subversion/trunk/subversion/libsvn_subr/simple_providers.c

Modified: subversion/trunk/subversion/include/svn_auth.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_auth.h?rev=1443556&r1=1443555&r2=1443556&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_auth.h (original)
+++ subversion/trunk/subversion/include/svn_auth.h Thu Feb  7 15:31:46 2013
@@ -590,19 +590,25 @@ svn_auth_get_parameter(svn_auth_baton_t 
 
 /** @brief Indicates whether providers may save passwords to disk in
  * plaintext. Property value can be either SVN_CONFIG_TRUE,
- * SVN_CONFIG_FALSE, or SVN_CONFIG_ASK. */
+ * SVN_CONFIG_FALSE, or SVN_CONFIG_ASK.
+ * @since New in 1.6.
+ */
 #define SVN_AUTH_PARAM_STORE_PLAINTEXT_PASSWORDS  SVN_AUTH_PARAM_PREFIX \
                                                   "store-plaintext-passwords"
 
 /** @brief The application doesn't want any providers to save passphrase
  * to disk. Property value is irrelevant; only property's existence
- * matters. */
+ * matters.
+ * @since New in 1.6.
+ */
 #define SVN_AUTH_PARAM_DONT_STORE_SSL_CLIENT_CERT_PP \
   SVN_AUTH_PARAM_PREFIX "dont-store-ssl-client-cert-pp"
 
 /** @brief Indicates whether providers may save passphrase to disk in
  * plaintext. Property value can be either SVN_CONFIG_TRUE,
- * SVN_CONFIG_FALSE, or SVN_CONFIG_ASK. */
+ * SVN_CONFIG_FALSE, or SVN_CONFIG_ASK.
+ * @since New in 1.6.
+ */
 #define SVN_AUTH_PARAM_STORE_SSL_CLIENT_CERT_PP_PLAINTEXT \
   SVN_AUTH_PARAM_PREFIX "store-ssl-client-cert-pp-plaintext"
 

Modified: subversion/trunk/subversion/libsvn_subr/simple_providers.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/simple_providers.c?rev=1443556&r1=1443555&r2=1443556&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/simple_providers.c (original)
+++ subversion/trunk/subversion/libsvn_subr/simple_providers.c Thu Feb  7 15:31:46 2013
@@ -372,8 +372,9 @@ svn_auth__simple_creds_cache_set(svn_boo
           simple_provider_baton_t *b =
             (simple_provider_baton_t *)provider_baton;
 
-          if (svn_cstring_casecmp(store_plaintext_passwords,
-                                  SVN_CONFIG_ASK) == 0)
+          if (store_plaintext_passwords
+              && svn_cstring_casecmp(store_plaintext_passwords,
+                                     SVN_CONFIG_ASK) == 0)
             {
               if (non_interactive)
                 /* In non-interactive mode, the default behaviour is
@@ -438,13 +439,15 @@ svn_auth__simple_creds_cache_set(svn_boo
                   may_save_password = TRUE;
                 }
             }
-          else if (svn_cstring_casecmp(store_plaintext_passwords,
-                                       SVN_CONFIG_FALSE) == 0)
+          else if (store_plaintext_passwords
+                   && svn_cstring_casecmp(store_plaintext_passwords,
+                                          SVN_CONFIG_FALSE) == 0)
             {
               may_save_password = FALSE;
             }
-          else if (svn_cstring_casecmp(store_plaintext_passwords,
-                                       SVN_CONFIG_TRUE) == 0)
+          else if (!store_plaintext_passwords
+                   || svn_cstring_casecmp(store_plaintext_passwords,
+                                          SVN_CONFIG_TRUE) == 0)
             {
               may_save_password = TRUE;
             }



Re: svn commit: r1443556 - in /subversion/trunk/subversion: include/svn_auth.h libsvn_subr/simple_providers.c

Posted by 'Stefan Sperling' <st...@elego.de>.
On Thu, Feb 07, 2013 at 05:16:37PM +0100, Bert Huijben wrote:
> > I agree that we shouldn't segfault. But it seems you've changed
> > the default behaviour with this commit, from 'ask' to 'yes',
> > in case the option isn't specified. See below.
> > 
> > > @@ -372,8 +372,9 @@ svn_auth__simple_creds_cache_set(svn_boo
> > >            simple_provider_baton_t *b =
> > >              (simple_provider_baton_t *)provider_baton;
> > >
> > > -          if (svn_cstring_casecmp(store_plaintext_passwords,
> > > -                                  SVN_CONFIG_ASK) == 0)
> > > +          if (store_plaintext_passwords
> > > +              && svn_cstring_casecmp(store_plaintext_passwords,
> > > +                                     SVN_CONFIG_ASK) == 0)
> > 
> > I think this should be:
> > 
> >           if (!store_plaintext_passwords
> >               || svn_cstring_casecmp(store_plaintext_passwords,
> >                                      SVN_CONFIG_ASK) == 0)
> > 
> > to make 'ask' the default catch-all case.
> 
> Which makes things much harder to verify,

Verify what and why?

> and will eventually fall back to
> allowing it anyway, because with the pre-1.6 api there is no way to 'ask'.
> 
> All our initializers set this value one way or another, so I didn't change a
> default. Or every svn invocation would have crashed since your change.
> (See r1443562 for a reproduction recipe)

Yeah, the default 'svn' behaviour hasn't changed, of course.

I still think it makes sense to write the code in accordance with the
intended default, even if the default ends up deciding to store the
password since no conflict prompt callback was provided by old API users.

RE: svn commit: r1443556 - in /subversion/trunk/subversion: include/svn_auth.h libsvn_subr/simple_providers.c

Posted by Bert Huijben <be...@qqmail.nl>.

> -----Original Message-----
> From: Stefan Sperling [mailto:stsp@elego.de]
> Sent: donderdag 7 februari 2013 16:44
> To: dev@subversion.apache.org
> Subject: Re: svn commit: r1443556 - in /subversion/trunk/subversion:
> include/svn_auth.h libsvn_subr/simple_providers.c
> 
> On Thu, Feb 07, 2013 at 03:31:47PM -0000, rhuijben@apache.org wrote:
> > Author: rhuijben
> > Date: Thu Feb  7 15:31:46 2013
> > New Revision: 1443556
> >
> > URL: http://svn.apache.org/viewvc?rev=1443556&view=rev
> > Log:
> > Fix a simple to trigger, but never reported segfault in the auth helper
code.
> >
> > * subversion/include/svn_auth.h
> >   (SVN_AUTH_PARAM_STORE_PLAINTEXT_PASSWORDS,
> >    SVN_AUTH_PARAM_DONT_STORE_SSL_CLIENT_CERT_PP,
> >    SVN_AUTH_PARAM_STORE_SSL_CLIENT_CERT_PP_PLAINTEXT): Mark as
> new in 1.6.
> >
> > * subversion/libsvn_subr/simple_providers.c
> >   (svn_auth__simple_creds_cache_set): If nobody has set
> >      SVN_AUTH_PARAM_STORE_PLAINTEXT_PASSWORDS (introduced in
> 1.6),
> >      we shouldn't segfault.
> 
> I agree that we shouldn't segfault. But it seems you've changed
> the default behaviour with this commit, from 'ask' to 'yes',
> in case the option isn't specified. See below.
> 
> > @@ -372,8 +372,9 @@ svn_auth__simple_creds_cache_set(svn_boo
> >            simple_provider_baton_t *b =
> >              (simple_provider_baton_t *)provider_baton;
> >
> > -          if (svn_cstring_casecmp(store_plaintext_passwords,
> > -                                  SVN_CONFIG_ASK) == 0)
> > +          if (store_plaintext_passwords
> > +              && svn_cstring_casecmp(store_plaintext_passwords,
> > +                                     SVN_CONFIG_ASK) == 0)
> 
> I think this should be:
> 
>           if (!store_plaintext_passwords
>               || svn_cstring_casecmp(store_plaintext_passwords,
>                                      SVN_CONFIG_ASK) == 0)
> 
> to make 'ask' the default catch-all case.

Which makes things much harder to verify, and will eventually fall back to
allowing it anyway, because with the pre-1.6 api there is no way to 'ask'.

All our initializers set this value one way or another, so I didn't change a
default. Or every svn invocation would have crashed since your change.
(See r1443562 for a reproduction recipe)

	Bert


Re: svn commit: r1443556 - in /subversion/trunk/subversion: include/svn_auth.h libsvn_subr/simple_providers.c

Posted by Stefan Sperling <st...@elego.de>.
On Thu, Feb 07, 2013 at 03:31:47PM -0000, rhuijben@apache.org wrote:
> Author: rhuijben
> Date: Thu Feb  7 15:31:46 2013
> New Revision: 1443556
> 
> URL: http://svn.apache.org/viewvc?rev=1443556&view=rev
> Log:
> Fix a simple to trigger, but never reported segfault in the auth helper code.
> 
> * subversion/include/svn_auth.h
>   (SVN_AUTH_PARAM_STORE_PLAINTEXT_PASSWORDS,
>    SVN_AUTH_PARAM_DONT_STORE_SSL_CLIENT_CERT_PP,
>    SVN_AUTH_PARAM_STORE_SSL_CLIENT_CERT_PP_PLAINTEXT): Mark as new in 1.6.
> 
> * subversion/libsvn_subr/simple_providers.c
>   (svn_auth__simple_creds_cache_set): If nobody has set
>      SVN_AUTH_PARAM_STORE_PLAINTEXT_PASSWORDS (introduced in 1.6),
>      we shouldn't segfault.

I agree that we shouldn't segfault. But it seems you've changed
the default behaviour with this commit, from 'ask' to 'yes',
in case the option isn't specified. See below.

> @@ -372,8 +372,9 @@ svn_auth__simple_creds_cache_set(svn_boo
>            simple_provider_baton_t *b =
>              (simple_provider_baton_t *)provider_baton;
>  
> -          if (svn_cstring_casecmp(store_plaintext_passwords,
> -                                  SVN_CONFIG_ASK) == 0)
> +          if (store_plaintext_passwords
> +              && svn_cstring_casecmp(store_plaintext_passwords,
> +                                     SVN_CONFIG_ASK) == 0)

I think this should be:

          if (!store_plaintext_passwords
              || svn_cstring_casecmp(store_plaintext_passwords,
                                     SVN_CONFIG_ASK) == 0)

to make 'ask' the default catch-all case.

>              {
>                if (non_interactive)
>                  /* In non-interactive mode, the default behaviour is
> @@ -438,13 +439,15 @@ svn_auth__simple_creds_cache_set(svn_boo
>                    may_save_password = TRUE;
>                  }
>              }
> -          else if (svn_cstring_casecmp(store_plaintext_passwords,
> -                                       SVN_CONFIG_FALSE) == 0)
> +          else if (store_plaintext_passwords
> +                   && svn_cstring_casecmp(store_plaintext_passwords,
> +                                          SVN_CONFIG_FALSE) == 0)
>              {
>                may_save_password = FALSE;
>              }
> -          else if (svn_cstring_casecmp(store_plaintext_passwords,
> -                                       SVN_CONFIG_TRUE) == 0)
> +          else if (!store_plaintext_passwords
> +                   || svn_cstring_casecmp(store_plaintext_passwords,
> +                                          SVN_CONFIG_TRUE) == 0)

And this should be:

          else if (store_plaintext_passwords
                   && svn_cstring_casecmp(store_plaintext_passwords,
                                          SVN_CONFIG_TRUE) == 0)

So that the password is saved only if the user put 'yes' in the config file.

>              {
>                may_save_password = TRUE;
>              }
>