On Thu, Oct 09, 2008 at 05:25:50PM +0200, Patrick Schoenfeld wrote:
> Hi,
> 
> On Thu, Oct 09, 2008 at 03:17:43PM +0300, Niko Tyni wrote:
> > Line 212 in the postinst breaks if sympa/key_password contains sed
> > metacharacters, for instance 'a/b/c' as above.
> 
> attached is a patch for this issue.
> 
> Best Regards,
> Patrick

> --- sympa-5.3.4/debian/postinst       2008-10-09 17:20:42.000000000 +0200
> +++ sympa-5.3.4.patched/debian/postinst       2008-10-09 17:20:18.433756307 
> +0200
> @@ -208,8 +208,10 @@
>       if ! grep -q "^#-- S/MIME configuration" /etc/sympa/sympa.conf ; then
>           db_get sympa/key_password
>           key_password="$RET"
> +         # Escape the character which is used in the sed command
> +         key_password="`echo $key_password|sed 's/|/\\\|/g'`"
>  
> -         sed -e "s/@KEY_PASSWORD@/$key_password/" \
> +         sed -e "s|@KEY_PASSWORD@|$key_password|" \
>           /etc/sympa/sympa.conf-smime.in >>/etc/sympa/sympa.conf
>           chown sympa:sympa /etc/sympa/sympa.conf
>       fi

What if one uses something like '\' characther in the password ?

I think maintainers of other packages are instead using perl and not sed, using 
a variable's value in the substitution, which helps get rid of those nasty 
special characters meanings in sed regexps.

For instance in twiki package I noticed things like :
perl -pi~ -e '$U=q{'"$RET"'}; s{http://your.domain.com}{$U}g;' 
/etc/twiki/apache.conf

I'm not completely sure of what I'm proposing here, but I hope this helps.

Best regards,




-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to