Пример #1
0
ANSC_STATUS
CosaBridgingRemove
    (
        ANSC_HANDLE                 hThisObject
    )
{
    ANSC_STATUS                     returnStatus      = ANSC_STATUS_SUCCESS;
    PCOSA_DATAMODEL_BRIDGING        pMyObject         = (PCOSA_DATAMODEL_BRIDGING   )hThisObject;
    PSLIST_HEADER                   pBridgeHead       = (PSLIST_HEADER              )&pMyObject->BridgeList;
    PCOSA_CONTEXT_LINK_OBJECT       pCosaContext2     = (PCOSA_CONTEXT_LINK_OBJECT  )NULL;
    PCOSA_DML_BRG_FULL_ALL          pDmlBridge        = (PCOSA_DML_BRG_FULL_ALL     )NULL;
    PSINGLE_LINK_ENTRY              pSLinkEntry       = (PSINGLE_LINK_ENTRY         )NULL;
    PSLIST_HEADER                   pListHead         = (PSLIST_HEADER              )NULL;
    PSINGLE_LINK_ENTRY              pSLinkEntry2      = (PSINGLE_LINK_ENTRY         )NULL;
    PCOSA_CONTEXT_LINK_OBJECT       pCosaContext3     = (PCOSA_CONTEXT_LINK_OBJECT  )NULL;
    PCOSA_DML_BRG_PORT_FULL         pPort             = (PCOSA_DML_BRG_PORT_FULL    )NULL;

    pSLinkEntry = AnscSListGetFirstEntry(pBridgeHead);

    while ( pSLinkEntry )
    {
        pCosaContext2 = ACCESS_COSA_CONTEXT_LINK_OBJECT(pSLinkEntry);
        pSLinkEntry   = AnscSListGetNextEntry(pSLinkEntry);

        pDmlBridge = (PCOSA_DML_BRG_FULL_ALL)pCosaContext2->hContext;

        if ( pDmlBridge )
        {
            AnscSListPopEntryByLink(pBridgeHead, &pCosaContext2->Linkage);

            pListHead = &pDmlBridge->PortList;

            pSLinkEntry2 = AnscSListGetFirstEntry(pListHead);

            while ( pSLinkEntry2 )
            {
                pCosaContext3 = ACCESS_COSA_CONTEXT_LINK_OBJECT(pSLinkEntry2);
                pSLinkEntry2 = AnscSListGetNextEntry(pSLinkEntry2);

                pPort = (PCOSA_DML_BRG_PORT_FULL)pCosaContext3->hContext;

                AnscSListPopEntryByLink(pListHead, &pCosaContext3->Linkage);

                if ( pPort )
                {
                    AnscFreeMemory(pPort);
                }

                AnscFreeMemory(pCosaContext3);
            }

            AnscFreeMemory(pDmlBridge);
            AnscFreeMemory(pCosaContext2);
        }
    }

    AnscFreeMemory((ANSC_HANDLE)pMyObject);

    return returnStatus;
}
ANSC_STATUS
CosaTSIPRemove
    (
        ANSC_HANDLE                 hThisObject
    )
{
    ANSC_STATUS                     returnStatus            = ANSC_STATUS_SUCCESS;
    PCOSA_DATAMODEL_TSIP            pMyObject               = (PCOSA_DATAMODEL_TSIP)hThisObject;
    PSINGLE_LINK_ENTRY              pSLinkEntry             = NULL;
    PCOSA_CONTEXT_LINK_OBJECT       pCosaContext            = NULL;

    /* Remove necessary resounce */
    if (AnscSListQueryDepth(&pMyObject->SubnetList) != 0)
    {
        pSLinkEntry = AnscSListGetFirstEntry(&pMyObject->SubnetList);

        while ( pSLinkEntry )
        {
            pCosaContext            = ACCESS_COSA_CONTEXT_LINK_OBJECT(pSLinkEntry);
            pSLinkEntry             = AnscSListGetNextEntry(pSLinkEntry);

            AnscSListPopEntryByLink(&pMyObject->SubnetList, &pCosaContext->Linkage);           

            AnscFreeMemory(pCosaContext->hContext);
            AnscFreeMemory(pCosaContext);
        }
    }

    if (AnscSListQueryDepth(&pMyObject->RuleList) != 0)
    {
        pSLinkEntry = AnscSListGetFirstEntry(&pMyObject->RuleList);

        while ( pSLinkEntry )
        {
            pCosaContext            = ACCESS_COSA_CONTEXT_LINK_OBJECT(pSLinkEntry);
            pSLinkEntry             = AnscSListGetNextEntry(pSLinkEntry);

            AnscSListPopEntryByLink(&pMyObject->RuleList, &pCosaContext->Linkage);           

            AnscFreeMemory(pCosaContext->hContext);
            AnscFreeMemory(pCosaContext);
        }
    }
    /* Remove self */
    AnscFreeMemory((ANSC_HANDLE)pMyObject);

    return returnStatus;
}
ULONG
IPv4PingServerTable_DelEntry
    (
        ANSC_HANDLE                 hInsContext,
        ANSC_HANDLE                 hInstance
    )

