[Pkg-silc-commits] r125 - /silc-server/trunk/debian/postinst

lunar at users.alioth.debian.org lunar at users.alioth.debian.org
Mon Jul 2 01:31:29 UTC 2007


Author: lunar
Date: Mon Jul  2 01:31:29 2007
New Revision: 125

URL: http://svn.debian.org/wsvn/pkg-silc/?sc=1&rev=125
Log:
Transform public key identifier into a correct RFC2253 string in postinst.

Modified:
    silc-server/trunk/debian/postinst

Modified: silc-server/trunk/debian/postinst
URL: http://svn.debian.org/wsvn/pkg-silc/silc-server/trunk/debian/postinst?rev=125&op=diff
==============================================================================
--- silc-server/trunk/debian/postinst (original)
+++ silc-server/trunk/debian/postinst Mon Jul  2 01:31:29 2007
@@ -45,18 +45,28 @@
     ADMIN_PASSPHRASE="$RET"
 }
 
+rfc2253ize() {
+    # We espace: symbols ,w+"\<> and spaces at end and begining
+    echo "$1" | sed -e 's/[,;+"\\<>]/\\\1/g,s/ $/\\\1/g,s/^[ #]/\\\1/g'
+}
+
 create_key_pair() {
     retrieve_debconf_answers
 
-    IDENTIFIER="UN=$SERVER_NAME,HN=$HOST_NAME"
+    if [ -z "$SERVER_NAME" -o -z "$HOST_NAME" ]; then
+        # Don't create keypair
+        return
+    fi
+
+    IDENTIFIER="UN=$(rfc2253ize "SERVER_NAME"), HN=$(rfc2253ize "$HOST_NAME")"
     if [ -n "$REAL_NAME" ]; then
-        IDENTIFIER="$IDENTIFIER,RN=$REAL_NAME"
+        IDENTIFIER="$IDENTIFIER, RN=$(rfc2253ize "$REAL_NAME")"
     fi
     if [ -n "$EMAIL" ]; then
-        IDENTIFIER="$IDENTIFIER,E=$EMAIL"
+        IDENTIFIER="$IDENTIFIER, E=$(rfc2253ize "$EMAIL")"
     fi
     if [ -n "$COUNTRY" ]; then
-        IDENTIFIER="$IDENTIFIER,C=$COUNTRY"
+        IDENTIFIER="$IDENTIFIER, C=$(rfc2253ize "$COUNTRY")"
     fi
 
     TMPDIR=$(mktemp -d -t silcd.XXXXXX)




More information about the Pkg-silc-commits mailing list