diff options
author | Eric S. Raymond <esr@thyrsus.com> | 1996-10-09 21:37:43 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 1996-10-09 21:37:43 +0000 |
commit | 698e430e163910540c40b5d373c3aadf134c5dff (patch) | |
tree | 649d7ca7f3aecb19c85cfcd656dd554111819738 | |
parent | c87d7e8bdb5159d19457a6542d4eab69f3c9c77b (diff) | |
download | fetchmail-698e430e163910540c40b5d373c3aadf134c5dff.tar.gz fetchmail-698e430e163910540c40b5d373c3aadf134c5dff.tar.bz2 fetchmail-698e430e163910540c40b5d373c3aadf134c5dff.zip |
Cleaner authentication code.
svn path=/trunk/; revision=278
-rw-r--r-- | pop3.c | 25 |
1 files changed, 8 insertions, 17 deletions
@@ -89,7 +89,7 @@ char *greeting; } /* copy timestamp and password into digestion buffer */ - msg = (char *) malloc((end-start-1) + strlen(queryctl->password) + 1); + msg = (char *)xmalloc((end-start-1) + strlen(queryctl->password) + 1); *(++end) = 0; strcpy(msg,start); strcat(msg,queryctl->password); @@ -100,19 +100,17 @@ char *greeting; switch (queryctl->protocol) { case P_POP3: - gen_send(socket,"USER %s", queryctl->remotename); - if (pop3_ok(socket, buf) != 0) - goto badAuth; + if ((gen_transact(socket,"USER %s", queryctl->remotename)) != 0) + return(PS_ERROR); - gen_send(socket, "PASS %s", queryctl->password); - if (pop3_ok(socket, buf) != 0) - goto badAuth; + if ((gen_transact(socket, "PASS %s", queryctl->password)) != 0) + return(PS_ERROR); break; case P_APOP: - gen_send(socket,"APOP %s %s", queryctl->remotename, queryctl->digest); - if (pop3_ok(socket, buf) != 0) - goto badAuth; + if ((gen_transact(socket, "APOP %s %s", + queryctl->remotename, queryctl->digest)) != 0) + return(PS_ERROR); break; default: @@ -121,13 +119,6 @@ char *greeting; /* we're approved */ return(0); - - /*NOTREACHED*/ - -badAuth: - if (outlevel > O_SILENT && outlevel < O_VERBOSE) - fprintf(stderr,"%s\n",buf); - return(PS_ERROR); } static pop3_getrange(socket, queryctl, countp) |