Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177462119
D60865.1794474311.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
943 B
Referenced Files
None
Subscribers
None
D60865.1794474311.diff
View Options
diff --git a/contrib/dma/conf.c b/contrib/dma/conf.c
--- a/contrib/dma/conf.c
+++ b/contrib/dma/conf.c
@@ -33,6 +33,7 @@
* SUCH DAMAGE.
*/
+#include <ctype.h>
#include <err.h>
#include <errno.h>
#include <stdio.h>
@@ -82,6 +83,22 @@
str[len - 1] = 0;
}
+/*
+ * Strip leading and trailing whitespace
+ */
+static char *
+trim_ws(char *str)
+{
+ char *end;
+
+ while (isspace((unsigned char)*str))
+ str++;
+ end = str + strlen(str);
+ while (end > str && isspace((unsigned char)end[-1]))
+ *--end = '\0';
+ return (str);
+}
+
/*
* Read the SMTP authentication config file
*
@@ -174,13 +191,16 @@
if (strchr(line, '#'))
*strchr(line, '#') = 0;
- data = line;
+ data = trim_ws(line);
word = strsep(&data, EQS);
/* Ignore empty lines */
if (word == NULL || *word == 0)
continue;
+ if (data != NULL)
+ data = trim_ws(data);
+
if (data != NULL && *data != 0)
data = strdup(data);
else
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Nov 12, 9:05 AM (18 h, 18 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41113951
Default Alt Text
D60865.1794474311.diff (943 B)
Attached To
Mode
D60865: dma: Improve whitespace handling in /etc/dma/dma.conf
Attached
Detach File
Event Timeline