1 |
pacho 13/03/03 14:48:52 |
2 |
|
3 |
Added: cups-pk-helper-0.2.4-revert-stricter.patch |
4 |
Removed: cups-pk-helper-0.2.2-cups-1.6.patch |
5 |
Log: |
6 |
Revert Be |
7 |
|
8 |
(Portage version: 2.1.11.52/cvs/Linux x86_64, signed Manifest commit with key A188FBD4) |
9 |
|
10 |
Revision Changes Path |
11 |
1.1 net-print/cups-pk-helper/files/cups-pk-helper-0.2.4-revert-stricter.patch |
12 |
|
13 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-print/cups-pk-helper/files/cups-pk-helper-0.2.4-revert-stricter.patch?rev=1.1&view=markup |
14 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-print/cups-pk-helper/files/cups-pk-helper-0.2.4-revert-stricter.patch?rev=1.1&content-type=text/plain |
15 |
|
16 |
Index: cups-pk-helper-0.2.4-revert-stricter.patch |
17 |
=================================================================== |
18 |
From f00aee0b43c31e94087668b23b72e873c660de5e Mon Sep 17 00:00:00 2001 |
19 |
From: Vincent Untz <vuntz@××××.com> |
20 |
Date: Mon, 10 Dec 2012 09:44:31 +0000 |
21 |
Subject: Revert "Be stricter when validating printer names" |
22 |
|
23 |
Apparently, this is way too strict. The lpadmin man page says: |
24 |
|
25 |
CUPS allows printer names to contain any printable character except |
26 |
SPACE, TAB, "/", or "#". |
27 |
|
28 |
So the previous code was (mostly) correct. |
29 |
|
30 |
This reverts commit 7bf9cbe43ef8f648f308e4760f75c2aa6b61fa8e. |
31 |
--- |
32 |
diff --git a/src/cups.c b/src/cups.c |
33 |
index 96c2c20..09f0e7b 100644 |
34 |
--- a/src/cups.c |
35 |
+++ b/src/cups.c |
36 |
@@ -327,25 +327,23 @@ _cph_cups_is_printer_name_valid_internal (const char *name) |
37 |
int i; |
38 |
int len; |
39 |
|
40 |
- /* Quoting http://www.cups.org/documentation.php/doc-1.1/sam.html#4_1: |
41 |
- * |
42 |
- * The printer name must start with any printable character except |
43 |
- * " ", "/", and "@". It can contain up to 127 letters, numbers, and |
44 |
- * the underscore (_). |
45 |
- * |
46 |
- * The first part is a bit weird, as the second part is more |
47 |
- * restrictive. So we only consider the second part. */ |
48 |
- |
49 |
/* no empty string */ |
50 |
if (!name || name[0] == '\0') |
51 |
return FALSE; |
52 |
|
53 |
len = strlen (name); |
54 |
- if (len > 127) |
55 |
+ /* no string that is too long; see comment at the beginning of the |
56 |
+ * validation code block */ |
57 |
+ if (len > CPH_STR_MAXLEN) |
58 |
return FALSE; |
59 |
|
60 |
+ /* only printable characters, no space, no /, no # */ |
61 |
for (i = 0; i < len; i++) { |
62 |
- if (!g_ascii_isalnum (name[i]) && name[i] != '_') |
63 |
+ if (!g_ascii_isprint (name[i])) |
64 |
+ return FALSE; |
65 |
+ if (g_ascii_isspace (name[i])) |
66 |
+ return FALSE; |
67 |
+ if (name[i] == '/' || name[i] == '#') |
68 |
return FALSE; |
69 |
} |
70 |
|
71 |
-- |
72 |
cgit v0.9.0.2-2-gbebe |