diff options
author | deraadt <> | 2014-04-19 16:31:51 +0000 |
---|---|---|
committer | deraadt <> | 2014-04-19 16:31:51 +0000 |
commit | 7705026f86844d42c6b1e0ffb1e2e8d7f016ba58 (patch) | |
tree | 75a233897e76764f04c05e664a2751caf4945498 /src/lib | |
parent | 9bb9a03936522f6652f1f5cf705eda6353c0e8a5 (diff) | |
download | openbsd-7705026f86844d42c6b1e0ffb1e2e8d7f016ba58.tar.gz openbsd-7705026f86844d42c6b1e0ffb1e2e8d7f016ba58.tar.bz2 openbsd-7705026f86844d42c6b1e0ffb1e2e8d7f016ba58.zip |
ReadFile() and GetStdHandle() are not very POSIX.
ok beck jsing
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/libssl/src/apps/apps.c | 37 | ||||
-rw-r--r-- | src/lib/libssl/src/apps/apps.h | 2 | ||||
-rw-r--r-- | src/lib/libssl/src/apps/s_client.c | 6 | ||||
-rw-r--r-- | src/lib/libssl/src/apps/s_server.c | 6 |
4 files changed, 6 insertions, 45 deletions
diff --git a/src/lib/libssl/src/apps/apps.c b/src/lib/libssl/src/apps/apps.c index 6413d5c437..3a6c3b9bdd 100644 --- a/src/lib/libssl/src/apps/apps.c +++ b/src/lib/libssl/src/apps/apps.c | |||
@@ -2513,40 +2513,3 @@ app_isdir(const char *name) | |||
2513 | return -1; | 2513 | return -1; |
2514 | #endif | 2514 | #endif |
2515 | } | 2515 | } |
2516 | |||
2517 | /* raw_read|write section */ | ||
2518 | #if defined(_WIN32) && defined(STD_INPUT_HANDLE) | ||
2519 | int | ||
2520 | raw_read_stdin(void *buf, int siz) | ||
2521 | { | ||
2522 | DWORD n; | ||
2523 | if (ReadFile(GetStdHandle(STD_INPUT_HANDLE), buf, siz, &n, NULL)) | ||
2524 | return (n); | ||
2525 | else | ||
2526 | return (-1); | ||
2527 | } | ||
2528 | #else | ||
2529 | int | ||
2530 | raw_read_stdin(void *buf, int siz) | ||
2531 | { | ||
2532 | return read(fileno(stdin), buf, siz); | ||
2533 | } | ||
2534 | #endif | ||
2535 | |||
2536 | #if defined(_WIN32) && defined(STD_OUTPUT_HANDLE) | ||
2537 | int | ||
2538 | raw_write_stdout(const void *buf, int siz) | ||
2539 | { | ||
2540 | DWORD n; | ||
2541 | if (WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), buf, siz, &n, NULL)) | ||
2542 | return (n); | ||
2543 | else | ||
2544 | return (-1); | ||
2545 | } | ||
2546 | #else | ||
2547 | int | ||
2548 | raw_write_stdout(const void *buf, int siz) | ||
2549 | { | ||
2550 | return write(fileno(stdout), buf, siz); | ||
2551 | } | ||
2552 | #endif | ||
diff --git a/src/lib/libssl/src/apps/apps.h b/src/lib/libssl/src/apps/apps.h index 55015024e9..eae0f4708a 100644 --- a/src/lib/libssl/src/apps/apps.h +++ b/src/lib/libssl/src/apps/apps.h | |||
@@ -320,8 +320,6 @@ unsigned char *next_protos_parse(unsigned short *outlen, const char *in); | |||
320 | #define SERIAL_RAND_BITS 64 | 320 | #define SERIAL_RAND_BITS 64 |
321 | 321 | ||
322 | int app_isdir(const char *); | 322 | int app_isdir(const char *); |
323 | int raw_read_stdin(void *, int); | ||
324 | int raw_write_stdout(const void *, int); | ||
325 | 323 | ||
326 | #define TM_START 0 | 324 | #define TM_START 0 |
327 | #define TM_STOP 1 | 325 | #define TM_STOP 1 |
diff --git a/src/lib/libssl/src/apps/s_client.c b/src/lib/libssl/src/apps/s_client.c index 8c71d6b6ae..fada0827a4 100644 --- a/src/lib/libssl/src/apps/s_client.c +++ b/src/lib/libssl/src/apps/s_client.c | |||
@@ -1524,7 +1524,7 @@ re_start: | |||
1524 | goto shut; | 1524 | goto shut; |
1525 | } | 1525 | } |
1526 | } else if (!ssl_pending && FD_ISSET(fileno(stdout), &writefds)) { | 1526 | } else if (!ssl_pending && FD_ISSET(fileno(stdout), &writefds)) { |
1527 | i = raw_write_stdout(&(sbuf[sbuf_off]), sbuf_len); | 1527 | i = write(fileno(stdout), &(sbuf[sbuf_off]), sbuf_len); |
1528 | 1528 | ||
1529 | if (i <= 0) { | 1529 | if (i <= 0) { |
1530 | BIO_printf(bio_c_out, "DONE\n"); | 1530 | BIO_printf(bio_c_out, "DONE\n"); |
@@ -1601,7 +1601,7 @@ re_start: | |||
1601 | if (crlf) { | 1601 | if (crlf) { |
1602 | int j, lf_num; | 1602 | int j, lf_num; |
1603 | 1603 | ||
1604 | i = raw_read_stdin(cbuf, BUFSIZZ / 2); | 1604 | i = read(fileno(stdin), cbuf, BUFSIZZ / 2); |
1605 | lf_num = 0; | 1605 | lf_num = 0; |
1606 | /* both loops are skipped when i <= 0 */ | 1606 | /* both loops are skipped when i <= 0 */ |
1607 | for (j = 0; j < i; j++) | 1607 | for (j = 0; j < i; j++) |
@@ -1617,7 +1617,7 @@ re_start: | |||
1617 | } | 1617 | } |
1618 | assert(lf_num == 0); | 1618 | assert(lf_num == 0); |
1619 | } else | 1619 | } else |
1620 | i = raw_read_stdin(cbuf, BUFSIZZ); | 1620 | i = read(fileno(stdin), cbuf, BUFSIZZ); |
1621 | 1621 | ||
1622 | if ((!c_ign_eof) && ((i <= 0) || (cbuf[0] == 'Q'))) { | 1622 | if ((!c_ign_eof) && ((i <= 0) || (cbuf[0] == 'Q'))) { |
1623 | BIO_printf(bio_err, "DONE\n"); | 1623 | BIO_printf(bio_err, "DONE\n"); |
diff --git a/src/lib/libssl/src/apps/s_server.c b/src/lib/libssl/src/apps/s_server.c index 3dd22e6b7a..1082ee51ee 100644 --- a/src/lib/libssl/src/apps/s_server.c +++ b/src/lib/libssl/src/apps/s_server.c | |||
@@ -1805,7 +1805,7 @@ sv_body(char *hostname, int s, unsigned char *context) | |||
1805 | if (s_crlf) { | 1805 | if (s_crlf) { |
1806 | int j, lf_num; | 1806 | int j, lf_num; |
1807 | 1807 | ||
1808 | i = raw_read_stdin(buf, bufsize / 2); | 1808 | i = read(fileno(stdin), buf, bufsize / 2); |
1809 | lf_num = 0; | 1809 | lf_num = 0; |
1810 | /* both loops are skipped when i <= 0 */ | 1810 | /* both loops are skipped when i <= 0 */ |
1811 | for (j = 0; j < i; j++) | 1811 | for (j = 0; j < i; j++) |
@@ -1821,7 +1821,7 @@ sv_body(char *hostname, int s, unsigned char *context) | |||
1821 | } | 1821 | } |
1822 | assert(lf_num == 0); | 1822 | assert(lf_num == 0); |
1823 | } else | 1823 | } else |
1824 | i = raw_read_stdin(buf, bufsize); | 1824 | i = read(fileno(stdin), buf, bufsize); |
1825 | if (!s_quiet) { | 1825 | if (!s_quiet) { |
1826 | if ((i <= 0) || (buf[0] == 'Q')) { | 1826 | if ((i <= 0) || (buf[0] == 'Q')) { |
1827 | BIO_printf(bio_s_out, "DONE\n"); | 1827 | BIO_printf(bio_s_out, "DONE\n"); |
@@ -1954,7 +1954,7 @@ sv_body(char *hostname, int s, unsigned char *context) | |||
1954 | #endif | 1954 | #endif |
1955 | switch (SSL_get_error(con, i)) { | 1955 | switch (SSL_get_error(con, i)) { |
1956 | case SSL_ERROR_NONE: | 1956 | case SSL_ERROR_NONE: |
1957 | raw_write_stdout(buf, | 1957 | write(fileno(stdout), buf, |
1958 | (unsigned int) i); | 1958 | (unsigned int) i); |
1959 | if (SSL_pending(con)) | 1959 | if (SSL_pending(con)) |
1960 | goto again; | 1960 | goto again; |