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

RE: svn commit: r1422706 - in /subversion/trunk/subversion: libsvn_subr/opt.c tests/cmdline/svntest/main.py

From: Bert Huijben <bert_at_qqmail.nl>
Date: Mon, 17 Dec 2012 08:47:43 +0000

I think we should suppress this warning on Windows when the CryptoAPI
encryption is enabled (read: +- always) to avoid unneeded user questions.

And Im not sure what to think of the color escape strings...
Do these work on any not Windows os with any terminal settings?
(We currently only use these in the test suite and the result is plainly
visisble on the buildbot log)

Bert

 *From:* brane_at_apache.org
*Sent:* December 16, 2012 11:43 PM
*To:* commits_at_subversion.apache.org
*Subject:* svn commit: r1422706 - in /subversion/trunk/subversion:
libsvn_subr/opt.c tests/cmdline/svntest/main.py

Author: brane
Date: Sun Dec 16 22:43:25 2012
New Revision: 1422706

URL: http://svn.apache.org/viewvc?rev=1422706&view=rev
Log:
Print a warning in "svn --version" if plaintext password storage is enabled.

* subversion/libsvn_subr/opt.c: Inlcude unistd.h on *nix.
  (svn_opt__print_version_info): If plaintext password storage is
   enabled, print a warning about that after the copyright notice.

* subversion/tests/cmdline/svntest/main.py
  (is_plaintext_password_storage_disabled): Instead of looking for
   and scanning svn_private_config.h, look for the warning emitted
   by "svn --version".

Modified:
    subversion/trunk/subversion/libsvn_subr/opt.c
    subversion/trunk/subversion/tests/cmdline/svntest/main.py

Modified: subversion/trunk/subversion/libsvn_subr/opt.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/opt.c?rev=1422706&r1=1422705&r2=1422706&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/opt.c (original)
+++ subversion/trunk/subversion/libsvn_subr/opt.c Sun Dec 16 22:43:25 2012
@@ -34,6 +34,10 @@
 #include <apr_lib.h>
 #include <apr_file_info.h>

+#ifndef WIN32
+#include <unistd.h>
+#endif
+
 #include "svn_cmdline.h"
 #include "svn_version.h"
 #include "svn_types.h"
@@ -1121,6 +1125,24 @@ svn_opt__print_version_info(const char *
                              svn_version_ext_build_host(info)));
   SVN_ERR(svn_cmdline_printf(pool, "%s\n",
svn_version_ext_copyright(info)));

+#ifndef SVN_DISABLE_PLAINTEXT_PASSWORD_STORAGE
+ {
+ const char *warnstart = "";
+ const char *warnend = "";
+#ifndef WIN32
+ if (isatty(fileno(stdout)))
+ {
+ warnstart = "\033[1;31m";
+ warnend = "\033[0;m";
+ }
+#endif /* WIN32 */
+ SVN_ERR(svn_cmdline_printf(
+ pool,
+ _("%sWARNING: Plaintext password storage is
enabled!%s\n\n"),
+ warnstart, warnend));
+ }
+#endif /* SVN_DISABLE_PLAINTEXT_PASSWORD_STORAGE */
+
   if (footer)
     {
       SVN_ERR(svn_cmdline_printf(pool, "%s\n", footer));

Modified: subversion/trunk/subversion/tests/cmdline/svntest/main.py
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/svntest/main.py?rev=1422706&r1=1422705&r2=1422706&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/svntest/main.py (original)
+++ subversion/trunk/subversion/tests/cmdline/svntest/main.py Sun Dec 16
22:43:25 2012
@@ -1234,27 +1234,16 @@ def server_enforces_date_syntax():
 def server_has_atomic_revprop():
   return options.server_minor_version >= 7

-# FIXME: The following should use information retreived from "svn
--version"
-# However, at the time of writing this predicate, that piece of
-# information was not available from a running Subversion client.
 def is_plaintext_password_storage_disabled():
- confighandle = None
   try:
- predicate = re.compile(r"^\s*#\s*define\s+"
- r"SVN_DISABLE_PLAINTEXT_PASSWORD_STORAGE")
- configfile = os.path.abspath(general_wc_dir)
- for i in range(4):
- configfile = os.path.dirname(configfile)
- configfile = os.path.join(configfile, "svn_private_config.h")
- confighandle = open(configfile, 'rt')
- for line in confighandle.readlines():
+ predicate = re.compile("^[^W]*WARNING: Plaintext password storage is
enabled!")
+ code, out, err = run_svn(False, "--version")
+ for line in out:
       if predicate.match(line):
- return True
+ return False
   except:
- pass
- if confighandle:
- confighandle.close()
- return False
+ return False
+ return True

 ######################################################################
Received on 2012-12-17 09:48:28 CET

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