From 634a9fff79356ba0f567cf60c111ee17a81a1ca6 Mon Sep 17 00:00:00 2001 From: "Karl O. Pinc kop@karlpinc.com" Date: Sat, 8 Feb 2025 00:03:44 +0000 Subject: [PATCH] Fix to require sslmode connections, by using a connection string --- bin/sokwedb-user-delete.m4 | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/bin/sokwedb-user-delete.m4 b/bin/sokwedb-user-delete.m4 index 0d6aa6a..e969959 100644 --- a/bin/sokwedb-user-delete.m4 +++ b/bin/sokwedb-user-delete.m4 @@ -29,7 +29,7 @@ include(global_macros.m4)dnl usage () { echo 'Syntax: sokwedb-user-delete [-h host] [-a] adminuser username' -echo ' sokwedb-user-add --help' +echo ' sokwedb-user-delete --help' echo '' echo ' -a Delete an admin or developer account' echo ' -h host Connect to the pg server on "host"' @@ -39,28 +39,29 @@ echo ' username The username to delete' } # Parse command line +export CONNECTIONSTRING='sslmode=require' export ADMIN='' -export HOSTARGS='' -export A_ADMINUSER=$1 -while [ "$A_ADMINUSER" = '-a' \ - -o "$A_ADMINUSER" = '-h' \ - -o "$A_ADMINUSER" = '--help' ] ; do - if [ "$A_ADMINUSER" = '-a' ] ; then +export FIRSTARG=$1 +while [ "$FIRSTARG" = '-a' \ + -o "$FIRSTARG" = '-h' \ + -o "$FIRSTARG" = '--help' ] ; do + if [ "$FIRSTARG" = '-a' ] ; then ADMIN='-a' shift - elif [ "$A_ADMINUSER" = '-h' ] ; then - HOSTARGS="--host $2" + elif [ "$FIRSTARG" = '-h' ] ; then + CONNECTIONSTRING="$CONNECTIONSTRING host=$2" shift 2 - elif [ "$A_ADMINUSER" = '--help' ] ; then + elif [ "$FIRSTARG" = '--help' ] ; then usage exit 0 fi -A_ADMINUSER=$1 + FIRSTARG=$1 done +CONNECTIONSTRING="$CONNECTIONSTRING user=$FIRSTARG" export A_USER=$2 if [ -z "$ADMIN" ] ; then -psql $HOSTARGS -U $A_ADMINUSER -d sokwedb_dev <