Juan Hernandez has posted comments on this change.

Change subject: core: pre processing for search-generated ldap filters
......................................................................


Patch Set 2: Code-Review+1

(2 comments)

....................................................
File 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/adbroker/UpnSplitterLdapFilterSearchEnginePreProcessor.java
Line 3: /**
Line 4:  * The filter generated by the search mechanism contains the 
$PRINCIPAL_NAME entry to perform search by UPN. The filter
Line 5:  * takes the part after the equation sign (as the $PRINCIPAL_NAME part 
of the filter looks like
Line 6:  * ($PRINCIPAL_NAME=user@domain) and splits to user and domain. It 
composes back the filter, so the part of
Line 7:  * $PRINCIPAL_NAME will not look like ($PRINCIPAL_NAME=user) This is 
relevant for RHDS and OpenLdap
s/not/now/?
Line 8:  */
Line 9: public class UpnSplitterLdapFilterSearchEnginePreProcessor implements 
LdapFilterSearchEnginePreProcessor {
Line 10: 
Line 11:     @Override


Line 12:     public String preProcess(String filter) {
Line 13:         int principalNameIdx = 
filter.indexOf(SearchLangageLDAPTokens.$PRINCIPAL_NAME.toString());
Line 14:         if (principalNameIdx != -1) {
Line 15:             int equalsIdx = filter.indexOf('=', principalNameIdx);
Line 16:             int closingParen = filter.indexOf(')', equalsIdx);
I know that this will not happen, but may be good to check that equalsIdx and 
closingParen aren't -1.
Line 17:             String user = filter.substring(equalsIdx + 1, 
closingParen);
Line 18:             if (user.indexOf('@') != -1) { // Indeed a principal name 
format
Line 19:                 String[] parts = user.split("@");
Line 20:                 user = parts[0];


-- 
To view, visit http://gerrit.ovirt.org/17794
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I35744eb423ca7f553bf7e9b20c72179bca4e6827
Gerrit-PatchSet: 2
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Yair Zaslavsky <yzasl...@redhat.com>
Gerrit-Reviewer: Juan Hernandez <juan.hernan...@redhat.com>
Gerrit-Reviewer: Oved Ourfali <oourf...@redhat.com>
Gerrit-Reviewer: Yair Zaslavsky <yzasl...@redhat.com>
Gerrit-Reviewer: automat...@ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to