]> www.infradead.org Git - users/dwmw2/crm114-spamd.git/commitdiff
reshuffle line reading... this shouldn't be order dependent!
authorJohannes Berg <johannes@sipsolutions.net>
Tue, 9 May 2006 21:42:47 +0000 (23:42 +0200)
committerJohannes Berg <johannes@johannes.berg>
Tue, 9 May 2006 21:42:47 +0000 (23:42 +0200)
dspam-spamd.c

index 99963c837f14ee6da7bd441571b380cd045c1ea0..71161cf9064a50a72bfe4379a1639c3d3e66dbd9 100644 (file)
@@ -44,15 +44,6 @@ int main() {
        if (strcmp(version, "1.2") != 0)
                ERROR(EX_PROTOCOL, "can only handle version 1.2");
 
-       /* read content-length line */
-       fgets(buf, sizeof(buf), stdin);
-       buf[sizeof(buf)-1] = '\0';
-       if (strlen(buf) > 50)
-               ERROR(EX_PROTOCOL, "line too long");
-
-       if (sscanf(buf, "Content-length: %d", &length) != 1)
-               ERROR(EX_PROTOCOL, "invalid input line");
-
        /* read user line */
        fgets(buf, sizeof(buf), stdin);
        buf[sizeof(buf)-1] = '\0';
@@ -69,6 +60,15 @@ int main() {
        if (setuid(ps->pw_uid))
                ERROR(EX_TEMPFAIL, "cannot setuid");
 
+       /* read content-length line */
+       fgets(buf, sizeof(buf), stdin);
+       buf[sizeof(buf)-1] = '\0';
+       if (strlen(buf) > 50)
+               ERROR(EX_PROTOCOL, "line too long");
+
+       if (sscanf(buf, "Content-length: %d", &length) != 1)
+               ERROR(EX_PROTOCOL, "invalid input line");
+
        /* now an empty line */
        fgets(buf, sizeof(buf), stdin);
        buf[sizeof(buf)-1] = '\0';