Skip to content

Commit

Permalink
[bugfix] guard against NPE in securitymanager
Browse files Browse the repository at this point in the history
fixes #4670
  • Loading branch information
Nico Verwer authored and line-o committed Dec 11, 2023
1 parent 1029a51 commit 39c00dc
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,17 @@ private org.exist.dom.memtree.DocumentImpl functionId() {

builder.startElement(new QName("id", SecurityManagerModule.NAMESPACE_URI, SecurityManagerModule.PREFIX), null);

builder.startElement(new QName("real", SecurityManagerModule.NAMESPACE_URI, SecurityManagerModule.PREFIX), null);
subjectToXml(builder, context.getRealUser());
builder.endElement();
final Subject realUser = context.getRealUser();
if (realUser != null) {
builder.startElement(new QName("real", SecurityManagerModule.NAMESPACE_URI, SecurityManagerModule.PREFIX), null);
subjectToXml(builder, realUser);
builder.endElement();
}

if (!sameUserWithSameGroups(context.getRealUser(), context.getEffectiveUser())) {
final Subject effectiveUser = context.getEffectiveUser();
if (effectiveUser != null && (realUser == null || !sameUserWithSameGroups(realUser, effectiveUser))) {
builder.startElement(new QName("effective", SecurityManagerModule.NAMESPACE_URI, SecurityManagerModule.PREFIX), null);
subjectToXml(builder, context.getEffectiveUser());
subjectToXml(builder, effectiveUser);
builder.endElement();
}

Expand Down

0 comments on commit 39c00dc

Please sign in to comment.