auth_rimap.c | auth_rimap.c | |||
---|---|---|---|---|
skipping to change at line 56 | skipping to change at line 56 | |||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT | |||
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |||
* END COPYRIGHT */ | * END COPYRIGHT */ | |||
/* SYNOPSIS | /* SYNOPSIS | |||
* Proxy authentication to a remote IMAP (or IMSP) server. | * Proxy authentication to a remote IMAP (or IMSP) server. | |||
* END SYNOPSIS */ | * END SYNOPSIS */ | |||
#ifdef __GNUC__ | #ifdef __GNUC__ | |||
#ident "$Id: auth_rimap.c,v 1.12 2006/04/06 20:19:54 jeaton Exp $" | #ident "$Id: auth_rimap.c,v 1.13 2008/01/23 19:54:54 murch Exp $" | |||
#endif | #endif | |||
/* PUBLIC DEPENDENCIES */ | /* PUBLIC DEPENDENCIES */ | |||
#include "mechanisms.h" | #include "mechanisms.h" | |||
#include <unistd.h> | #include <unistd.h> | |||
#include <stdlib.h> | #include <stdlib.h> | |||
#include <assert.h> | #include <assert.h> | |||
#include <errno.h> | #include <errno.h> | |||
#include <string.h> | #include <string.h> | |||
skipping to change at line 163 | skipping to change at line 163 | |||
char *c; /* pointer to returned string */ | char *c; /* pointer to returned string */ | |||
register const char *p1; /* scratch pointers */ | register const char *p1; /* scratch pointers */ | |||
register char *p2; /* scratch pointers */ | register char *p2; /* scratch pointers */ | |||
int len; /* length of array to malloc */ | int len; /* length of array to malloc */ | |||
int num_quotes; /* number of '"' chars in string*/ | int num_quotes; /* number of '"' chars in string*/ | |||
/* see of we have to deal with any '"' characters */ | /* see of we have to deal with any '"' characters */ | |||
num_quotes = 0; | num_quotes = 0; | |||
p1 = s; | p1 = s; | |||
while ((p1 = strchr(p1, '"')) != NULL) { | while ((p1 = strchr(p1, '"')) != NULL) { | |||
p1++; | ||||
num_quotes++; | num_quotes++; | |||
} | } | |||
if (!num_quotes) { | if (!num_quotes) { | |||
/* | /* | |||
* no double-quotes to escape, so just wrap the input string | * no double-quotes to escape, so just wrap the input string | |||
* in double-quotes and return it. | * in double-quotes and return it. | |||
*/ | */ | |||
len = strlen(s) + 2 + 1; | len = strlen(s) + 2 + 1; | |||
c = malloc(len); | c = malloc(len); | |||
skipping to change at line 437 | skipping to change at line 438 | |||
syslog(LOG_DEBUG, "auth_rimap: sending %s%s %s", | syslog(LOG_DEBUG, "auth_rimap: sending %s%s %s", | |||
LOGIN_CMD, qlogin, qpass); | LOGIN_CMD, qlogin, qpass); | |||
} | } | |||
alarm(NETWORK_IO_TIMEOUT); | alarm(NETWORK_IO_TIMEOUT); | |||
rc = retry_writev(s, iov, 5); | rc = retry_writev(s, iov, 5); | |||
alarm(0); | alarm(0); | |||
if (rc == -1) { | if (rc == -1) { | |||
syslog(LOG_WARNING, "auth_rimap: writev: %m"); | syslog(LOG_WARNING, "auth_rimap: writev: %m"); | |||
memset(qlogin, 0, strlen(qlogin)); | memset(qlogin, 0, strlen(qlogin)); | |||
free(qlogin); | free(qlogin); | |||
memset(qpass, 0, strlen(qlogin)); | memset(qpass, 0, strlen(qpass)); | |||
free(qpass); | free(qpass); | |||
(void)close(s); | (void)close(s); | |||
return strdup(RESP_IERROR); | return strdup(RESP_IERROR); | |||
} | } | |||
/* don't need these any longer */ | /* don't need these any longer */ | |||
memset(qlogin, 0, strlen(qlogin)); | memset(qlogin, 0, strlen(qlogin)); | |||
free(qlogin); | free(qlogin); | |||
memset(qpass, 0, strlen(qlogin)); | memset(qpass, 0, strlen(qpass)); | |||
free(qpass); | free(qpass); | |||
/* read and parse the LOGIN response */ | /* read and parse the LOGIN response */ | |||
alarm(NETWORK_IO_TIMEOUT); | alarm(NETWORK_IO_TIMEOUT); | |||
rc = read(s, rbuf, sizeof(rbuf)); | rc = read(s, rbuf, sizeof(rbuf)); | |||
alarm(0); | alarm(0); | |||
(void) close(s); /* we're done with the remote */ | (void) close(s); /* we're done with the remote */ | |||
if (rc == -1) { | if (rc == -1) { | |||
syslog(LOG_WARNING, "auth_rimap: read (response): %m"); | syslog(LOG_WARNING, "auth_rimap: read (response): %m"); | |||
End of changes. 4 change blocks. | ||||
3 lines changed or deleted | 4 lines changed or added | |||
This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |