This is an automated email from the ASF dual-hosted git repository.

rnewson pushed a commit to branch adminpass-spaces
in repository https://gitbox.apache.org/repos/asf/couchdb-pkg.git

commit df9ff3841d9dd72d3590ec649cb7846b0e286a2f
Author: Robert Newson <[email protected]>
AuthorDate: Fri Jun 20 18:16:44 2025 +0100

    permit spaces in admin password
---
 debian/couchdb.postinst | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/debian/couchdb.postinst b/debian/couchdb.postinst
index 1207cde..4d2863c 100644
--- a/debian/couchdb.postinst
+++ b/debian/couchdb.postinst
@@ -102,15 +102,16 @@ createdb() {
   if [ "${ip}" = "0.0.0.0" ]; then
     ip=127.0.0.1
   fi
+  url="http://${ip}:5984";
   if [ ! -z "${adminpw}" ]; then
-    url="http://admin:${adminpw}@${ip}:5984";
+    auth="--user \"admin:${adminpw}\""
   else
-    url="http://${ip}:5984";
+    auth=''
   fi
-  if curl -s "${url}/${db}" | grep -q "${db}"; then
+  if curl -s $auth "${url}/${db}" | grep -q "${db}"; then
     return 0
   fi
-  curl -s -X PUT "${url}/${db}" >/dev/null 2>&1 || warnfail
+  curl -s $auth -X PUT "${url}/${db}" >/dev/null 2>&1 || warnfail
   return $?
 }
 

Reply via email to