/*
* Globals...
*/
-
-static const char *auth_info_required;
- /* New auth-info-required value */
#if defined(HAVE_GSSAPI) && defined(HAVE_XPC)
static pid_t child_pid = 0; /* Child process ID */
#endif /* HAVE_GSSAPI && HAVE_XPC */
validate_retried = 0, /* Was Validate-Job request retried? */
copies, /* Number of copies for job */
copies_remaining; /* Number of copies remaining */
- const char *content_type, /* CONTENT_TYPE environment variable */
+ const char *auth_info_required, /* New auth-info-required value */
+ *content_type, /* CONTENT_TYPE environment variable */
*final_content_type, /* FINAL_CONTENT_TYPE environment var */
*document_format; /* document-format value */
int fd; /* File descriptor */
if (!getuid() && (value = getenv("AUTH_UID")) != NULL)
{
- uid_t uid = (uid_t)atoi(value);
+ uid_t uid = (uid_t)strtoul(value, NULL, 10);
/* User ID */
# ifdef HAVE_XPC
- if (uid > 0)
+ if (uid)
{
if (argc == 6)
return (run_as_user(argv, uid, device_uri, 0));
}
# else /* No XPC, just try to run as the user ID */
- if (uid > 0)
+ if (uid)
setuid(uid);
# endif /* HAVE_XPC */
}
#endif /* HAVE_LIBZ */
else if (!_cups_strcasecmp(name, "contimeout"))
{
+ int value_int = atoi(value);
/*
* Set the connection timeout...
*/
- if (atoi(value) > 0)
- contimeout = atoi(value);
+ if (value_int > 0)
+ contimeout = value_int;
}
else
{
if (job_canceled)
return (CUPS_BACKEND_OK);
- else if (!http)
- return (CUPS_BACKEND_FAILED);
if (httpIsEncrypted(http))
{
* the printer...
*/
- for (i = 0; i < (int)(sizeof(hashes) / sizeof(hashes[0])); i ++)
- if (ippContainsString(encryption_sup, hashes[i]))
+ size_t j;
+ for (j = 0; j < (sizeof(hashes) / sizeof(hashes[0])); j ++)
+ if (ippContainsString(encryption_sup, hashes[j]))
+ {
+ num_options = cupsAddOption("job-password-encryption", hashes[j], num_options, &options);
break;
-
- if (i < (int)(sizeof(hashes) / sizeof(hashes[0])))
- num_options = cupsAddOption("job-password-encryption", hashes[i], num_options, &options);
+ }
}
}
}
* Remember that we need to authenticate...
*/
- auth_info_required = "username,password";
-
if (httpGetSubField(http, HTTP_FIELD_WWW_AUTHENTICATE, "username",
def_username))
{
int fd) /* I - File to print */
{
const char *auth_negotiate,/* AUTH_NEGOTIATE env var */
- *content_type; /* [FINAL_]CONTENT_TYPE env vars */
+ *content_type, /* [FINAL_]CONTENT_TYPE env vars */
+ *auth_info_required; /* New auth-info-required value */
xpc_connection_t conn; /* Connection to XPC service */
xpc_object_t request; /* Request message dictionary */
__block xpc_object_t response; /* Response message dictionary */
xpc_dictionary_set_string(request, "title", argv[3]);
xpc_dictionary_set_string(request, "copies", argv[4]);
xpc_dictionary_set_string(request, "options", argv[5]);
- xpc_dictionary_set_string(request, "auth-info-required",
- getenv("AUTH_INFO_REQUIRED"));
+ if ((auth_info_required = getenv("AUTH_INFO_REQUIRED")) != NULL)
+ xpc_dictionary_set_string(request, "auth-info-required",
+ auth_info_required);
if ((auth_negotiate = getenv("AUTH_NEGOTIATE")) != NULL)
xpc_dictionary_set_string(request, "auth-negotiate", auth_negotiate);
if ((content_type = getenv("CONTENT_TYPE")) != NULL)
*options, /* Pointer to options */
*name, /* Name of option */
*value, /* Value of option */
- sep, /* Separator character */
- *filename, /* File to print */
+ sep, /* Separator character */
title[256]; /* Title string */
int port; /* Port number */
http_addrlist_t *addrlist; /* List of addresses for printer */
* Stream from stdin...
*/
- filename = NULL;
fd = 0;
}
else
{
- filename = argv[6];
- fd = open(filename, O_RDONLY);
+ fd = open(argv[6], O_RDONLY);
if (fd == -1)
{
switch (leftcount)
{
case 0 :
- b = (unsigned)((((((data[0] << 8) | data[1]) << 8) | data[2]) << 8) | data[3]);
+ b = (unsigned)((data[0] << 24) | (data[1] << 16) | (data[2] << 8) | data[3]);
break;
case 1 :
- b = (unsigned)((((((leftdata[0] << 8) | data[0]) << 8) | data[1]) << 8) | data[2]);
+ b = (unsigned)((leftdata[0] << 24) | (data[0] << 16) | (data[1] << 8) | data[2]);
break;
case 2 :
- b = (unsigned)((((((leftdata[0] << 8) | leftdata[1]) << 8) | data[0]) << 8) | data[1]);
+ b = (unsigned)((leftdata[0] << 24) | (leftdata[1] << 16) | (data[0] << 8) | data[1]);
break;
case 3 :
- b = (unsigned)((((((leftdata[0] << 8) | leftdata[1]) << 8) | leftdata[2]) << 8) | data[0]);
+ b = (unsigned)((leftdata[0] << 24) | (leftdata[1] << 16) | (leftdata[2] << 8) | data[0]);
break;
}
}
else
{
- c[4] = (b % 85) + '!';
+ c[4] = (unsigned char) ((b % 85) + '!');
b /= 85;
- c[3] = (b % 85) + '!';
+ c[3] = (unsigned char) ((b % 85) + '!');
b /= 85;
- c[2] = (b % 85) + '!';
+ c[2] = (unsigned char) ((b % 85) + '!');
b /= 85;
- c[1] = (b % 85) + '!';
+ c[1] = (unsigned char) ((b % 85) + '!');
b /= 85;
c[0] = (unsigned char)(b + '!');
if (leftcount > 0)
{
// Write the remaining bytes as needed...
- b = (unsigned)((((((leftdata[0] << 8) | leftdata[1]) << 8) | leftdata[2]) << 8) | leftdata[3]);
+ b = (unsigned)((leftdata[0] << 24) | (leftdata[1] << 16) | (leftdata[2] << 8) | leftdata[3]);
- c[4] = (b % 85) + '!';
+ c[4] = (unsigned char) ((b % 85) + '!');
b /= 85;
- c[3] = (b % 85) + '!';
+ c[3] = (unsigned char) ((b % 85) + '!');
b /= 85;
- c[2] = (b % 85) + '!';
+ c[2] = (unsigned char) ((b % 85) + '!');
b /= 85;
- c[1] = (b % 85) + '!';
+ c[1] = (unsigned char) ((b % 85) + '!');
b /= 85;
c[0] = (unsigned char)(b + '!');
if (value)
{
char *ptr; /* Pointer into value */
- int fin; /* Current value */
+ long fin; /* Current value */
for (fin = strtol(value, &ptr, 10); fin > 0; fin = strtol(ptr + 1, &ptr, 10))
{
int copy; /* Current copy */
int width = 0, /* Width */
height = 0, /* Height */
- depth = 0, /* Number of colors */
- length; /* Length of marker */
+ depth = 0; /* Number of colors */
+ ssize_t length; /* Length of marker */
unsigned char buffer[65536], /* Copy buffer */
*bufptr, /* Pointer info buffer */
*bufend; /* End of buffer */
bufend += bytes;
}
- length = (size_t)((bufptr[1] << 8) | bufptr[2]);
+ length = (ssize_t)((bufptr[1] << 8) | bufptr[2]);
if ((*bufptr >= 0xc0 && *bufptr <= 0xc3) || (*bufptr >= 0xc5 && *bufptr <= 0xc7) || (*bufptr >= 0xc9 && *bufptr <= 0xcb) || (*bufptr >= 0xcd && *bufptr <= 0xcf))
{
first_page, /* First page */
last_page; /* Last page */
const char *page_ranges; /* page-ranges option */
- long first_pos = -1; /* Offset for first page */
+ long first_pos; /* Offset for first page */
char line[1024]; /* Line from file */
break;
}
- fprintf(stderr, "DEBUG: y=%d at end...\n", y);
+ fprintf(stderr, "DEBUG: y=%u at end...\n", y);
puts("grestore grestore");
puts("showpage");