You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ja...@apache.org on 2010/05/19 23:52:31 UTC

svn commit: r946428 - /couchdb/trunk/src/couchdb/couch_rep.erl

Author: jan
Date: Wed May 19 21:52:31 2010
New Revision: 946428

URL: http://svn.apache.org/viewvc?rev=946428&view=rev
Log:
Strip password from URLs before adding them to the tasks database
and before sending it to the logger.

Closes COUCHDB-756.

Modified:
    couchdb/trunk/src/couchdb/couch_rep.erl

Modified: couchdb/trunk/src/couchdb/couch_rep.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_rep.erl?rev=946428&r1=946427&r2=946428&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_rep.erl (original)
+++ couchdb/trunk/src/couchdb/couch_rep.erl Wed May 19 21:52:31 2010
@@ -350,10 +350,16 @@ close_db(Db) ->
     couch_db:close(Db).
 
 dbname(#http_db{url = Url}) ->
-    Url;
+    strip_password(Url);
 dbname(#db{name = Name}) ->
     Name.
 
+strip_password(Url) ->
+    re:replace(Url,
+        "http(s)?://([^:]+):[^@]+@(.*)$",
+        "http\\1://\\2:*****@\\3",
+        [{return, list}]).
+
 dbinfo(#http_db{} = Db) ->
     {DbProps} = couch_rep_httpc:request(Db),
     [{list_to_atom(?b2l(K)), V} || {K,V} <- DbProps];