Blame SOURCES/cups-str4476.patch

5e7041
diff -up cups-1.6.3/cups/http.c.str4476 cups-1.6.3/cups/http.c
5e7041
--- cups-1.6.3/cups/http.c.str4476	2013-06-07 02:12:52.000000000 +0100
5e7041
+++ cups-1.6.3/cups/http.c	2015-06-23 14:05:39.872805417 +0100
5e7041
@@ -175,6 +175,8 @@ static int		http_write_ssl(http_t *http,
5e7041
  * Local globals...
5e7041
  */
5e7041
 
5e7041
+static int		tls_options = 0; /* Options for TLS connections */
5e7041
+
5e7041
 static const char * const http_fields[] =
5e7041
 			{
5e7041
 			  "Accept-Language",
5e7041
@@ -3722,7 +3724,10 @@ http_send(http_t       *http,	/* I - Con
5e7041
   if (http->encryption == HTTP_ENCRYPT_REQUIRED && !http->tls)
5e7041
   {
5e7041
     httpSetField(http, HTTP_FIELD_CONNECTION, "Upgrade");
5e7041
-    httpSetField(http, HTTP_FIELD_UPGRADE, "TLS/1.0,SSL/2.0,SSL/3.0");
5e7041
+    if (tls_options & _HTTP_TLS_ALLOW_SSL3)
5e7041
+      httpSetField(http, HTTP_FIELD_UPGRADE, "TLS/1.1,TLS/1.0,SSL/3.0");
5e7041
+    else
5e7041
+      httpSetField(http, HTTP_FIELD_UPGRADE, "TLS/1.1,TLS/1.0");
5e7041
   }
5e7041
 #endif /* HAVE_SSL */
5e7041
 
5e7041
@@ -3959,6 +3964,10 @@ http_setup_ssl(http_t *http)		/* I - Con
5e7041
   context = SSL_CTX_new(SSLv23_client_method());
5e7041
 
5e7041
   SSL_CTX_set_options(context, SSL_OP_NO_SSLv2); /* Only use SSLv3 or TLS */
5e7041
+  if (!(tls_options & _HTTP_TLS_ALLOW_SSL3))
5e7041
+    SSL_CTX_set_options(context, SSL_OP_NO_SSLv3); /* Don't use SSLv3 */
5e7041
+  if (!(tls_options & _HTTP_TLS_ALLOW_RC4))
5e7041
+    SSL_CTX_set_cipher_list(context, "DEFAULT:-RC4");
5e7041
 
5e7041
   bio = BIO_new(_httpBIOMethods());
5e7041
   BIO_ctrl(bio, BIO_C_SET_FILE_PTR, 0, (char *)http);
5e7041
@@ -4018,7 +4027,16 @@ http_setup_ssl(http_t *http)		/* I - Con
5e7041
   gnutls_certificate_allocate_credentials(credentials);
5e7041
 
5e7041
   gnutls_init(&http->tls, GNUTLS_CLIENT);
5e7041
-  gnutls_set_default_priority(http->tls);
5e7041
+  if (!tls_options)
5e7041
+    gnutls_priority_set_direct(http->tls, "NORMAL:-ARCFOUR-128:-VERS-SSL3.0", NULL);
5e7041
+  else if ((tls_options & _HTTP_TLS_ALLOW_SSL3) &&
5e7041
+	   (tls_options & _HTTP_TLS_ALLOW_RC4))
5e7041
+    gnutls_priority_set_direct(http->tls, "NORMAL", NULL);
5e7041
+  else if (tls_options & _HTTP_TLS_ALLOW_SSL3)
5e7041
+    gnutls_priority_set_direct(http->tls, "NORMAL:-ARCFOUR-128", NULL);
5e7041
+  else
5e7041
+    gnutls_priority_set_direct(http->tls, "NORMAL:-VERS-SSL3.0", NULL);
5e7041
+
5e7041
   gnutls_server_name_set(http->tls, GNUTLS_NAME_DNS, hostname,
5e7041
                          strlen(hostname));
5e7041
   gnutls_credentials_set(http->tls, GNUTLS_CRD_CERTIFICATE, *credentials);
5e7041
@@ -4433,7 +4451,10 @@ http_upgrade(http_t *http)		/* I - Conne
5e7041
 
5e7041
   httpClearFields(http);
5e7041
   httpSetField(http, HTTP_FIELD_CONNECTION, "upgrade");
5e7041
-  httpSetField(http, HTTP_FIELD_UPGRADE, "TLS/1.2, TLS/1.1, TLS/1.0, SSL/3.0");
5e7041
+  if (tls_options & _HTTP_TLS_ALLOW_SSL3)
5e7041
+    httpSetField(http, HTTP_FIELD_UPGRADE, "TLS/1.2, TLS/1.1, TLS/1.0, SSL/3.0");
5e7041
+  else
5e7041
+    httpSetField(http, HTTP_FIELD_UPGRADE, "TLS/1.2, TLS/1.1, TLS/1.0");
5e7041
 
5e7041
   if ((ret = httpOptions(http, "*")) == 0)
5e7041
   {
5e7041
@@ -4764,6 +4785,16 @@ http_write_ssl(http_t     *http,	/* I -
5e7041
 }
5e7041
 #endif /* HAVE_SSL */
5e7041
 
5e7041
+/*
5e7041
+ * '_httpTLSSetOptions()' - Set TLS/SSL options.
5e7041
+ */
5e7041
+
5e7041
+void
5e7041
+_httpTLSSetOptions(int options)
5e7041
+{
5e7041
+  tls_options = options;
5e7041
+}
5e7041
+
5e7041
 
5e7041
 /*
5e7041
  * End of "$Id: http.c 7850 2008-08-20 00:07:25Z mike $".
5e7041
diff -up cups-1.6.3/cups/http-private.h.str4476 cups-1.6.3/cups/http-private.h
5e7041
--- cups-1.6.3/cups/http-private.h.str4476	2015-06-23 14:04:45.244230171 +0100
5e7041
+++ cups-1.6.3/cups/http-private.h	2015-06-23 14:05:39.873805409 +0100
5e7041
@@ -140,6 +140,10 @@ extern "C" {
5e7041
 #define _HTTP_RESOLVE_FQDN	2	/* Resolve to a FQDN */
5e7041
 #define _HTTP_RESOLVE_FAXOUT	4	/* Resolve FaxOut service? */
5e7041
 
5e7041
+/* care - these should be the same values as the CUPSD_SSL_* equivalents */
5e7041
+#define _HTTP_TLS_ALLOW_RC4	2
5e7041
+#define _HTTP_TLS_ALLOW_SSL3	4
5e7041
+
5e7041
 
5e7041
 /*
5e7041
  * Types and functions for SSL support...
5e7041
@@ -377,6 +381,8 @@ extern const char	*_httpResolveURI(const
5e7041
 extern int		_httpUpdate(http_t *http, http_status_t *status);
5e7041
 extern int		_httpWait(http_t *http, int msec, int usessl);
5e7041
 
5e7041
+extern void		_httpTLSSetOptions(int options);
5e7041
+
5e7041
 
5e7041
 /*
5e7041
  * C++ magic...
5e7041
diff -up cups-1.6.3/cups/usersys.c.str4476 cups-1.6.3/cups/usersys.c
5e7041
--- cups-1.6.3/cups/usersys.c.str4476	2015-06-23 14:04:45.268229986 +0100
5e7041
+++ cups-1.6.3/cups/usersys.c	2015-06-23 14:05:39.873805409 +0100
5e7041
@@ -72,7 +72,8 @@ static void	cups_read_client_conf(cups_f
5e7041
 #endif /* HAVE_GSSAPI */
5e7041
 				      const char *cups_anyroot,
5e7041
 				      const char *cups_expiredroot,
5e7041
-				      const char *cups_expiredcerts);
5e7041
+				      const char *cups_expiredcerts,
5e7041
+				      int ssl_options);
5e7041
 
5e7041
 
5e7041
 /*
5e7041
@@ -257,6 +258,9 @@ cupsSetEncryption(http_encryption_t e)	/
5e7041
   _cups_globals_t *cg = _cupsGlobals();	/* Pointer to library globals */
5e7041
 
5e7041
 
5e7041
+  if (cg->encryption == (http_encryption_t)-1)
5e7041
+    _cupsSetDefaults();
5e7041
+
5e7041
   cg->encryption = e;
5e7041
 
5e7041
   if (cg->http)
5e7041
@@ -823,7 +827,36 @@ _cupsSetDefaults(void)
5e7041
   if (cg->encryption == (http_encryption_t)-1 || !cg->server[0] ||
5e7041
       !cg->user[0] || !cg->ipp_port)
5e7041
   {
5e7041
+   /*
5e7041
+    * Look for CUPS_SERVERROOT/client.conf...
5e7041
+    */
5e7041
+
5e7041
+    snprintf(filename, sizeof(filename), "%s/client.conf",
5e7041
+	     cg->cups_serverroot);
5e7041
+    fp = cupsFileOpen(filename, "r");
5e7041
+
5e7041
+   /*
5e7041
+    * Read the configuration file and apply any environment variables; both
5e7041
+    * functions handle NULL cups_file_t pointers...
5e7041
+    */
5e7041
+
5e7041
+    cups_read_client_conf(fp, cg, cups_encryption, cups_server, cups_user,
5e7041
+#ifdef HAVE_GSSAPI
5e7041
+			  cups_gssservicename,
5e7041
+#endif /* HAVE_GSSAPI */
5e7041
+			  cups_anyroot, cups_expiredroot,
5e7041
+			  cups_expiredcerts, 1);
5e7041
+
5e7041
+   /*
5e7041
+    * Then user defaults, if it is safe to do so...
5e7041
+    */
5e7041
+
5e7041
+#ifdef HAVE_GETEUID
5e7041
+    if ((geteuid() == getuid() || !getuid()) && getegid() == getgid() &&
5e7041
+	(home = getenv("HOME")) != NULL)
5e7041
+#else
5e7041
     if ((home = getenv("HOME")) != NULL)
5e7041
+#endif
5e7041
     {
5e7041
      /*
5e7041
       * Look for ~/.cups/client.conf...
5e7041
@@ -831,33 +864,20 @@ _cupsSetDefaults(void)
5e7041
 
5e7041
       snprintf(filename, sizeof(filename), "%s/.cups/client.conf", home);
5e7041
       fp = cupsFileOpen(filename, "r");
5e7041
-    }
5e7041
-    else
5e7041
-      fp = NULL;
5e7041
 
5e7041
-    if (!fp)
5e7041
-    {
5e7041
      /*
5e7041
-      * Look for CUPS_SERVERROOT/client.conf...
5e7041
+      * Read the configuration file and apply any environment variables; both
5e7041
+      * functions handle NULL cups_file_t pointers...
5e7041
       */
5e7041
 
5e7041
-      snprintf(filename, sizeof(filename), "%s/client.conf",
5e7041
-               cg->cups_serverroot);
5e7041
-      fp = cupsFileOpen(filename, "r");
5e7041
-    }
5e7041
-
5e7041
-   /*
5e7041
-    * Read the configuration file and apply any environment variables; both
5e7041
-    * functions handle NULL cups_file_t pointers...
5e7041
-    */
5e7041
-
5e7041
-    cups_read_client_conf(fp, cg, cups_encryption, cups_server, cups_user,
5e7041
+      cups_read_client_conf(fp, cg, cups_encryption, cups_server, cups_user,
5e7041
 #ifdef HAVE_GSSAPI
5e7041
-			  cups_gssservicename,
5e7041
+			    cups_gssservicename,
5e7041
 #endif /* HAVE_GSSAPI */
5e7041
-			  cups_anyroot, cups_expiredroot,
5e7041
-			  cups_expiredcerts);
5e7041
-    cupsFileClose(fp);
5e7041
+			    cups_anyroot, cups_expiredroot,
5e7041
+			    cups_expiredcerts, 0);
5e7041
+      cupsFileClose(fp);
5e7041
+    }
5e7041
   }
