{"thread":{"id":"21171","subject":"[PATCH 7/8] mingw: enable OpenSSL","startedAt":"2009-10-09T15:04:35Z","lastAt":"2009-10-10T00:57:12Z","messageCount":13,"participants":["Erik Faye-Lund","Sverre Rabbelier","Matt Kraai","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":8},"messages":[{"id":"124501","messageId":"1255100682-13952-1-git-send-email-kusmabite@gmail.com","threadId":"21171","inReplyTo":null,"subject":"[PATCH 1/8] imap-send: remove useless uid code","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@googlemail.com","sentAt":"2009-10-09T15:04:35Z","receivedAt":"2009-10-09T15:04:35Z","isPatch":true,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"From: Jeff King <peff@peff.net>\n\nThe imap-send code is based on code from isync, a program\nfor syncing imap mailboxes. Because of this, it has\ninherited some code that makes sense for isync, but not for\nimap-send.\n\nIn particular, when storing a message, it does one of:\n\n  - if the server supports it, note the server-assigned\n    unique identifier (UID) given to each message\n\n  - otherwise, assigned a random UID and store it in the\n    message header as X-TUID\n\nPresumably this is used in isync to be able to synchronize\nmailstores multiple times without duplication. But for\nimap-send, it the values are useless; we never do anything\nwith them and simply forget them at the end of the program.\n\nThis patch removes the useless code. Not only is it nice for\nmaintainability to get rid of dead code, but the removed\ncode relied on the existence of /dev/urandom, which made it\na portability problem for non-Unix platforms.\n\nSigned-off-by: Jeff King <peff@peff.net>\nSigned-off-by: Erik Faye-Lund <kusmabite@gmail.com>\n---\n imap-send.c |  155 ++++------------------------------------------------------\n 1 files changed, 11 insertions(+), 144 deletions(-)\n\ndiff --git a/imap-send.c b/imap-send.c\nindex 3847fd1..8da7a94 100644\n--- a/imap-send.c\n+++ b/imap-send.c\n@@ -123,9 +123,6 @@ static int nfvasprintf(char **strp, const char *fmt, va_list ap)\n \treturn len;\n }\n \n-static void arc4_init(void);\n-static unsigned char arc4_getbyte(void);\n-\n struct imap_server_conf {\n \tchar *name;\n \tchar *tunnel;\n@@ -489,52 +486,6 @@ static int nfsnprintf(char *buf, int blen, const char *fmt, ...)\n \treturn ret;\n }\n \n-static struct {\n-\tunsigned char i, j, s[256];\n-} rs;\n-\n-static void arc4_init(void)\n-{\n-\tint i, fd;\n-\tunsigned char j, si, dat[128];\n-\n-\tif ((fd = open(\"/dev/urandom\", O_RDONLY)) < 0 && (fd = open(\"/dev/random\", O_RDONLY)) < 0) {\n-\t\tfprintf(stderr, \"Fatal: no random number source available.\\n\");\n-\t\texit(3);\n-\t}\n-\tif (read_in_full(fd, dat, 128) != 128) {\n-\t\tfprintf(stderr, \"Fatal: cannot read random number source.\\n\");\n-\t\texit(3);\n-\t}\n-\tclose(fd);\n-\n-\tfor (i = 0; i < 256; i++)\n-\t\trs.s[i] = i;\n-\tfor (i = j = 0; i < 256; i++) {\n-\t\tsi = rs.s[i];\n-\t\tj += si + dat[i & 127];\n-\t\trs.s[i] = rs.s[j];\n-\t\trs.s[j] = si;\n-\t}\n-\trs.i = rs.j = 0;\n-\n-\tfor (i = 0; i < 256; i++)\n-\t\tarc4_getbyte();\n-}\n-\n-static unsigned char arc4_getbyte(void)\n-{\n-\tunsigned char si, sj;\n-\n-\trs.i++;\n-\tsi = rs.s[rs.i];\n-\trs.j += si;\n-\tsj = rs.s[rs.j];\n-\trs.s[rs.i] = sj;\n-\trs.s[rs.j] = si;\n-\treturn rs.s[(si + sj) & 0xff];\n-}\n-\n static struct imap_cmd *v_issue_imap_cmd(struct imap_store *ctx,\n \t\t\t\t\t struct imap_cmd_cb *cb,\n \t\t\t\t\t const char *fmt, va_list ap)\n@@ -1198,88 +1149,20 @@ static int imap_make_flags(int flags, char *buf)\n \treturn d;\n }\n \n-#define TUIDL 8\n-\n-static int imap_store_msg(struct store *gctx, struct msg_data *data, int *uid)\n+static int imap_store_msg(struct store *gctx, struct msg_data *data)\n {\n \tstruct imap_store *ctx = (struct imap_store *)gctx;\n \tstruct imap *imap = ctx->imap;\n \tstruct imap_cmd_cb cb;\n-\tchar *fmap, *buf;\n \tconst char *prefix, *box;\n-\tint ret, i, j, d, len, extra, nocr;\n-\tint start, sbreak = 0, ebreak = 0;\n-\tchar flagstr[128], tuid[TUIDL * 2 + 1];\n+\tint ret, d;\n+\tchar flagstr[128];\n \n \tmemset(&cb, 0, sizeof(cb));\n \n-\tfmap = data->data;\n-\tlen = data->len;\n-\tnocr = !data->crlf;\n-\textra = 0, i = 0;\n-\tif (!CAP(UIDPLUS) && uid) {\n-\tnloop:\n-\t\tstart = i;\n-\t\twhile (i < len)\n-\t\t\tif (fmap[i++] == '\\n') {\n-\t\t\t\textra += nocr;\n-\t\t\t\tif (i - 2 + nocr == start) {\n-\t\t\t\t\tsbreak = ebreak = i - 2 + nocr;\n-\t\t\t\t\tgoto mktid;\n-\t\t\t\t}\n-\t\t\t\tif (!memcmp(fmap + start, \"X-TUID: \", 8)) {\n-\t\t\t\t\textra -= (ebreak = i) - (sbreak = start) + nocr;\n-\t\t\t\t\tgoto mktid;\n-\t\t\t\t}\n-\t\t\t\tgoto nloop;\n-\t\t\t}\n-\t\t/* invalid message */\n-\t\tfree(fmap);\n-\t\treturn DRV_MSG_BAD;\n-\tmktid:\n-\t\tfor (j = 0; j < TUIDL; j++)\n-\t\t\tsprintf(tuid + j * 2, \"%02x\", arc4_getbyte());\n-\t\textra += 8 + TUIDL * 2 + 2;\n-\t}\n-\tif (nocr)\n-\t\tfor (; i < len; i++)\n-\t\t\tif (fmap[i] == '\\n')\n-\t\t\t\textra++;\n-\n-\tcb.dlen = len + extra;\n-\tbuf = cb.data = xmalloc(cb.dlen);\n-\ti = 0;\n-\tif (!CAP(UIDPLUS) && uid) {\n-\t\tif (nocr) {\n-\t\t\tfor (; i < sbreak; i++)\n-\t\t\t\tif (fmap[i] == '\\n') {\n-\t\t\t\t\t*buf++ = '\\r';\n-\t\t\t\t\t*buf++ = '\\n';\n-\t\t\t\t} else\n-\t\t\t\t\t*buf++ = fmap[i];\n-\t\t} else {\n-\t\t\tmemcpy(buf, fmap, sbreak);\n-\t\t\tbuf += sbreak;\n-\t\t}\n-\t\tmemcpy(buf, \"X-TUID: \", 8);\n-\t\tbuf += 8;\n-\t\tmemcpy(buf, tuid, TUIDL * 2);\n-\t\tbuf += TUIDL * 2;\n-\t\t*buf++ = '\\r';\n-\t\t*buf++ = '\\n';\n-\t\ti = ebreak;\n-\t}\n-\tif (nocr) {\n-\t\tfor (; i < len; i++)\n-\t\t\tif (fmap[i] == '\\n') {\n-\t\t\t\t*buf++ = '\\r';\n-\t\t\t\t*buf++ = '\\n';\n-\t\t\t} else\n-\t\t\t\t*buf++ = fmap[i];\n-\t} else\n-\t\tmemcpy(buf, fmap + i, len - i);\n-\n-\tfree(fmap);\n+\tcb.dlen = data->len;\n+\tcb.data = xmalloc(cb.dlen);\n+\tmemcpy(cb.data, data->data, data->len);\n \n \td = 0;\n \tif (data->flags) {\n@@ -1288,26 +1171,14 @@ static int imap_store_msg(struct store *gctx, struct msg_data *data, int *uid)\n \t}\n \tflagstr[d] = 0;\n \n-\tif (!uid) {\n-\t\tbox = gctx->conf->trash;\n-\t\tprefix = ctx->prefix;\n-\t\tcb.create = 1;\n-\t\tif (ctx->trashnc)\n-\t\t\timap->caps = imap->rcaps & ~(1 << LITERALPLUS);\n-\t} else {\n-\t\tbox = gctx->name;\n-\t\tprefix = !strcmp(box, \"INBOX\") ? \"\" : ctx->prefix;\n-\t\tcb.create = 0;\n-\t}\n-\tcb.ctx = uid;\n+\tbox = gctx->name;\n+\tprefix = !strcmp(box, \"INBOX\") ? \"\" : ctx->prefix;\n+\tcb.create = 0;\n \tret = imap_exec_m(ctx, &cb, \"APPEND \\\"%s%s\\\" %s\", prefix, box, flagstr);\n \timap->caps = imap->rcaps;\n \tif (ret != DRV_OK)\n \t\treturn ret;\n-\tif (!uid)\n-\t\tctx->trashnc = 0;\n-\telse\n-\t\tgctx->count++;\n+\tgctx->count++;\n \n \treturn DRV_OK;\n }\n@@ -1483,7 +1354,6 @@ int main(int argc, char **argv)\n {\n \tstruct msg_data all_msgs, msg;\n \tstruct store *ctx = NULL;\n-\tint uid = 0;\n \tint ofs = 0;\n \tint r;\n \tint total, n = 0;\n@@ -1491,9 +1361,6 @@ int main(int argc, char **argv)\n \n \tgit_extract_argv0_path(argv[0]);\n \n-\t/* init the random number generator */\n-\tarc4_init();\n-\n \tsetup_git_directory_gently(&nongit_ok);\n \tgit_config(git_imap_config, NULL);\n \n@@ -1540,7 +1407,7 @@ int main(int argc, char **argv)\n \t\t\tbreak;\n \t\tif (server.use_html)\n \t\t\twrap_in_html(&msg);\n-\t\tr = imap_store_msg(ctx, &msg, &uid);\n+\t\tr = imap_store_msg(ctx, &msg);\n \t\tif (r != DRV_OK)\n \t\t\tbreak;\n \t\tn++;\n-- \n1.6.5.rc1.60.g41795\n"},{"id":"124496","messageId":"1255100682-13952-2-git-send-email-kusmabite@gmail.com","threadId":"21171","inReplyTo":"1255100682-13952-1-git-send-email-kusmabite@gmail.com","subject":"[PATCH 2/8] imap-send: use separate read and write fds","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@googlemail.com","sentAt":"2009-10-09T15:04:36Z","receivedAt":"2009-10-09T15:04:36Z","isPatch":true,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"This is a patch that enables us to use the run-command\nAPI, which is supported on Windows.\n\nSigned-off-by: Erik Faye-Lund <kusmabite@gmail.com>\n---\n imap-send.c |   37 +++++++++++++++++++++++--------------\n 1 files changed, 23 insertions(+), 14 deletions(-)\n\ndiff --git a/imap-send.c b/imap-send.c\nindex 8da7a94..7216453 100644\n--- a/imap-send.c\n+++ b/imap-send.c\n@@ -151,7 +151,7 @@ struct imap_list {\n };\n \n struct imap_socket {\n-\tint fd;\n+\tint fd[2];\n \tSSL *ssl;\n };\n \n@@ -301,8 +301,12 @@ static int ssl_socket_connect(struct imap_socket *sock, int use_tls_only, int ve\n \t\tssl_socket_perror(\"SSL_new\");\n \t\treturn -1;\n \t}\n-\tif (!SSL_set_fd(sock->ssl, sock->fd)) {\n-\t\tssl_socket_perror(\"SSL_set_fd\");\n+\tif (!SSL_set_rfd(sock->ssl, sock->fd[0])) {\n+\t\tssl_socket_perror(\"SSL_set_rfd\");\n+\t\treturn -1;\n+\t}\n+\tif (!SSL_set_wfd(sock->ssl, sock->fd[1])) {\n+\t\tssl_socket_perror(\"SSL_set_wfd\");\n \t\treturn -1;\n \t}\n \n@@ -324,11 +328,12 @@ static int socket_read(struct imap_socket *sock, char *buf, int len)\n \t\tn = SSL_read(sock->ssl, buf, len);\n \telse\n #endif\n-\t\tn = xread(sock->fd, buf, len);\n+\t\tn = xread(sock->fd[0], buf, len);\n \tif (n <= 0) {\n \t\tsocket_perror(\"read\", sock, n);\n-\t\tclose(sock->fd);\n-\t\tsock->fd = -1;\n+\t\tclose(sock->fd[0]);\n+\t\tclose(sock->fd[1]);\n+\t\tsock->fd[0] = sock->fd[1] = -1;\n \t}\n \treturn n;\n }\n@@ -341,11 +346,12 @@ static int socket_write(struct imap_socket *sock, const char *buf, int len)\n \t\tn = SSL_write(sock->ssl, buf, len);\n \telse\n #endif\n-\t\tn = write_in_full(sock->fd, buf, len);\n+\t\tn = write_in_full(sock->fd[1], buf, len);\n \tif (n != len) {\n \t\tsocket_perror(\"write\", sock, n);\n-\t\tclose(sock->fd);\n-\t\tsock->fd = -1;\n+\t\tclose(sock->fd[0]);\n+\t\tclose(sock->fd[1]);\n+\t\tsock->fd[0] = sock->fd[1] = -1;\n \t}\n \treturn n;\n }\n@@ -358,7 +364,8 @@ static void socket_shutdown(struct imap_socket *sock)\n \t\tSSL_free(sock->ssl);\n \t}\n #endif\n-\tclose(sock->fd);\n+\tclose(sock->fd[0]);\n+\tclose(sock->fd[1]);\n }\n \n /* simple line buffering */\n@@ -911,7 +918,7 @@ static void imap_close_server(struct imap_store *ictx)\n {\n \tstruct imap *imap = ictx->imap;\n \n-\tif (imap->buf.sock.fd != -1) {\n+\tif (imap->buf.sock.fd[0] != -1) {\n \t\timap_exec(ictx, NULL, \"LOGOUT\");\n \t\tsocket_shutdown(&imap->buf.sock);\n \t}\n@@ -939,7 +946,7 @@ static struct store *imap_open_store(struct imap_server_conf *srvc)\n \tctx = xcalloc(sizeof(*ctx), 1);\n \n \tctx->imap = imap = xcalloc(sizeof(*imap), 1);\n-\timap->buf.sock.fd = -1;\n+\timap->buf.sock.fd[0] = imap->buf.sock.fd[1] = -1;\n \timap->in_progress_append = &imap->in_progress;\n \n \t/* open connection to IMAP server */\n@@ -966,7 +973,8 @@ static struct store *imap_open_store(struct imap_server_conf *srvc)\n \n \t\tclose(a[0]);\n \n-\t\timap->buf.sock.fd = a[1];\n+\t\timap->buf.sock.fd[0] = a[1];\n+\t\timap->buf.sock.fd[1] = dup(a[1]);\n \n \t\timap_info(\"ok\\n\");\n \t} else {\n@@ -1043,7 +1051,8 @@ static struct store *imap_open_store(struct imap_server_conf *srvc)\n \t\t\tgoto bail;\n \t\t}\n \n-\t\timap->buf.sock.fd = s;\n+\t\timap->buf.sock.fd[0] = s;\n+\t\timap->buf.sock.fd[1] = dup(s);\n \n \t\tif (srvc->use_ssl &&\n \t\t    ssl_socket_connect(&imap->buf.sock, 0, srvc->ssl_verify)) {\n-- \n1.6.5.rc1.60.g41795\n"},{"id":"124497","messageId":"1255100682-13952-3-git-send-email-kusmabite@gmail.com","threadId":"21171","inReplyTo":"1255100682-13952-2-git-send-email-kusmabite@gmail.com","subject":"[PATCH 3/8] imap-send: use run-command API for tunneling","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@googlemail.com","sentAt":"2009-10-09T15:04:37Z","receivedAt":"2009-10-09T15:04:37Z","isPatch":true,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>\n---\n imap-send.c |   37 ++++++++++++++++---------------------\n 1 files changed, 16 insertions(+), 21 deletions(-)\n\ndiff --git a/imap-send.c b/imap-send.c\nindex 7216453..dc3da98 100644\n--- a/imap-send.c\n+++ b/imap-send.c\n@@ -24,6 +24,7 @@\n \n #include \"cache.h\"\n #include \"exec_cmd.h\"\n+#include \"run-command.h\"\n #ifdef NO_OPENSSL\n typedef void *SSL;\n #endif\n@@ -940,8 +941,7 @@ static struct store *imap_open_store(struct imap_server_conf *srvc)\n \tstruct imap_store *ctx;\n \tstruct imap *imap;\n \tchar *arg, *rsp;\n-\tint s = -1, a[2], preauth;\n-\tpid_t pid;\n+\tint s = -1, preauth;\n \n \tctx = xcalloc(sizeof(*ctx), 1);\n \n@@ -952,29 +952,24 @@ static struct store *imap_open_store(struct imap_server_conf *srvc)\n \t/* open connection to IMAP server */\n \n \tif (srvc->tunnel) {\n-\t\timap_info(\"Starting tunnel '%s'... \", srvc->tunnel);\n+\t\tconst char *argv[4];\n+\t\tstruct child_process tunnel = {0};\n \n-\t\tif (socketpair(PF_UNIX, SOCK_STREAM, 0, a)) {\n-\t\t\tperror(\"socketpair\");\n-\t\t\texit(1);\n-\t\t}\n+\t\timap_info(\"Starting tunnel '%s'... \", srvc->tunnel);\n \n-\t\tpid = fork();\n-\t\tif (pid < 0)\n-\t\t\t_exit(127);\n-\t\tif (!pid) {\n-\t\t\tif (dup2(a[0], 0) == -1 || dup2(a[0], 1) == -1)\n-\t\t\t\t_exit(127);\n-\t\t\tclose(a[0]);\n-\t\t\tclose(a[1]);\n-\t\t\texecl(\"/bin/sh\", \"sh\", \"-c\", srvc->tunnel, NULL);\n-\t\t\t_exit(127);\n-\t\t}\n+\t\targv[0] = \"/bin/sh\";\n+\t\targv[1] = \"-c\";\n+\t\targv[2] = srvc->tunnel;\n+\t\targv[3] = NULL;\n \n-\t\tclose(a[0]);\n+\t\ttunnel.argv = argv;\n+\t\ttunnel.in = -1;\n+\t\ttunnel.out = -1;\n+\t\tif (start_command(&tunnel))\n+\t\t\tdie(\"cannot start proxy %s\", argv[0]);\n \n-\t\timap->buf.sock.fd[0] = a[1];\n-\t\timap->buf.sock.fd[1] = dup(a[1]);\n+\t\timap->buf.sock.fd[0] = tunnel.out;\n+\t\timap->buf.sock.fd[1] = tunnel.in;\n \n \t\timap_info(\"ok\\n\");\n \t} else {\n-- \n1.6.5.rc1.60.g41795\n"},{"id":"124499","messageId":"1255100682-13952-4-git-send-email-kusmabite@gmail.com","threadId":"21171","inReplyTo":"1255100682-13952-3-git-send-email-kusmabite@gmail.com","subject":"[PATCH 4/8] imap-send: fix compilation-error on Windows","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@googlemail.com","sentAt":"2009-10-09T15:04:38Z","receivedAt":"2009-10-09T15:04:38Z","isPatch":true,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"mmsystem.h (included from windows.h) defines DRV_OK to 1. To avoid\nan error due to DRV_OK redefenition, this patch undefines the old\ndefinition (i.e the one from mmsystem.h) before defining DRV_OK.\n\nSigned-off-by: Erik Faye-Lund <kusmabite@gmail.com>\n---\n imap-send.c |    4 ++++\n 1 files changed, 4 insertions(+), 0 deletions(-)\n\ndiff --git a/imap-send.c b/imap-send.c\nindex dc3da98..ed51dbf 100644\n--- a/imap-send.c\n+++ b/imap-send.c\n@@ -94,6 +94,10 @@ struct msg_data {\n \tunsigned int crlf:1;\n };\n \n+#ifdef DRV_OK\n+#undef DRV_OK\n+#endif\n+\n #define DRV_OK          0\n #define DRV_MSG_BAD     -1\n #define DRV_BOX_BAD     -2\n-- \n1.6.5.rc1.60.g41795\n"},{"id":"124502","messageId":"1255100682-13952-5-git-send-email-kusmabite@gmail.com","threadId":"21171","inReplyTo":"1255100682-13952-4-git-send-email-kusmabite@gmail.com","subject":"[PATCH 5/8] imap-send: build imap-send on Windows","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@googlemail.com","sentAt":"2009-10-09T15:04:39Z","receivedAt":"2009-10-09T15:04:39Z","isPatch":true,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"Since the POSIX-specific tunneling code has been replaced\nby the run-command API (and a compile-error has been\ncleaned away), we can now enable imap-send on Windows\nbuilds.\n\nSigned-off-by: Erik Faye-Lund <kusmabite@gmail.com>\n---\n Makefile |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 12defd4..8ba789a 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -361,6 +361,7 @@ PROGRAMS += git-show-index$X\n PROGRAMS += git-unpack-file$X\n PROGRAMS += git-upload-pack$X\n PROGRAMS += git-var$X\n+PROGRAMS += git-imap-send$X\n \n # List built-in command $C whose implementation cmd_$C() is not in\n # builtin-$C.o but is linked in as part of some other command.\n@@ -1056,7 +1057,6 @@ EXTLIBS += -lz\n \n ifndef NO_POSIX_ONLY_PROGRAMS\n \tPROGRAMS += git-daemon$X\n-\tPROGRAMS += git-imap-send$X\n endif\n ifndef NO_OPENSSL\n \tOPENSSL_LIBSSL = -lssl\n-- \n1.6.5.rc1.60.g41795\n"},{"id":"124500","messageId":"1255100682-13952-6-git-send-email-kusmabite@gmail.com","threadId":"21171","inReplyTo":"1255100682-13952-5-git-send-email-kusmabite@gmail.com","subject":"[PATCH 6/8] mingw: wrap SSL_set_(w|r)fd to call _get_osfhandle","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@googlemail.com","sentAt":"2009-10-09T15:04:40Z","receivedAt":"2009-10-09T15:04:40Z","isPatch":true,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"SSL_set_fd (and friends) expects a OS file handle on Windows, not\na file descriptor as on UNIX(-ish).\n\nThis patch makes the Windows version of SSL_set_fd behave like the\nUNIX versions, by calling _get_osfhandle on it's input.\n\nSigned-off-by: Erik Faye-Lund <kusmabite@gmail.com>\n---\n compat/mingw.h |   21 +++++++++++++++++++++\n 1 files changed, 21 insertions(+), 0 deletions(-)\n\ndiff --git a/compat/mingw.h b/compat/mingw.h\nindex 5b5258b..6907345 100644\n--- a/compat/mingw.h\n+++ b/compat/mingw.h\n@@ -124,6 +124,27 @@ static inline int waitpid(pid_t pid, int *status, unsigned options)\n \treturn -1;\n }\n \n+#ifndef NO_OPENSSL\n+#include <openssl/ssl.h>\n+static inline int mingw_SSL_set_fd(SSL *ssl, int fd)\n+{\n+\treturn SSL_set_fd(ssl, _get_osfhandle(fd));\n+}\n+#define SSL_set_fd mingw_SSL_set_fd\n+\n+static inline int mingw_SSL_set_rfd(SSL *ssl, int fd)\n+{\n+\treturn SSL_set_rfd(ssl, _get_osfhandle(fd));\n+}\n+#define SSL_set_rfd mingw_SSL_set_rfd\n+\n+static inline int mingw_SSL_set_wfd(SSL *ssl, int fd)\n+{\n+\treturn SSL_set_wfd(ssl, _get_osfhandle(fd));\n+}\n+#define SSL_set_wfd mingw_SSL_set_wfd\n+#endif\n+\n /*\n  * implementations of missing functions\n  */\n-- \n1.6.5.rc1.60.g41795\n"},{"id":"124495","messageId":"1255100682-13952-7-git-send-email-kusmabite@gmail.com","threadId":"21171","inReplyTo":"1255100682-13952-6-git-send-email-kusmabite@gmail.com","subject":"[PATCH 7/8] mingw: enable OpenSSL","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@googlemail.com","sentAt":"2009-10-09T15:04:41Z","receivedAt":"2009-10-09T15:04:41Z","isPatch":true,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"Since we have OpenSSL in msysgit now, enable it to support SSL\nencryption for imap-send.\n\nSigned-off-by: Erik Faye-Lund <kusmabite@gmail.com>\n---\n Makefile |    1 -\n 1 files changed, 0 insertions(+), 1 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 8ba789a..8818f0f 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -933,7 +933,6 @@ else\n ifneq (,$(findstring MINGW,$(uname_S)))\n \tpathsep = ;\n \tNO_PREAD = YesPlease\n-\tNO_OPENSSL = YesPlease\n \tNO_LIBGEN_H = YesPlease\n \tNO_SYMLINK_HEAD = YesPlease\n \tNO_IPV6 = YesPlease\n-- \n1.6.5.rc1.60.g41795\n"},{"id":"124498","messageId":"1255100682-13952-8-git-send-email-kusmabite@gmail.com","threadId":"21171","inReplyTo":"1255100682-13952-7-git-send-email-kusmabite@gmail.com","subject":"[PATCH 8/8] MSVC: Enable OpenSSL, and translate -lcrypto","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@googlemail.com","sentAt":"2009-10-09T15:04:42Z","receivedAt":"2009-10-09T15:04:42Z","isPatch":true,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"From: Marius Storm-Olsen <mstormo@gmail.com>\n\nWe don't use crypto, but rather require libeay32 and\nssleay32. handle it in both the Makefile msvc linker\nscript, and the buildsystem generator.\n\nSigned-off-by: Marius Storm-Olsen <mstormo@gmail.com>\nSigned-off-by: Erik Faye-Lund <kusmabite@gmail.com>\n---\n Makefile                        |    1 -\n compat/vcbuild/scripts/clink.pl |    3 +++\n contrib/buildsystems/engine.pl  |    3 +++\n 3 files changed, 6 insertions(+), 1 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 8818f0f..c4b91d8 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -881,7 +881,6 @@ ifdef MSVC\n \tGIT_VERSION := $(GIT_VERSION).MSVC\n \tpathsep = ;\n \tNO_PREAD = YesPlease\n-\tNO_OPENSSL = YesPlease\n \tNO_LIBGEN_H = YesPlease\n \tNO_SYMLINK_HEAD = YesPlease\n \tNO_IPV6 = YesPlease\ndiff --git a/compat/vcbuild/scripts/clink.pl b/compat/vcbuild/scripts/clink.pl\nindex 0ffd59f..fce1e24 100644\n--- a/compat/vcbuild/scripts/clink.pl\n+++ b/compat/vcbuild/scripts/clink.pl\n@@ -29,6 +29,9 @@ while (@ARGV) {\n \t\tpush(@args, \"zlib.lib\");\n \t} elsif (\"$arg\" eq \"-liconv\") {\n \t\tpush(@args, \"iconv.lib\");\n+\t} elsif (\"$arg\" eq \"-lcrypto\") {\n+\t\tpush(@args, \"libeay32.lib\");\n+\t\tpush(@args, \"ssleay32.lib\");\n \t} elsif (\"$arg\" =~ /^-L/ && \"$arg\" ne \"-LTCG\") {\n \t\t$arg =~ s/^-L/-LIBPATH:/;\n \t\tpush(@args, $arg);\ndiff --git a/contrib/buildsystems/engine.pl b/contrib/buildsystems/engine.pl\nindex 20bd061..d506717 100644\n--- a/contrib/buildsystems/engine.pl\n+++ b/contrib/buildsystems/engine.pl\n@@ -315,6 +315,9 @@ sub handleLinkLine\n             $appout = shift @parts;\n         } elsif (\"$part\" eq \"-lz\") {\n             push(@libs, \"zlib.lib\");\n+\t} elsif (\"$part\" eq \"-lcrypto\") {\n+            push(@libs, \"libeay32.lib\");\n+            push(@libs, \"ssleay32.lib\");\n         } elsif ($part =~ /^-/) {\n             push(@lflags, $part);\n         } elsif ($part =~ /\\.(a|lib)$/) {\n-- \n1.6.5.rc1.60.g41795\n"},{"id":"124503","messageId":"fabb9a1e0910090821n67c86d0kb4eef1b9ff4bdff1@mail.gmail.com","threadId":"21171","inReplyTo":"1255100682-13952-1-git-send-email-kusmabite@gmail.com","subject":"Re: [PATCH 1/8] imap-send: remove useless uid code","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2009-10-09T15:21:59Z","receivedAt":"2009-10-09T15:21:59Z","isPatch":true,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\nOn Fri, Oct 9, 2009 at 17:04, Erik Faye-Lund <kusmabite@googlemail.com> wrote:\n\nPlease include a cover letter for series as long as these (anything\nlarger than 4 should have a cover letter IMHO). Doing so makes it\neasier for those that follow the series to see what changed (assuming\nyou write down what changed in the cover letter). Also, it makes it\neasier for those that were not following the series to drop in at the\ncurrent version (assuming you provide a short summary of what the\nseries is about in the cover letter)..\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"124506","messageId":"loom.20091009T174035-62@post.gmane.org","threadId":"21171","inReplyTo":"1255100682-13952-4-git-send-email-kusmabite@gmail.com","subject":"Re: [PATCH 4/8] imap-send: fix compilation-error on Windows","fromName":"Matt Kraai","fromEmail":"mkraai@beckman.com","sentAt":"2009-10-09T15:42:15Z","receivedAt":"2009-10-09T15:42:15Z","isPatch":true,"sender":{"key":"mkraai@beckman.com","avatar":null},"body":"Erik Faye-Lund <kusmabite <at> googlemail.com> writes:\n> +#ifdef DRV_OK\n> +#undef DRV_OK\n> +#endif\n> +\n\nIt shouldn't be necessary to check whether DRV_OK is defined before undefining\nit; if it's not defined, undefining it will be a NOP.\n"},{"id":"124507","messageId":"loom.20091009T174542-570@post.gmane.org","threadId":"21171","inReplyTo":"1255100682-13952-1-git-send-email-kusmabite@gmail.com","subject":"Re: [PATCH 1/8] imap-send: remove useless uid code","fromName":"Matt Kraai","fromEmail":"mkraai@beckman.com","sentAt":"2009-10-09T15:46:50Z","receivedAt":"2009-10-09T15:46:50Z","isPatch":true,"sender":{"key":"mkraai@beckman.com","avatar":null},"body":"Erik Faye-Lund <kusmabite <at> googlemail.com> writes:\n> Presumably this is used in isync to be able to synchronize\n> mailstores multiple times without duplication. But for\n> imap-send, it the values are useless; we never do anything\n> with them and simply forget them at the end of the program.\n\nOn the third line of this paragraph, \"it\" should be removed.\n"},{"id":"124510","messageId":"40aa078e0910090912t54df0433y8c1bad523bfa6d70@mail.gmail.com","threadId":"21171","inReplyTo":"fabb9a1e0910090821n67c86d0kb4eef1b9ff4bdff1@mail.gmail.com","subject":"Re: [PATCH 1/8] imap-send: remove useless uid code","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@googlemail.com","sentAt":"2009-10-09T16:12:02Z","receivedAt":"2009-10-09T16:12:02Z","isPatch":true,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"On Fri, Oct 9, 2009 at 5:21 PM, Sverre Rabbelier <srabbelier@gmail.com> wrote:\n> Heya,\n>\n> On Fri, Oct 9, 2009 at 17:04, Erik Faye-Lund <kusmabite@googlemail.com> wrote:\n>\n> Please include a cover letter for series as long as these (anything\n> larger than 4 should have a cover letter IMHO). Doing so makes it\n> easier for those that follow the series to see what changed (assuming\n> you write down what changed in the cover letter). Also, it makes it\n> easier for those that were not following the series to drop in at the\n> current version (assuming you provide a short summary of what the\n> series is about in the cover letter)..\n\nDoh, I'm sorry about this. Here's an added cover-letter, I hope it helps:\n\n--->8---\nHere's the 2nd iteration of my patches  for Windows-compatibility in imap-send.\n\nPatch 1-3 is about getting rid of or rewriting code with portability issues.\n\nPatch 4 fixes a compilation error on Windows\n\nPatch 5 enables compilation of imap-send\n\nPatch 6-7 enables SSL-suport for mingw\n\nPatch 8 enables imap-send and SSL for msvc\n\nChanges in this iteration compared to the previous are as follows:\n\n - Patch 7 has been replaced with patch 1 in the current series. All\nother patches from the previous iteration has been shifted up a number\ndue to this.\n - Patch 2 (previously 1) now has a short comment that declares it's intent.\n - Patch 8 has been included\n\n-- \nErik \"kusma\" Faye-Lund\nkusmabite@gmail.com\n(+47) 986 59 656\n"},{"id":"124547","messageId":"7v63aof4lz.fsf@alter.siamese.dyndns.org","threadId":"21171","inReplyTo":"fabb9a1e0910090821n67c86d0kb4eef1b9ff4bdff1@mail.gmail.com","subject":"Re: [PATCH 1/8] imap-send: remove useless uid code","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-10-10T00:57:12Z","receivedAt":"2009-10-10T00:57:12Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sverre Rabbelier <srabbelier@gmail.com> writes:\n\n> Please include a cover letter for series as long as these (anything\n> larger than 4 should have a cover letter IMHO). Doing so makes it\n> easier for those that follow the series to see what changed (assuming\n> you write down what changed in the cover letter). Also, it makes it\n> easier for those that were not following the series to drop in at the\n> current version (assuming you provide a short summary of what the\n> series is about in the cover letter)..\n\nThanks.\n"}]}