libfreerdp-utils: added snprintf wrapper for windows portability
This commit is contained in:
parent
1353637886
commit
4f6f990806
@ -26,6 +26,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <freerdp/types.h>
|
||||
#include <freerdp/utils/print.h>
|
||||
#include <freerdp/utils/memory.h>
|
||||
#include <freerdp/utils/hexdump.h>
|
||||
#include <freerdp/rfx/rfx.h>
|
||||
|
29
include/freerdp/utils/print.h
Normal file
29
include/freerdp/utils/print.h
Normal file
@ -0,0 +1,29 @@
|
||||
/**
|
||||
* FreeRDP: A Remote Desktop Protocol Client
|
||||
* Print Utils
|
||||
*
|
||||
* Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __PRINT_UTILS_H
|
||||
#define __PRINT_UTILS_H
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#define snprintf sprintf_s
|
||||
#endif
|
||||
|
||||
#endif /* __PRINT_UTILS_H */
|
@ -113,7 +113,7 @@
|
||||
* @param cert X.509 certificate
|
||||
*/
|
||||
|
||||
void certificate_read_x509_certificate(CERT_BLOB* cert, CERT_INFO* info)
|
||||
void certificate_read_x509_certificate(rdpCertBlob* cert, rdpCertInfo* info)
|
||||
{
|
||||
STREAM* s;
|
||||
int length;
|
||||
@ -194,14 +194,14 @@ void certificate_read_x509_certificate(CERT_BLOB* cert, CERT_INFO* info)
|
||||
* @return new X.509 certificate chain
|
||||
*/
|
||||
|
||||
X509_CERT_CHAIN* certificate_new_x509_certificate_chain(uint32 count)
|
||||
rdpX509CertChain* certificate_new_x509_certificate_chain(uint32 count)
|
||||
{
|
||||
X509_CERT_CHAIN* x509_cert_chain;
|
||||
rdpX509CertChain* x509_cert_chain;
|
||||
|
||||
x509_cert_chain = (X509_CERT_CHAIN*) xmalloc(sizeof(X509_CERT_CHAIN));
|
||||
x509_cert_chain = (rdpX509CertChain*) xmalloc(sizeof(rdpX509CertChain));
|
||||
|
||||
x509_cert_chain->count = count;
|
||||
x509_cert_chain->array = (CERT_BLOB*) xzalloc(sizeof(CERT_BLOB) * count);
|
||||
x509_cert_chain->array = (rdpCertBlob*) xzalloc(sizeof(rdpCertBlob) * count);
|
||||
|
||||
return x509_cert_chain;
|
||||
}
|
||||
@ -211,7 +211,7 @@ X509_CERT_CHAIN* certificate_new_x509_certificate_chain(uint32 count)
|
||||
* @param x509_cert_chain X.509 certificate chain to be freed
|
||||
*/
|
||||
|
||||
void certificate_free_x509_certificate_chain(X509_CERT_CHAIN* x509_cert_chain)
|
||||
void certificate_free_x509_certificate_chain(rdpX509CertChain* x509_cert_chain)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -268,7 +268,7 @@ void certificate_read_server_x509_certificate_chain(rdpCertificate* certificate,
|
||||
|
||||
if (numCertBlobs - i == 2)
|
||||
{
|
||||
CERT_INFO cert_info;
|
||||
rdpCertInfo cert_info;
|
||||
DEBUG_CERTIFICATE("License Server Certificate");
|
||||
certificate_read_x509_certificate(&certificate->x509_cert_chain->array[i], &cert_info);
|
||||
DEBUG_LICENSE("modulus length:%d", cert_info.modulus.length);
|
||||
|
@ -37,35 +37,38 @@ typedef struct rdp_certificate rdpCertificate;
|
||||
#define CERT_PERMANENTLY_ISSUED 0x00000000
|
||||
#define CERT_TEMPORARILY_ISSUED 0x80000000
|
||||
|
||||
typedef struct
|
||||
struct rdp_CertBlob
|
||||
{
|
||||
uint32 length;
|
||||
uint8* data;
|
||||
} CERT_BLOB;
|
||||
};
|
||||
typedef struct rdp_CertBlob rdpCertBlob;
|
||||
|
||||
typedef struct
|
||||
struct rdp_X509CertChain
|
||||
{
|
||||
uint32 count;
|
||||
CERT_BLOB* array;
|
||||
} X509_CERT_CHAIN;
|
||||
rdpCertBlob* array;
|
||||
};
|
||||
typedef struct rdp_X509CertChain rdpX509CertChain;
|
||||
|
||||
typedef struct
|
||||
struct rdp_CertInfo
|
||||
{
|
||||
rdpBlob modulus;
|
||||
uint8 exponent[4];
|
||||
} CERT_INFO;
|
||||
};
|
||||
typedef struct rdp_CertInfo rdpCertInfo;
|
||||
|
||||
struct rdp_certificate
|
||||
{
|
||||
struct rdp_rdp* rdp;
|
||||
CERT_INFO cert_info;
|
||||
X509_CERT_CHAIN* x509_cert_chain;
|
||||
rdpCertInfo cert_info;
|
||||
rdpX509CertChain* x509_cert_chain;
|
||||
};
|
||||
|
||||
void certificate_read_x509_certificate(CERT_BLOB* cert, CERT_INFO* info);
|
||||
void certificate_read_x509_certificate(rdpCertBlob* cert, rdpCertInfo* info);
|
||||
|
||||
X509_CERT_CHAIN* certificate_new_x509_certificate_chain(uint32 count);
|
||||
void certificate_free_x509_certificate_chain(X509_CERT_CHAIN* x509_cert_chain);
|
||||
rdpX509CertChain* certificate_new_x509_certificate_chain(uint32 count);
|
||||
void certificate_free_x509_certificate_chain(rdpX509CertChain* x509_cert_chain);
|
||||
|
||||
void certificate_read_server_proprietary_certificate(rdpCertificate* certificate, STREAM* s);
|
||||
void certificate_read_server_x509_certificate_chain(rdpCertificate* certificate, STREAM* s);
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include <sys/socket.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <freerdp/utils/print.h>
|
||||
#include <freerdp/utils/stream.h>
|
||||
#include <freerdp/utils/memory.h>
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <freerdp/settings.h>
|
||||
#include <freerdp/utils/print.h>
|
||||
#include <freerdp/utils/memory.h>
|
||||
#include <freerdp/utils/args.h>
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <freerdp/utils/print.h>
|
||||
#include <freerdp/utils/load_plugin.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
|
Loading…
Reference in New Issue
Block a user