Strip whitespace for secrets
authorPierre Habouzit <madcoder@debian.org>
Wed, 29 Aug 2007 21:10:23 +0000 (23:10 +0200)
committerPierre Habouzit <madcoder@debian.org>
Wed, 29 Aug 2007 21:10:23 +0000 (23:10 +0200)
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
srsd.c

diff --git a/srsd.c b/srsd.c
index 0ee15ca..cd53c9e 100644 (file)
--- a/srsd.c
+++ b/srsd.c
@@ -349,12 +349,12 @@ static srs_t *srs_read_secrets(const char *sfile)
         int n = strlen(buf);
 
         ++lineno;
-        if (buf[n - 1] != '\n') {
+        if (n == sizeof(buf) - 1 && buf[n - 1] != '\n') {
             syslog(LOG_CRIT, "%s:%d: line too long", sfile, lineno);
             goto error;
         }
-
-        srs_add_secret(srs, buf);
+        m_strrtrim(buf);
+        srs_add_secret(srs, skipspaces(buf));
     }
 
     if (!lineno) {