summaryrefslogtreecommitdiff
path: root/imap/src/osdep/nt/proc.c
diff options
context:
space:
mode:
authorEduardo Chappa <chappa@washington.edu>2018-08-12 22:34:43 -0600
committerEduardo Chappa <chappa@washington.edu>2018-08-12 22:34:43 -0600
commit9449b23bbca71471a64f914b4bc7ec7d810e587f (patch)
tree12e119c0e389546892ae4bc4df82980cda4d6ffe /imap/src/osdep/nt/proc.c
parentabcd5fe37b31b2e13907893f70a9e411dcf5e295 (diff)
downloadalpine-9449b23bbca71471a64f914b4bc7ec7d810e587f.tar.xz
* Several changes to the compilation of Alpine in Windows to use
LibreSSL in connecting to external servers. This complements the changes to support S/MIME. In particular, we add support for validation of certificates by using C:\\libressl\ssl\certs as the place to save CA certificates. In order to help users, some certificates are distributed. TODO: Kerberos port, w2k.
Diffstat (limited to 'imap/src/osdep/nt/proc.c')
-rw-r--r--imap/src/osdep/nt/proc.c80
1 files changed, 80 insertions, 0 deletions
diff --git a/imap/src/osdep/nt/proc.c b/imap/src/osdep/nt/proc.c
new file mode 100644
index 00000000..8fc3c4ee
--- /dev/null
+++ b/imap/src/osdep/nt/proc.c
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2018 Eduardo Chappa
+ *
+ * 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
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+
+int main(int, char **);
+
+int
+main(int argc, char *argv[])
+{
+ int rv = 0, i;
+ FILE *fph, *fpc, *fpa;
+ char *opt;
+
+ fph = fpc = fpa = NULL;
+ if(argc < 2){
+ fprintf(stdout, "Not enough arguments.\n");
+ fprintf(stdout, "Usage: %s opt ...\n", argv[0]);
+ fprintf(stdout, "opt can be drivers, mkauths, version, setproto or sslinit\n");
+ exit(1);
+ }
+
+ opt = argv[1];
+ if(!strcmp(opt, "drivers")){
+ fph = fopen("linkage.h", "w");
+ fpc = fopen("linkage.c", "w");
+ for (i = 2; i < argc; i++){
+ fprintf(fph, "extern DRIVER %sdriver;\n", argv[i]);
+ fprintf(fpc, " mail_link (&%sdriver); /* link in the %s driver */\n",
+ argv[i], argv[i]);
+ }
+ }
+ else if(!strcmp(opt, "mkauths")){
+ fph = fopen("linkage.h", "a");
+ fpc = fopen("linkage.c", "a");
+ fpa = fopen("auths.c", "w");
+ for (i = 2; i < argc; i++){
+ fprintf(fph, "extern AUTHENTICATOR auth_%s;\n", argv[i]);
+ fprintf(fpc, " auth_link (&auth_%s); /* link in the %s authenticator */\n",
+ argv[i], argv[i]);
+ fprintf(fpa, "#include \"auth_%s.c\"\n", argv[i]);
+ }
+ }
+ else if(!strcmp(opt, "setproto")){
+ if(argc != 4){
+ fprintf(stdout, "setproto requires two additional arguments\n");
+ exit(1);
+ }
+ fph = fopen("linkage.h", "a");
+ fprintf(fph, "#define CREATEPROTO %sproto\n", argv[2]);
+ fprintf(fph, "#define APPENDPROTO %sproto\n", argv[3]);
+ }
+ else if(!strcmp(opt, "sslinit")){
+ fpc = fopen("linkage.c", "a");
+ fprintf(fpc, "%s\n", "ssl_onceonlyinit();");
+ }
+ else if(!strcmp(opt, "version")){
+ fpc = fopen("linkage.c", "a");
+ fprintf(fpc, "%s\n", "mail_versioncheck(CCLIENTVERSION);");
+ }
+ else {
+ fprintf(stdout, "Try: \"drivers\", \"mkauths\", \"setproto\", \"sslinit\", or \"version\".\n");
+ exit(1);
+ }
+ if(fpa != NULL) fclose(fpa);
+ if(fpc != NULL) fclose(fpc);
+ if(fph != NULL) fclose(fph);
+ exit(0);
+}