From: Andreas Schneider Date: Wed, 20 Nov 2019 10:27:10 +0000 (+0100) Subject: s3:printing: Use httpConnect2 from CUPS X-Git-Tag: ldb-2.1.0~641 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e7f0e858e00a76976c3d84c8808e9296254b42a5;p=thirdparty%2Fsamba.git s3:printing: Use httpConnect2 from CUPS This fixes deprecation warnings. Signed-off-by: Andreas Schneider Reviewed-by: Andrew Bartlett Autobuild-User(master): Andrew Bartlett Autobuild-Date(master): Fri Nov 22 19:54:55 UTC 2019 on sn-devel-184 --- diff --git a/source3/printing/print_cups.c b/source3/printing/print_cups.c index 738307f47b4..c4704cc5831 100644 --- a/source3/printing/print_cups.c +++ b/source3/printing/print_cups.c @@ -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); diff --git a/source3/printing/print_iprint.c b/source3/printing/print_iprint.c index 1c9e5a25922..e57d111acd0 100644 --- a/source3/printing/print_iprint.c +++ b/source3/printing/print_iprint.c @@ -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; diff --git a/source3/wscript b/source3/wscript index 28f43fa72b9..f3d0c7d7f34 100644 --- a/source3/wscript +++ b/source3/wscript @@ -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: