Skip to content

Commit bb9177f

Browse files
author
Vladimir Kotal
committed
add comment about expanding non-ambiguous comments
1 parent e6f635b commit bb9177f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

plugins/LdapPlugin/src/opengrok/auth/plugin/LdapFilter.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ public void fillSession(HttpServletRequest req, User user) {
109109
*
110110
* Use \% for printing the '%̈́' character.
111111
*
112+
* Also replaces any other LDAP attribute that would not be ambiguous.
113+
*
112114
* @param filter basic filter containing the special values
113115
* @param ldapUser user from LDAP
114116
* @param user user from the request
@@ -119,6 +121,7 @@ protected String expandFilter(String filter, LdapUser ldapUser, User user) {
119121
filter = filter.replaceAll("(?<!\\\\)%mail(?<!\\\\)%", ldapUser.getMail());
120122
filter = filter.replaceAll("(?<!\\\\)%username(?<!\\\\)%", user.getUsername());
121123
filter = filter.replaceAll("(?<!\\\\)%guid(?<!\\\\)%", user.getId());
124+
122125
for (Entry<String, Set<String>> entry : ldapUser.getAttributes().entrySet()) {
123126
if (entry.getValue().size() == 1) {
124127
try {
@@ -131,7 +134,9 @@ protected String expandFilter(String filter, LdapUser ldapUser, User user) {
131134
}
132135

133136
}
137+
134138
filter = filter.replaceAll("\\\\%", "%");
139+
135140
return filter;
136141
}
137142

0 commit comments

Comments
 (0)