@@ -71,19 +71,27 @@ VaultDeposit::preclaim(PreclaimContext const& ctx)
7171 if (isFrozen (ctx.view , account, share))
7272 return tecFROZEN;
7373
74- if (vault->getFlags () == tfVaultPrivate && account != vault->at (sfOwner))
74+ if (( vault->getFlags () & tfVaultPrivate) && account != vault->at (sfOwner))
7575 {
76+ // The authorization check below is based on DomainID stored in
77+ // MPTokenIssuance. Had the vault shares been a regular MPToken, we
78+ // would allow authorization granted by the issuer explicitly, but Vault
79+ // does not have an MPT issuer (instead it uses pseudo-account, which is
80+ // blackholed and cannot create any transactions).
81+ //
82+ // We also need to do similar check inside doApply(), in order to remove
83+ // expired credentials and/or adjust authorization flag on tokens owned
84+ // by DomainID (i.e. with lsfMPTDomainCheck flag). This is why we
85+ // suppress authorization errors if domainId is set.
86+ uint256 domainId = beast::zero;
7687 auto const err = requireAuth (
77- ctx.view , MPTIssue (vault->at (sfMPTokenIssuanceID)), account);
78- return err;
88+ ctx.view ,
89+ MPTIssue (vault->at (sfMPTokenIssuanceID)),
90+ account,
91+ &domainId);
7992
80- // The above will perform authorization check based on DomainID stored
81- // in MPTokenIssuance. Had this been a regular MPToken, it would also
82- // allow use of authorization granted by the issuer explicitly, but
83- // Vault does not have an MPT issuer (instead it uses pseudo-account).
84- //
85- // If we passed the above check then we also need to do similar check
86- // inside doApply(), in order to check for expired credentials.
93+ if (domainId == beast::zero)
94+ return err;
8795 }
8896
8997 return tesSUCCESS;
@@ -120,7 +128,7 @@ VaultDeposit::doApply()
120128
121129 MPTIssue const mptIssue (mptIssuanceID);
122130 // Note, vault owner is always authorized
123- if (account_ != vault->at (sfOwner ) && ( vault->getFlags () & tfVaultPrivate ))
131+ if (( vault->getFlags ( ) & tfVaultPrivate) && account_ != vault->at (sfOwner ))
124132 {
125133 if (auto const err = enforceMPTokenAuthorization (
126134 ctx_.view (), mptIssue, account_, mPriorBalance , j_);
0 commit comments