Uploaded image for project: 'MidPoint'
  1. MidPoint
  2. MID-4836

Strange query behaviour with underscore (_) and substring

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.4.2
    • Fix Version/s: 4.3
    • Component/s: Repository
    • Labels:
      None
    • Environment:

      MS SQL Server, .NET AD connector (but the query is repo-only)

      Description

      Query for shadow objects is as following, in Query playground (simplified and anonymized):

      <query          xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3"
               xmlns:ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3"
               xmlns:icfs="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3"
      >
          <filter>
              <and>
              <ref>
                  <path>resourceRef</path>
                  <value oid="00000000-dc00-dc00-0001-100000000002"/>
              </ref>
                  <q:equal>
                                <q:path>objectClass</q:path>
                                <q:value>ri:CustomGroupObjectClass</q:value>
                            </q:equal>
                            <q:substring>
                                <q:matching>stringIgnoreCase</q:matching>
                                <q:path>attributes/icfs:name</q:path>
                                <q:value>cn=group-orbis_</q:value>
                                <q:anchorStart>true</q:anchorStart>
                            </q:substring>
                            <q:equal>
                              <q:path>kind</q:path>
                              <q:value>entitlement</q:value>
                            </q:equal>
              </and>
          </filter>
      </query>
      

      The query is meant to match shadows like:

      • cn=group-orbis_whatever1,ou=...,,dc=example,dc=com
      • cn=group-orbis_whatever2,ou=...,,dc=example,dc=com

      but is also matches:

      • cn=group-orbis,ou=...,,dc=example,dc=com

      which is bad.

      The issue is that substring is translated to "like" and the underscode is being interpreted by SQL engine (MS SQL in our case).
      One possible workaround may be enclosing underscode in [], but it's too late to test that in my environment (the groups are already gone).

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              vix Ivan Noris
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: