Skip to contentSkip to conversation

git-svn: respect Subversion's [auth] section configuration values

PATCH In review Eygene Ryabinkin 3 participants 7 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 git-svn: respect Subversion's [auth] section configuration values

Parameters 'store-passwords' and 'store-auth-creds' from Subversion's configuration (~/.subversion/config) were not respected. This was
fixed: the default values for these parameters are set to 'yes' to follow Subversion behaviour.

---
 git-svn.perl |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)
git-svn.perl +23 -0
index 484b057..f7ef421 100755
@@ -3051,6 +3051,29 @@ sub new {
 	  ]);
 	my $config = SVN::Core::config_get_config($config_dir);
 	$RA = undef;
+	my $dont_store_passwords = 1;
+	my $conf_t = ${$config}{'config'};
+	{
+		# The usage of $SVN::_Core::SVN_CONFIG_* variables
+		# produces warnings that variables are used only once.
+		# I had not found the better way to shut them up, so
+		# warnings are disabled in this block.
+		no warnings;
+		if (SVN::_Core::svn_config_get_bool($conf_t,
+		    $SVN::_Core::SVN_CONFIG_SECTION_AUTH,
+		    $SVN::_Core::SVN_CONFIG_OPTION_STORE_PASSWORDS,
+		    1) == 0) {
+			SVN::_Core::svn_auth_set_parameter($baton,
+			    $SVN::_Core::SVN_AUTH_PARAM_DONT_STORE_PASSWORDS,
+			    bless (\$dont_store_passwords, "_p_void"));
+		}
+		if (SVN::_Core::svn_config_get_bool($conf_t,
+		    $SVN::_Core::SVN_CONFIG_SECTION_AUTH,
+		    $SVN::_Core::SVN_CONFIG_OPTION_STORE_AUTH_CREDS,
+		    1) == 0) {
+			$Git::SVN::Prompt::_no_auth_cache = 1;
+		}
+	}
 	my $self = SVN::Ra->new(url => $url, auth => $baton,
 	                      config => $config,
 			      pool => SVN::Pool->new,
Signature · 5 lines
1.5.3.2


-- 
Eygene
Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · Eygene Ryabinkin

Parameters 'store-passwords' and 'store-auth-creds' from Subversion's configuration (~/.subversion/config) were not respected. This was
fixed: the default values for these parameters are set to 'yes' to follow Subversion behaviour.

Thanks.

Quoted 1 line
Quoted 38 lines
---
 git-svn.perl |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)
git-svn.perl +23 -0
index 484b057..f7ef421 100755
@@ -3051,6 +3051,29 @@ sub new {
 	  ]);
 	my $config = SVN::Core::config_get_config($config_dir);
 	$RA = undef;
+	my $dont_store_passwords = 1;
+	my $conf_t = ${$config}{'config'};
+	{
+		# The usage of $SVN::_Core::SVN_CONFIG_* variables
+		# produces warnings that variables are used only once.
+		# I had not found the better way to shut them up, so
+		# warnings are disabled in this block.
+		no warnings;
+		if (SVN::_Core::svn_config_get_bool($conf_t,
+		    $SVN::_Core::SVN_CONFIG_SECTION_AUTH,
+		    $SVN::_Core::SVN_CONFIG_OPTION_STORE_PASSWORDS,
+		    1) == 0) {
+			SVN::_Core::svn_auth_set_parameter($baton,
+			    $SVN::_Core::SVN_AUTH_PARAM_DONT_STORE_PASSWORDS,
+			    bless (\$dont_store_passwords, "_p_void"));
+		}
+		if (SVN::_Core::svn_config_get_bool($conf_t,
+		    $SVN::_Core::SVN_CONFIG_SECTION_AUTH,
+		    $SVN::_Core::SVN_CONFIG_OPTION_STORE_AUTH_CREDS,
+		    1) == 0) {
+			$Git::SVN::Prompt::_no_auth_cache = 1;
+		}
+	}
 	my $self = SVN::Ra->new(url => $url, auth => $baton,
 	                      config => $config,
 			      pool => SVN::Pool->new,
Signature · 1 line
Eric Wong
#2 lore raw
In reply to Eygene Ryabinkin
Quoted 5 lines · Eygene Ryabinkin

Parameters 'store-passwords' and 'store-auth-creds' from Subversion's configuration (~/.subversion/config) were not respected. This was
fixed: the default values for these parameters are set to 'yes' to follow Subversion behaviour.

I saw this in the svn api before. It really is a strange API, requiring the user to get things like this right.

Quoted 12 lines
---
 git-svn.perl |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)
git-svn.perl +0 -0
index 484b057..f7ef421 100755
@@ -3051,6 +3051,29 @@ sub new {
 	  ]);
 	my $config = SVN::Core::config_get_config($config_dir);

