mirror of
https://github.com/pivpn/pivpn.git
synced 2024-12-19 19:30:16 +00:00
Don't get CN list by counting columns as it is wholly unreliable.
If user had space in some cert fields, like city was "Fort Worth" the current way would have fell apart. This fixes these issues in 'pivpn list' and hence 'pivpn revoke'
This commit is contained in:
parent
d096335d5f
commit
a432e187b9
2 changed files with 3 additions and 6 deletions
|
@ -16,18 +16,16 @@ printf " ::\e[4m Status \e[0m||\e[4m Name \e[0m:: \n"
|
|||
|
||||
while read -r line || [[ -n "$line" ]]; do
|
||||
status=$(echo $line | awk '{print $1}')
|
||||
var=$(echo $line | sed -e 's/^.*CN=\([^/]*\)\/.*/\1/')
|
||||
if [[ $status = "V" ]]; then
|
||||
printf " Valid :: "
|
||||
var=$(echo $line | awk '{print $5}' | cut -d'/' -f7)
|
||||
var=${var#CN=}
|
||||
printf " $var\n"
|
||||
elif [[ $status = "R" ]]; then
|
||||
printf " Revoked :: "
|
||||
var=$(echo $line | awk '{print $6}' | cut -d'/' -f7)
|
||||
var=${var#CN=}
|
||||
printf " $var\n"
|
||||
else
|
||||
printf " Unknown :: \n"
|
||||
printf " $var\n"
|
||||
fi
|
||||
done <$INDEX
|
||||
printf "\n"
|
||||
|
|
|
@ -19,8 +19,7 @@ i=0
|
|||
while read -r line || [[ -n "$line" ]]; do
|
||||
status=$(echo $line | awk '{print $1}')
|
||||
if [[ $status = "V" ]]; then
|
||||
var=$(echo $line | awk '{print $5}' | cut -d'/' -f7)
|
||||
var=${var#CN=}
|
||||
var=$(echo $line | sed -e 's/^.*CN=\([^/]*\)\/.*/\1/')
|
||||
certs[$i]=$var
|
||||
if [ "$i" != 0 ]; then
|
||||
printf " $var\n"
|
||||
|
|
Loading…
Reference in a new issue