{"thread":{"id":"21310","subject":"[PATCH v5 0/8] imap-send: Windows support","startedAt":"2009-10-21T17:04:43Z","lastAt":"2009-10-27T06:56:01Z","messageCount":16,"participants":["Erik Faye-Lund","Johannes Schindelin","Johannes Sixt","Junio C Hamano"],"isPatch":true,"patchVersion":5,"patchTotal":8},"messages":[{"id":"125611","messageId":"1256144691-2908-1-git-send-email-kusmabite@gmail.com","threadId":"21310","inReplyTo":null,"subject":"[PATCH v5 0/8] imap-send: Windows support","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@googlemail.com","sentAt":"2009-10-21T17:04:43Z","receivedAt":"2009-10-21T17:04:43Z","isPatch":true,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"\nHere's the 5th iteration of my patches for\nWindows-compatibility in imap-send.\n\n - Patch 1-3 is about getting rid of or rewriting\n   code with portability issues.\n - Patch 4 fixes a compilation error on Windows\n - Patch 5 enables compilation of imap-send\n - Patch 6-7 enables SSL-suport for mingw\n - Patch 8 enables imap-send and SSL for msvc\n\nThe only change compared to the previous iteration\nis that patch 7 and 8 enables NEEDS_CRYPTO_WITH_SSL.\n\nPlease note that I haven't tested Patch 8 with\nNEEDS_CRYPTO_WITH_SSL under MSVC, as I don't have a\nworking setup with both msysgit and MSVC installed.\n\nI'd love it if someone with such a working setup\ncould verify that it works, preferrably also with\nBLK_SHA1 enabled.\n\nErik Faye-Lund (6):\n  imap-send: use separate read and write fds\n  imap-send: use run-command API for tunneling\n  imap-send: fix compilation-error on Windows\n  imap-send: build imap-send on Windows\n  mingw: wrap SSL_set_(w|r)fd to call _get_osfhandle\n  mingw: enable OpenSSL\n\nJeff King (1):\n  imap-send: remove useless uid code\n\nMarius Storm-Olsen (1):\n  MSVC: Enable OpenSSL, and translate -lcrypto\n\n Makefile                        |    6 +-\n compat/mingw.h                  |   21 ++++\n compat/vcbuild/scripts/clink.pl |    3 +\n contrib/buildsystems/engine.pl  |    3 +\n imap-send.c                     |  226 +++++++++------------------------------\n 5 files changed, 79 insertions(+), 180 deletions(-)\n"},{"id":"125613","messageId":"1256144691-2908-2-git-send-email-kusmabite@gmail.com","threadId":"21310","inReplyTo":"1256144691-2908-1-git-send-email-kusmabite@gmail.com","subject":"[PATCH v5 1/8] imap-send: remove useless uid code","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@googlemail.com","sentAt":"2009-10-21T17:04:44Z","receivedAt":"2009-10-21T17:04:44Z","isPatch":true,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"\nFrom: 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, 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.4.msysgit.0\n"},{"id":"125618","messageId":"1256144691-2908-3-git-send-email-kusmabite@gmail.com","threadId":"21310","inReplyTo":"1256144691-2908-2-git-send-email-kusmabite@gmail.com","subject":"[PATCH v5 2/8] imap-send: use separate read and write fds","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@googlemail.com","sentAt":"2009-10-21T17:04:45Z","receivedAt":"2009-10-21T17:04:45Z","isPatch":true,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"\nThis 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.4.msysgit.0\n"},{"id":"125612","messageId":"1256144691-2908-4-git-send-email-kusmabite@gmail.com","threadId":"21310","inReplyTo":"1256144691-2908-3-git-send-email-kusmabite@gmail.com","subject":"[PATCH v5 3/8] imap-send: use run-command API for tunneling","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@googlemail.com","sentAt":"2009-10-21T17:04:46Z","receivedAt":"2009-10-21T17:04:46Z","isPatch":true,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"\nSigned-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..72ed640 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] = \"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.4.msysgit.0\n"},{"id":"125619","messageId":"1256144691-2908-5-git-send-email-kusmabite@gmail.com","threadId":"21310","inReplyTo":"1256144691-2908-4-git-send-email-kusmabite@gmail.com","subject":"[PATCH v5 4/8] imap-send: fix compilation-error on Windows","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@googlemail.com","sentAt":"2009-10-21T17:04:47Z","receivedAt":"2009-10-21T17:04:47Z","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 |    1 +\n 1 files changed, 1 insertions(+), 0 deletions(-)\n\ndiff --git a/imap-send.c b/imap-send.c\nindex 72ed640..69e6142 100644\n--- a/imap-send.c\n+++ b/imap-send.c\n@@ -94,6 +94,7 @@ struct msg_data {\n \tunsigned int crlf:1;\n };\n \n+#undef DRV_OK\n #define DRV_OK          0\n #define DRV_MSG_BAD     -1\n #define DRV_BOX_BAD     -2\n-- \n1.6.4.msysgit.0\n"},{"id":"125614","messageId":"1256144691-2908-6-git-send-email-kusmabite@gmail.com","threadId":"21310","inReplyTo":"1256144691-2908-5-git-send-email-kusmabite@gmail.com","subject":"[PATCH v5 5/8] imap-send: build imap-send on Windows","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@googlemail.com","sentAt":"2009-10-21T17:04:48Z","receivedAt":"2009-10-21T17:04:48Z","isPatch":true,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"\nSince 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 fea237b..0d13af3 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -354,6 +354,7 @@ EXTRA_PROGRAMS =\n PROGRAMS += $(EXTRA_PROGRAMS)\n PROGRAMS += git-fast-import$X\n PROGRAMS += git-hash-object$X\n+PROGRAMS += git-imap-send$X\n PROGRAMS += git-index-pack$X\n PROGRAMS += git-merge-index$X\n PROGRAMS += git-merge-tree$X\n@@ -1075,7 +1076,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.4.msysgit.0\n"},{"id":"125615","messageId":"1256144691-2908-7-git-send-email-kusmabite@gmail.com","threadId":"21310","inReplyTo":"1256144691-2908-6-git-send-email-kusmabite@gmail.com","subject":"[PATCH v5 6/8] mingw: wrap SSL_set_(w|r)fd to call _get_osfhandle","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@googlemail.com","sentAt":"2009-10-21T17:04:49Z","receivedAt":"2009-10-21T17:04:49Z","isPatch":true,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"\nSSL_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.4.msysgit.0\n"},{"id":"125617","messageId":"1256144691-2908-8-git-send-email-kusmabite@gmail.com","threadId":"21310","inReplyTo":"1256144691-2908-7-git-send-email-kusmabite@gmail.com","subject":"[PATCH v5 7/8] mingw: enable OpenSSL","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@googlemail.com","sentAt":"2009-10-21T17:04:50Z","receivedAt":"2009-10-21T17:04:50Z","isPatch":true,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"\nSince 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 |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 0d13af3..986483b 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -952,7 +952,7 @@ else\n ifneq (,$(findstring MINGW,$(uname_S)))\n \tpathsep = ;\n \tNO_PREAD = YesPlease\n-\tNO_OPENSSL = YesPlease\n+\tNEEDS_CRYPTO_WITH_SSL = YesPlease\n \tNO_LIBGEN_H = YesPlease\n \tNO_SYMLINK_HEAD = YesPlease\n \tNO_IPV6 = YesPlease\n-- \n1.6.4.msysgit.0\n"},{"id":"125616","messageId":"1256144691-2908-9-git-send-email-kusmabite@gmail.com","threadId":"21310","inReplyTo":"1256144691-2908-8-git-send-email-kusmabite@gmail.com","subject":"[PATCH v5 8/8] MSVC: Enable OpenSSL, and translate -lcrypto","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@googlemail.com","sentAt":"2009-10-21T17:04:51Z","receivedAt":"2009-10-21T17:04:51Z","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                        |    2 +-\n compat/vcbuild/scripts/clink.pl |    3 +++\n contrib/buildsystems/engine.pl  |    3 +++\n 3 files changed, 7 insertions(+), 1 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 986483b..1e1a2f2 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -900,7 +900,7 @@ ifdef MSVC\n \tGIT_VERSION := $(GIT_VERSION).MSVC\n \tpathsep = ;\n \tNO_PREAD = YesPlease\n-\tNO_OPENSSL = YesPlease\n+\tNEEDS_CRYPTO_WITH_SSL = 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 f9528c0..8a2112f 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.4.msysgit.0\n"},{"id":"125716","messageId":"alpine.DEB.1.00.0910221942150.1263@felix-maschine","threadId":"21310","inReplyTo":"1256144691-2908-1-git-send-email-kusmabite@gmail.com","subject":"Re: [msysGit] [PATCH v5 0/8] imap-send: Windows support","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-10-22T17:42:42Z","receivedAt":"2009-10-22T17:42:42Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Wed, 21 Oct 2009, Erik Faye-Lund wrote:\n\n> Here's the 5th iteration of my patches for Windows-compatibility in \n> imap-send.\n> \n>  - Patch 1-3 is about getting rid of or rewriting\n>    code with portability issues.\n>  - Patch 4 fixes a compilation error on Windows\n>  - Patch 5 enables compilation of imap-send\n>  - Patch 6-7 enables SSL-suport for mingw\n>  - Patch 8 enables imap-send and SSL for msvc\n> \n> The only change compared to the previous iteration\n> is that patch 7 and 8 enables NEEDS_CRYPTO_WITH_SSL.\n> \n> Please note that I haven't tested Patch 8 with\n> NEEDS_CRYPTO_WITH_SSL under MSVC, as I don't have a\n> working setup with both msysgit and MSVC installed.\n> \n> I'd love it if someone with such a working setup\n> could verify that it works, preferrably also with\n> BLK_SHA1 enabled.\n\nIf there are no objections, I will apply them tomorrow.\n\nCiao,\nDscho\n"},{"id":"125717","messageId":"200910222011.02737.j6t@kdbg.org","threadId":"21310","inReplyTo":"alpine.DEB.1.00.0910221942150.1263@felix-maschine","subject":"Re: [msysGit] Re: [PATCH v5 0/8] imap-send: Windows support","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2009-10-22T18:11:02Z","receivedAt":"2009-10-22T18:11:02Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"On Donnerstag, 22. Oktober 2009, Johannes Schindelin wrote:\n> If there are no objections, I will apply them tomorrow.\n\nThe series is already in pu (FYI), and I have one more patch to be applied on \ntop of the series.\n\n-- Hannes\n"},{"id":"125718","messageId":"200910222026.29885.j6t@kdbg.org","threadId":"21310","inReplyTo":"200910222011.02737.j6t@kdbg.org","subject":"[PATCH ef/msys-imap] mingw: use BLK_SHA1 again","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2009-10-22T18:26:29Z","receivedAt":"2009-10-22T18:26:29Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Since NO_OPENSSL is no longer defined on Windows, BLK_SHA1 is not defined\nanymore implicitly. Define it explicitly.\n\nAs a nice side-effect, we no longer link against libcrypto.dll, which has\nnon-trivial startup costs because it depends on 6 otherwise unneeded\nDLLs.\n\nSigned-off-by: Johannes Sixt <j6t@kdbg.org>\n---\nOn Donnerstag, 22. Oktober 2009, Johannes Sixt wrote:\n> ... and I have one more patch to be applied on top of the series.\n\nHere it is. I haven't tested the MSVC aspect of the patch. I would\nappreciate feedback in this regard.\n\n-- Hannes\n\n Makefile |    2 ++\n 1 files changed, 2 insertions(+), 0 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 5403fad..f666d2f 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -911,6 +911,7 @@ ifdef MSVC\n \tNO_REGEX = YesPlease\n \tNO_CURL = YesPlease\n \tNO_PTHREADS = YesPlease\n+\tBLK_SHA1 = YesPlease\n \n \tCC = compat/vcbuild/scripts/clink.pl\n \tAR = compat/vcbuild/scripts/lib.pl\n@@ -960,6 +961,7 @@ ifneq (,$(findstring MINGW,$(uname_S)))\n \tUNRELIABLE_FSTAT = UnfortunatelyYes\n \tOBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo\n \tNO_REGEX = YesPlease\n+\tBLK_SHA1 = YesPlease\n \tCOMPAT_CFLAGS += -D__USE_MINGW_ACCESS -DNOGDI -Icompat -Icompat/fnmatch\n \tCOMPAT_CFLAGS += -DSTRIP_EXTENSION=\\\".exe\\\"\n \tCOMPAT_OBJS += compat/mingw.o compat/fnmatch/fnmatch.o compat/winansi.o\n-- \n1.6.5.rc3.70.gfc1aa\n"},{"id":"125719","messageId":"200910222038.41151.j6t@kdbg.org","threadId":"21310","inReplyTo":"1256144691-2908-8-git-send-email-kusmabite@gmail.com","subject":"Re: [msysGit] [PATCH v5 7/8] mingw: enable OpenSSL","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2009-10-22T18:38:41Z","receivedAt":"2009-10-22T18:38:41Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"On Mittwoch, 21. Oktober 2009, Erik Faye-Lund wrote:\n> Since we have OpenSSL in msysgit now, enable it to support SSL\n> encryption for imap-send.\n>\n> Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>\n\nAcked-by: Johannes Sixt <j6t@kdbg.org>\n\n-- Hannes\n"},{"id":"125725","messageId":"7vd44fgrrq.fsf@alter.siamese.dyndns.org","threadId":"21310","inReplyTo":"200910222011.02737.j6t@kdbg.org","subject":"Re: [msysGit] Re: [PATCH v5 0/8] imap-send: Windows support","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-10-22T19:20:09Z","receivedAt":"2009-10-22T19:20:09Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Sixt <j6t@kdbg.org> writes:\n\n> On Donnerstag, 22. Oktober 2009, Johannes Schindelin wrote:\n>> If there are no objections, I will apply them tomorrow.\n>\n> The series is already in pu (FYI),...\n\nPlease don't mind me; if msysgit people are happy with this series that\naffects only msysgit, I would be a lot happier to get a pull request to\nmerge them with Acks and Sign-offs from you guys directly into 'master',\nrather than me shepherding the series from 'pu' down to 'master'.\n"},{"id":"125958","messageId":"alpine.DEB.1.00.0910262324350.4985@pacific.mpi-cbg.de","threadId":"21310","inReplyTo":"200910222026.29885.j6t@kdbg.org","subject":"Re: [PATCH ef/msys-imap] mingw: use BLK_SHA1 again","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-10-26T22:26:45Z","receivedAt":"2009-10-26T22:26:45Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 22 Oct 2009, Johannes Sixt wrote:\n\n> Since NO_OPENSSL is no longer defined on Windows, BLK_SHA1 is not defined\n> anymore implicitly. Define it explicitly.\n> \n> As a nice side-effect, we no longer link against libcrypto.dll, which has\n> non-trivial startup costs because it depends on 6 otherwise unneeded\n> DLLs.\n> \n> Signed-off-by: Johannes Sixt <j6t@kdbg.org>\n> ---\n> On Donnerstag, 22. Oktober 2009, Johannes Sixt wrote:\n> > ... and I have one more patch to be applied on top of the series.\n> \n> Here it is. I haven't tested the MSVC aspect of the patch. I would\n> appreciate feedback in this regard.\n\nFor better visibility, I pushed it to the work/msys-imap branch in \n4msysgit.git (but I could not even compile-test it today, due to lack of \naccess to a Windows machine).\n\nIf nobody complains by the end of the week, I will merge it into \n4msysgit.git's 'devel' branch (I can only compile-test by then).\n\nCiao,\nDscho\n"},{"id":"125991","messageId":"4AE69981.6080107@viscovery.net","threadId":"21310","inReplyTo":"alpine.DEB.1.00.0910262324350.4985@pacific.mpi-cbg.de","subject":"Re: [PATCH ef/msys-imap] mingw: use BLK_SHA1 again","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2009-10-27T06:56:01Z","receivedAt":"2009-10-27T06:56:01Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Johannes Schindelin schrieb:\n> For better visibility, I pushed it to the work/msys-imap branch in \n> 4msysgit.git (but I could not even compile-test it today, due to lack of \n> access to a Windows machine).\n> \n> If nobody complains by the end of the week, I will merge it into \n> 4msysgit.git's 'devel' branch (I can only compile-test by then).\n\nUgh, I totally forgot: I have this branch ready for Junio to pull:\n\n  git://repo.or.cz/git/mingw/j6t.git ef/imap-send-windows\n\nOnly the top 3 commits are different from what is currently in pu: I added\nmy ACK, and reworded the commit message of my patch that is at the tip.\nContent-wise it is identical to the series in pu.\n\nI haven't seen an ACK from Marius regarding the changes that touch MSVC\nparts, but there was plenty of time to test, and the changes look obvious\nenough.\n\nJunio, please pull.\n\n-- Hannes\n"}]}