~ubuntu-branches/ubuntu/precise/autofs5/precise

« back to all changes in this revision

Viewing changes to debian/patches/autofs-5.0.5-fix-isspace-wild-card-substition.patch

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2011-07-03 14:35:46 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20110703143546-nej26krjij0rf792
Tags: 5.0.6-0ubuntu1
* New upstream release:
  - Dropped upstream patches 
  - Refreshed debian/patches/17ld.patch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
autofs-5.0.5 - fix isspace() wild card substition
2
 
 
3
 
From: Ian Kent <raven@themaw.net>
4
 
 
5
 
If there are characters that match isspace() (such as \t, \n, etc.) in a
6
 
passed map entry key and there is no space in the key these characters
7
 
won't be properly preserved, leading to failed or incorrect mounts.
8
 
 
9
 
This is caused by an incorrect attempt at optimization, using a check
10
 
to see if a space is present in the passed key and only then processing
11
 
each character of the key individually, escaping any isspace() characters.
12
 
---
13
 
 
14
 
 CHANGELOG           |    1 +
15
 
 modules/parse_sun.c |   40 +++++++++++++++++-----------------------
16
 
 2 files changed, 18 insertions(+), 23 deletions(-)
17
 
 
18
 
 
19
 
diff --git a/CHANGELOG b/CHANGELOG
20
 
index c98204d..72590f7 100644
21
 
--- a/CHANGELOG
22
 
+++ b/CHANGELOG
23
 
@@ -56,6 +56,7 @@
24
 
 - fix add simple bind auth.
25
 
 - add option to dump configured automount maps.
26
 
 - use weight only for server selection.
27
 
+- fix isspace() wild card substition.
28
 
 
29
 
 03/09/2009 autofs-5.0.5
30
 
 -----------------------
31
 
diff --git a/modules/parse_sun.c b/modules/parse_sun.c
32
 
index 4bddcc9..3242e3b 100644
33
 
--- a/modules/parse_sun.c
34
 
+++ b/modules/parse_sun.c
35
 
@@ -161,30 +161,24 @@ int expandsunent(const char *src, char *dst, const char *key,
36
 
                case '&':
37
 
                        l = strlen(key);
38
 
                        /*
39
 
-                        * In order to ensure that any spaces in the key
40
 
-                        * re preserved, we need to escape them here.
41
 
+                        * In order to ensure that any isspace() characters
42
 
+                        * in the key are preserved, we need to escape them
43
 
+                        * here.
44
 
                         */
45
 
-                       if (strchr(key, ' ')) {
46
 
-                               const char *keyp = key;
47
 
-                               while (*keyp) {
48
 
-                                       if (isspace(*keyp)) {
49
 
-                                               if (dst) {
50
 
-                                                       *dst++ = '\\';
51
 
-                                                       *dst++ = *keyp++;
52
 
-                                               } else
53
 
-                                                       keyp++;
54
 
-                                               l++;
55
 
-                                       } else {
56
 
-                                               if (dst)
57
 
-                                                       *dst++ = *keyp++;
58
 
-                                               else
59
 
-                                                       keyp++;
60
 
-                                       }
61
 
-                               }
62
 
-                       } else {
63
 
-                               if (dst) {
64
 
-                                       strcpy(dst, key);
65
 
-                                       dst += l;
66
 
+                       const char *keyp = key;
67
 
+                       while (*keyp) {
68
 
+                               if (isspace(*keyp)) {
69
 
+                                       if (dst) {
70
 
+                                               *dst++ = '\\';
71
 
+                                               *dst++ = *keyp++;
72
 
+                                       } else
73
 
+                                               keyp++;
74
 
+                                       l++;
75
 
+                               } else {
76
 
+                                       if (dst)
77
 
+                                               *dst++ = *keyp++;
78
 
+                                       else
79
 
+                                               keyp++;
80
 
                                }
81
 
                        }
82
 
                        len += l;