5e7041
 }
5e7041
 
5e7041
@@ -879,7 +899,8 @@ cups_read_client_conf(
5e7041
 #endif /* HAVE_GSSAPI */
5e7041
     const char	    *cups_anyroot,	/* I - CUPS_ANYROOT env var */
5e7041
     const char	    *cups_expiredroot,	/* I - CUPS_EXPIREDROOT env var */
5e7041
-    const char	    *cups_expiredcerts)	/* I - CUPS_EXPIREDCERTS env var */
5e7041
+    const char	    *cups_expiredcerts,	/* I - CUPS_EXPIREDCERTS env var */
5e7041
+    int		     ssl_options)	/* I - Allow setting of SSLOptions? */
5e7041
 {
5e7041
   int	linenum;			/* Current line number */
5e7041
   char	line[1024],			/* Line from file */
5e7041
@@ -952,6 +973,43 @@ cups_read_client_conf(
5e7041
       cups_gssservicename = gss_service_name;
5e7041
     }
5e7041
 #endif /* HAVE_GSSAPI */
5e7041
+    else if (ssl_options && !_cups_strcasecmp(line, "SSLOptions") && value)
5e7041
+    {
5e7041
+     /*
5e7041
+      * SSLOptions [AllowRC4] [AllowSSL3] [None]
5e7041
+      */
5e7041
+
5e7041
+      int	options = 0;		/* SSL/TLS options */
5e7041
+      char	*start,			/* Start of option */
5e7041
+		*end;			/* End of option */
5e7041
+
5e7041
+      for (start = value; *start; start = end)
5e7041
+      {
5e7041
+       /*
5e7041
+	* Find end of keyword...
5e7041
+	*/
5e7041
+
5e7041
+	end = start;
5e7041
+	while (*end && !_cups_isspace(*end))
5e7041
+	  end++;
5e7041
+
5e7041
+	if (*end)
5e7041
+	  *end++ = '\0';
5e7041
+
5e7041
+       /*
5e7041
+	* Compare...
5e7041
+	*/
5e7041
+
5e7041
+	if (!_cups_strcasecmp(start, "AllowRC4"))
5e7041
+	  options |= _HTTP_TLS_ALLOW_RC4;
5e7041
+	else if (!_cups_strcasecmp(start, "AllowSSL3"))
5e7041
+	  options |= _HTTP_TLS_ALLOW_SSL3;
5e7041
+	else if (!_cups_strcasecmp(start, "None"))
5e7041
+	  options = 0;
5e7041
+      }
5e7041
+
5e7041
+      _httpTLSSetOptions(options);
5e7041
+    }
5e7041
   }
