Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add basic Windows support #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libx509pq--1.0.sql
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ CREATE OR REPLACE FUNCTION x509_subjectKeyIdentifier(bytea) RETURNS bytea
AS 'MODULE_PATHNAME' LANGUAGE c IMMUTABLE;

CREATE OR REPLACE FUNCTION x509_authorityKeyId(bytea) RETURNS bytea
AS '$libdir/libx509pq.so' LANGUAGE c IMMUTABLE;
AS 'MODULE_PATHNAME' LANGUAGE c IMMUTABLE;

CREATE OR REPLACE FUNCTION x509_extKeyUsages(bytea,boolean DEFAULT TRUE) RETURNS SETOF text
AS 'MODULE_PATHNAME' LANGUAGE c IMMUTABLE;
Expand Down
48 changes: 48 additions & 0 deletions libx509pq.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/



#include "c.h"
#include "postgres.h"
#include "plpgsql.h" /* _PG_init() */
Expand All @@ -29,6 +31,52 @@
PG_MODULE_MAGIC;
#endif


#ifdef _WIN32
#define timegm _mkgmtime

PGDLLEXPORT Datum x509_altnames(PG_FUNCTION_ARGS);
PGDLLEXPORT Datum x509_altnames_raw(PG_FUNCTION_ARGS);
PGDLLEXPORT Datum x509_anynameswithnuls(PG_FUNCTION_ARGS);
PGDLLEXPORT Datum x509_authorityinfoaccess(PG_FUNCTION_ARGS);
PGDLLEXPORT Datum x509_authoritykeyid(PG_FUNCTION_ARGS);
PGDLLEXPORT Datum x509_canissuecerts(PG_FUNCTION_ARGS);
PGDLLEXPORT Datum x509_certpolicies(PG_FUNCTION_ARGS);
PGDLLEXPORT Datum x509_commonname(PG_FUNCTION_ARGS);
PGDLLEXPORT Datum x509_crldistributionpoints(PG_FUNCTION_ARGS);
PGDLLEXPORT Datum x509_extensions(PG_FUNCTION_ARGS);
PGDLLEXPORT Datum x509_extkeyusages(PG_FUNCTION_ARGS);
PGDLLEXPORT Datum x509_getpathlenconstraint(PG_FUNCTION_ARGS);
PGDLLEXPORT Datum x509_hasextension(PG_FUNCTION_ARGS);
PGDLLEXPORT Datum x509_hasrocafingerprint(PG_FUNCTION_ARGS);
PGDLLEXPORT Datum x509_isekupermitted(PG_FUNCTION_ARGS);
PGDLLEXPORT Datum x509_ispolicypermitted(PG_FUNCTION_ARGS);
PGDLLEXPORT Datum x509_issuername(PG_FUNCTION_ARGS);
PGDLLEXPORT Datum x509_keyalgorithm(PG_FUNCTION_ARGS);
PGDLLEXPORT Datum x509_keysize(PG_FUNCTION_ARGS);
PGDLLEXPORT Datum x509_name(PG_FUNCTION_ARGS);
PGDLLEXPORT Datum x509_name_print(PG_FUNCTION_ARGS);
PGDLLEXPORT Datum x509_nameattributes(PG_FUNCTION_ARGS);
PGDLLEXPORT Datum x509_nameattributes_raw(PG_FUNCTION_ARGS);
PGDLLEXPORT Datum x509_notafter(PG_FUNCTION_ARGS);
PGDLLEXPORT Datum x509_notbefore(PG_FUNCTION_ARGS);
PGDLLEXPORT Datum x509_print(PG_FUNCTION_ARGS);
PGDLLEXPORT Datum x509_publickey(PG_FUNCTION_ARGS);
PGDLLEXPORT Datum x509_publickeymd5(PG_FUNCTION_ARGS);
PGDLLEXPORT Datum x509_rsamodulus(PG_FUNCTION_ARGS);
PGDLLEXPORT Datum x509_serialnumber(PG_FUNCTION_ARGS);
PGDLLEXPORT Datum x509_signaturehashalgorithm(PG_FUNCTION_ARGS);
PGDLLEXPORT Datum x509_signaturekeyalgorithm(PG_FUNCTION_ARGS);
PGDLLEXPORT Datum x509_subjectkeyidentifier(PG_FUNCTION_ARGS);
PGDLLEXPORT Datum x509_subjectname(PG_FUNCTION_ARGS);
PGDLLEXPORT Datum x509_tbscert_strip_ct_ext(PG_FUNCTION_ARGS);
PGDLLEXPORT Datum x509_verify(PG_FUNCTION_ARGS);
PGDLLEXPORT Datum x509pq_opensslversion(PG_FUNCTION_ARGS);
PGDLLEXPORT Datum ocspresponse_print(PG_FUNCTION_ARGS);
PGDLLEXPORT Datum urldecode(PG_FUNCTION_ARGS);
PGDLLEXPORT Datum urlencode(PG_FUNCTION_ARGS);
#endif

#include <string.h>
#include <time.h>

Expand Down