[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/kdepim/enterprise/kdepim/certmanager
From: Marc Mutz <mutz () kde ! org>
Date: 2008-06-13 6:47:27
Message-ID: 1213339647.984604.13333.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 820074 by mutz:
Fix serialisation of DNs (missing escapting of rfc2253 'special's
kolab/issue2619
M +2 -2 certificatewizardimpl.cpp
M +27 -1 lib/kleo/dn.cpp
M +3 -0 lib/kleo/dn.h
--- branches/kdepim/enterprise/kdepim/certmanager/certificatewizardimpl.cpp \
#820073:820074 @@ -230,9 +230,9 @@
if ( const char * oid = oidForAttributeName( attr ) ) {
// we need to translate the attribute name for the backend:
- rdns.push_back( QString::fromUtf8( oid ) + '=' + value );
+ rdns.push_back( QString::fromUtf8( oid ) + '=' + Kleo::DN::escape( \
value ) ); } else {
- rdns.push_back( attr + '=' + value );
+ rdns.push_back( attr + '=' + Kleo::DN::escape( value ) );
}
}
certParms += rdns.join(",");
--- branches/kdepim/enterprise/kdepim/certmanager/lib/kleo/dn.cpp #820073:820074
@@ -268,12 +268,33 @@
return parse_dn( (const unsigned char*)dn.utf8().data() );
}
+static QString dn_escape( const QString & s ) {
+ QString result;
+ for ( unsigned int i = 0, end = s.length() ; i != end ; ++i ) {
+ const QChar ch = s[i];
+ switch ( ch.unicode() ) {
+ case ',':
+ case '+':
+ case '"':
+ case '\\':
+ case '<':
+ case '>':
+ case ';':
+ result += '\\';
+ // fall through
+ default:
+ result += ch;
+ }
+ }
+ return result;
+}
+
static QString
serialise( const QValueVector<Kleo::DN::Attribute> & dn ) {
QStringList result;
for ( QValueVector<Kleo::DN::Attribute>::const_iterator it = dn.begin() ; it != \
dn.end() ; ++it ) if ( !(*it).name().isEmpty() && !(*it).value().isEmpty() )
- result.push_back( (*it).name().stripWhiteSpace() + '=' + \
(*it).value().stripWhiteSpace() ); + result.push_back( \
(*it).name().stripWhiteSpace() + '=' + dn_escape( (*it).value().stripWhiteSpace() ) \
); return result.join( "," );
}
@@ -367,6 +388,11 @@
return d ? serialise( d->attributes ) : QString::null ;
}
+// static
+QString Kleo::DN::escape( const QString & value ) {
+ return dn_escape( value );
+}
+
void Kleo::DN::detach() {
if ( !d ) {
d = new Kleo::DN::Private();
--- branches/kdepim/enterprise/kdepim/certmanager/lib/kleo/dn.h #820073:820074
@@ -87,6 +87,9 @@
const DN & operator=( const DN & other );
+ /** @return the value in rfc-2253-escaped form */
+ static QString escape( const QString & value );
+
/** @return the DN in a reordered form, according to the settings in
the [DN] group of the application's config file */
QString prettyDN() const;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic