]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:printing: Use httpConnect2 from CUPS
authorAndreas Schneider <asn@samba.org>
Wed, 20 Nov 2019 10:27:10 +0000 (11:27 +0100)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 22 Nov 2019 19:54:55 +0000 (19:54 +0000)
This fixes deprecation warnings.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri Nov 22 19:54:55 UTC 2019 on sn-devel-184

source3/printing/print_cups.c
source3/printing/print_iprint.c
source3/wscript

index 738307f47b4cfef1a3bf2361bc601010220ea0e2..c4704cc5831baf0adde3387584bbefd8a5f00a32 100644 (file)
@@ -143,7 +143,18 @@ static http_t *cups_connect(TALLOC_CTX *frame)
                 alarm(timeout);
         }
 
-#ifdef HAVE_HTTPCONNECTENCRYPT
+#if defined(HAVE_HTTPCONNECT2)
+       http = httpConnect2(server,
+                           port,
+                           NULL,
+                           AF_UNSPEC,
+                           lp_cups_encrypt() ?
+                               HTTP_ENCRYPTION_ALWAYS :
+                               HTTP_ENCRYPTION_IF_REQUESTED,
+                           1, /* blocking */
+                           30 * 1000, /* timeout */
+                           NULL);
+#elif defined(HAVE_HTTPCONNECTENCRYPT)
        http = httpConnectEncrypt(server, port, lp_cups_encrypt());
 #else
        http = httpConnect(server, port);
index 1c9e5a25922780993bf10a0f1fc5c112e7df4c3f..e57d111acd04b5860beea7da5c05e411e03ad342 100644 (file)
@@ -375,7 +375,19 @@ bool iprint_cache_reload(struct pcap_cache **_pcache)
        * Try to connect to the server...
        */
 
-       if ((http = httpConnect(iprint_server(), ippPort())) == NULL) {
+#ifdef HAVE_HTTPCONNECT2
+       http = httpConnect2(iprint_server(),
+                           ippPort(),
+                           NULL,
+                           AF_UNSPEC,
+                           HTTP_ENCRYPTION_NEVER,
+                           1, /* blocking */
+                           30 * 1000, /* timeout */
+                           NULL);
+#else
+       http = httpConnect(iprint_server(), ippPort());
+#endif
+       if (http == NULL) {
                DEBUG(0,("Unable to connect to iPrint server %s - %s\n", 
                         iprint_server(), strerror(errno)));
                goto out;
@@ -495,7 +507,19 @@ static int iprint_job_delete(const char *sharename, const char *lprm_command, st
        * Try to connect to the server...
        */
 
-       if ((http = httpConnect(iprint_server(), ippPort())) == NULL) {
+#ifdef HAVE_HTTPCONNECT2
+       http = httpConnect2(iprint_server(),
+                           ippPort(),
+                           NULL,
+                           AF_UNSPEC,
+                           HTTP_ENCRYPTION_NEVER,
+                           1, /* blocking */
+                           30 * 1000, /* timeout */
+                           NULL);
+#else
+       http = httpConnect(iprint_server(), ippPort());
+#endif
+       if (http == NULL) {
                DEBUG(0,("Unable to connect to iPrint server %s - %s\n", 
                         iprint_server(), strerror(errno)));
                goto out;
@@ -593,7 +617,19 @@ static int iprint_job_pause(int snum, struct printjob *pjob)
        * Try to connect to the server...
        */
 
-       if ((http = httpConnect(iprint_server(), ippPort())) == NULL) {
+#ifdef HAVE_HTTPCONNECT2
+       http = httpConnect2(iprint_server(),
+                           ippPort(),
+                           NULL,
+                           AF_UNSPEC,
+                           HTTP_ENCRYPTION_NEVER,
+                           1, /* blocking */
+                           30 * 1000, /* timeout */
+                           NULL);
+#else
+       http = httpConnect(iprint_server(), ippPort());
+#endif
+       if (http == NULL) {
                DEBUG(0,("Unable to connect to iPrint server %s - %s\n", 
                         iprint_server(), strerror(errno)));
                goto out;
@@ -693,7 +729,19 @@ static int iprint_job_resume(int snum, struct printjob *pjob)
        * Try to connect to the server...
        */
 
-       if ((http = httpConnect(iprint_server(), ippPort())) == NULL) {
+#ifdef HAVE_HTTPCONNECT2
+       http = httpConnect2(iprint_server(),
+                           ippPort(),
+                           NULL,
+                           AF_UNSPEC,
+                           HTTP_ENCRYPTION_NEVER,
+                           1, /* blocking */
+                           30 * 1000, /* timeout */
+                           NULL);
+#else
+       http = httpConnect(iprint_server(), ippPort());
+#endif
+       if (http == NULL) {
                DEBUG(0,("Unable to connect to iPrint server %s - %s\n", 
                         iprint_server(), strerror(errno)));
                goto out;
@@ -794,7 +842,19 @@ static int iprint_job_submit(int snum, struct printjob *pjob,
        * Try to connect to the server...
        */
 
-       if ((http = httpConnect(iprint_server(), ippPort())) == NULL) {
+#ifdef HAVE_HTTPCONNECT2
+       http = httpConnect2(iprint_server(),
+                           ippPort(),
+                           NULL,
+                           AF_UNSPEC,
+                           HTTP_ENCRYPTION_NEVER,
+                           1, /* blocking */
+                           30 * 1000, /* timeout */
+                           NULL);
+#else
+       http = httpConnect(iprint_server(), ippPort());
+#endif
+       if (http == NULL) {
                DEBUG(0,("Unable to connect to iPrint server %s - %s\n", 
                         iprint_server(), strerror(errno)));
                goto out;
@@ -959,7 +1019,19 @@ static int iprint_queue_get(const char *sharename,
        * Try to connect to the server...
        */
 
-       if ((http = httpConnect(iprint_server(), ippPort())) == NULL) {
+#ifdef HAVE_HTTPCONNECT2
+       http = httpConnect2(iprint_server(),
+                           ippPort(),
+                           NULL,
+                           AF_UNSPEC,
+                           HTTP_ENCRYPTION_NEVER,
+                           1, /* blocking */
+                           30 * 1000, /* timeout */
+                           NULL);
+#else
+       http = httpConnect(iprint_server(), ippPort());
+#endif
+       if (http == NULL) {
                DEBUG(0,("Unable to connect to iPrint server %s - %s\n", 
                         iprint_server(), strerror(errno)));
                goto out;
index 28f43fa72b953a24c09d8d19b01f51931e6fbcf6..f3d0c7d7f34594ea775a67832a8be6ade7ec662b 100644 (file)
@@ -650,7 +650,7 @@ msg.msg_accrightslen = sizeof(fd);
             conf.CHECK_CFG(path=conf.env.CUPS_CONFIG, args="--cflags --ldflags",
                            package="", uselib_store="CUPS")
         conf.CHECK_HEADERS('cups/cups.h cups/language.h', lib='cups')
-        conf.CHECK_FUNCS_IN('httpConnect httpConnectEncrypt', 'cups')
+        conf.CHECK_FUNCS_IN('httpConnect httpConnect2 httpConnectEncrypt', 'cups')
         if conf.CONFIG_SET('HAVE_CUPS_CUPS_H') and conf.CONFIG_SET('HAVE_CUPS_LANGUAGE_H'):
             conf.DEFINE('HAVE_CUPS', '1')
         else: