Hi all,

I only just joined this list today to past this patch.

32bit Solaris has a nasty bug in fopen(3C) which prevents
opening a file once there are more than 256 descriptors
active in a process. The work-around is to use open(2)
instead. See: http://access1.sun.com/technotes/01406.html
This affects all Solaris versions, including 10, on both
Intel and Sparc.

PEM_read_bio_X509 uses BIO_gets, so if you give it an
fd BIO it fails with "BIO_gets:unsupported method" as
that routine is not implemented.

What follows is a tested and working implementation done
in 0.9.7g. This fixes the problem on Solaris. Code to
test it would be along the lines of:

fd = open(filename, O_RDONLY);
bio = BIO_new_fd(fd, BIO_NOCLOSE);
cert = PEM_read_bio_X509(bio, NULL, NULL, NULL);

Can we get this happening in the next 0.9.7 and 0.9.8
releases?

Cheers,
David

--
crypto/bio/bss_fd.c:
68a69,70
> static int fd_gets(BIO *h, char *buf, int size);
> static int fd_getc(BIO *bp, char *c);
79c81
<       NULL, /* fd_gets, */
---
>       fd_gets,
217a220,251
> static int fd_getc(BIO *bp, char *c)
>       {
>               return(fd_read(bp,c,1));
>       }
>
> static int fd_gets(BIO *bp, char *buf, int size)
>       {
>       int i, ret;
>       char c;
>
>       memset(buf,0,size);
>
>       for ( i=0 ; ((i < size)&&(fd_getc(bp,&c)==1)) ; i++ )
>       {
>               if (c=='\r')
>               {
>                       continue;
>               }
>               else if (c=='\n')
>               {
>                       break;
>               }
>               else
>               {
>                       buf[i] = c;
>               }
>       }
>       buf[i] = (char)NULL;
>       ret = strlen(buf);
>       return ret;
>       }
>
--
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [email protected]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to