You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2013/07/11 11:22:46 UTC

svn commit: r1502163 - /subversion/trunk/subversion/svnauth/svnauth.c

Author: stsp
Date: Thu Jul 11 09:22:45 2013
New Revision: 1502163

URL: http://svn.apache.org/r1502163
Log:
In svnauth, label simple credential fields with translatable strings.

* subversion/svnauth/svnauth.c
  (AUTHN_USERNAME_KEY, AUTHN_PASSWORD_KEY, AUTHN_PASSTYPE_KEY): New macros,
   copied from libsvn_subr/simple_providers.c (at some point we'll have
   to move all these AUTHN_* macros into a shared header file).
  (list_credentials): Pretty-print simple credentials.

Modified:
    subversion/trunk/subversion/svnauth/svnauth.c

Modified: subversion/trunk/subversion/svnauth/svnauth.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svnauth/svnauth.c?rev=1502163&r1=1502162&r2=1502163&view=diff
==============================================================================
--- subversion/trunk/subversion/svnauth/svnauth.c (original)
+++ subversion/trunk/subversion/svnauth/svnauth.c Thu Jul 11 09:22:45 2013
@@ -422,6 +422,11 @@ show_cert_failures(const char *failure_s
   return SVN_NO_ERROR;
 }
 
+/* ### from libsvn_subr/simple_providers.c */
+#define AUTHN_USERNAME_KEY            "username"
+#define AUTHN_PASSWORD_KEY            "password"
+#define AUTHN_PASSTYPE_KEY            "passtype"
+
 /* This implements `svn_config_auth_walk_func_t` */
 static svn_error_t *
 list_credentials(svn_boolean_t *delete_cred,
@@ -457,10 +462,21 @@ list_credentials(svn_boolean_t *delete_c
       item = APR_ARRAY_IDX(sorted_hash_items, i, svn_sort__item_t);
       key = item.key;
       value = item.value;
-      if (!opt_state->show_passwords && strcmp(key, "password") == 0)
-        SVN_ERR(svn_cmdline_printf(iterpool, _("%s: [not shown]\n"), key));
-      else if (strcmp(value->data, realmstring) == 0)
+      if (strcmp(value->data, realmstring) == 0)
         continue; /* realm string was already shown above */
+      else if (strcmp(key, AUTHN_PASSWORD_KEY) == 0)
+        {
+          if (opt_state->show_passwords)
+            SVN_ERR(svn_cmdline_printf(iterpool, _("Password: %s\n"),
+                                       value->data));
+          else
+            SVN_ERR(svn_cmdline_printf(iterpool, _("Password: [not shown]\n")));
+        }
+      else if (strcmp(key, AUTHN_PASSTYPE_KEY) == 0)
+        SVN_ERR(svn_cmdline_printf(iterpool, _("Password cache: %s\n"),
+                                   value->data));
+      else if (strcmp(key, AUTHN_USERNAME_KEY) == 0)
+        SVN_ERR(svn_cmdline_printf(iterpool, _("Username: %s\n"), value->data));
       else if (strcmp(key, AUTHN_ASCII_CERT_KEY) == 0)
         SVN_ERR(show_ascii_cert(value->data, iterpool));
       else if (strcmp(key, AUTHN_FAILURES_KEY) == 0)



Re: svn commit: r1502163 - /subversion/trunk/subversion/svnauth/svnauth.c

Posted by Daniel Shahaf <da...@elego.de>.
stsp@apache.org wrote on Thu, Jul 11, 2013 at 09:22:46 -0000:
> Author: stsp
> Date: Thu Jul 11 09:22:45 2013
> New Revision: 1502163
> 
> URL: http://svn.apache.org/r1502163
> Log:
> In svnauth, label simple credential fields with translatable strings.
> 
> * subversion/svnauth/svnauth.c
>   (AUTHN_USERNAME_KEY, AUTHN_PASSWORD_KEY, AUTHN_PASSTYPE_KEY): New macros,
>    copied from libsvn_subr/simple_providers.c (at some point we'll have
>    to move all these AUTHN_* macros into a shared header file).
>   (list_credentials): Pretty-print simple credentials.
> 
> Modified:
>     subversion/trunk/subversion/svnauth/svnauth.c
> 
> Modified: subversion/trunk/subversion/svnauth/svnauth.c
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svnauth/svnauth.c?rev=1502163&r1=1502162&r2=1502163&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/svnauth/svnauth.c (original)
> +++ subversion/trunk/subversion/svnauth/svnauth.c Thu Jul 11 09:22:45 2013
> @@ -422,6 +422,11 @@ show_cert_failures(const char *failure_s
>    return SVN_NO_ERROR;
>  }
>  
> +/* ### from libsvn_subr/simple_providers.c */
> +#define AUTHN_USERNAME_KEY            "username"
> +#define AUTHN_PASSWORD_KEY            "password"
> +#define AUTHN_PASSTYPE_KEY            "passtype"
> +
>  /* This implements `svn_config_auth_walk_func_t` */
>  static svn_error_t *
>  list_credentials(svn_boolean_t *delete_cred,
> @@ -457,10 +462,21 @@ list_credentials(svn_boolean_t *delete_c
>        item = APR_ARRAY_IDX(sorted_hash_items, i, svn_sort__item_t);
>        key = item.key;
>        value = item.value;
> -      if (!opt_state->show_passwords && strcmp(key, "password") == 0)
> -        SVN_ERR(svn_cmdline_printf(iterpool, _("%s: [not shown]\n"), key));
> -      else if (strcmp(value->data, realmstring) == 0)
> +      if (strcmp(value->data, realmstring) == 0)
>          continue; /* realm string was already shown above */
> +      else if (strcmp(key, AUTHN_PASSWORD_KEY) == 0)
> +        {
> +          if (opt_state->show_passwords)
> +            SVN_ERR(svn_cmdline_printf(iterpool, _("Password: %s\n"),
> +                                       value->data));
> +          else
> +            SVN_ERR(svn_cmdline_printf(iterpool, _("Password: [not shown]\n")));
> +        }

Have you tested this on windows?

IIRC, when the 'wincrypt' provider is used, the svn.simple/$(md5 realm)
files to contain a 'password' key, which contains some base64'd
ciphertext --- i.e., a value which would not be useful to print.

Re: svn commit: r1502163 - /subversion/trunk/subversion/svnauth/svnauth.c

Posted by Daniel Shahaf <da...@elego.de>.
stsp@apache.org wrote on Thu, Jul 11, 2013 at 09:22:46 -0000:
> Author: stsp
> Date: Thu Jul 11 09:22:45 2013
> New Revision: 1502163
> 
> URL: http://svn.apache.org/r1502163
> Log:
> In svnauth, label simple credential fields with translatable strings.
> 
> * subversion/svnauth/svnauth.c
>   (AUTHN_USERNAME_KEY, AUTHN_PASSWORD_KEY, AUTHN_PASSTYPE_KEY): New macros,
>    copied from libsvn_subr/simple_providers.c (at some point we'll have
>    to move all these AUTHN_* macros into a shared header file).
>   (list_credentials): Pretty-print simple credentials.
> 
> Modified:
>     subversion/trunk/subversion/svnauth/svnauth.c
> 
> Modified: subversion/trunk/subversion/svnauth/svnauth.c
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svnauth/svnauth.c?rev=1502163&r1=1502162&r2=1502163&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/svnauth/svnauth.c (original)
> +++ subversion/trunk/subversion/svnauth/svnauth.c Thu Jul 11 09:22:45 2013
> @@ -422,6 +422,11 @@ show_cert_failures(const char *failure_s
>    return SVN_NO_ERROR;
>  }
>  
> +/* ### from libsvn_subr/simple_providers.c */
> +#define AUTHN_USERNAME_KEY            "username"
> +#define AUTHN_PASSWORD_KEY            "password"
> +#define AUTHN_PASSTYPE_KEY            "passtype"
> +
>  /* This implements `svn_config_auth_walk_func_t` */
>  static svn_error_t *
>  list_credentials(svn_boolean_t *delete_cred,
> @@ -457,10 +462,21 @@ list_credentials(svn_boolean_t *delete_c
>        item = APR_ARRAY_IDX(sorted_hash_items, i, svn_sort__item_t);
>        key = item.key;
>        value = item.value;
> -      if (!opt_state->show_passwords && strcmp(key, "password") == 0)
> -        SVN_ERR(svn_cmdline_printf(iterpool, _("%s: [not shown]\n"), key));
> -      else if (strcmp(value->data, realmstring) == 0)
> +      if (strcmp(value->data, realmstring) == 0)
>          continue; /* realm string was already shown above */
> +      else if (strcmp(key, AUTHN_PASSWORD_KEY) == 0)
> +        {
> +          if (opt_state->show_passwords)
> +            SVN_ERR(svn_cmdline_printf(iterpool, _("Password: %s\n"),
> +                                       value->data));
> +          else
> +            SVN_ERR(svn_cmdline_printf(iterpool, _("Password: [not shown]\n")));
> +        }

Have you tested this on windows?

IIRC, when the 'wincrypt' provider is used, the svn.simple/$(md5 realm)
files to contain a 'password' key, which contains some base64'd
ciphertext --- i.e., a value which would not be useful to print.