anndl: Fixed a couple of bugs.
[utils.git] / certreq
diff --git a/certreq b/certreq
index fb7e26c..142644e 100755 (executable)
--- a/certreq
+++ b/certreq
@@ -1,5 +1,14 @@
 #!/bin/bash
 
+commajoin() {
+    f=y
+    for arg in "$@"; do
+       if [ -z "$f" ]; then echo -n ,; fi
+       echo -n "$arg"
+       f=
+    done
+}
+
 usage() {
     echo "usage: certreq [-h] [-a ALTNAMES] SUBJECT KEYFILE"
     echo '        SUBJECT is of the form `/PART1=VALUE1/PART2=VALUE2/...'\'
@@ -28,7 +37,9 @@ fi
 
 args=(openssl req -new)
 if [ -n "${!reqexts[*]}" ]; then
-    args=("${args[@]}" -reqexts "${!reqexts[@]}")
+    for reqext in "${!reqexts[@]}"; do
+       args=("${args[@]}" -reqexts "$reqext")
+    done
 fi
 if [ -n "${!config[*]}" ]; then
     confpath="$(mktemp /tmp/certreq-XXXXXX)"