5e7041
 
5e7041
  /*
5e7041
diff -up cups-1.6.3/doc/help/ref-client-conf.html.str4476 cups-1.6.3/doc/help/ref-client-conf.html
5e7041
--- cups-1.6.3/doc/help/ref-client-conf.html.str4476	2013-06-25 15:38:12.000000000 +0100
5e7041
+++ cups-1.6.3/doc/help/ref-client-conf.html	2015-06-23 14:05:39.873805409 +0100
5e7041
@@ -76,6 +76,26 @@ present, only the last one is used. This
5e7041
 
5e7041
 
5e7041
 
5e7041
+

SSLOptions

5e7041
+
5e7041
+

Examples

5e7041
+
5e7041
+
5e7041
+SSLOptions None
5e7041
+SSLOptions AllowSSL3
5e7041
+SSLOptions AllowRC4
5e7041
+
5e7041
+
5e7041
+

Description

5e7041
+
5e7041
+

Sets encryption options (only in /etc/cups/client.conf). By

5e7041
+default, CUPS only supports encryption using TLS v1.0 or higher using
5e7041
+known secure cipher suites. The AllowRC4 option enables the
5e7041
+128-bit RC4 cipher suites, which are required for some older clients
5e7041
+that do not implement newer ones. The AllowSSL3 option enables
5e7041
+SSL v3.0, which is required for some older clients that do not support
5e7041
+TLS v1.0.

5e7041
+
5e7041
 

CUPS 1.6/OS X 10.8User

5e7041
 
5e7041
 

Examples

5e7041
diff -up cups-1.6.3/doc/help/ref-cupsd-conf.html.in.str4476 cups-1.6.3/doc/help/ref-cupsd-conf.html.in
5e7041
--- cups-1.6.3/doc/help/ref-cupsd-conf.html.in.str4476	2013-05-10 17:52:10.000000000 +0100
5e7041
+++ cups-1.6.3/doc/help/ref-cupsd-conf.html.in	2015-06-23 14:05:39.873805409 +0100
5e7041
@@ -2011,23 +2011,23 @@ SetEnv MY_ENV_VAR foo
5e7041
 variable that should be passed to child processes.

5e7041
 
5e7041
 
5e7041
-

SSLListen

5e7041
+

SSLOptions

5e7041
 
5e7041
 

Examples

5e7041
 
5e7041
 
5e7041
-SSLListen 127.0.0.1:443
5e7041
-SSLListen 192.0.2.1:443
5e7041
+SSLOptions 127.0.0.1:443
5e7041
+SSLOptions 192.0.2.1:443
5e7041
 
5e7041
 
5e7041
 

Description

5e7041
 
5e7041
-

The SSLListen directive specifies a network

5e7041
+

The SSLOptions directive specifies a network

5e7041
 address and port to listen for secure connections. Multiple
5e7041
-SSLListen directives can be provided to listen on
5e7041
+SSLOptions directives can be provided to listen on
5e7041
 multiple addresses.

5e7041
 
5e7041
-

The SSLListen directive is similar to the

5e7041
+

The SSLOptions directive is similar to the

5e7041
 HREF="#SSLPort">SSLPort directive but allows you
5e7041
 to restrict access to specific interfaces or networks.

5e7041
 
5e7041
@@ -2039,15 +2039,22 @@ to restrict access to specific interface
5e7041
 
5e7041
 SSLOptions None
5e7041
 SSLOptions NoEmptyFragments
5e7041
+SSLOptions AllowSSL3
5e7041
+SSLOptions AllowRC4
5e7041
 
5e7041
 
5e7041
 

Description

5e7041
 
5e7041
 

The SSLOptions directive specifies additional SSL/TLS

5e7041
-protocol options to use for encrypted connected. Currently only two
5e7041
-options are supported - None (the default) for the most
5e7041
-secure mode and NoEmptyFragments to allow CUPS to work with
5e7041
-Microsoft Windows with the FIPS conformance mode enabled.

5e7041
+protocol options to use for encrypted connected. By default, CUPS only
5e7041
+supports encryption using TLS v1.0 or higher using known secure cipher
5e7041
+suites. The NoEmptyFragments option allows CUPS to work
5e7041
+with Microsoft Windows with the FIPS conformance mode
5e7041
+enabled. The AllowRC4 option enables the 128-bit RC4
5e7041
+cipher suites, which are required for some older clients that do not
5e7041
+implement newer ones. The AllowSSL3 option enables SSL
5e7041
+v3.0, which is required for some older clients that do not support TLS
5e7041
+v1.0.

5e7041
 
5e7041
 
5e7041
 

SSLPort

5e7041
diff -up cups-1.6.3/man/client.conf.man.in.str4476 cups-1.6.3/man/client.conf.man.in
5e7041
--- cups-1.6.3/man/client.conf.man.in.str4476	2013-06-25 15:38:12.000000000 +0100
5e7041
+++ cups-1.6.3/man/client.conf.man.in	2015-06-23 14:05:39.874805401 +0100
5e7041
@@ -53,6 +53,15 @@ Specifies the address and optionally the
5e7041
 server running CUPS 1.3.12 and earlier. \fBNote: Not supported on OS X 10.7 or
5e7041
 later.\fR
5e7041
 .TP 5
5e7041
+SSLOptions \fR[\fIAllowRC4\fR] [\fIAllow SSL3\fR]
5e7041
+.br
5e7041
+Sets SSL/TLS protocol options for encrypted connections. By default,
5e7041
+CUPS only supports encryption using TLS v1.0 or higher using known
5e7041
+secure cipher suites. The \fIAllowRC4\fR option enables the 128-bit
5e7041
+RC4 cipher suites, which are required for some older clients that do
5e7041
+not implement newer ones. The \fIAllowSSL3\fR option enables SSL v3.0,
5e7041
+which is required for some older clients that do not support TLS v1.0.
5e7041
+.TP 5
5e7041
 User name
5e7041
 .br
5e7041
 Specifies the default user name to use for requests.
5e7041
diff -up cups-1.6.3/man/cupsd.conf.man.in.str4476 cups-1.6.3/man/cupsd.conf.man.in
5e7041
--- cups-1.6.3/man/cupsd.conf.man.in.str4476	2015-06-23 14:04:45.278229909 +0100
5e7041
+++ cups-1.6.3/man/cupsd.conf.man.in	2015-06-23 14:05:39.874805401 +0100
5e7041
@@ -480,9 +480,16 @@ Listens on the specified address and por
5e7041
 .TP 5
5e7041
 SSLOptions None
5e7041
 .TP 5
5e7041
-SSLOptions NoEmptyFragments
5e7041
+SSLOptions \fR[\fINoEmptyFragments\fR] [\fIAllowRC4\fR] [\fIAllow SSL3\fR]
5e7041
 .br
5e7041
-Sets SSL/TLS protocol options for encrypted connections.
5e7041
+Sets SSL/TLS protocol options for encrypted connections. By default,
5e7041
+CUPS only supports encryption using TLS v1.0 or higher using known
5e7041
+secure cipher suites. The \fINoEmptyFragments\fR option allows CUPS to
5e7041
+work with Microsoft Windows with the FIPS conformance mode
5e7041
+enabled. The \fIAllowRC4\fR option enables the 128-bit RC4 cipher
5e7041
+suites, which are required for some older clients that do not
5e7041
+implement newer ones. The \fIAllowSSL3\fR option enables SSL v3.0,
5e7041
+which is required for some older clients that do not support TLS v1.0.
5e7041
 .TP 5
5e7041
 SSLPort
5e7041
 .br
5e7041
diff -up cups-1.6.3/scheduler/conf.c.str4476 cups-1.6.3/scheduler/conf.c
5e7041
--- cups-1.6.3/scheduler/conf.c.str4476	2015-06-23 14:04:45.298229754 +0100
5e7041
+++ cups-1.6.3/scheduler/conf.c	2015-06-23 14:05:39.874805401 +0100
5e7041
@@ -3361,17 +3361,54 @@ read_cupsd_conf(cups_file_t *fp)	/* I -
5e7041
     else if (!_cups_strcasecmp(line, "SSLOptions"))
5e7041
     {
5e7041
      /*
5e7041
+      * SSLOptions [AllowRC4] [AllowSSL3] [NoEmptyFragments] [None]
5e7041
+      */
5e7041
+
5e7041
+      int	options = 0;	/* SSL/TLS options */
5e7041
+
5e7041
+     /*
5e7041
       * SSLOptions options
5e7041
       */
