Juan Lang : wintrust: Don't hardcode supported OIDs, let CryptDecodeObject handle it directly.
Alexandre Julliard
julliard at winehq.org
Thu Oct 9 07:42:40 CDT 2008
Module: wine
Branch: master
Commit: 04841e1f355c93091518ff62a2c1e96aa8604b97
URL: http://source.winehq.org/git/wine.git/?a=commit;h=04841e1f355c93091518ff62a2c1e96aa8604b97
Author: Juan Lang <juan.lang at gmail.com>
Date: Wed Oct 8 09:09:31 2008 -0700
wintrust: Don't hardcode supported OIDs, let CryptDecodeObject handle it directly.
---
dlls/wintrust/softpub.c | 62 +++++++++++++++++++---------------------------
1 files changed, 26 insertions(+), 36 deletions(-)
diff --git a/dlls/wintrust/softpub.c b/dlls/wintrust/softpub.c
index 9140182..6faaa1f 100644
--- a/dlls/wintrust/softpub.c
+++ b/dlls/wintrust/softpub.c
@@ -198,64 +198,54 @@ static DWORD SOFTPUB_DecodeInnerContent(CRYPT_PROVIDER_DATA *data)
{
BOOL ret;
DWORD size;
+ LPSTR oid = NULL;
LPBYTE buf = NULL;
ret = CryptMsgGetParam(data->hMsg, CMSG_INNER_CONTENT_TYPE_PARAM, 0, NULL,
&size);
if (!ret)
goto error;
- buf = data->psPfns->pfnAlloc(size);
- if (!buf)
+ oid = data->psPfns->pfnAlloc(size);
+ if (!oid)
{
SetLastError(ERROR_OUTOFMEMORY);
ret = FALSE;
goto error;
}
- ret = CryptMsgGetParam(data->hMsg, CMSG_INNER_CONTENT_TYPE_PARAM, 0, buf,
+ ret = CryptMsgGetParam(data->hMsg, CMSG_INNER_CONTENT_TYPE_PARAM, 0, oid,
&size);
if (!ret)
goto error;
- if (!strcmp((LPCSTR)buf, SPC_INDIRECT_DATA_OBJID))
+ ret = CryptMsgGetParam(data->hMsg, CMSG_CONTENT_PARAM, 0, NULL, &size);
+ if (!ret)
+ goto error;
+ buf = data->psPfns->pfnAlloc(size);
+ if (!buf)
{
- data->psPfns->pfnFree(buf);
- buf = NULL;
- ret = CryptMsgGetParam(data->hMsg, CMSG_CONTENT_PARAM, 0, NULL, &size);
- if (!ret)
- goto error;
- buf = data->psPfns->pfnAlloc(size);
- if (!buf)
- {
- SetLastError(ERROR_OUTOFMEMORY);
- ret = FALSE;
- goto error;
- }
- ret = CryptMsgGetParam(data->hMsg, CMSG_CONTENT_PARAM, 0, buf, &size);
- if (!ret)
- goto error;
- ret = CryptDecodeObject(data->dwEncoding,
- SPC_INDIRECT_DATA_CONTENT_STRUCT, buf, size, 0, NULL, &size);
- if (!ret)
- goto error;
- data->u.pPDSip->psIndirectData = data->psPfns->pfnAlloc(size);
- if (!data->u.pPDSip->psIndirectData)
- {
- SetLastError(ERROR_OUTOFMEMORY);
- ret = FALSE;
- goto error;
- }
- ret = CryptDecodeObject(data->dwEncoding,
- SPC_INDIRECT_DATA_CONTENT_STRUCT, buf, size, 0,
- data->u.pPDSip->psIndirectData, &size);
+ SetLastError(ERROR_OUTOFMEMORY);
+ ret = FALSE;
+ goto error;
}
- else
+ ret = CryptMsgGetParam(data->hMsg, CMSG_CONTENT_PARAM, 0, buf, &size);
+ if (!ret)
+ goto error;
+ ret = CryptDecodeObject(data->dwEncoding, oid, buf, size, 0, NULL, &size);
+ if (!ret)
+ goto error;
+ data->u.pPDSip->psIndirectData = data->psPfns->pfnAlloc(size);
+ if (!data->u.pPDSip->psIndirectData)
{
- FIXME("unimplemented for OID %s\n", (LPCSTR)buf);
- SetLastError(TRUST_E_SUBJECT_FORM_UNKNOWN);
+ SetLastError(ERROR_OUTOFMEMORY);
ret = FALSE;
+ goto error;
}
+ ret = CryptDecodeObject(data->dwEncoding, oid, buf, size, 0,
+ data->u.pPDSip->psIndirectData, &size);
error:
TRACE("returning %d\n", ret);
+ data->psPfns->pfnFree(oid);
+ data->psPfns->pfnFree(buf);
return ret;
}
More information about the wine-cvs
mailing list