diff -Naur cups.orig/scheduler/client.c cups.new/scheduler/client.c --- cups.orig/scheduler/client.c 2007-11-08 16:36:45 +0300 +++ cups.new/scheduler/client.c 2007-11-08 17:08:32 +0300 @@ -110,6 +110,28 @@ struct stat *filestats); +void +_cupsdFixClientsBIO(void) +{ +#ifdef HAVE_LIBSSL + cupsd_client_t *c; + BIO *bio; + cupsArraySave (Clients); + for (c = (cupsd_client_t *)cupsArrayFirst(Clients); + c; + c = (cupsd_client_t *)cupsArrayNext(Clients)) + { + if (c->http.tls) + { + bio = SSL_get_wbio(c->http.tls); + BIO_ctrl(bio, BIO_C_SET_FILE_PTR, 0, (char *)HTTP(c)); + } + } + cupsArrayRestore (Clients); +#endif +} + + /* * 'cupsdAcceptClient()' - Accept a new client. */ @@ -392,6 +414,7 @@ } cupsArrayAdd(Clients, con); + _cupsdFixClientsBIO(); cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdAcceptClient: %d connected to server on %s:%d", @@ -684,6 +707,7 @@ */ cupsArrayRemove(Clients, con); + _cupsdFixClientsBIO(); free(con); } diff -Naur cups.orig/scheduler/main.c cups.new/scheduler/main.c --- cups.orig/scheduler/main.c 2007-11-08 16:36:45 +0300 +++ cups.new/scheduler/main.c 2007-11-08 17:07:35 +0300 @@ -920,7 +920,7 @@ * Write data as needed... */ - if (con->pipe_pid && FD_ISSET(con->file, input)) + if (con->pipe_pid && con->file >= 0 && FD_ISSET(con->file, input)) { /* * Keep track of pending input from the file/pipe separately