ssl_engine_io.c revision bfad8636cb9e52b309679a90dadc91b635ecfe2a
** _ __ ___ ___ __| | ___ ___| | mod_ssl ** | '_ ` _ \ / _ \ / _` | / __/ __| | Apache Interface to OpenSSL ** | | | | | | (_) | (_| | \__ \__ \ | www.modssl.org ** |_| |_| |_|\___/ \__,_|___|___/___/_| ftp.modssl.org /* ==================================================================== * The Apache Software License, Version 1.1 * Copyright (c) 2000-2001 The Apache Software Foundation. All rights * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * 4. The names "Apache" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact apache@apache.org. * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * ==================================================================== /* ``MY HACK: This universe. /* _________________________________________________________________ ** _________________________________________________________________ /* XXX THIS STUFF NEEDS A MAJOR CLEANUP -RSE XXX */ * Simulate an EINTR in case OpenSSL wants to read more. * (This is usually the case when the client forces an SSL * renegotation which is handled implicitly by OpenSSL.) "SSL error on reading data");
* read(2) returns only the generic error number -1 * XXX - Just trying to reflect the behaviour in * Simulate an EINTR in case OpenSSL wants to write more. "SSL error on writing data");
* write(2) returns only the generic error number -1 * XXX - Just trying to reflect the behaviour in /* we've been shutdown */ apr_bucket *pbktEOS=apr_bucket_create_eos(); APR_BRIGADE_INSERT_TAIL(pbbOutput,pbktEOS);*/ assert (n > 0);
/* XXX => Check if required */ /* XXX: check for errors */ /* XXX: it may be possible to not always flush */ /* Lazy frickin browsers just reset instead of shutting down. */ /* also gotta handle timeout of keepalive connections */ /* Next time around, the incoming brigade will be empty, * so we'll return EOF then "Read failed in tls_in_filter");
/* In this case, we have data in the output bucket, or we were * non-blocking, so returning nothing is fine. /* we're doing renegotiation in the access phase */ /* trick ap_http_filter into leaving us alone */ break;
/* SSL_renegotiate will take it from here */ /* if this is the case, ssl connection has been shutdown * and pRec->pssl has been freed /* pass along all of the current BIO */ (
unsigned char *)
buf,
sizeof(
buf))) > 0)
/* XXX: should we use a heap bucket instead? Or a transient (in * which case we need a separate brigade for each bucket)? /* Once we've read something, we can move to non-blocking mode (if char *
reason =
"reason unknown";
/* XXX: probably a better way to determine this */ reason =
"likely due to failed renegotiation";
"failed to write %d of %d bytes (%s)",
/* else fallthrough to flush the current wbio * likely triggered by renegotiation in ssl_hook_Access /* churn the state machine */ /* XXX: we don't currently support peek */ /* churn the state machine */ /* XXX: shame that APR_BRIGADE_FOREACH doesn't work here */ /* already been shutdown */ "Error in ssl_hook_CloseConnection");
/* _________________________________________________________________ ** _________________________________________________________________ for(; (
len > 0) && ((s[
len-
1] ==
' ') || (s[
len-
1] ==
'\0'));
len--)
"+-------------------------------------------------------------------------+");
for(i = 0 ; i<
rows; i++) {
ch = ((
unsigned char)*((
char *)(s) + i *
DUMP_WIDTH + j)) &
0xff;
ch = ((
unsigned char)*((
char *)(s) + i *
DUMP_WIDTH + j)) &
0xff;
"+-------------------------------------------------------------------------+");
"%s: %s %ld/%d bytes %s BIO#%08X [mem: %08lX] %s",
(
argp !=
NULL ?
"(BIO dump follows)" :
"(Ops, no memory buffer?)"));
"%s: I/O error, %d bytes expected to %s on BIO#%08X [mem: %08lX]",