1
#! /bin/sh /usr/share/dpatch/dpatch-run
2
## 01UPSTREAM_autofs-5.0.4-fix-map-type-info-parse-error-update.patch
4
## DP: Upstream patch on top of 5.0.4.
7
autofs-5.0.4 - fix map type info parse error update
9
From: Ian Kent <raven@themaw.net>
11
Make parsing map type info more robust.
14
lib/parse_subs.c | 123 +++++++++++++++++++++++++++++++++++++++++++++---------
15
1 files changed, 102 insertions(+), 21 deletions(-)
18
diff --git a/lib/parse_subs.c b/lib/parse_subs.c
19
index 0608cb7..2326838 100644
20
--- a/lib/parse_subs.c
21
+++ b/lib/parse_subs.c
24
#include "automount.h"
31
+static struct types map_type[] = {
42
+static unsigned int map_type_count = sizeof(map_type)/sizeof(struct types);
44
+static struct types format_type[] = {
48
+static unsigned int format_type_count = sizeof(format_type)/sizeof(struct types);
51
* Skip whitespace in a string; if we hit a #, consider the rest of the
53
@@ -315,7 +339,7 @@ struct map_type_info *parse_map_type_info(const char *str)
55
struct map_type_info *info;
56
char *buf, *type, *fmt, *map, *tmp;
62
@@ -328,32 +352,89 @@ struct map_type_info *parse_map_type_info(const char *str)
64
memset(info, 0, sizeof(struct map_type_info));
67
+ type = fmt = map = NULL;
69
+ tmp = strchr(buf, ':');
78
+ for (i = 0; i < map_type_count; i++) {
79
+ char *m_type = map_type[i].type;
80
+ unsigned int m_len = map_type[i].len;
84
+ if (strncmp(m_type, pos, m_len))
90
+ if (*pos == ' ' || *pos == ':') {
108
+ for (j = 0; j < format_type_count; j++) {
109
+ char *f_type = format_type[j].type;
110
+ unsigned int f_len = format_type[j].len;
112
+ if (strncmp(f_type, pos, f_len))
118
+ if (*pos == ' ' || *pos == ':') {
119
+ while (*pos == ' ')
127
+ while (*pos == ' ')
139
+ while (*pos == ' ')
145
/* Look for space terminator - ignore local options */
147
for (tmp = buf; *tmp; tmp++) {
151
- } else if (!seen_colon && *tmp == ',') {
155
- } else if (*tmp == ':') {
161
- } else if (*tmp == '[') {
163
- * Unescaped '[' is a syntax error here as only
164
- * an ldap map with a type specified should contain