/*
* Destination option/media support for CUPS.
*
- * Copyright 2012-2018 by Apple Inc.
+ * Copyright © 2012-2018 by Apple Inc.
*
- * Licensed under Apache License v2.0. See the file "LICENSE" for more information.
+ * Licensed under Apache License v2.0. See the file "LICENSE" for more
+ * information.
*/
/*
*/
#include "cups-private.h"
+#include "debug-internal.h"
/*
if (!http)
{
+ DEBUG_puts("1cupsCopyDestInfo: Default server connection.");
http = _cupsConnect();
dflags = CUPS_DEST_FLAGS_NONE;
}
#ifdef AF_LOCAL
- else if (strcmp(http->hostname, cg->server) || (httpAddrFamily(http->hostaddr) != AF_LOCAL && cg->ipp_port != httpAddrPort(http->hostaddr)))
-#else
- else if (strcmp(http->hostname, cg->server) || cg->ipp_port != httpAddrPort(http->hostaddr))
+ else if (httpAddrFamily(http->hostaddr) == AF_LOCAL)
+ {
+ DEBUG_puts("1cupsCopyDestInfo: Connection to server (domain socket).");
+ dflags = CUPS_DEST_FLAGS_NONE;
+ }
#endif /* AF_LOCAL */
+ else if ((strcmp(http->hostname, cg->server) && cg->server[0] != '/') || cg->ipp_port != httpAddrPort(http->hostaddr))
+ {
+ DEBUG_printf(("1cupsCopyDestInfo: Connection to device (%s).", http->hostname));
dflags = CUPS_DEST_FLAGS_DEVICE;
+ }
else
+ {
+ DEBUG_printf(("1cupsCopyDestInfo: Connection to server (%s).", http->hostname));
dflags = CUPS_DEST_FLAGS_NONE;
+ }
/*
* Range check input...
if (!ippGetBoolean(member, 0))
{
if (bufptr < bufend)
- strlcpy(bufptr, "no", bufend - bufptr + 1);
+ strlcpy(bufptr, "no", (size_t)(bufend - bufptr + 1));
bufptr += 2;
}
if (bufptr < bufend)
- strlcpy(bufptr, mname, bufend - bufptr + 1);
+ strlcpy(bufptr, mname, (size_t)(bufend - bufptr + 1));
bufptr += strlen(mname);
continue;
}
if (bufptr < bufend)
- strlcpy(bufptr, mname, bufend - bufptr + 1);
+ strlcpy(bufptr, mname, (size_t)(bufend - bufptr + 1));
bufptr += strlen(mname);
if (bufptr < bufend)
{
case IPP_TAG_INTEGER :
case IPP_TAG_ENUM :
- bufptr += snprintf(bufptr, bufptr < bufend ? (bufend - bufptr + 1) : 0, "%d", ippGetInteger(member, j));
+ bufptr += snprintf(bufptr, bufptr < bufend ? (size_t)(bufend - bufptr + 1) : 0, "%d", ippGetInteger(member, j));
break;
case IPP_TAG_STRING :