Changeset a9fa300 in mod_gnutls for src/gnutls_io.c


Ignore:
Timestamp:
May 27, 2016, 12:11:32 PM (3 years ago)
Author:
Thomas Klute <thomas2.klute@…>
Branches:
debian/master, debian/stretch-backports, jessie-backports, master, upstream
Children:
19f2719
Parents:
6868585
Message:

Set GnuTLS session errno on all error paths in mgs_transport_read()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/gnutls_io.c

    r6868585 ra9fa300  
    765765/**
    766766 * Pull function for GnuTLS
     767 *
     768 * Generic errnos used for gnutls_transport_set_errno:
     769 * EIO: Unknown I/O error
     770 * ECONNABORTED: Input BB does not exist (NULL)
     771 *
     772 * The reason we are not using APR_TO_OS_ERROR to map apr_status_t to
     773 * errnos is this warning in the APR documentation: "If the statcode
     774 * was not created by apr_get_os_error or APR_FROM_OS_ERROR, the
     775 * results are undefined." We cannot know if this applies to any error
     776 * we might encounter.
    767777 */
    768778ssize_t mgs_transport_read(gnutls_transport_ptr_t ptr,
     
    782792    if (!ctxt->input_bb) {
    783793        ctxt->input_rc = APR_EOF;
     794        gnutls_transport_set_errno(ctxt->session, ECONNABORTED);
    784795        return -1;
    785796    }
     
    813824            apr_brigade_cleanup(ctxt->input_bb);
    814825            ctxt->input_bb = NULL;
     826            gnutls_transport_set_errno(ctxt->session, EIO);
    815827            return -1;
    816828        }
     
    850862    }
    851863
     864    gnutls_transport_set_errno(ctxt->session, EIO);
    852865    return -1;
    853866}
    854867
     868/**
     869 * Push function for GnuTLS
     870 *
     871 * In case of unexpected errors gnutls_transport_set_errno is called
     872 * with EIO.  The reason we are not using APR_TO_OS_ERROR to map
     873 * apr_status_t to errnos is this warning in the APR documentation:
     874 * "If the statcode was not created by apr_get_os_error or
     875 * APR_FROM_OS_ERROR, the results are undefined." We cannot know if
     876 * this applies to any error we might encounter.
     877 */
    855878ssize_t mgs_transport_write(gnutls_transport_ptr_t ptr,
    856879        const void *buffer, size_t len) {
Note: See TracChangeset for help on using the changeset viewer.