/** * [DFS root referral success] If the current ReferralCache entry's RootOrLink indicates * root targets, go to step 3; otherwise, go to step 4. */ private DFSPath step7(Session session, ResolveState state, ReferralCache.ReferralCacheEntry lookup) throws DFSException { logger.trace("DFS[7]: {}", state); if (lookup.isRoot()) { return step3(session, state, lookup); } return step4(session, state, lookup); }
/** * [DFS root referral success] If the current ReferralCache entry's RootOrLink indicates * root targets, go to step 3; otherwise, go to step 4. */ private DFSPath step7(Session session, ResolveState state, ReferralCache.ReferralCacheEntry lookup) throws DFSException { logger.trace("DFS[7]: {}", state); if (lookup.isRoot()) { return step3(session, state, lookup); } return step4(session, state, lookup); }
/** * Step 4: [ReferralCache hit, unexpired TTL, RootOrLink=link] * 1. If the second component of the path is "SYSVOL" or "NETLOGON" go to step 3. * 2. Check the Interlink element of the ReferralCache entry. * - If Interlink is set in the ReferralCache entry,then the TargetHint is in another DFS namespace. Go to step 11. * - If Interlink is not set in the ReferralCache entry then the TargetHint is not in another DFS namespace. Go to step 3. */ private DFSPath step4(Session session, ResolveState state, ReferralCache.ReferralCacheEntry lookup) throws DFSException { logger.trace("DFS[4]: {}", state); if (state.path.isSysVolOrNetLogon()) { return step3(session, state, lookup); } if (lookup.isInterlink()) { return step11(session, state, lookup); } return step3(session, state, lookup); }
/** * Step 4: [ReferralCache hit, unexpired TTL, RootOrLink=link] * 1. If the second component of the path is "SYSVOL" or "NETLOGON" go to step 3. * 2. Check the Interlink element of the ReferralCache entry. * - If Interlink is set in the ReferralCache entry,then the TargetHint is in another DFS namespace. Go to step 11. * - If Interlink is not set in the ReferralCache entry then the TargetHint is not in another DFS namespace. Go to step 3. */ private DFSPath step4(Session session, ResolveState state, ReferralCache.ReferralCacheEntry lookup) throws DFSException { logger.trace("DFS[4]: {}", state); if (state.path.isSysVolOrNetLogon()) { return step3(session, state, lookup); } if (lookup.isInterlink()) { return step11(session, state, lookup); } return step3(session, state, lookup); }
/** * Step 10: [sysvol referral request] Issue a sysvol referral request, as specified in * section 3.1.4.2, providing 'SYSVOL', the DCHint DC of the DomainCache entry that * corresponds to the domain name in the first path component, UserCredentials, MaxOutputSize, * and Path as parameters. The processing of the referral response and/or error is as * specified in section 3.1.5.4.4, which will update the ReferralCache on success. * If the referral request is successful, go to step 3; otherwise, go to step 13. */ private DFSPath step10(Session session, ResolveState state, DomainCache.DomainCacheEntry domainCacheEntry) throws DFSException { logger.trace("DFS[10]: {}", state); ReferralResult r = sendDfsReferralRequest(DfsRequestType.SYSVOL, domainCacheEntry.getDCHint(), session, state.path); if (NtStatus.isSuccess(r.status)) { return step3(session, state, r.referralCacheEntry); } return step13(session, state, r); }
/** * Step 10: [sysvol referral request] Issue a sysvol referral request, as specified in * section 3.1.4.2, providing 'SYSVOL', the DCHint DC of the DomainCache entry that * corresponds to the domain name in the first path component, UserCredentials, MaxOutputSize, * and Path as parameters. The processing of the referral response and/or error is as * specified in section 3.1.5.4.4, which will update the ReferralCache on success. * If the referral request is successful, go to step 3; otherwise, go to step 13. */ private DFSPath step10(Session session, ResolveState state, DomainCache.DomainCacheEntry domainCacheEntry) throws DFSException { logger.trace("DFS[10]: {}", state); ReferralResult r = sendDfsReferralRequest(DfsRequestType.SYSVOL, domainCacheEntry.getDCHint(), session, state.path); if (NtStatus.isSuccess(r.status)) { return step3(session, state, r.referralCacheEntry); } return step13(session, state, r); }
/** * Step 9: [ReferralCache hit, expired TTL, RootOrLink=link] The link referral request is issued to a DFS root target of the namespace. * Find the root ReferralCache entry corresponding to the first two path components, noting that this will already be in the cache due * to processing that resulted in acquiring the expired link ReferralCache entry. Issue a DFS link referral request, * as specified in section 3.1.4.2, providing "LINK", TargetHint of the root ReferralCache entry, UserCredentials, MaxOutputSize, and Path * as parameters, and process the DFS referral response and/or error as specified in section 3.1.5.4.3, which will update the ReferralCache * on success. * <p> * If the DFS Link referral request fails, set the failure status to the last error that occurred and go to step 14. Otherwise: * 1. If the RootOrLink of the refreshed ReferralCache entry indicates DFS root targets, go to step 3. * 2. If the RootOrLink of the refreshed ReferralCache entry indicates DFS link targets, go to step 4. */ @SuppressWarnings("PMD.UnusedFormalParameter") private DFSPath step9(Session session, ResolveState state, ReferralCache.ReferralCacheEntry lookup) throws DFSException { logger.trace("DFS[9]: {}", state); DFSPath rootPath = new DFSPath(state.path.getPathComponents().subList(0, 2)); ReferralCache.ReferralCacheEntry rootReferralCacheEntry = referralCache.lookup(rootPath); if (rootReferralCacheEntry == null) { throw new IllegalStateException("Could not find referral cache entry for " + rootPath); } ReferralResult result = sendDfsReferralRequest(DfsRequestType.LINK, rootReferralCacheEntry.getTargetHint().getTargetPath(), session, state.path); if (!NtStatus.isSuccess(result.status)) { return step14(session, state, result); } if (result.referralCacheEntry.isRoot()) { return step3(session, state, result.referralCacheEntry); } return step4(session, state, result.referralCacheEntry); }
/** * Step 9: [ReferralCache hit, expired TTL, RootOrLink=link] The link referral request is issued to a DFS root target of the namespace. * Find the root ReferralCache entry corresponding to the first two path components, noting that this will already be in the cache due * to processing that resulted in acquiring the expired link ReferralCache entry. Issue a DFS link referral request, * as specified in section 3.1.4.2, providing "LINK", TargetHint of the root ReferralCache entry, UserCredentials, MaxOutputSize, and Path * as parameters, and process the DFS referral response and/or error as specified in section 3.1.5.4.3, which will update the ReferralCache * on success. * <p> * If the DFS Link referral request fails, set the failure status to the last error that occurred and go to step 14. Otherwise: * 1. If the RootOrLink of the refreshed ReferralCache entry indicates DFS root targets, go to step 3. * 2. If the RootOrLink of the refreshed ReferralCache entry indicates DFS link targets, go to step 4. */ @SuppressWarnings("PMD.UnusedFormalParameter") private DFSPath step9(Session session, ResolveState state, ReferralCache.ReferralCacheEntry lookup) throws DFSException { logger.trace("DFS[9]: {}", state); DFSPath rootPath = new DFSPath(state.path.getPathComponents().subList(0, 2)); ReferralCache.ReferralCacheEntry rootReferralCacheEntry = referralCache.lookup(rootPath); if (rootReferralCacheEntry == null) { throw new IllegalStateException("Could not find referral cache entry for " + rootPath); } ReferralResult result = sendDfsReferralRequest(DfsRequestType.LINK, rootReferralCacheEntry.getTargetHint().getTargetPath(), session, state.path); if (!NtStatus.isSuccess(result.status)) { return step14(session, state, result); } if (result.referralCacheEntry.isRoot()) { return step3(session, state, result.referralCacheEntry); } return step4(session, state, result.referralCacheEntry); }
/** * Step 2: Look up the path in ReferralCache if a cache is being maintained. * If no cache is being maintained, go to step 5. * 1. If no matching entry is found in ReferralCache, go to step 5. * 2. If an entry's TTL has expired: * - If RootOrLink indicates DFS root targets, goto step 5. * - If RootOrLink indicates DFS link targets, goto step 9. * 3. If an entry contains DFS link targets as indicated by RootOrLink, go to step 4; otherwise, go to * step 3. */ private DFSPath step2(Session session, ResolveState state) throws DFSException { logger.trace("DFS[2]: {}", state); ReferralCache.ReferralCacheEntry lookup = referralCache.lookup(state.path); if (lookup == null || (lookup.isExpired() && lookup.isRoot())) { return step5(session, state); // Resolve Root Referral } if (lookup.isExpired()) { // Expired LINK target return step9(session, state, lookup); // Resolve Link Referral } if (lookup.isLink()) { return step4(session, state, lookup); } return step3(session, state, lookup); }
/** * Step 2: Look up the path in ReferralCache if a cache is being maintained. * If no cache is being maintained, go to step 5. * 1. If no matching entry is found in ReferralCache, go to step 5. * 2. If an entry's TTL has expired: * - If RootOrLink indicates DFS root targets, goto step 5. * - If RootOrLink indicates DFS link targets, goto step 9. * 3. If an entry contains DFS link targets as indicated by RootOrLink, go to step 4; otherwise, go to * step 3. */ private DFSPath step2(Session session, ResolveState state) throws DFSException { logger.trace("DFS[2]: {}", state); ReferralCache.ReferralCacheEntry lookup = referralCache.lookup(state.path); if (lookup == null || (lookup.isExpired() && lookup.isRoot())) { return step5(session, state); // Resolve Root Referral } if (lookup.isExpired()) { // Expired LINK target return step9(session, state, lookup); // Resolve Link Referral } if (lookup.isLink()) { return step4(session, state, lookup); } return step3(session, state, lookup); }