Make certificate_read_server_certificate() return BOOL

This commit is contained in:
Maks Naumov 2014-04-08 15:59:34 +03:00 committed by Maks
parent 5aa64a08b0
commit c230fae097
3 changed files with 10 additions and 10 deletions

View File

@ -584,20 +584,20 @@ BOOL certificate_read_server_x509_certificate_chain(rdpCertificate* certificate,
* @param length certificate length
*/
int certificate_read_server_certificate(rdpCertificate* certificate, BYTE* server_cert, int length)
BOOL certificate_read_server_certificate(rdpCertificate* certificate, BYTE* server_cert, int length)
{
wStream* s;
UINT32 dwVersion;
int status = 1;
BOOL ret;
if (length < 1)
{
DEBUG_CERTIFICATE("null server certificate\n");
return 0;
return FALSE;
}
if (length < 4)
return -1;
return FALSE;
s = Stream_New(server_cert, length);
@ -606,22 +606,22 @@ int certificate_read_server_certificate(rdpCertificate* certificate, BYTE* serve
switch (dwVersion & CERT_CHAIN_VERSION_MASK)
{
case CERT_CHAIN_VERSION_1:
status = certificate_read_server_proprietary_certificate(certificate, s);
ret = certificate_read_server_proprietary_certificate(certificate, s);
break;
case CERT_CHAIN_VERSION_2:
status = certificate_read_server_x509_certificate_chain(certificate, s);
ret = certificate_read_server_x509_certificate_chain(certificate, s);
break;
default:
fprintf(stderr, "invalid certificate chain version:%d\n", dwVersion & CERT_CHAIN_VERSION_MASK);
status = -1;
ret = FALSE;
break;
}
Stream_Free(s, FALSE);
return status;
return ret;
}
rdpRsaKey* key_new(const char* keyfile)

View File

@ -50,7 +50,7 @@ void certificate_free_x509_certificate_chain(rdpX509CertChain* x509_cert_chain);
BOOL certificate_read_server_proprietary_certificate(rdpCertificate* certificate, wStream* s);
BOOL certificate_read_server_x509_certificate_chain(rdpCertificate* certificate, wStream* s);
int certificate_read_server_certificate(rdpCertificate* certificate, BYTE* server_cert, int length);
BOOL certificate_read_server_certificate(rdpCertificate* certificate, BYTE* server_cert, int length);
rdpCertificate* certificate_new(void);
void certificate_free(rdpCertificate* certificate);

View File

@ -775,7 +775,7 @@ BOOL license_read_license_request_packet(rdpLicense* license, wStream* s)
/* Parse Server Certificate */
if (!certificate_read_server_certificate(license->certificate,
license->ServerCertificate->data, license->ServerCertificate->length) < 0)
license->ServerCertificate->data, license->ServerCertificate->length))
return FALSE;
license_generate_keys(license);