]> diplodocus.org Git - nmh/commitdiff
Okay! Squashed a few bugs, now have POP OAuth tests working.
authorKen Hornstein <kenh@pobox.com>
Wed, 21 Sep 2016 20:51:21 +0000 (16:51 -0400)
committerKen Hornstein <kenh@pobox.com>
Wed, 21 Sep 2016 20:51:21 +0000 (16:51 -0400)
sbr/netsec.c
test/oauth/common.sh
test/oauth/test-inc

index 4d0d672f6edfc413b37c5f8117ec7ad352aed13c..a5110f0c643fc53a2f3d78d27e678935003c0b58 100644 (file)
@@ -281,6 +281,7 @@ netsec_b64_snoop_decoder(netsec_context *nsc, const char *string, size_t len,
 {
     const char *decoded;
     size_t decodedlen;
+    NMH_UNUSED(nsc);
 
     int offset = context ? *((int *) context) : 0;
 
@@ -797,7 +798,7 @@ retry:
 #endif /* TLS_SUPPORT */
            fprintf(stderr, "=> ");
            if (nsc->ns_snoop_cb)
-               nsc->ns_snoop_cb(nsc, nsc->ns_outptr, outlen,
+               nsc->ns_snoop_cb(nsc, (char *) nsc->ns_outptr, outlen,
                                 nsc->ns_snoop_context);
            else
                 fprintf(stderr, "%.*s\n", outlen, nsc->ns_outptr); 
@@ -1093,7 +1094,6 @@ netsec_negotiate_sasl(netsec_context *nsc, const char *mechlist, char **errstr)
 
        i = (str[i] == NULL);
 
-       free(str);
        free(mlist);
 
        if (i) {
@@ -1150,7 +1150,7 @@ netsec_negotiate_sasl(netsec_context *nsc, const char *mechlist, char **errstr)
             * we ignore it and send a blank message in response.  We should
             * then get either an +OK or -ERR
             */
-           free(errstr);
+           free(*errstr);
            nsc->sasl_proto_cb(NETSEC_SASL_WRITE, NULL, 0, NULL, 0, NULL);
            rc = nsc->sasl_proto_cb(NETSEC_SASL_FINISH, NULL, 0, NULL, 0,
                                    errstr);
index ab0bad5373c0e9aa39583145004afc2d8c8f9b05..932c705144e26e94bf1eacf50e39ab4998ec20f7 100644 (file)
@@ -131,7 +131,7 @@ expect_creds() {
 }
 
 test_inc() {
-    run_test "inc -host 127.0.0.1 -port ${pop_port} -saslmech xoauth2 -authservice test -user nobody@example.com -width 80" "$@"
+    run_test "inc -host 127.0.0.1 -port ${pop_port} -sasl -saslmech xoauth2 -authservice test -user nobody@example.com -width 80" "$@"
 }
 
 test_inc_success() {
index c745692892018d78fd2a541295871c5d7a31bca3..96a2af04ede8441c83fdacc394ce5a05204e0c3c 100755 (executable)
@@ -77,6 +77,7 @@ Content-Type: application/json
 EOF
 
 start_fakehttp
+start_pop_xoauth
 
 test_inc 'inc: error refreshing OAuth2 token
 inc: bad OAuth request; re-run with -snoop and send REDACTED output to nmh-workers'
@@ -93,7 +94,7 @@ EOF
 
 start_pop_xoauth
 
-test_inc 'inc: -ERR [AUTH] Invalid credentials.'
+test_inc 'inc: Authentication failed: -ERR [AUTH] Invalid credentials.'
 
 # TEST
 start_test "pop server doesn't support oauth"