Skip to content

Commit 371197a

Browse files
author
Vladimir Kotal
committed
handle filter failure
1 parent 6b45eea commit 371197a

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

opengrok-indexer/src/main/java/org/opengrok/indexer/authorization/AuthorizationException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public AuthorizationException(Throwable ex) {
3131
super(ex);
3232
}
3333

34-
AuthorizationException(String msg) {
34+
public AuthorizationException(String msg) {
3535
super(msg);
3636
}
3737

plugins/src/opengrok/auth/plugin/LdapUserPlugin.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ protected boolean sessionExists(HttpServletRequest req) {
104104
}
105105

106106
protected String getFilter(User user) {
107-
String filter = null;
108107
String commonName;
109108

110109
Matcher matcher = usernameCnPattern.matcher(user.getUsername());
@@ -113,14 +112,11 @@ protected String getFilter(User user) {
113112
LOGGER.log(Level.FINEST, "extracted common name {0} from {1}",
114113
new Object[]{commonName, user.getUsername()});
115114
} else {
116-
LOGGER.log(Level.WARNING, "cannot get common name out of {0}",
117-
user.getUsername());
118-
return filter;
115+
throw new AuthorizationException(String.format("cannot get common name out of %s",
116+
user.getUsername()));
119117
}
120118

121-
filter = "(&(objectclass=" + this.objectClass + ")(" + commonName + "))";
122-
123-
return filter;
119+
return "(&(objectclass=" + this.objectClass + ")(" + commonName + "))";
124120
}
125121

126122
@Override

0 commit comments

Comments
 (0)