5e7041
 
5e7041
-      if (!value || !_cups_strcasecmp(value, "none"))
5e7041
-        SSLOptions = CUPSD_SSL_NONE;
5e7041
-      else if (!_cups_strcasecmp(value, "noemptyfragments"))
5e7041
-        SSLOptions = CUPSD_SSL_NOEMPTY;
5e7041
-      else
5e7041
-        cupsdLogMessage(CUPSD_LOG_ERROR,
5e7041
-	                "Unknown value \"%s\" for SSLOptions directive on "
5e7041
-			"line %d.", value, linenum);
5e7041
+      if (value)
5e7041
+      {
5e7041
+	char	*start,		/* Start of option */
5e7041
+		*end;		/* End of option */
5e7041
+
5e7041
+	for (start = value; *start; start = end)
5e7041
+	{
5e7041
+	 /*
5e7041
+	  * Find end of keyword...
5e7041
+	  */
5e7041
+
5e7041
+	  end = start;
5e7041
+	  while (*end && !_cups_isspace(*end))
5e7041
+	    end++;
5e7041
+
5e7041
+	  if (*end)
5e7041
+	    *end++ = '\0';
5e7041
+
5e7041
+	 /*
5e7041
+	  * Compare...
5e7041
+	  */
5e7041
+
5e7041
+	  if (!_cups_strcasecmp(start, "NoEmptyFragments"))
5e7041
+	    options |= CUPSD_SSL_NOEMPTY;
5e7041
+	  else if (!_cups_strcasecmp(start, "AllowRC4"))
5e7041
+	    options |= CUPSD_SSL_ALLOW_RC4;
5e7041
+	  else if (!_cups_strcasecmp(start, "AllowSSL3"))
5e7041
+	    options |= CUPSD_SSL_ALLOW_SSL3;
5e7041
+	  else if (!_cups_strcasecmp(start, "None"))
5e7041
+	    options = 0;
5e7041
+	  else
5e7041
+	    cupsdLogMessage(CUPSD_LOG_ERROR,
5e7041
+			    "Unknown value \"%s\" for SSLOptions directive on "
5e7041
+			    "line %d.", start, linenum);
5e7041
+	}
5e7041
+      }
5e7041
+
5e7041
+      SSLOptions = options;
5e7041
+      _httpTLSSetOptions (SSLOptions & ~CUPSD_SSL_NOEMPTY);
5e7041
     }
