]> diplodocus.org Git - nmh/commitdiff
Use HasPrefix() instead of strncmp().
authorRalph Corderoy <ralph@inputplus.co.uk>
Sun, 23 Oct 2016 17:56:33 +0000 (18:56 +0100)
committerRalph Corderoy <ralph@inputplus.co.uk>
Mon, 24 Oct 2016 09:18:55 +0000 (10:18 +0100)
mts/smtp/smtp.c

index 68228ee3daaf7f5c68f38d59838d756e7a173a98..f1b4917c2bd56dee0574f41bfa663dfb1e4c4624 100644 (file)
@@ -811,7 +811,7 @@ again: ;
                                                 &errstr)) != NULL ; ) {
 
        if (doingEHLO
                                                 &errstr)) != NULL ; ) {
 
        if (doingEHLO
-               && strncmp (buffer, "250", LEN("250")) == 0
+               && HasPrefix(buffer, "250")
                && (buffer[3] == '-' || doingEHLO == 2)
                && buffer[4]) {
            if (doingEHLO == 2) {
                && (buffer[3] == '-' || doingEHLO == 2)
                && buffer[4]) {
            if (doingEHLO == 2) {
@@ -950,7 +950,7 @@ EHLOset (char *s)
 
     for (ehlo = EHLOkeys; *ehlo; ehlo++) {
        ep = *ehlo;
 
     for (ehlo = EHLOkeys; *ehlo; ehlo++) {
        ep = *ehlo;
-       if (strncmp (ep, s, len) == 0) {
+       if (HasPrefix(ep, s)) {
            for (ep += len; *ep == ' '; ep++)
                continue;
            return ep;
            for (ep += len; *ep == ' '; ep++)
                continue;
            return ep;
@@ -1028,7 +1028,7 @@ sm_sasl_callback(enum sasl_message_type mtype, unsigned const char *indata,
            return NOTOK;
        }
 
            return NOTOK;
        }
 
-       if (strncmp(line, "334 ", 4) != 0) {
+       if (!HasPrefix(line, "334 ")) {
            netsec_err(errstr, "Improper SASL protocol response: %s", line);
            return NOTOK;
        }
            netsec_err(errstr, "Improper SASL protocol response: %s", line);
            return NOTOK;
        }
@@ -1077,7 +1077,7 @@ sm_sasl_callback(enum sasl_message_type mtype, unsigned const char *indata,
        if (line == NULL)
            return NOTOK;
 
        if (line == NULL)
            return NOTOK;
 
-       if (strncmp(line, "235 ", 4) != 0) {
+       if (!HasPrefix(line, "235 ")) {
            if (len > 4)
                netsec_err(errstr, "Authentication failed: %s", line + 4);
            else
            if (len > 4)
                netsec_err(errstr, "Authentication failed: %s", line + 4);
            else