git-svn.perl sub new { · line 3062

Quoted 10 lines
git-svn.perl +8 -0
 	$RA = undef;
+	my $dont_store_passwords = 1;
+	my $conf_t = ${$config}{'config'};
+	{
+		# The usage of $SVN::_Core::SVN_CONFIG_* variables
+		# produces warnings that variables are used only once.
+		# I had not found the better way to shut them up, so
+		# warnings are disabled in this block.
+		no warnings;
 

You can use no warnings 'once';

Quoted 19 lines
git-svn.perl +15 -0
+		if (SVN::_Core::svn_config_get_bool($conf_t,
+		    $SVN::_Core::SVN_CONFIG_SECTION_AUTH,
+		    $SVN::_Core::SVN_CONFIG_OPTION_STORE_PASSWORDS,
+		    1) == 0) {
+			SVN::_Core::svn_auth_set_parameter($baton,
+			    $SVN::_Core::SVN_AUTH_PARAM_DONT_STORE_PASSWORDS,
+			    bless (\$dont_store_passwords, "_p_void"));
+		}
+		if (SVN::_Core::svn_config_get_bool($conf_t,
+		    $SVN::_Core::SVN_CONFIG_SECTION_AUTH,
+		    $SVN::_Core::SVN_CONFIG_OPTION_STORE_AUTH_CREDS,
+		    1) == 0) {
+			$Git::SVN::Prompt::_no_auth_cache = 1;
+		}
+	}
 	my $self = SVN::Ra->new(url => $url, auth => $baton,
 	                      config => $config,

pool => SVN::Pool->new,

#3 lore raw
Quoted 9 lines · Sam Vilain

git-svn.perl sub new { · line 3061

Quoted 6 lines · Eygene Ryabinkin
git-svn.perl +5 -0
+		# The usage of $SVN::_Core::SVN_CONFIG_* variables
+		# produces warnings that variables are used only once.
+		# I had not found the better way to shut them up, so
+		# warnings are disabled in this block.
+		no warnings;

You can use no warnings 'once';

Interesting, I should use that globally in git-svn and get rid of the $kill_stupid_warnings variable :)

Signature · 1 line
Eric Wong
#4 lore raw
In reply to Sam Vilain

Eric, Sam, good day.

Quoted 7 lines · Eric Wong
Quoted 4 lines · Eygene Ryabinkin

Parameters 'store-passwords' and 'store-auth-creds' from Subversion's configuration (~/.subversion/config) were not respected. This was
fixed: the default values for these parameters are set to 'yes' to follow Subversion behaviour.

Thanks.

You're welcome ;))

Quoted 9 lines · Sam Vilain
Quoted 5 lines · Eygene Ryabinkin

Parameters 'store-passwords' and 'store-auth-creds' from Subversion's configuration (~/.subversion/config) were not respected. This was
fixed: the default values for these parameters are set to 'yes' to follow Subversion behaviour.

I saw this in the svn api before. It really is a strange API, requiring the user to get things like this right.

Yes, the need to parse the configuration and set some flags is rather strange. Looks like nobody cared to stuff the code like I had added to the configuration file parsing routines.

Quoted 1 line

You can use no warnings 'once';

Great, thanks for the pointer! Eric, do you want me to produce another patch or you'll correct mine?

Signature · 1 line
Eygene
#5 lore raw
Quoted 9 lines · Eygene Ryabinkin

Eric, Sam, good day.

Quoted 7 lines · Sam Vilain
Quoted 5 lines · Eygene Ryabinkin

Parameters 'store-passwords' and 'store-auth-creds' from Subversion's configuration (~/.subversion/config) were not respected. This was
fixed: the default values for these parameters are set to 'yes' to follow Subversion behaviour.

Quoted 6 lines
Quoted 2 lines

I saw this in the svn api before. It really is a strange API, requiring the user to get things like this right.

Yes, the need to parse the configuration and set some flags is rather strange. Looks like nobody cared to stuff the code like I had added to the configuration file parsing routines.

I think I started to look at it a while back and forgot about it :)

Quoted 4 lines
Quoted 1 line

You can use no warnings 'once';

Great, thanks for the pointer! Eric, do you want me to produce another patch or you'll correct mine?

Go ahead and produce another patch. I haven't had much time to work on git lately.

Signature · 1 line
Eric Wong
#6 lore raw

Eric, good day.

Quoted 5 lines · Eric Wong
Quoted 2 lines

Great, thanks for the pointer! Eric, do you want me to produce another patch or you'll correct mine?

Go ahead and produce another patch. I haven't had much time to work on git lately.

OK, the patch will follow in the separate thread. I had embedded "no warnings 'once'" both to my new code and to your code to get rid of the $kill_stupid_warnings. I did it selectively to minimize the impact of the "no warnings" pragma.

Signature · 1 line
Eygene