diff options
| author | djm <> | 2010-10-01 22:59:01 +0000 |
|---|---|---|
| committer | djm <> | 2010-10-01 22:59:01 +0000 |
| commit | 8922d4bc4a8b8893d72a48deb2cdf58215f98505 (patch) | |
| tree | 939b752540947d33507b3acc48d76a8bfb7c3dc3 /src/lib/libcrypto/bio/bss_fd.c | |
| parent | 76262f7bf9262f965142b1b2b2105cb279c5c696 (diff) | |
| download | openbsd-8922d4bc4a8b8893d72a48deb2cdf58215f98505.tar.gz openbsd-8922d4bc4a8b8893d72a48deb2cdf58215f98505.tar.bz2 openbsd-8922d4bc4a8b8893d72a48deb2cdf58215f98505.zip | |
resolve conflicts, fix local changes
Diffstat (limited to 'src/lib/libcrypto/bio/bss_fd.c')
| -rw-r--r-- | src/lib/libcrypto/bio/bss_fd.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/src/lib/libcrypto/bio/bss_fd.c b/src/lib/libcrypto/bio/bss_fd.c index 4c229bf641..d1bf85aae1 100644 --- a/src/lib/libcrypto/bio/bss_fd.c +++ b/src/lib/libcrypto/bio/bss_fd.c | |||
| @@ -60,6 +60,13 @@ | |||
| 60 | #include <errno.h> | 60 | #include <errno.h> |
| 61 | #define USE_SOCKETS | 61 | #define USE_SOCKETS |
| 62 | #include "cryptlib.h" | 62 | #include "cryptlib.h" |
| 63 | |||
| 64 | #if defined(OPENSSL_NO_POSIX_IO) | ||
| 65 | /* | ||
| 66 | * One can argue that one should implement dummy placeholder for | ||
| 67 | * BIO_s_fd here... | ||
| 68 | */ | ||
| 69 | #else | ||
| 63 | /* | 70 | /* |
| 64 | * As for unconditional usage of "UPLINK" interface in this module. | 71 | * As for unconditional usage of "UPLINK" interface in this module. |
| 65 | * Trouble is that unlike Unix file descriptors [which are indexes | 72 | * Trouble is that unlike Unix file descriptors [which are indexes |
| @@ -77,6 +84,7 @@ | |||
| 77 | static int fd_write(BIO *h, const char *buf, int num); | 84 | static int fd_write(BIO *h, const char *buf, int num); |
| 78 | static int fd_read(BIO *h, char *buf, int size); | 85 | static int fd_read(BIO *h, char *buf, int size); |
| 79 | static int fd_puts(BIO *h, const char *str); | 86 | static int fd_puts(BIO *h, const char *str); |
| 87 | static int fd_gets(BIO *h, char *buf, int size); | ||
| 80 | static long fd_ctrl(BIO *h, int cmd, long arg1, void *arg2); | 88 | static long fd_ctrl(BIO *h, int cmd, long arg1, void *arg2); |
| 81 | static int fd_new(BIO *h); | 89 | static int fd_new(BIO *h); |
| 82 | static int fd_free(BIO *data); | 90 | static int fd_free(BIO *data); |
| @@ -88,7 +96,7 @@ static BIO_METHOD methods_fdp= | |||
| 88 | fd_write, | 96 | fd_write, |
| 89 | fd_read, | 97 | fd_read, |
| 90 | fd_puts, | 98 | fd_puts, |
| 91 | NULL, /* fd_gets, */ | 99 | fd_gets, |
| 92 | fd_ctrl, | 100 | fd_ctrl, |
| 93 | fd_new, | 101 | fd_new, |
| 94 | fd_free, | 102 | fd_free, |
| @@ -227,6 +235,22 @@ static int fd_puts(BIO *bp, const char *str) | |||
| 227 | return(ret); | 235 | return(ret); |
| 228 | } | 236 | } |
| 229 | 237 | ||
| 238 | static int fd_gets(BIO *bp, char *buf, int size) | ||
| 239 | { | ||
| 240 | int ret=0; | ||
| 241 | char *ptr=buf; | ||
| 242 | char *end=buf+size-1; | ||
| 243 | |||
| 244 | while ( (ptr < end) && (fd_read(bp, ptr, 1) > 0) && (ptr[0] != '\n') ) | ||
| 245 | ptr++; | ||
| 246 | |||
| 247 | ptr[0]='\0'; | ||
| 248 | |||
| 249 | if (buf[0] != '\0') | ||
| 250 | ret=strlen(buf); | ||
| 251 | return(ret); | ||
| 252 | } | ||
| 253 | |||
| 230 | int BIO_fd_should_retry(int i) | 254 | int BIO_fd_should_retry(int i) |
| 231 | { | 255 | { |
| 232 | int err; | 256 | int err; |
| @@ -292,3 +316,4 @@ int BIO_fd_non_fatal_error(int err) | |||
| 292 | } | 316 | } |
| 293 | return(0); | 317 | return(0); |
| 294 | } | 318 | } |
| 319 | #endif | ||
