From 75f22af1b3cf80af11af6bda875fcd68b831e1f2 Mon Sep 17 00:00:00 2001 From: Jan Lehnardt Date: Wed, 19 May 2010 21:52:31 +0000 Subject: Strip password from URLs before adding them to the tasks database and before sending it to the logger. Closes COUCHDB-756. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@946428 13f79535-47bb-0310-9956-ffa450edef68 --- src/couchdb/couch_rep.erl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/couchdb/couch_rep.erl b/src/couchdb/couch_rep.erl index 3daf8170..6be37f0b 100644 --- a/src/couchdb/couch_rep.erl +++ b/src/couchdb/couch_rep.erl @@ -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]; -- cgit v1.2.3