/*
- * "$Id: client.c 5491 2006-05-04 20:53:35Z mike $"
+ * "$Id: client.c 5630 2006-06-05 18:42:53Z mike $"
*
* Client routines for the Common UNIX Printing System (CUPS) scheduler.
*
#ifdef HAVE_CDSASSL
# include <Security/Security.h>
+# ifdef HAVE_SECBASEPRIV_H
+# include <Security/SecBasePriv.h>
+# else
+ extern const char *cssmErrorString(int error);
+# endif /* HAVE_SECBASEPRIV_H */
#endif /* HAVE_CDSASSL */
#ifdef HAVE_GNUTLS
# include <gnutls/x509.h>
cupsdLogMessage(CUPSD_LOG_DEBUG2,
"cupsdReadClient: %d command=\"%s\", "
"options = \"%s\"",
- con->http.fd, con->command, con->options);
+ con->http.fd, con->command,
+ con->options ? con->options : "(null)");
if (con->http.version <= HTTP_1_0)
con->http.keep_alive = HTTP_KEEPALIVE_OFF;
if (con->filename)
+ {
fd = open(con->filename, O_RDONLY);
- else
- fd = open("/dev/null", O_RDONLY);
- if (fd < 0)
- {
- cupsdLogMessage(CUPSD_LOG_ERROR,
- "cupsdSendCommand: %d Unable to open \"%s\" for reading: %s",
- con->http.fd, con->filename ? con->filename : "/dev/null",
- strerror(errno));
- return (0);
- }
+ if (fd < 0)
+ {
+ cupsdLogMessage(CUPSD_LOG_ERROR,
+ "cupsdSendCommand: %d Unable to open \"%s\" for reading: %s",
+ con->http.fd, con->filename ? con->filename : "/dev/null",
+ strerror(errno));
+ return (0);
+ }
- fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC);
+ fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC);
+ }
+ else
+ fd = -1;
con->pipe_pid = pipe_command(con, fd, &(con->file), command, options, root);
- close(fd);
+ if (fd >= 0)
+ close(fd);
cupsdLogMessage(CUPSD_LOG_INFO, "Started \"%s\" (pid=%d)", command,
con->pipe_pid);
error = SSLSetIOFuncs(conn->session, _httpReadCDSA, _httpWriteCDSA);
if (!error)
- error = SSLSetProtocolVersion(conn->session, kSSLProtocol3);
+ error = SSLSetProtocolVersionEnabled(conn->session, kSSLProtocol2, false);
if (!error)
{
"encrypt_client: Unable to encrypt connection from %s!",
con->http.hostname);
- cupsdLogMessage(CUPSD_LOG_ERROR,
- "encrypt_client: CDSA error code is %d", (int)error);
+ cupsdLogMessage(CUPSD_LOG_ERROR, "encrypt_client: %s (%d)",
+ cssmErrorString(error), (int)error);
con->http.error = error;
con->http.status = HTTP_ERROR;
cupsdLogMessage(CUPSD_LOG_DEBUG2,
"pipe_command: command=\"%s\", options=\"%s\"",
- command, options);
+ command, options ? options : "(null)");
argv[0] = command;
query_string = NULL;
/*
- * End of "$Id: client.c 5491 2006-05-04 20:53:35Z mike $".
+ * End of "$Id: client.c 5630 2006-06-05 18:42:53Z mike $".
*/