5e7041
 #endif /* HAVE_SSL */
5e7041
     else if (!_cups_strcasecmp(line, "AccessLog") ||
5e7041
diff -up cups-1.6.3/scheduler/conf.h.str4476 cups-1.6.3/scheduler/conf.h
5e7041
--- cups-1.6.3/scheduler/conf.h.str4476	2015-06-23 14:04:45.298229754 +0100
5e7041
+++ cups-1.6.3/scheduler/conf.h	2015-06-23 14:05:39.874805401 +0100
5e7041
@@ -78,6 +78,8 @@ typedef enum
5e7041
 
5e7041
 #define CUPSD_SSL_NONE		0	/* No special options */
5e7041
 #define CUPSD_SSL_NOEMPTY	1	/* Do not insert empty fragments */
5e7041
+#define CUPSD_SSL_ALLOW_RC4	2	/* Allow RC4 cipher suites */
5e7041
+#define CUPSD_SSL_ALLOW_SSL3	4	/* Allow SSL 3.0 */
5e7041
 
5e7041
 
5e7041
 /*
5e7041
diff -up cups-1.6.3/scheduler/tls-gnutls.c.str4476 cups-1.6.3/scheduler/tls-gnutls.c
5e7041
--- cups-1.6.3/scheduler/tls-gnutls.c.str4476	2013-06-07 02:12:52.000000000 +0100
5e7041
+++ cups-1.6.3/scheduler/tls-gnutls.c	2015-06-23 14:05:39.874805401 +0100
5e7041
@@ -114,7 +114,15 @@ cupsdStartTLS(cupsd_client_t *con)	/* I
5e7041
 				       ServerKey, GNUTLS_X509_FMT_PEM);
5e7041
 
5e7041
   gnutls_init(&con->http.tls, GNUTLS_SERVER);
5e7041
-  gnutls_set_default_priority(con->http.tls);
5e7041
+  if (!SSLOptions)
5e7041
+    gnutls_priority_set_direct(con->http.tls, "NORMAL:-ARCFOUR-128:-VERS-SSL3.0", NULL);
5e7041
+  else if ((SSLOptions & CUPSD_SSL_ALLOW_SSL3) &&
5e7041
+	   (SSLOptions & CUPSD_SSL_ALLOW_RC4))
5e7041
+    gnutls_priority_set_direct(con->http.tls, "NORMAL", NULL);
5e7041
+  else if (SSLOptions & CUPSD_SSL_ALLOW_SSL3)
5e7041
+    gnutls_priority_set_direct(con->http.tls, "NORMAL:-ARCFOUR-128", NULL);
5e7041
+  else
5e7041
+    gnutls_priority_set_direct(con->http.tls, "NORMAL:-VERS-SSL3.0", NULL);
5e7041
 
5e7041
   gnutls_credentials_set(con->http.tls, GNUTLS_CRD_CERTIFICATE, *credentials);
5e7041
   gnutls_transport_set_ptr(con->http.tls, (gnutls_transport_ptr)HTTP(con));
5e7041
diff -up cups-1.6.3/scheduler/tls-openssl.c.str4476 cups-1.6.3/scheduler/tls-openssl.c
5e7041
--- cups-1.6.3/scheduler/tls-openssl.c.str4476	2013-06-07 02:12:52.000000000 +0100
5e7041
+++ cups-1.6.3/scheduler/tls-openssl.c	2015-06-23 14:05:39.875805393 +0100
5e7041
@@ -107,6 +107,10 @@ cupsdStartTLS(cupsd_client_t *con)	/* I
5e7041
   SSL_CTX_set_options(context, SSL_OP_NO_SSLv2); /* Only use SSLv3 or TLS */
5e7041
   if (SSLOptions & CUPSD_SSL_NOEMPTY)
5e7041
     SSL_CTX_set_options(context, SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS);
5e7041
+  if (!(SSLOptions & CUPSD_SSL_ALLOW_SSL3))
5e7041
+    SSL_CTX_set_options(context, SSL_OP_NO_SSLv3); /* Don't use SSLv3 */
5e7041
+  if (!(SSLOptions & CUPSD_SSL_ALLOW_RC4))
5e7041
+    SSL_CTX_set_cipher_list(context, "DEFAULT:-RC4");
5e7041
   SSL_CTX_use_PrivateKey_file(context, ServerKey, SSL_FILETYPE_PEM);
5e7041
   SSL_CTX_use_certificate_chain_file(context, ServerCertificate);
5e7041