aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Holme <steve_holme@hotmail.com>2012-06-03 18:24:35 +0100
committerSteve Holme <steve_holme@hotmail.com>2012-06-03 18:24:35 +0100
commit2b9ca12edf614877e39c426964e6d32bf34927c3 (patch)
tree1fa8071bf1f339cd5cd4e0bd71c4d807beb55cd6
parent3b8cf5bd142b289effcbc1bb12a01e0ae2fe2af2 (diff)
sasl: Small code tidy up
Added some comments and removed an unreferenced variable.
-rw-r--r--lib/curl_sasl.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/curl_sasl.c b/lib/curl_sasl.c
index 1889a208e..c473fa378 100644
--- a/lib/curl_sasl.c
+++ b/lib/curl_sasl.c
@@ -73,15 +73,19 @@ CURLcode Curl_sasl_create_plain_message(struct SessionHandle *data,
if(2 * ulen + plen + 2 > sizeof(plainauth)) {
*outlen = 0;
*outptr = NULL;
- return CURLE_OUT_OF_MEMORY; /* plainauth too small */
+
+ /* Plainauth too small */
+ return CURLE_OUT_OF_MEMORY;
}
+ /* Calculate the reply */
memcpy(plainauth, userp, ulen);
plainauth[ulen] = '\0';
memcpy(plainauth + ulen + 1, userp, ulen);
plainauth[2 * ulen + 1] = '\0';
memcpy(plainauth + 2 * ulen + 2, passwdp, plen);
+ /* Base64 encode the reply */
return Curl_base64_encode(data, plainauth, 2 * ulen + plen + 2, outptr,
outlen);
}
@@ -109,6 +113,7 @@ CURLcode Curl_sasl_create_login_message(struct SessionHandle *data,
size_t vlen = strlen(valuep);
if(!vlen) {
+ /* Calculate an empty reply */
*outptr = strdup("=");
if(*outptr) {
*outlen = (size_t) 1;
@@ -119,6 +124,7 @@ CURLcode Curl_sasl_create_login_message(struct SessionHandle *data,
return CURLE_OUT_OF_MEMORY;
}
+ /* Base64 encode the value */
return Curl_base64_encode(data, valuep, vlen, outptr, outlen);
}
@@ -149,7 +155,6 @@ CURLcode Curl_sasl_create_cram_md5_message(struct SessionHandle *data,
{
CURLcode result = CURLE_OK;
size_t chlg64len = strlen(chlg64);
- size_t len = 0;
unsigned char *chlg = (unsigned char *) NULL;
size_t chlglen = 0;
HMAC_context *ctxt;