diff options
author | Steve Holme <steve_holme@hotmail.com> | 2012-05-31 23:11:54 +0100 |
---|---|---|
committer | Steve Holme <steve_holme@hotmail.com> | 2012-05-31 23:11:54 +0100 |
commit | 54d484e136d43b50934cc906804662e780adc3fa (patch) | |
tree | 2d895f748df6a9fcfe47c9a2b7f5597f3f87300f /lib/smtp.c | |
parent | cb3d0ce2cb5097d906c9e7b9d5bb1de2eb4bbb93 (diff) |
sasl: Moved login authentication message creation from smtp.c
Moved the login message creation from smtp.c into the sasl module
to allow for use by other modules such as pop3.
Diffstat (limited to 'lib/smtp.c')
-rw-r--r-- | lib/smtp.c | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/lib/smtp.c b/lib/smtp.c index f202fd6a7..06cf2a5a2 100644 --- a/lib/smtp.c +++ b/lib/smtp.c @@ -383,25 +383,6 @@ static CURLcode smtp_state_helo(struct connectdata *conn) return CURLE_OK; } -static CURLcode smtp_auth_login(struct connectdata *conn, const char *valuep, - char **outptr, size_t *outlen) -{ - size_t vlen = strlen(valuep); - - if(!vlen) { - *outptr = strdup("="); - if(*outptr) { - *outlen = (size_t) 1; - return CURLE_OK; - } - - *outlen = 0; - return CURLE_OUT_OF_MEMORY; - } - - return Curl_base64_encode(conn->data, valuep, vlen, outptr, outlen); -} - #ifdef USE_NTLM static CURLcode smtp_auth_ntlm_type1_message(struct connectdata *conn, char **outptr, size_t *outlen) @@ -459,7 +440,8 @@ static CURLcode smtp_authenticate(struct connectdata *conn) state1 = SMTP_AUTHLOGIN; state2 = SMTP_AUTHPASSWD; smtpc->authused = SASL_AUTH_LOGIN; - result = smtp_auth_login(conn, conn->user, &initresp, &len); + result = Curl_sasl_create_login_message(conn->data, conn->user, + &initresp, &len); } else if(smtpc->authmechs & SASL_AUTH_PLAIN) { mech = "PLAIN"; @@ -685,7 +667,8 @@ static CURLcode smtp_state_authlogin_resp(struct connectdata *conn, result = CURLE_LOGIN_DENIED; } else { - result = smtp_auth_login(conn, conn->user, &authuser, &len); + result = Curl_sasl_create_login_message(conn->data, conn->user, + &authuser, &len); if(!result) { if(authuser) { @@ -718,7 +701,8 @@ static CURLcode smtp_state_authpasswd_resp(struct connectdata *conn, result = CURLE_LOGIN_DENIED; } else { - result = smtp_auth_login(conn, conn->passwd, &authpasswd, &len); + result = Curl_sasl_create_login_message(conn->data, conn->passwd, + &authpasswd, &len); if(!result) { if(authpasswd) { |