/*
- * "$Id: dirsvc.c 5059 2006-02-02 23:17:16Z mike $"
+ * "$Id: dirsvc.c 5117 2006-02-16 14:10:43Z mike $"
*
* Directory services routines for the Common UNIX Printing System (CUPS).
*
- * Copyright 1997-2005 by Easy Software Products, all rights reserved.
+ * Copyright 1997-2006 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
* property of Easy Software Products and are protected by Federal
int linenum; /* Current line number */
char line[1024], /* Line from file */
*value, /* Pointer to value */
- *valueptr; /* Pointer into value */
+ *valueptr, /* Pointer into value */
+ scheme[32], /* Scheme portion of URI */
+ username[64], /* Username portion of URI */
+ host[HTTP_MAX_HOST],
+ /* Hostname portion of URI */
+ resource[HTTP_MAX_URI];
+ /* Resource portion of URI */
+ int port; /* Port number */
cupsd_printer_t *p; /* Current printer */
time_t now; /* Current time */
cupsdLogMessage(CUPSD_LOG_DEBUG,
"cupsdLoadRemoteCache: Loading printer %s...", value);
- p = cupsdAddPrinter(value);
+ if ((p = cupsdFindDest(value)) != NULL)
+ {
+ if (p->type & CUPS_PRINTER_CLASS)
+ {
+ cupsdLogMessage(CUPSD_LOG_WARN,
+ "Cached remote printer \"%s\" conflicts with "
+ "existing class!",
+ value);
+ p = NULL;
+ continue;
+ }
+ }
+ else
+ p = cupsdAddPrinter(value);
+
p->accepting = 1;
p->state = IPP_PRINTER_IDLE;
p->type |= CUPS_PRINTER_REMOTE;
cupsdLogMessage(CUPSD_LOG_DEBUG,
"cupsdLoadRemoteCache: Loading class %s...", value);
- p = cupsdAddClass(value);
+ if ((p = cupsdFindDest(value)) != NULL)
+ p->type = CUPS_PRINTER_CLASS;
+ else
+ p = cupsdAddClass(value);
+
p->accepting = 1;
p->state = IPP_PRINTER_IDLE;
p->type |= CUPS_PRINTER_REMOTE;
{
if (value)
{
+ httpSeparateURI(HTTP_URI_CODING_ALL, value, scheme, sizeof(scheme),
+ username, sizeof(username), host, sizeof(host), &port,
+ resource, sizeof(resource));
+
+ cupsdSetString(&p->hostname, host);
cupsdSetString(&p->uri, value);
cupsdSetString(&p->device_uri, value);
}
/*
- * End of "$Id: dirsvc.c 5059 2006-02-02 23:17:16Z mike $".
+ * End of "$Id: dirsvc.c 5117 2006-02-16 14:10:43Z mike $".
*/