{
    ANSC_STATUS                          returnStatus      = ANSC_STATUS_SUCCESS;
    PCOSA_DATAMODEL_SELFHEAL             pSelfHeal               = (PCOSA_DATAMODEL_SELFHEAL)g_pCosaBEManager->hSelfHeal;
    PCOSA_CONTEXT_SELFHEAL_LINK_OBJECT   pSelfHealCxtLink   = (PCOSA_CONTEXT_SELFHEAL_LINK_OBJECT)hInstance;
    PCOSA_DML_SELFHEAL_IPv4_SERVER_TABLE pServerIpv4      = (PCOSA_DML_SELFHEAL_IPv4_SERVER_TABLE)pSelfHealCxtLink->hContext;
	/* Remove entery from the database */
	returnStatus = RemovePingServerURI(PingServerType_IPv4, pServerIpv4->InstanceNumber);
    if ( returnStatus == ANSC_STATUS_SUCCESS )
	{
			/* Remove entery from the Queue */
        if(AnscSListPopEntryByLink(&pSelfHeal->IPV4PingServerList, &pSelfHealCxtLink->Linkage) == TRUE)
		{
			AnscFreeMemory(pSelfHealCxtLink->hContext);
			AnscFreeMemory(pSelfHealCxtLink);
		}
		else
		{
			return ANSC_STATUS_FAILURE;
		}
	}
    return returnStatus;
}
ANSC_STATUS
CosaNeighdiscRemove
    (
        ANSC_HANDLE                 hThisObject
    )
{
    ANSC_STATUS                     returnStatus    = ANSC_STATUS_SUCCESS;
    PCOSA_DATAMODEL_NEIGHDISC       pMyObject       = (PCOSA_DATAMODEL_NEIGHDISC)hThisObject;
    PSLIST_HEADER                   pNeighdiscIFHead       = (PSLIST_HEADER)&pMyObject->InterfaceList;
    PCOSA_DML_NEIGHDISC_IF_FULL     pNeighdiscInterface    = (PCOSA_DML_NEIGHDISC_IF_FULL)NULL;
    PSINGLE_LINK_ENTRY              pLink           = (PSINGLE_LINK_ENTRY )NULL;
    PSINGLE_LINK_ENTRY              pSubLink        = (PSINGLE_LINK_ENTRY )NULL;
    PCOSA_CONTEXT_LINK_OBJECT       pCosaContext    = (PCOSA_CONTEXT_LINK_OBJECT)NULL;
    PCOSA_CONTEXT_LINK_OBJECT       pSubCosaContext = (PCOSA_CONTEXT_LINK_OBJECT)NULL;
    PPOAM_IREP_FOLDER_OBJECT        pPoamIrepFoTemp = (PPOAM_IREP_FOLDER_OBJECT)NULL;

    /*free the back end memory*/
    CosaDmlNeighdiscIfBERemove();

    /* Neighdisc Interface List */
    pLink = AnscSListGetFirstEntry(pNeighdiscIFHead);

    while ( pLink )
    {
        pCosaContext = ACCESS_COSA_CONTEXT_LINK_OBJECT(pLink);
        pLink   = AnscSListGetNextEntry(pLink);

        pNeighdiscInterface = (PCOSA_DML_NEIGHDISC_IF_FULL)pCosaContext->hContext;

        if ( pNeighdiscInterface )
        {
            AnscSListPopEntryByLink(pNeighdiscIFHead, &pCosaContext->Linkage);

            AnscFreeMemory(pNeighdiscInterface);
            AnscFreeMemory(pCosaContext);
        }
    }


    /* Remove self */
    pPoamIrepFoTemp = (PPOAM_IREP_FOLDER_OBJECT)pMyObject->hIrepFolderNeighdiscInterfaceHA;
    if ( pPoamIrepFoTemp )
    {
        pPoamIrepFoTemp->Remove(pPoamIrepFoTemp);
    }

    
    pPoamIrepFoTemp = (PPOAM_IREP_FOLDER_OBJECT)pMyObject->hIrepFolderNeighdiscInterface;
    if ( pPoamIrepFoTemp )
    {
        pPoamIrepFoTemp->Remove(pPoamIrepFoTemp);
    }
 

    AnscFreeMemory((ANSC_HANDLE)pMyObject);

    return returnStatus;
}
ANSC_STATUS
WebVhoDelGso
(
    ANSC_HANDLE                 hThisObject,
    ULONG                       ulSessionId,
    PUCHAR                      address,
    USHORT                      port
)
{
    ANSC_STATUS                     returnStatus = ANSC_STATUS_SUCCESS;
    PWEB_VIRTUAL_HOST_OBJECT        pMyObject    = (PWEB_VIRTUAL_HOST_OBJECT  )hThisObject;
    PWEB_VIRTUAL_HOST_PROPERTY      pProperty    = (PWEB_VIRTUAL_HOST_PROPERTY)&pMyObject->Property;
    PHTTP_HFP_INTERFACE             pHfpIf       = (PHTTP_HFP_INTERFACE       )pMyObject->hHfpIf;
    PWEB_LSM_INTERFACE              pLsmIf       = (PWEB_LSM_INTERFACE        )pMyObject->hLsmIf;
    PWEB_GENERAL_SESSION_OBJECT     pSession     = NULL;
    ULONG                           ulClientAddr = 0;
    PSINGLE_LINK_ENTRY              pSLinkEntry  = NULL;
    ULONG                           ulHashIndex  = AnscHashUlong(ulSessionId, WEB_VHO_GSO_TABLE_SIZE);

    AnscAcquireLock(&pMyObject->GsoTableLock);

    pSLinkEntry = AnscSListGetFirstEntry(&pMyObject->GsoTable[ulHashIndex]);

    while ( pSLinkEntry )
    {
        pSession     = ACCESS_WEB_GENERAL_SESSION_OBJECT(pSLinkEntry);
        ulClientAddr = *(PULONG)pSession->GetClientAddr((ANSC_HANDLE)pSession);
        pSLinkEntry  = AnscSListGetNextEntry(pSLinkEntry);

        if ( (pSession->GetSessionId((ANSC_HANDLE)pSession) == ulSessionId           ) &&
                (ulClientAddr                                  == AnscReadUlong(address)) )
        {
            AnscSListPopEntryByLink(&pMyObject->GsoTable[ulHashIndex], &pSession->Linkage);

            pSession->AcquireAccess((ANSC_HANDLE)pSession);

            returnStatus =
                pLsmIf->EndSession
                (
                    pLsmIf->hOwnerContext,
                    (ANSC_HANDLE)pSession
                );

            pSession->ReleaseAccess((ANSC_HANDLE)pSession);
            pSession->Cancel       ((ANSC_HANDLE)pSession);
            pSession->Remove       ((ANSC_HANDLE)pSession);
        }
    }

    AnscReleaseLock(&pMyObject->GsoTableLock);

    return  ANSC_STATUS_SUCCESS;
}
ANSC_STATUS
CosaDdnsRemove
    (
        ANSC_HANDLE                 hThisObject
    )
{
    ANSC_STATUS                     returnStatus     = ANSC_STATUS_SUCCESS;
    PCOSA_DATAMODEL_DDNS            pMyObject        = (PCOSA_DATAMODEL_DDNS     )hThisObject;
    PSLIST_HEADER                   pListHead        = (PSLIST_HEADER            )&pMyObject->ContextHead;
    PPOAM_IREP_FOLDER_OBJECT        pPoamIrepFoDdns  = (PPOAM_IREP_FOLDER_OBJECT )pMyObject->hIrepFolderDdns;
    PPOAM_IREP_FOLDER_OBJECT        pPoamIrepFo      = (PPOAM_IREP_FOLDER_OBJECT )NULL;
    PCOSA_CONTEXT_LINK_OBJECT       pCosaContext     = (PCOSA_CONTEXT_LINK_OBJECT)NULL;
    PCOSA_DML_DDNS_SERVICE          pDdnsEntry       = (PCOSA_DML_DDNS_SERVICE   )NULL;
    PSINGLE_LINK_ENTRY              pSLinkEntry      = (PSINGLE_LINK_ENTRY       )NULL;

	/* Remove necessary resounce */
    pSLinkEntry = AnscSListGetFirstEntry(pListHead);

    while ( pSLinkEntry )
    {
        pCosaContext = ACCESS_COSA_CONTEXT_LINK_OBJECT(pSLinkEntry);
        pSLinkEntry  = AnscSListGetNextEntry(pSLinkEntry);

        pDdnsEntry = (PCOSA_DML_DDNS_SERVICE)pCosaContext->hContext;

        if ( pDdnsEntry )
        {
            AnscSListPopEntryByLink(pListHead, &pCosaContext->Linkage);

            AnscFreeMemory(pDdnsEntry);

            pPoamIrepFo = pCosaContext->hPoamIrepFo;

            if ( pPoamIrepFo )
            {
                pPoamIrepFo->Remove((ANSC_HANDLE)pPoamIrepFo);
            }

            AnscFreeMemory(pCosaContext);
        }
    }

    if ( pPoamIrepFoDdns )
    {
        pPoamIrepFoDdns->Remove((ANSC_HANDLE)pPoamIrepFoDdns);
    }

    /* Remove self */
    AnscFreeMemory((ANSC_HANDLE)pMyObject);

	return returnStatus;
}
ANSC_STATUS
BwrmPmoDelPage
    (
        ANSC_HANDLE                 hThisObject,
        char*                       root_path,
        char*                       file_path
    )
{
    ANSC_STATUS                     returnStatus      = ANSC_STATUS_SUCCESS;
    PBWRM_PAGE_MANAGER_OBJECT       pMyObject         = (PBWRM_PAGE_MANAGER_OBJECT    )hThisObject;
    PBWRM_PAGE_MANAGER_PROPERTY     pProperty         = (PBWRM_PAGE_MANAGER_PROPERTY  )&pMyObject->Property;
    PANSC_TIMER_DESCRIPTOR_OBJECT   pCacheTimerObject = (PANSC_TIMER_DESCRIPTOR_OBJECT)pMyObject->hCacheTimerObject;
    PBWRM_COOKED_PAGE_OBJECT        pCookedPage       = (PBWRM_COOKED_PAGE_OBJECT     )NULL;
    PSINGLE_LINK_ENTRY              pSLinkEntry       = (PSINGLE_LINK_ENTRY           )NULL;
    ULONG                           ulHashIndex       = (ULONG                        )AnscHashString(file_path, AnscSizeOfString(file_path), BWRM_PMO_CPO_TABLE_SIZE);

    AnscAcquireLock(&pMyObject->CpoTableLock);

    pSLinkEntry = AnscSListGetFirstEntry(&pMyObject->CpoTable[ulHashIndex]);

    while ( pSLinkEntry )
    {
        pCookedPage = ACCESS_BWRM_COOKED_PAGE_OBJECT(pSLinkEntry);
        pSLinkEntry = AnscSListGetNextEntry(pSLinkEntry);

        if ( pCookedPage->MatchPath
                (
                    (ANSC_HANDLE)pCookedPage,
                    root_path,
                    file_path
                ) )
        {
            AnscSListPopEntryByLink(&pMyObject->CpoTable[ulHashIndex], &pCookedPage->Linkage);

            pCookedPage->Remove((ANSC_HANDLE)pCookedPage);

            break;
        }
    }

    AnscReleaseLock(&pMyObject->CpoTableLock);

    if ( pMyObject->GetPageCount((ANSC_HANDLE)pMyObject) == 0 )
    {
        pCacheTimerObject->Stop((ANSC_HANDLE)pCacheTimerObject);
    }

    return  ANSC_STATUS_SUCCESS;
}
Пример #8
0
ULONG
IPv6rdIF_DelEntry(
        ANSC_HANDLE hInsContext,
        ULONG       hInstance)
{
    PCOSA_DATAMODEL_IPV6RD      pMyObject = (PCOSA_DATAMODEL_IPV6RD)g_pCosaBEManager->hIPv6rd;
    PCOSA_CONTEXT_LINK_OBJECT   pCosaContext = (PCOSA_CONTEXT_LINK_OBJECT)hInstance;
    PCOSA_CONTEXT_LINK_OBJECT   pCosaContext2 = NULL;
    PCOSA_DML_IPV6RD_IF         pEntry = (PCOSA_DML_IPV6RD_IF)pCosaContext->hContext;
    PCOSA_DML_IPV6RD_IF         pNewEntry = NULL;
    PSLIST_HEADER               pListHead = (PSLIST_HEADER)&pMyObject->IfList;
    PSINGLE_LINK_ENTRY          pSLinkEntry = NULL;

    if (CosaDml_IPv6rdDelEntry(NULL, pEntry->InstanceNumber) != ANSC_STATUS_SUCCESS)
    {
        CcspTraceError(("IPv6rdIF_DelEntry: CosaDml_IPv6rdDelEntry error\n"));
        /* may fail if object is add be PSM config is not set.
         * so do not return here */
        /* return ANSC_STATUS_FAILURE; */
    }

    pSLinkEntry = AnscSListGetFirstEntry(&pMyObject->IfList);
    while (pSLinkEntry)
    {
        pCosaContext2 = ACCESS_COSA_CONTEXT_LINK_OBJECT(pSLinkEntry);
        pSLinkEntry = AnscSListGetNextEntry(pSLinkEntry);

        pNewEntry = (PCOSA_DML_IPV6RD_IF)pCosaContext2->hContext;
        if (pNewEntry && AnscEqualString(pNewEntry->Alias, pEntry->Alias, FALSE))
        {
            AnscSListPopEntryByLink(pListHead, &pCosaContext2->Linkage);

			if (pCosaContext->bNew)
	            CosaIPv6rdIfRegDelInfo((ANSC_HANDLE)pMyObject, (ANSC_HANDLE)pCosaContext2);

            AnscFreeMemory(pNewEntry);
            AnscFreeMemory(pCosaContext2);
            break;
        }
    }

    return ANSC_STATUS_SUCCESS;
}
ANSC_HANDLE
HttpPsoVer2PopTroBySocket
    (
        ANSC_HANDLE                 hThisObject,
        ANSC_HANDLE                 hSocket
    )
{
    ANSC_STATUS                     returnStatus   = ANSC_STATUS_SUCCESS;
    PHTTP_PSO_VER2_OBJECT           pMyObject      = (PHTTP_PSO_VER2_OBJECT      )hThisObject;
    PHTTP_ADVANCED_PROXY_OBJECT     pAdvancedProxy = (PHTTP_ADVANCED_PROXY_OBJECT)pMyObject->hOwnerContext;
    PHTTP_TRANS_RECORD_OBJECT       pTransRecord   = NULL;
    PSINGLE_LINK_ENTRY              pSLinkEntry    = NULL;

    AnscAcquireLock(&pMyObject->TroSListLock);

    pSLinkEntry = AnscSListGetFirstEntry(&pMyObject->TroSList);

    while ( pSLinkEntry )
    {
        pTransRecord = ACCESS_HTTP_TRANS_RECORD_OBJECT(pSLinkEntry);
        pSLinkEntry  = AnscSListGetNextEntry(pSLinkEntry);

        if ( pTransRecord->hServerSocket == hSocket )
        {
            AnscSListPopEntryByLink(&pMyObject->TroSList, &pTransRecord->Linkage);

            pTransRecord->AcquireAccess((ANSC_HANDLE)pTransRecord);

            AnscReleaseLock(&pMyObject->TroSListLock);

            return  (ANSC_HANDLE)pTransRecord;
        }
    }

    AnscReleaseLock(&pMyObject->TroSListLock);

    return  (ANSC_HANDLE)NULL;
}
ANSC_STATUS
HttpAuthcoAddAuthInfo
    (
        ANSC_HANDLE                 hThisObject,
        ANSC_HANDLE                 hRequest,
        ANSC_HANDLE                 hChallenge
    )
{
    ANSC_STATUS                     status       = ANSC_STATUS_SUCCESS;
    PHTTP_AUTH_CLIENT_OBJECT        pMyObject    = (PHTTP_AUTH_CLIENT_OBJECT)hThisObject;
    PHTTP_BMO_REQ_OBJECT            pRequest     = (PHTTP_BMO_REQ_OBJECT    )hRequest;
    PHTTP_AUTH_CHALLENGE            pChallenge   = (PHTTP_AUTH_CHALLENGE    )hChallenge;
    PHTTP_AUTHO_INFO                pAuthInfo    = NULL;
    PHTTP_AUTHO_DIGEST_INFO         pDigestInfo  = NULL;
    PHTTP_ACM_INTERFACE             pHttpAcmIf   = (PHTTP_ACM_INTERFACE     )pMyObject->hAcmIf;
    BOOL                            bDigestAuth  = (pChallenge->AuthType == HTTP_AUTH_TYPE_DIGEST);
    PUCHAR                          pHostName    = NULL;
    PUCHAR                          pUriPath     = NULL;
    USHORT                          HostPort     = 0;
    BOOL                            bParentUri   = FALSE;

    if ( !pHttpAcmIf )
    {
        return ANSC_STATUS_INTERNAL_ERROR;
    }

    status = pMyObject->GetRequestHostUri((ANSC_HANDLE)pMyObject, hRequest, &pHostName, &HostPort, &pUriPath);

    if ( status != ANSC_STATUS_SUCCESS )
    {
        status = ANSC_STATUS_INTERNAL_ERROR;
        goto ABNORM;
    }

    AnscAcquireLock(&pMyObject->AuthInfoListLock);

    pAuthInfo   = (PHTTP_AUTHO_INFO)pMyObject->FindAuthInfo2((ANSC_HANDLE)pMyObject, hRequest, &bParentUri);

    if ( pAuthInfo )
    {
        AnscSListPopEntryByLink(&pMyObject->AuthInfoList, &pAuthInfo->Linkage);
        HttpAuthInfoRemove(pAuthInfo);
        pAuthInfo   = NULL;
    }

    HttpAuthInfoCreate(pAuthInfo);

    if ( !pAuthInfo )
    {
        status  = ANSC_STATUS_RESOURCES;
        goto EXIT;
    }

    if ( bDigestAuth )
    {
        HttpAuthDigestInfoCreate(pAuthInfo->pDigest);

        if ( !pAuthInfo->pDigest )
        {
            status  = ANSC_STATUS_RESOURCES;
            goto EXIT;
        }
    }

    /* set up authentication info */
    pAuthInfo->AuthType     = pChallenge->AuthType;
    status =
        pHttpAcmIf->GetCredential
            (
                pHttpAcmIf->hOwnerContext,
                pHostName,
                HostPort,
                pUriPath,
                &pAuthInfo->pUserName,
                &pAuthInfo->pPassword
            );

    if ( status != ANSC_STATUS_SUCCESS )
    {
        goto EXIT;
    }

    pAuthInfo->pHostName    = pHostName;
    pAuthInfo->HostPort     = HostPort;
    pAuthInfo->pUri         = pUriPath;

    if ( !bDigestAuth )
    {
        /* basic authentication */
        PHTTP_CHALLENGE_BASIC       pBasicChal  = &pChallenge->Challenge.Basic;

        pAuthInfo->pRealm   = AnscCloneString(pBasicChal->Realm);
    }
    else
    {
        /* digest authentication */
        PHTTP_CHALLENGE_DIGEST      pDigestChal = &pChallenge->Challenge.Digest;
        PUCHAR                      pChal       = (PUCHAR)pDigestChal->Realm;

        pMyObject->GetDigestAuthInfo
            (
                (ANSC_HANDLE)pMyObject,
                (ANSC_HANDLE)pAuthInfo,
                pChal
            );
    }

    /* sweep out old entries */
    if ( TRUE )
    {
        ULONG                       ulCount = (ULONG)AnscSListQueryDepth(&pMyObject->AuthInfoList);

        while ( ulCount >= pMyObject->AuthInfoMaxCount )
        {
            PSINGLE_LINK_ENTRY          pLastEntry = NULL;

            pLastEntry = AnscSListGetLastEntry(&pMyObject->AuthInfoList);
            AnscSListPopEntryByLink(&pMyObject->AuthInfoList, pLastEntry);

            ulCount --;
        }
    }

    AnscSListPushEntry(&pMyObject->AuthInfoList, &pAuthInfo->Linkage);

    status = ANSC_STATUS_SUCCESS;

EXIT:
    AnscReleaseLock(&pMyObject->AuthInfoListLock);

ABNORM:
    if ( status != ANSC_STATUS_SUCCESS )
    {
        if ( pHostName )
        {
            AnscFreeMemory(pHostName);
        }

        if ( pUriPath )
        {
            AnscFreeMemory(pUriPath);
        }

        if ( pAuthInfo )
        {
            HttpAuthInfoRemove(pAuthInfo);
        }
    }

    return status;
}
ANSC_HANDLE
HttpAuthcoFindAuthInfo2
    (
        ANSC_HANDLE                 hThisObject,
        ANSC_HANDLE                 hRequest,
        PBOOL                       pbParentUri
    )
{
    ANSC_STATUS                     status       = ANSC_STATUS_SUCCESS;
    PHTTP_AUTH_CLIENT_OBJECT        pMyObject    = (PHTTP_AUTH_CLIENT_OBJECT)hThisObject;
    PHTTP_BMO_REQ_OBJECT            pRequest     = (PHTTP_BMO_REQ_OBJECT    )hRequest;
    PHTTP_AUTHO_INFO                pAuthInfo    = NULL;
    PSINGLE_LINK_ENTRY              pSLinkEntry  = NULL;
    ANSC_HANDLE                     hAuthInfo    = (ANSC_HANDLE)NULL;
    PUCHAR                          pHostName    = NULL;
    PUCHAR                          pUriPath     = NULL;
    USHORT                          HostPort     = 0;
    PUCHAR                          pDomain      = NULL;
    PUCHAR                          pMatchStr;

    *pbParentUri    = FALSE;

    status = pMyObject->GetRequestHostUri((ANSC_HANDLE)pMyObject, hRequest, &pHostName, &HostPort, &pUriPath);

    if ( status != ANSC_STATUS_SUCCESS || !pUriPath || !pHostName )
    {
        goto EXIT;
    }

    pSLinkEntry = AnscSListGetFirstEntry(&pMyObject->AuthInfoList);
    while (pSLinkEntry)
    {
        pAuthInfo   = ACCESS_HTTP_AUTHO_INFO_OBJECT(pSLinkEntry);
        pSLinkEntry = AnscSListGetNextEntry(pSLinkEntry);

        if ( pAuthInfo->HostPort != HostPort )
        {
            continue;
        }

        if ( !AnscEqualString(pAuthInfo->pHostName, pHostName, FALSE) )
        {
            continue;
        }

        if ( AnscEqualString(pAuthInfo->pUri, pUriPath, TRUE ) )
        {
            hAuthInfo       = (ANSC_HANDLE)pAuthInfo;
            break;
        }

        pMatchStr   = (PUCHAR)_ansc_strstr(pUriPath, pAuthInfo->pUri);
        if ( pMatchStr == pUriPath )
        {
            hAuthInfo       = (ANSC_HANDLE)pAuthInfo;
            break;
        }

        pMatchStr   = (PUCHAR)_ansc_strstr(pAuthInfo->pUri, pUriPath);
        if ( pMatchStr == pAuthInfo->pUri )
        {
            hAuthInfo       = (ANSC_HANDLE)pAuthInfo;
            *pbParentUri    = TRUE;
            break;
        }

        if ( pAuthInfo->AuthType == HTTP_AUTH_TYPE_DIGEST )
        {
            PUCHAR                          *pURIs;
            ULONG                           i, ulCount;
            BOOL                            bMatch  = FALSE;

            if ( pAuthInfo->pDigest->pDomainURIs )
            {
                ulCount = pAuthInfo->pDigest->pDomainURIs->NumURIs;
                pURIs   = pAuthInfo->pDigest->pDomainURIs->pURIs;

                for ( i = 0; i < ulCount; i ++)
                {
                    pMatchStr   = (PUCHAR)_ansc_strstr(pUriPath, pURIs[i]);
                    if ( pMatchStr == pUriPath )
                    {
                        bMatch  = TRUE;
                        break;
                    }
                }

                if ( bMatch )
                {
                    hAuthInfo   = (ANSC_HANDLE)pAuthInfo;
                    break;
                }
            }
            else
            {
                pDomain = pAuthInfo->pDigest->pDomain;

                pMatchStr   = (PUCHAR)_ansc_strstr(pUriPath, pDomain);
                if ( pMatchStr == pUriPath )
                {
                    hAuthInfo   = (ANSC_HANDLE)pAuthInfo;
                    break;
                }
            }
        }
    }

EXIT:

    if ( pHostName )
    {
        AnscFreeMemory(pHostName);
    }

    if ( pUriPath )
    {
        AnscFreeMemory(pUriPath);
    }

    /* move this info to front-most */
    if ( hAuthInfo )
    {
        pAuthInfo   = (PHTTP_AUTHO_INFO)hAuthInfo;

        AnscSListPopEntryByLink(&pMyObject->AuthInfoList, &pAuthInfo->Linkage);
        AnscSListPushEntry(&pMyObject->AuthInfoList, &pAuthInfo->Linkage);
    }

    return hAuthInfo;
}
Пример #12
0
ANSC_STATUS
CosaRARemove
    (
        ANSC_HANDLE                 hThisObject
    )
{
    ANSC_STATUS                     returnStatus    = ANSC_STATUS_SUCCESS;
    PCOSA_DATAMODEL_RA              pMyObject       = (PCOSA_DATAMODEL_RA)hThisObject;
    PSLIST_HEADER                   pRAIFHead       = (PSLIST_HEADER)&pMyObject->InterfaceList;
    PSLIST_HEADER                   pRAOptionHead       = (PSLIST_HEADER)NULL;
    PCOSA_DML_RA_IF_FULL2           pRAInterface    = (PCOSA_DML_RA_IF_FULL2)NULL;
    PCOSA_DML_RA_OPTION             pRAOption       = (PCOSA_DML_RA_OPTION)NULL;
    PSINGLE_LINK_ENTRY              pLink           = (PSINGLE_LINK_ENTRY )NULL;
    PSINGLE_LINK_ENTRY              pSubLink        = (PSINGLE_LINK_ENTRY )NULL;
    PCOSA_CONTEXT_LINK_OBJECT       pCosaContext    = (PCOSA_CONTEXT_LINK_OBJECT)NULL;
    PCOSA_CONTEXT_LINK_OBJECT       pSubCosaContext = (PCOSA_CONTEXT_LINK_OBJECT)NULL;
    PPOAM_IREP_FOLDER_OBJECT        pPoamIrepFoTemp = (PPOAM_IREP_FOLDER_OBJECT)NULL;

    /*free the back end memory*/
    CosaDmlRaIfBERemove();

    /* RA Interface List */
    pLink = AnscSListGetFirstEntry(pRAIFHead);

    while ( pLink )
    {
        pCosaContext = ACCESS_COSA_CONTEXT_LINK_OBJECT(pLink);
        pLink   = AnscSListGetNextEntry(pLink);

        pRAInterface = (PCOSA_DML_RA_IF_FULL2)pCosaContext->hContext;

        if ( pRAInterface )
        {
            AnscSListPopEntryByLink(pRAIFHead, &pCosaContext->Linkage);

            pRAOptionHead    = &pRAInterface->OptionList;

            /* Option List */            
            pSubLink = AnscSListGetFirstEntry(pRAOptionHead);
        
            while ( pSubLink )
            {
                pSubCosaContext = ACCESS_COSA_CONTEXT_LINK_OBJECT(pSubLink);
                
                pSubLink  = AnscSListGetNextEntry(pSubLink);
            
                pRAOption = (PCOSA_DML_RA_OPTION)pSubCosaContext->hContext;
            
                AnscSListPopEntryByLink(pRAOptionHead, &pSubCosaContext->Linkage);
            
                if ( pRAOption )
                {
                    AnscFreeMemory(pRAOption);
                }
            
                AnscFreeMemory(pSubCosaContext);
            }

            AnscFreeMemory(pRAInterface);
            AnscFreeMemory(pCosaContext);
        }
    }


    /* Remove self */
    pPoamIrepFoTemp = (PPOAM_IREP_FOLDER_OBJECT)pMyObject->hIrepFolderRAInterfaceHA;
    if ( pPoamIrepFoTemp )
    {
        pPoamIrepFoTemp->Remove(pPoamIrepFoTemp);
    }

    
    pPoamIrepFoTemp = (PPOAM_IREP_FOLDER_OBJECT)pMyObject->hIrepFolderRAInterface;
    if ( pPoamIrepFoTemp )
    {
        pPoamIrepFoTemp->Remove(pPoamIrepFoTemp);
    }
 

    AnscFreeMemory((ANSC_HANDLE)pMyObject);

    return returnStatus;
}