408434 - Crash with PKIX based verify. r=nelson

This commit is contained in:
alexei.volkov.bugs%sun.com 2008-01-16 23:21:15 +00:00
Родитель c4a8dc88f7
Коммит cf95eae585
2 изменённых файлов: 53 добавлений и 118 удалений

Просмотреть файл

@ -215,7 +215,9 @@ pkix_pl_AiaMgr_FindLDAPClient(
/* No, create a connection (and cache it) */
PKIX_CHECK(PKIX_PL_LdapDefaultClient_CreateByName
(domainName,
PR_INTERVAL_NO_WAIT, /* PR_INTERVAL_NO_TIMEOUT, */
/* Do not use NBIO until we verify, that
* it is working */
PR_INTERVAL_NO_TIMEOUT, /* PR_INTERVAL_NO_WAIT, */
NULL,
&client,
plContext),
@ -376,15 +378,34 @@ pkix_pl_AIAMgr_GetHTTPCerts(
pCerts,
plContext),
PKIX_HTTPCERTSTOREPROCESSCERTRESPONSEFAILED);
/* Session and request cleanup in case of success */
if (aiaMgr->client.hdata.requestSession != NULL) {
(*hcv1->freeFcn)(aiaMgr->client.hdata.requestSession);
aiaMgr->client.hdata.requestSession = NULL;
}
if (aiaMgr->client.hdata.serverSession != NULL) {
(*hcv1->freeSessionFcn)(aiaMgr->client.hdata.serverSession);
aiaMgr->client.hdata.serverSession = NULL;
}
aiaMgr->client.hdata.httpClient = 0; /* callback fn */
} else {
PKIX_ERROR(PKIX_UNSUPPORTEDVERSIONOFHTTPCLIENT);
}
cleanup:
if (aiaMgr) {
PKIX_DECREF(aiaMgr->client.hdata.requestSession);
PKIX_DECREF(aiaMgr->client.hdata.serverSession);
/* Session and request cleanup in case of error. Passing through without cleanup
* if interrupted by blocked IO. */
if (PKIX_ERROR_RECEIVED && aiaMgr) {
if (aiaMgr->client.hdata.requestSession != NULL) {
(*hcv1->freeFcn)(aiaMgr->client.hdata.requestSession);
aiaMgr->client.hdata.requestSession = NULL;
}
if (aiaMgr->client.hdata.serverSession != NULL) {
(*hcv1->freeSessionFcn)(aiaMgr->client.hdata.serverSession);
aiaMgr->client.hdata.serverSession = NULL;
}
aiaMgr->client.hdata.httpClient = 0; /* callback fn */
}

Просмотреть файл

@ -498,8 +498,7 @@ pkix_pl_HttpDefaultClient_Destroy(
client->rcvHeaders = NULL;
if (client->GETBuf != NULL) {
PKIX_PL_NSSCALL
(HTTPDEFAULTCLIENT, PR_smprintf_free, (client->GETBuf));
PR_smprintf_free(client->GETBuf);
client->GETBuf = NULL;
}
@ -1219,19 +1218,6 @@ cleanup:
}
PKIX_Error *
pkix_pl_HttpDefaultClient_FreeSession(
SEC_HTTP_SERVER_SESSION session,
void *plContext)
{
PKIX_ENTER(HTTPDEFAULTCLIENT, "pkix_pl_HttpDefaultClient_FreeSession");
PKIX_DECREF(session);
PKIX_RETURN(HTTPDEFAULTCLIENT);
}
PKIX_Error *
pkix_pl_HttpDefaultClient_RequestCreate(
SEC_HTTP_SERVER_SESSION session,
@ -1370,34 +1356,6 @@ cleanup:
}
PKIX_Error *
pkix_pl_HttpDefaultClient_AddHeader(
SEC_HTTP_REQUEST_SESSION request,
const char *http_header_name,
const char *http_header_value,
void *plContext)
{
PKIX_PL_HttpDefaultClient *client = NULL;
PKIX_ENTER(HTTPDEFAULTCLIENT, "pkix_pl_HttpDefaultClient_AddHeader");
PKIX_NULLCHECK_ONE(request);
PKIX_CHECK(pkix_CheckType
((PKIX_PL_Object *)request,
PKIX_HTTPDEFAULTCLIENT_TYPE,
plContext),
PKIX_REQUESTNOTANHTTPDEFAULTCLIENT);
client = (PKIX_PL_HttpDefaultClient *)request;
PKIX_ERROR(PKIX_ADDHEADERFUNCTIONNOTSUPPORTED);
cleanup:
PKIX_RETURN(HTTPDEFAULTCLIENT);
}
PKIX_Error *
pkix_pl_HttpDefaultClient_TrySendAndReceive(
SEC_HTTP_REQUEST_SESSION request,
@ -1603,36 +1561,8 @@ pkix_pl_HttpDefaultClient_Cancel(
client = (PKIX_PL_HttpDefaultClient *)request;
/* ... */
cleanup:
PKIX_RETURN(HTTPDEFAULTCLIENT);
}
PKIX_Error *
pkix_pl_HttpDefaultClient_Free(
SEC_HTTP_REQUEST_SESSION request,
void *plContext)
{
PKIX_PL_HttpDefaultClient *client = NULL;
PKIX_ENTER(HTTPDEFAULTCLIENT, "pkix_pl_HttpDefaultClient_Free");
PKIX_NULLCHECK_ONE(request);
PKIX_CHECK(pkix_CheckType
((PKIX_PL_Object *)request,
PKIX_HTTPDEFAULTCLIENT_TYPE,
plContext),
PKIX_REQUESTNOTANHTTPDEFAULTCLIENT);
client = (PKIX_PL_HttpDefaultClient *)request;
/* XXX Not implemented */
PKIX_DECREF(client);
cleanup:
PKIX_RETURN(HTTPDEFAULTCLIENT);
@ -1648,12 +1578,11 @@ pkix_pl_HttpDefaultClient_CreateSessionFcn(
PKIX_Error *err = pkix_pl_HttpDefaultClient_CreateSession
(host, portnum, pSession, plContext);
if (err == NULL) {
return SECSuccess;
} else {
if (err) {
PKIX_PL_Object_DecRef((PKIX_PL_Object *)err, plContext);
return SECFailure;
}
return SECSuccess;
}
SECStatus
@ -1664,27 +1593,25 @@ pkix_pl_HttpDefaultClient_KeepAliveSessionFcn(
PKIX_Error *err = pkix_pl_HttpDefaultClient_KeepAliveSession
(session, pPollDesc, plContext);
if (err == NULL) {
return SECSuccess;
} else {
if (err) {
PKIX_PL_Object_DecRef((PKIX_PL_Object *)err, plContext);
return SECFailure;
}
return SECSuccess;
}
SECStatus
pkix_pl_HttpDefaultClient_FreeSessionFcn(
SEC_HTTP_SERVER_SESSION session)
{
PKIX_Error *err = pkix_pl_HttpDefaultClient_FreeSession
(session, plContext);
PKIX_Error *err =
PKIX_PL_Object_DecRef((PKIX_PL_Object *)(session), plContext);
if (err == NULL) {
return SECSuccess;
} else {
if (err) {
PKIX_PL_Object_DecRef((PKIX_PL_Object *)err, plContext);
return SECFailure;
}
return SECSuccess;
}
SECStatus
@ -1705,12 +1632,11 @@ pkix_pl_HttpDefaultClient_RequestCreateFcn(
pRequest,
plContext);
if (err == NULL) {
return SECSuccess;
} else {
if (err) {
PKIX_PL_Object_DecRef((PKIX_PL_Object *)err, plContext);
return SECFailure;
}
return SECSuccess;
}
SECStatus
@ -1720,19 +1646,16 @@ pkix_pl_HttpDefaultClient_SetPostDataFcn(
const PRUint32 http_data_len,
const char *http_content_type)
{
PKIX_Error *err = pkix_pl_HttpDefaultClient_SetPostData
(request,
http_data,
http_data_len,
http_content_type,
plContext);
if (err == NULL) {
return SECSuccess;
} else {
PKIX_Error *err =
pkix_pl_HttpDefaultClient_SetPostData(request, http_data,
http_data_len,
http_content_type,
plContext);
if (err) {
PKIX_PL_Object_DecRef((PKIX_PL_Object *)err, plContext);
return SECFailure;
}
return SECSuccess;
}
SECStatus
@ -1741,15 +1664,8 @@ pkix_pl_HttpDefaultClient_AddHeaderFcn(
const char *http_header_name,
const char *http_header_value)
{
PKIX_Error *err = pkix_pl_HttpDefaultClient_AddHeader
(request, http_header_name, http_header_value, plContext);
if (err == NULL) {
return SECSuccess;
} else {
PKIX_PL_Object_DecRef((PKIX_PL_Object *)err, plContext);
return SECFailure;
}
/* Not supported */
return SECFailure;
}
SECStatus
@ -1775,12 +1691,11 @@ pkix_pl_HttpDefaultClient_TrySendAndReceiveFcn(
&rv,
plContext);
if (err == NULL) {
return rv;
} else {
if (err) {
PKIX_PL_Object_DecRef((PKIX_PL_Object *)err, plContext);
return rv;
}
return SECSuccess;
}
SECStatus
@ -1789,24 +1704,23 @@ pkix_pl_HttpDefaultClient_CancelFcn(
{
PKIX_Error *err = pkix_pl_HttpDefaultClient_Cancel(request, plContext);
if (err == NULL) {
return SECSuccess;
} else {
if (err) {
PKIX_PL_Object_DecRef((PKIX_PL_Object *)err, plContext);
return SECFailure;
}
return SECSuccess;
}
SECStatus
pkix_pl_HttpDefaultClient_FreeFcn(
SEC_HTTP_REQUEST_SESSION request)
{
PKIX_Error *err = pkix_pl_HttpDefaultClient_Free(request, plContext);
PKIX_Error *err =
PKIX_PL_Object_DecRef((PKIX_PL_Object *)(request), plContext);
if (err == NULL) {
return SECSuccess;
} else {
if (err) {
PKIX_PL_Object_DecRef((PKIX_PL_Object *)err, plContext);
return SECFailure;
}
return SECSuccess;
}