aboutsummaryrefslogtreecommitdiffstats
path: root/imap.c
diff options
context:
space:
mode:
authorMatthias Andree <matthias.andree@gmx.de>2010-10-09 12:21:51 +0200
committerMatthias Andree <matthias.andree@gmx.de>2010-10-09 12:21:51 +0200
commitc0db499f36439269c81c0d83fc4655502985bbc5 (patch)
tree6014c43afcec291ff11cbcea75320a8af5564cec /imap.c
parent858d08aeb74c6280ebcc29f6674084f345fdd425 (diff)
parent269cba9b00fa7ecb0d707ef5b6f10d34e049327c (diff)
downloadfetchmail-c0db499f36439269c81c0d83fc4655502985bbc5.tar.gz
fetchmail-c0db499f36439269c81c0d83fc4655502985bbc5.tar.bz2
fetchmail-c0db499f36439269c81c0d83fc4655502985bbc5.zip
Merge branch 'master' of gitorious.org:fetchmail/fetchmail
Diffstat (limited to 'imap.c')
-rw-r--r--imap.c50
1 files changed, 3 insertions, 47 deletions
diff --git a/imap.c b/imap.c
index d6415866..b1c51043 100644
--- a/imap.c
+++ b/imap.c
@@ -290,57 +290,13 @@ static int imap_ok(int sock, char *argbuf)
static int do_imap_ntlm(int sock, struct query *ctl)
{
- tSmbNtlmAuthRequest request;
- tSmbNtlmAuthChallenge challenge;
- tSmbNtlmAuthResponse response;
-
- char msgbuf[2048];
- int result,len;
+ int result;
gen_send(sock, "AUTHENTICATE NTLM");
- if ((result = gen_recv(sock, msgbuf, sizeof msgbuf)))
- return result;
-
- if (msgbuf[0] != '+')
- return PS_AUTHFAIL;
-
- buildSmbNtlmAuthRequest(&request,ctl->remotename,NULL);
-
- if (outlevel >= O_DEBUG)
- dumpSmbNtlmAuthRequest(stdout, &request);
-
- memset(msgbuf,0,sizeof msgbuf);
- to64frombits (msgbuf, &request, SmbLength(&request));
-
- if (outlevel >= O_MONITOR)
- report(stdout, "IMAP> %s\n", msgbuf);
-
- strcat(msgbuf,"\r\n");
- SockWrite (sock, msgbuf, strlen (msgbuf));
-
- if ((gen_recv(sock, msgbuf, sizeof msgbuf)))
+ if ((result = ntlm_helper(sock, ctl, "IMAP")))
return result;
-
- len = from64tobits (&challenge, msgbuf, sizeof(challenge));
-
- if (outlevel >= O_DEBUG)
- dumpSmbNtlmAuthChallenge(stdout, &challenge);
-
- buildSmbNtlmAuthResponse(&challenge, &response,ctl->remotename,ctl->password);
-
- if (outlevel >= O_DEBUG)
- dumpSmbNtlmAuthResponse(stdout, &response);
-
- memset(msgbuf,0,sizeof msgbuf);
- to64frombits (msgbuf, &response, SmbLength(&response));
-
- if (outlevel >= O_MONITOR)
- report(stdout, "IMAP> %s\n", msgbuf);
-
- strcat(msgbuf,"\r\n");
- SockWrite (sock, msgbuf, strlen (msgbuf));
-
+
result = imap_ok (sock, NULL);
if (result == PS_SUCCESS)
return PS_SUCCESS;