Репозитории ALT
S: | 2.4.7-alt1 |
5.1: | 1.4.2-alt1.M51.2 |
4.1: | 1.3.10-alt0.M41.4 |
+updates: | 1.3.9-alt1.M41.1 |
4.0: | 1.2.12-alt6.M40.9 |
+updates: | 1.2.12-alt6.M40.8 |
3.0: | 1.1.20-alt14.1 |
Группа :: Система/Серверы
Пакет: cups
Главная Изменения Спек Патчи Sources Загрузить Gear Bugs and FR Repocop
Патч: cups-1.1.20-sanitize.patch
Скачать
Скачать
Index: ipp.c
===================================================================
RCS file: /development/cvs/cups/scheduler/ipp.c,v
retrieving revision 1.233
diff -u -r1.233 ipp.c
--- ipp.c 23 Aug 2004 18:36:50 -0000 1.233
+++ ipp.c 4 Oct 2004 20:19:17 -0000
@@ -1222,7 +1222,9 @@
}
LogMessage(L_INFO, "Setting %s device-uri to \"%s\" (was \"%s\".)",
- printer->name, attr->values[0].string.text, printer->device_uri);
+ printer->name,
+ cupsdSanitizeURI(attr->values[0].string.text, line, sizeof(line)),
+ cupsdSanitizeURI(printer->device_uri, resource, sizeof(resource)));
SetString(&printer->device_uri, attr->values[0].string.text);
}
Index: job.c
===================================================================
RCS file: /development/cvs/cups/scheduler/job.c,v
retrieving revision 1.231
diff -u -r1.231 job.c
--- job.c 4 Oct 2004 19:40:35 -0000 1.231
+++ job.c 4 Oct 2004 20:19:17 -0000
@@ -1202,6 +1202,7 @@
classification[1024], /* CLASSIFICATION environment variable */
content_type[1024], /* CONTENT_TYPE environment variable */
device_uri[1024], /* DEVICE_URI environment variable */
+ sani_uri[1024], /* Sanitized DEVICE_URI env var */
ppd[1024], /* PPD environment variable */
class_name[255], /* CLASS environment variable */
printer_name[255], /* PRINTER environment variable */
@@ -1803,7 +1804,12 @@
envp[envc] = NULL;
for (i = 0; i < envc; i ++)
- LogMessage(L_DEBUG, "StartJob: envp[%d]=\"%s\"", i, envp[i]);
+ if (strncmp(envp[i], "DEVICE_URI=", 11))
+ LogMessage(L_DEBUG, "StartJob: envp[%d]=\"%s\"", i, envp[i]);
+ else
+ LogMessage(L_DEBUG, "StartJob: envp[%d]=\"DEVICE_URI=%s\"", i,
+ cupsdSanitizeURI(printer->device_uri, sani_uri,
+ sizeof(sani_uri)));
current->current_file ++;
Index: printers.c
===================================================================
RCS file: /development/cvs/cups/scheduler/printers.c,v
retrieving revision 1.164
diff -u -r1.164 printers.c
--- printers.c 4 Oct 2004 19:40:35 -0000 1.164
+++ printers.c 4 Oct 2004 20:19:17 -0000
@@ -43,6 +43,7 @@
* ValidateDest() - Validate a printer/class destination.
* WritePrintcap() - Write a pseudo-printcap file for older
* applications that need it...
+ * cupsdSanitizeURI() - Sanitize a device URI...
* write_irix_config() - Update the config files used by the IRIX
* desktop tools.
* write_irix_state() - Update the status files used by IRIX printing
@@ -1150,11 +1151,7 @@
SetPrinterAttrs(printer_t *p) /* I - Printer to setup */
{
char uri[HTTP_MAX_URI]; /* URI for printer */
- char method[HTTP_MAX_URI], /* Method portion of URI */
- username[HTTP_MAX_URI], /* Username portion of URI */
- host[HTTP_MAX_URI], /* Host portion of URI */
- resource[HTTP_MAX_URI]; /* Resource portion of URI */
- int port; /* Port portion of URI */
+ char resource[HTTP_MAX_URI]; /* Resource portion of URI */
int i; /* Looping var */
char filename[1024]; /* Name of PPD file */
int num_media; /* Number of media options */
@@ -1360,12 +1357,7 @@
* http://..., ipp://..., etc.
*/
- httpSeparate(p->device_uri, method, username, host, &port, resource);
- if (port)
- snprintf(uri, sizeof(uri), "%s://%s:%d%s", method, host, port,
- resource);
- else
- snprintf(uri, sizeof(uri), "%s://%s%s", method, host, resource);
+ cupsdSanitizeURI(p->device_uri, uri, sizeof(uri));
}
else
{
@@ -2172,6 +2164,74 @@
*/
cupsFileClose(fp);
+}
+
+
+/*
+ * 'cupsdSanitizeURI()' - Sanitize a device URI...
+ */
+
+char * /* O - New device URI */
+cupsdSanitizeURI(const char *uri, /* I - Original device URI */
+ char *buffer, /* O - New device URI */
+ int buflen) /* I - Size of new device URI buffer */
+{
+ char *start, /* Start of data after scheme */
+ *slash, /* First slash after scheme:// */
+ *ptr; /* Pointer into user@host:port part */
+
+
+ /*
+ * Range check input...
+ */
+
+ if (!uri || !buffer || buflen < 2)
+ return (NULL);
+
+ /*
+ * Copy the device URI to the new buffer...
+ */
+
+ strlcpy(buffer, uri, buflen);
+
+ /*
+ * Find the end of the scheme:// part...
+ */
+
+ if ((ptr = strchr(buffer, ':')) == NULL)
+ return (buffer); /* No scheme: part... */
+
+ for (start = ptr + 1; *start; start ++)
+ if (*start != '/')
+ break;
+
+ /*
+ * Find the next slash (/) in the URI...
+ */
+
+ if ((slash = strchr(start, '/')) == NULL)
+ slash = start + strlen(start); /* No slash, point to the end */
+
+ /*
+ * Check for an @ sign before the slash...
+ */
+
+ if ((ptr = strchr(start, '@')) != NULL && ptr < slash)
+ {
+ /*
+ * Found an @ sign and it is before the resource part, so we have
+ * an authentication string. Copy the remaining URI over the
+ * authentication string...
+ */
+
+ cups_strcpy(start, ptr + 1);
+ }
+
+ /*
+ * Return the new device URI...
+ */
+
+ return (buffer);
}
Index: printers.h
===================================================================
RCS file: /development/cvs/cups/scheduler/printers.h,v
retrieving revision 1.39
diff -u -r1.39 printers.h
--- printers.h 23 Aug 2004 18:00:59 -0000 1.39
+++ printers.h 4 Oct 2004 20:19:17 -0000
@@ -126,6 +126,9 @@
cups_ptype_t *dtype);
extern void WritePrintcap(void);
+extern char *cupsdSanitizeURI(const char *uri, char *buffer,
+ int buflen);
+
/*
* End of "$Id: printers.h,v 1.39 2004/08/23 18:00:59 mike Exp $".