Hi,

I have a (severe?) issue with the SQL abstraction layer. I am using mysql as backend and unfortunatly no clue about other rdbms - therefore I need some feedback if the issue is mysql only or not.

Problem:
I am searching a certificate by its subject, the subject I am looking for contains a backshlash character.

my $issuer_dn = "OU=Trustcenter,O=Snakeoil\, Inc.,C=US";
CTX('dbi_backend')->first(
  TABLE   => 'CERTIFICATE',
  COLUMNS => [ 'IDENTIFIER' ],
  DYNAMIC => {
    'SUBJECT' => $issuer_dn,
    'PKI_REALM' => $pki_realm
});

I get an empty result, which I tracked down to:

According OpenXPKI::Server::DBI::SQL, Line 979 the query uses a "like" statement on the condition. In mysql the backslash is an escape character when used in like statements:
http://dev.mysql.com/doc/refman/5.0/en/string-comparison-functions.html

Workaround: I ended up now in adding slashes to this special query, which does the job, but I expect that can make some headache one day in any other query, too. Besides I do not now what happens on other RDBMS.

I guess that switching to a simple equotation will break the code as it prevents wildcard queries so we need some kind of escaping mechanism.

Any ideas on that ?

Oliver

--
Protect your environment -  close windows and adopt a penguin!
PGP-Key: 3B2C 8095 A7DF 8BB5 2CFF  8168 CAB7 B0DD 3985 1721

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
OpenXPKI-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openxpki-devel

Reply via email to