]> git.pld-linux.org Git - packages/autofs.git/blob - autofs-5.0.2-basedn-with-spaces-fix.patch
- rel.1, lets try
[packages/autofs.git] / autofs-5.0.2-basedn-with-spaces-fix.patch
1 diff --git a/lib/master_tok.l b/lib/master_tok.l
2 index 48bc233..5450753 100644
3 --- a/lib/master_tok.l
4 +++ b/lib/master_tok.l
5 @@ -108,8 +108,8 @@ AT_DC               ([dD][[cC])
6  AT_O           ([oO])
7  AT_C           ([cC])
8  DNATTRSTR      {AT_CN}|{AT_NMN}|{AT_AMN}|{AT_OU}|{AT_DC}|{AT_O}|{AT_C}
9 -DNNAMESTR      ([[:alnum:]_.\-]+)
10 -DNNAMETRM      (,|{WS}{NL}|{WS}#.*|\x00)
11 +DNNAMESTR      ([[:alnum:]_.\- ]+)
12 +DNNAMETRM      (,|{OPTWS}{NL}|{OPTWS}#.*|{OPTWS}\x00)
13  
14  INTMAP         (-hosts|-null)
15  MULTI          ((multi)(,(sun|hesiod))?(:{OPTWS}|{WS}))
16 @@ -379,7 +379,13 @@ void master_set_scan_buffer(const char *buffer)
17  {
18         line = buffer;
19         line_pos = &line[0];
20 -       line_lim = line + strlen(buffer);
21 +       /*
22 +        * Ensure buffer is 1 greater than string and is zeroed before
23 +        * the parse so we can fit the extra NULL which allows us to
24 +        * explicitly match an end of line within the buffer (ie. the
25 +        * need for 2 NULLS when parsing in memeory buffers).
26 +        */
27 +       line_lim = line + strlen(buffer) + 1;
28  }
29  
30  #define min(a,b) (((a) < (b)) ? (a) : (b))
31 diff --git a/modules/lookup_file.c b/modules/lookup_file.c
32 index 921b32b..c093415 100644
33 --- a/modules/lookup_file.c
34 +++ b/modules/lookup_file.c
35 @@ -479,7 +479,7 @@ int lookup_read_master(struct master *master, time_t age, void *context)
36  
37                         master->name = save_name;
38                 } else {
39 -                       blen = path_len + 1 + ent_len + 1;
40 +                       blen = path_len + 1 + ent_len + 2;
41                         buffer = malloc(blen);
42                         if (!buffer) {
43                                 error(logopt,
44 diff --git a/modules/lookup_ldap.c b/modules/lookup_ldap.c
45 index 00215af..dfb3054 100644
46 --- a/modules/lookup_ldap.c
47 +++ b/modules/lookup_ldap.c
48 @@ -1368,7 +1368,7 @@ int lookup_read_master(struct master *master, time_t age, void *context)
49                         goto next;
50                 }
51  
52 -               blen = strlen(*keyValue) + 1 + strlen(*values) + 1;
53 +               blen = strlen(*keyValue) + 1 + strlen(*values) + 2;
54                 if (blen > PARSE_MAX_BUF) {
55                         error(logopt, MODPREFIX "map entry too long");
56                         ldap_value_free(values);
57 diff --git a/modules/lookup_nisplus.c b/modules/lookup_nisplus.c
58 index ff8bd49..bcdaeeb 100644
59 --- a/modules/lookup_nisplus.c
60 +++ b/modules/lookup_nisplus.c
61 @@ -90,7 +90,7 @@ int lookup_read_master(struct master *master, time_t age, void *context)
62         char *path, *ent;
63         char *buffer;
64         char buf[MAX_ERR_BUF];
65 -       int cur_state;
66 +       int cur_state, len;
67  
68         pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cur_state);
69         tablename = alloca(strlen(ctxt->mapname) + strlen(ctxt->domainname) + 20);
70 @@ -138,11 +138,13 @@ int lookup_read_master(struct master *master, time_t age, void *context)
71  
72                 ent = ENTRY_VAL(this, 1);
73  
74 -               buffer = malloc(ENTRY_LEN(this, 0) + 1 + ENTRY_LEN(this, 1) + 1);
75 +               len = ENTRY_LEN(this, 0) + 1 + ENTRY_LEN(this, 1) + 2;
76 +               buffer = malloc(len);
77                 if (!buffer) {
78                         logerr(MODPREFIX "could not malloc parse buffer");
79                         continue;
80                 }
81 +               memset(buffer, 0, len);
82  
83                 strcat(buffer, path);
84                 strcat(buffer, " ");
85 diff --git a/modules/lookup_yp.c b/modules/lookup_yp.c
86 index 63fc8e3..7ba6940 100644
87 --- a/modules/lookup_yp.c
88 +++ b/modules/lookup_yp.c
89 @@ -178,7 +178,7 @@ int yp_all_master_callback(int status, char *ypkey, int ypkeylen,
90         *(ypkey + ypkeylen) = '\0';
91         *(val + vallen) = '\0';
92  
93 -       len = ypkeylen + 1 + vallen + 1;
94 +       len = ypkeylen + 1 + vallen + 2;
95  
96         buffer = alloca(len);
97         if (!buffer) {
This page took 0.062192 seconds and 3 git commands to generate.