]> diplodocus.org Git - nmh/commitdiff
Check for empty code.
authorDavid Levine <david.levine@gonift.com>
Mon, 25 Apr 2016 02:09:39 +0000 (22:09 -0400)
committerDavid Levine <david.levine@gonift.com>
Mon, 25 Apr 2016 02:09:39 +0000 (22:09 -0400)
uip/mhlogin.c

index 88912b5ccea5166ae405923b478781acc5798ad9..6ce414f201c1853e1404c57e8e4112d5d7556d5a 100644 (file)
@@ -101,9 +101,10 @@ do_login(const char *svc, const char *user, const char *browser, int snoop)
     fflush(stdout);
     code = geta();
 
-    while ((cred = mh_oauth_authorize(code, ctx)) == NULL
-           && mh_oauth_get_err_code(ctx) == MH_OAUTH_BAD_GRANT) {
-      printf("Code rejected; try again? ");
+    while (strlen(code) == 0 ||
+           ((cred = mh_oauth_authorize(code, ctx)) == NULL
+            && mh_oauth_get_err_code(ctx) == MH_OAUTH_BAD_GRANT)) {
+      printf(strlen(code) == 0  ?  "Empty code; try again? "  :  "Code rejected; try again? ");
       fflush(stdout);
       code = geta();
     }