pull/16/head
Michele Calgaro 10 years ago
commit 95aebc56c0

@ -33,7 +33,7 @@ cupsGetConf(void)
char prompt[1024]; /* Prompt string */ char prompt[1024]; /* Prompt string */
int digest_tries; /* Number of tries with Digest */ int digest_tries; /* Number of tries with Digest */
static char filename[HTTP_MAX_URI]; /* Local filename */ static char filename[HTTP_MAX_URI]; /* Local filename */
#if CUPS_VERSION_MAJOR - 0 <= 1 && CUPS_VERSION_MINOR - 0 < 2 #if CUPS_VERSION_MAJOR < 1 || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR < 2)
const char *fqdn = 0; const char *fqdn = 0;
#else #else
char fqdn[ HTTP_MAX_URI ]; /* Server name buffer */ char fqdn[ HTTP_MAX_URI ]; /* Server name buffer */
@ -119,7 +119,7 @@ cupsGetConf(void)
* See if we should retry the current digest password... * See if we should retry the current digest password...
*/ */
#if CUPS_VERSION_MAJOR - 0 <= 1 && CUPS_VERSION_MINOR - 0 < 2 #if CUPS_VERSION_MAJOR < 1 || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR < 2)
www_authenticate = cups_server->fields[HTTP_FIELD_WWW_AUTHENTICATE]; www_authenticate = cups_server->fields[HTTP_FIELD_WWW_AUTHENTICATE];
#else #else
www_authenticate = httpGetField( cups_server, HTTP_FIELD_WWW_AUTHENTICATE ); www_authenticate = httpGetField( cups_server, HTTP_FIELD_WWW_AUTHENTICATE );
@ -130,7 +130,7 @@ cupsGetConf(void)
/* /*
* Nope - get a password from the user... * Nope - get a password from the user...
*/ */
#if CUPS_VERSION_MAJOR - 0 <= 1 && CUPS_VERSION_MINOR - 0 < 2 #if CUPS_VERSION_MAJOR < 1 || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR < 2)
fqdn = cups_server->hostname; fqdn = cups_server->hostname;
#else #else
httpGetHostname( cups_server, fqdn, sizeof( fqdn ) ); httpGetHostname( cups_server, fqdn, sizeof( fqdn ) );
@ -155,7 +155,7 @@ cupsGetConf(void)
* Got a password; encode it for the server... * Got a password; encode it for the server...
*/ */
#if CUPS_VERSION_MAJOR - 0 <= 1 && CUPS_VERSION_MINOR - 0 < 2 #if CUPS_VERSION_MAJOR < 1 || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR < 2)
www_authenticate = cups_server->fields[HTTP_FIELD_WWW_AUTHENTICATE]; www_authenticate = cups_server->fields[HTTP_FIELD_WWW_AUTHENTICATE];
#else #else
www_authenticate = httpGetField( cups_server, HTTP_FIELD_WWW_AUTHENTICATE ); www_authenticate = httpGetField( cups_server, HTTP_FIELD_WWW_AUTHENTICATE );
@ -167,7 +167,7 @@ cupsGetConf(void)
*/ */
snprintf(plain, sizeof(plain), "%s:%s", cupsUser(), pwdstring); snprintf(plain, sizeof(plain), "%s:%s", cupsUser(), pwdstring);
#if CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR >= 2 #if CUPS_VERSION_MAJOR > 1 || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR >= 2)
httpEncode64_2(encode, sizeof(encode), plain, sizeof(plain)); httpEncode64_2(encode, sizeof(encode), plain, sizeof(plain));
#else #else
httpEncode64(encode, plain); httpEncode64(encode, plain);
@ -236,7 +236,7 @@ cupsGetConf(void)
*/ */
while ((bytes = while ((bytes =
#if CUPS_VERSION_MAJOR - 0 <= 1 && CUPS_VERSION_MINOR - 0 < 2 #if CUPS_VERSION_MAJOR < 1 || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR < 2)
httpRead httpRead
#else #else
httpRead2 httpRead2
@ -266,7 +266,7 @@ cupsPutConf(const char *name) /* I - Name of the config file to send */
http_status_t status; /* HTTP status from server */ http_status_t status; /* HTTP status from server */
char prompt[1024]; /* Prompt string */ char prompt[1024]; /* Prompt string */
int digest_tries; /* Number of tries with Digest */ int digest_tries; /* Number of tries with Digest */
#if CUPS_VERSION_MAJOR - 0 <= 1 && CUPS_VERSION_MINOR - 0 < 2 #if CUPS_VERSION_MAJOR < 1 || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR < 2)
const char *fqdn = 0; const char *fqdn = 0;
#else #else
char fqdn[ HTTP_MAX_URI ]; /* Server name buffer */ char fqdn[ HTTP_MAX_URI ]; /* Server name buffer */
@ -341,7 +341,7 @@ cupsPutConf(const char *name) /* I - Name of the config file to send */
break; break;
} }
else else
#if CUPS_VERSION_MAJOR - 0 <= 1 && CUPS_VERSION_MINOR - 0 < 2 #if CUPS_VERSION_MAJOR < 1 || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR < 2)
httpWrite httpWrite
#else #else
httpWrite2 httpWrite2
@ -350,7 +350,7 @@ cupsPutConf(const char *name) /* I - Name of the config file to send */
if (status == HTTP_CONTINUE) if (status == HTTP_CONTINUE)
{ {
#if CUPS_VERSION_MAJOR - 0 <= 1 && CUPS_VERSION_MINOR - 0 < 2 #if CUPS_VERSION_MAJOR < 1 || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR < 2)
httpWrite httpWrite
#else #else
httpWrite2 httpWrite2
@ -381,7 +381,7 @@ cupsPutConf(const char *name) /* I - Name of the config file to send */
* See if we should retry the current digest password... * See if we should retry the current digest password...
*/ */
#if CUPS_VERSION_MAJOR - 0 <= 1 && CUPS_VERSION_MINOR - 0 < 2 #if CUPS_VERSION_MAJOR < 1 || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR < 2)
www_authenticate = cups_server->fields[HTTP_FIELD_WWW_AUTHENTICATE]; www_authenticate = cups_server->fields[HTTP_FIELD_WWW_AUTHENTICATE];
#else #else
www_authenticate = httpGetField( cups_server, HTTP_FIELD_WWW_AUTHENTICATE ); www_authenticate = httpGetField( cups_server, HTTP_FIELD_WWW_AUTHENTICATE );
@ -394,7 +394,7 @@ cupsPutConf(const char *name) /* I - Name of the config file to send */
*/ */
#if CUPS_VERSION_MAJOR - 0 <= 1 && CUPS_VERSION_MINOR - 0 < 2 #if CUPS_VERSION_MAJOR < 1 || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR < 2)
fqdn = cups_server->hostname; fqdn = cups_server->hostname;
#else #else
httpGetHostname( cups_server, fqdn, sizeof( fqdn ) ); httpGetHostname( cups_server, fqdn, sizeof( fqdn ) );
@ -418,7 +418,7 @@ cupsPutConf(const char *name) /* I - Name of the config file to send */
* Got a password; encode it for the server... * Got a password; encode it for the server...
*/ */
#if CUPS_VERSION_MAJOR - 0 <= 1 && CUPS_VERSION_MINOR - 0 < 2 #if CUPS_VERSION_MAJOR < 1 || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR < 2)
www_authenticate = cups_server->fields[HTTP_FIELD_WWW_AUTHENTICATE]; www_authenticate = cups_server->fields[HTTP_FIELD_WWW_AUTHENTICATE];
#else #else
www_authenticate = httpGetField( cups_server, HTTP_FIELD_WWW_AUTHENTICATE ); www_authenticate = httpGetField( cups_server, HTTP_FIELD_WWW_AUTHENTICATE );
@ -430,7 +430,7 @@ cupsPutConf(const char *name) /* I - Name of the config file to send */
*/ */
snprintf(plain, sizeof(plain), "%s:%s", cupsUser(), pwdstring); snprintf(plain, sizeof(plain), "%s:%s", cupsUser(), pwdstring);
#if CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR >= 2 #if CUPS_VERSION_MAJOR > 1 || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR >= 2)
httpEncode64_2(encode, sizeof(encode), plain, sizeof(plain)); httpEncode64_2(encode, sizeof(encode), plain, sizeof(plain));
#else #else
httpEncode64(encode, plain); httpEncode64(encode, plain);
@ -512,7 +512,7 @@ cups_local_auth(http_t *http) /* I - Connection */
* See if we are accessing localhost... * See if we are accessing localhost...
the struct has changed in newer versions - PiggZ (adam@piggz.co.uk) the struct has changed in newer versions - PiggZ (adam@piggz.co.uk)
*/ */
#if CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR >= 2 #if CUPS_VERSION_MAJOR > 1 || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR >= 2)
if (!httpAddrLocalhost(http)) if (!httpAddrLocalhost(http))
#else #else
if (ntohl(*(int*)&http->hostaddr.sin_addr) != 0x7f000001 && if (ntohl(*(int*)&http->hostaddr.sin_addr) != 0x7f000001 &&

@ -407,7 +407,7 @@ bool IppRequest::doFileRequest(const TQString& res, const TQString& filename)
} }
#ifdef HAVE_CUPS_NO_PWD_CACHE #ifdef HAVE_CUPS_NO_PWD_CACHE
#if CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR <= 2 #if CUPS_VERSION_MAJOR < 1 || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR < 2)
strncpy( HTTP->authstring, cups_authstring.data(), HTTP_MAX_VALUE ); strncpy( HTTP->authstring, cups_authstring.data(), HTTP_MAX_VALUE );
#else #else
httpSetAuthString( HTTP, NULL, cups_authstring.data() ); httpSetAuthString( HTTP, NULL, cups_authstring.data() );
@ -421,7 +421,7 @@ bool IppRequest::doFileRequest(const TQString& res, const TQString& filename)
request_ = cupsDoFileRequest(HTTP, request_, (res.isEmpty() ? "/" : res.latin1()), (filename.isEmpty() ? NULL : filename.latin1())); request_ = cupsDoFileRequest(HTTP, request_, (res.isEmpty() ? "/" : res.latin1()), (filename.isEmpty() ? NULL : filename.latin1()));
#ifdef HAVE_CUPS_NO_PWD_CACHE #ifdef HAVE_CUPS_NO_PWD_CACHE
#if CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR <= 2 #if CUPS_VERSION_MAJOR < 1 || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR < 2)
cups_authstring = HTTP->authstring; cups_authstring = HTTP->authstring;
#else #else
cups_authstring = httpGetAuthString( HTTP ); cups_authstring = httpGetAuthString( HTTP );
@ -757,7 +757,7 @@ void IppRequest::setMap(const TQMap<TQString,TQString>& opts)
cupsFreeOptions(n, options); cupsFreeOptions(n, options);
// find an remove that annoying "document-format" attribute // find an remove that annoying "document-format" attribute
#if CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR >= 2 #if CUPS_VERSION_MAJOR > 1 || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR >= 2)
ipp_attribute_t *attr = ippFindAttribute(request_, "document-format", IPP_TAG_NAME); ipp_attribute_t *attr = ippFindAttribute(request_, "document-format", IPP_TAG_NAME);
ippDeleteAttribute(request_, attr); ippDeleteAttribute(request_, attr);
#else #else

Loading…
Cancel
Save