Skip to content

Commit

Permalink
Update code;testing
Browse files Browse the repository at this point in the history
  • Loading branch information
JinhangZhang committed Jan 12, 2025
1 parent ff4934b commit a992864
Showing 1 changed file with 49 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -317,76 +317,83 @@ public AccessControlContext(ProtectionDomain[] fromContext) {
// this.authorizeState is STATE_UNKNOWN by default
}

// AccessControlContext(ProtectionDomain[] context, int authorizeState) {
// super();
// switch (authorizeState) {
// default:
// // authorizeState can't be STATE_UNKNOWN, callerPD always is NULL
// throw new IllegalArgumentException();
// case STATE_AUTHORIZED:
// case STATE_NOT_AUTHORIZED:
// break;
// }
// this.context = context;
// this.authorizeState = authorizeState;
// this.containPrivilegedContext = true;
// }

// AccessControlContext(AccessControlContext acc, ProtectionDomain[] context, int authorizeState) {
// super();
// switch (authorizeState) {
// default:
// // authorizeState can't be STATE_UNKNOWN, callerPD always is NULL
// throw new IllegalArgumentException();
// case STATE_AUTHORIZED:
// if (null != acc) {
// // inherit the domain combiner when authorized
// this.domainCombiner = acc.domainCombiner;
// }
// break;
// case STATE_NOT_AUTHORIZED:
// break;
// }
// this.doPrivilegedAcc = acc;
// this.context = context;
// this.authorizeState = authorizeState;
// this.containPrivilegedContext = true;
// }
AccessControlContext(ProtectionDomain[] context, int authorizeState) {
super();
switch (authorizeState) {
default:
// authorizeState can't be STATE_UNKNOWN, callerPD always is NULL
throw new IllegalArgumentException();
case STATE_AUTHORIZED:
case STATE_NOT_AUTHORIZED:
break;
}
this.context = context;
this.authorizeState = authorizeState;
this.containPrivilegedContext = true;
this(context, null, null, authorizeState);
}

AccessControlContext(AccessControlContext acc, ProtectionDomain[] context, int authorizeState) {
super();
switch (authorizeState) {
default:
// authorizeState can't be STATE_UNKNOWN, callerPD always is NULL
throw new IllegalArgumentException();
case STATE_AUTHORIZED:
if (null != acc) {
// inherit the domain combiner when authorized
this.domainCombiner = acc.domainCombiner;
}
break;
case STATE_NOT_AUTHORIZED:
break;
}
this.doPrivilegedAcc = acc;
this.context = context;
this.authorizeState = authorizeState;
this.containPrivilegedContext = true;
this(context, null, acc, authorizeState);
}

AccessControlContext(ProtectionDomain[] pdArray, AccessControlContext parentAcc, AccessControlContext context, int authorizeState) {
AccessControlContext(ProtectionDomain[] context, AccessControlContext parentAcc, AccessControlContext acc, int authorizeState) {
super();
switch (authorizeState) {
default:
// authorizeState can't be STATE_UNKNOWN, callerPD always is NULL
// authorizeState can't be STATE_UNKNOWN, callerPD is always NULL
throw new IllegalArgumentException();
case STATE_AUTHORIZED:
if (context != null) {
if (acc != null) {
if (parentAcc == null) {
// inherit the domain combiner when authorized
this.domainCombiner = context.domainCombiner;
this.domainCombiner = acc.domainCombiner;
} else {
// when parent combiner is not null, use parent combiner to combine the current context
DomainCombiner parentAccCombiner = parentAcc.getCombiner();
if (parentAccCombiner != null) {
this.context = parentAccCombiner.combine(pdArray, context.context);
this.domainCombiner = parentAccCombiner;
DomainCombiner parentCombiner = parentAcc.getCombiner();
if (parentCombiner != null) {
this.context = parentCombiner.combine(context, acc.context);
this.domainCombiner = parentCombiner;
} else {
this.context = combinePDObjs(pdArray, context.context);
this.domainCombiner = context.domainCombiner;
this.context = combinePDObjs(context, acc.context);
this.domainCombiner = acc.domainCombiner;
}
}
} else {
if (parentAcc != null) {
this.domainCombiner = parentAcc.domainCombiner;
this.nextStackAcc = parentAcc;
}
this.context = pdArray;
this.context = context;
}
break;
case STATE_NOT_AUTHORIZED:
break;
}
this.doPrivilegedAcc = context;
this.doPrivilegedAcc = acc;
this.authorizeState = authorizeState;
this.containPrivilegedContext = true;
}
Expand Down

0 comments on commit a992864

Please sign in to comment.