Lines 114-126
Link Here
|
114 |
* buffer first, and then do the translation on every |
114 |
* buffer first, and then do the translation on every |
115 |
* subsequent string. |
115 |
* subsequent string. |
116 |
*/ |
116 |
*/ |
117 |
p = strtok(buf, " \t"); |
|
|
118 |
if (p) do { |
119 |
argv[++argc] = p; |
120 |
p = strtok(NULL, " \t"); |
121 |
} while(p != NULL); |
122 |
|
117 |
|
123 |
argv[++argc] = p; |
118 |
p = buf; |
|
|
119 |
/* step through entire string, noting separate args by spaces or |
120 |
* single/double quotes */ |
121 |
while (*p) { |
122 |
if (*p != ' ' && *p != '\t') { |
123 |
/* Quotes: Search for matching quote; if found mark token */ |
124 |
if (*p == '\'' || *p == '\"') { |
125 |
char qt = *p; |
126 |
argv[++argc] = p+1; |
127 |
while (*++p != qt && *p); |
128 |
if (*p) { |
129 |
*(p++) = '\x00'; /* Make closing quote string terminator */ |
130 |
} |
131 |
} else { |
132 |
/* Start of unquoted arg -- mark it */ |
133 |
argv[++argc] = p; |
134 |
while (*p && (*p != '\t' && *p != ' ')) p++; |
135 |
} |
136 |
} else { |
137 |
*p = 0x00; /* terminate each string on first whitespace */ |
138 |
while (*++p && (*p == '\t' || *p == ' ')); |
139 |
} |
140 |
} |
141 |
|
124 |
if (argc == 0) { |
142 |
if (argc == 0) { |
125 |
radlog(L_ERR, "Exec-Program: empty command line."); |
143 |
radlog(L_ERR, "Exec-Program: empty command line."); |
126 |
return -1; |
144 |
return -1; |