/* Initial response encoded in Bas64 */
buf = t_buffer_create(MAX_BASE64_DECODED_SIZE(len));
- if (base64_decode(initial_resp, len, NULL, buf) < 0) {
+ if (base64_decode(initial_resp, len, buf) < 0) {
auth_request_handler_auth_fail_code(handler, request,
AUTH_CLIENT_FAIL_CODE_INVALID_BASE64,
"Invalid base64 data in initial response");
data_len = strlen(data);
buf = t_buffer_create(MAX_BASE64_DECODED_SIZE(data_len));
- if (base64_decode(data, data_len, NULL, buf) < 0) {
+ if (base64_decode(data, data_len, buf) < 0) {
auth_request_handler_auth_fail_code(handler, request,
AUTH_CLIENT_FAIL_CODE_INVALID_BASE64,
"Invalid base64 data in continued response");
request->proof = buffer_create_dynamic(request->pool,
MAX_BASE64_DECODED_SIZE(len));
- if (base64_decode(&fields[field_count-1][2], len, NULL,
+ if (base64_decode(&fields[field_count-1][2], len,
request->proof) < 0) {
*error_r = "Invalid base64 encoding";
return FALSE;
*salt_r = fields[1];
buf = t_buffer_create(hmethod->digest_size);
- if (base64_decode(fields[2], strlen(fields[2]), NULL, buf) < 0 ||
+ if (base64_decode(fields[2], strlen(fields[2]), buf) < 0 ||
buf->used != hmethod->digest_size) {
*error_r = t_strdup_printf(
"Invalid %s StoredKey in passdb", name);
memcpy(stored_key_r, buf->data, hmethod->digest_size);
buffer_set_used_size(buf, 0);
- if (base64_decode(fields[3], strlen(fields[3]), NULL, buf) < 0 ||
+ if (base64_decode(fields[3], strlen(fields[3]), buf) < 0 ||
buf->used != hmethod->digest_size) {
*error_r = t_strdup_printf(
"Invalid %s ServerKey in passdb", name);
/* fall through */
case PW_ENCODING_BASE64:
buf = t_buffer_create(MAX_BASE64_DECODED_SIZE(len));
- if (base64_decode(password, len, NULL, buf) < 0) {
+ if (base64_decode(password, len, buf) < 0) {
*error_r = "Input isn't valid base64 encoded data";
return -1;
}
}
plain = t_buffer_create(128);
- if (base64_decode(line + 6, strlen(line + 6), NULL, plain) < 0) {
+ if (base64_decode(line + 6, strlen(line + 6), plain) < 0) {
i_error("doveadm client sent invalid base64 auth PLAIN data");
return -1;
}
unsigned int i, count;
buf = t_buffer_create(strlen(input));
- if (base64_decode(input, strlen(input), NULL, buf) < 0) {
+ if (base64_decode(input, strlen(input), buf) < 0) {
*error_r = "Invalid base64 data";
return -1;
}
buffer_t *state_buf;
state_buf = buffer_create_dynamic(pool, 1024);
- if (base64_decode(value, strlen(value), NULL,
+ if (base64_decode(value, strlen(value),
state_buf) < 0) {
*error_r = t_strdup_printf(
"Invalid state base64 value: %s", value);
str = t_str_new(128);
if (line[1] != ' ' ||
- base64_decode(line+2, strlen(line+2), NULL, str) < 0) {
+ base64_decode(line+2, strlen(line+2), str) < 0) {
const char *reason = t_strdup_printf(
"Invalid base64 data in AUTHENTICATE response");
login_proxy_failed(client->login_proxy,
input_r->userdb_fields =
t_strsplit_tabescaped(value);
} else if (strcmp(key, "client_input") == 0) {
- if (base64_decode(value, strlen(value), NULL,
+ if (base64_decode(value, strlen(value),
master_input_r->client_input) < 0) {
*error_r = t_strdup_printf(
"Invalid client_input base64 value: %s", value);
return -1;
}
} else if (strcmp(key, "client_output") == 0) {
- if (base64_decode(value, strlen(value), NULL,
+ if (base64_decode(value, strlen(value),
master_input_r->client_output) < 0) {
*error_r = t_strdup_printf(
"Invalid client_output base64 value: %s", value);
return -1;
}
} else if (strcmp(key, "state") == 0) {
- if (base64_decode(value, strlen(value), NULL,
+ if (base64_decode(value, strlen(value),
master_input_r->state) < 0) {
*error_r = t_strdup_printf(
"Invalid state base64 value: %s", value);
input_len = strlen(reply->text_full);
buf = t_buffer_create(MAX_BASE64_DECODED_SIZE(input_len));
- if (base64_decode(reply->text_full, input_len, NULL, buf) < 0) {
+ if (base64_decode(reply->text_full, input_len, buf) < 0) {
imapc_auth_failed(conn, reply,
t_strdup_printf("Server sent non-base64 input for AUTHENTICATE: %s",
reply->text_full));
case 'B':
if (base64_decode(data + start_pos[1] + 1,
start_pos[2] - start_pos[1] - 1,
- NULL, decodebuf) < 0) {
+ decodebuf) < 0) {
/* contains invalid data. show what we got so far. */
}
break;
return FALSE;
}
buffer_set_used_size(&buf, 0);
- if (base64_decode(str+start, i-start, NULL, &buf) < 0)
+ if (base64_decode(str+start, i-start, &buf) < 0)
return FALSE;
i++;
input_len = strlen(reply->text_lines[0]);
buf = buffer_create_dynamic(pool_datastack_create(),
MAX_BASE64_DECODED_SIZE(input_len));
- if (base64_decode(reply->text_lines[0], input_len,
- NULL, buf) < 0) {
+ if (base64_decode(reply->text_lines[0], input_len, buf) < 0) {
error = t_strdup_printf(
"Authentication failed: "
"Server sent non-base64 input for AUTH: %s",
/* Translates base64 data into binary and appends it to dest buffer. See
base64_scheme_decode().
-
- The src_pos_r parameter is deprecated and MUST be NULL.
*/
static inline int
-base64_decode(const void *src, size_t src_size, size_t *src_pos_r ATTR_UNUSED,
- buffer_t *dest) ATTR_NULL(3)
+base64_decode(const void *src, size_t src_size, buffer_t *dest)
{
- // NOTE: src_pos_r is deprecated here; to be removed in v2.4 */
- i_assert(src_pos_r == NULL);
-
return base64_scheme_decode(&base64_scheme, 0, src, src_size, dest);
}
max_decoded_size);
str = &buf;
ret = base64_decode(tests[i].input, strlen(tests[i].input),
- NULL, str);
+ str);
test_assert_idx(tests[i].ret == ret, i);
test_assert_idx(strlen(tests[i].output) == str_len(str) &&
str_truncate(dest, 0);
base64_encode(buf, max, str);
test_assert_idx(base64_decode(str_data(str), str_len(str),
- NULL, dest) >= 0, i);
+ dest) >= 0, i);
test_assert_idx(str_len(dest) == max &&
memcmp(buf, str_data(dest), max) == 0, i);
}
}
data = t_buffer_create(256);
if (resp != NULL) {
- if (base64_decode(resp, strlen(resp), NULL, data) < 0) {
+ if (base64_decode(resp, strlen(resp), data) < 0) {
i_error("Bad AUTH request: Bad base64");
return FALSE;
}
resp = args[0];
data = t_buffer_create(256);
if (resp != NULL) {
- if (base64_decode(resp, strlen(resp), NULL, data) < 0) {
+ if (base64_decode(resp, strlen(resp), data) < 0) {
i_error("Bad CONT request: Bad base64");
return FALSE;
}
client->common.forward_fields =
str_new(client->common.preproxy_pool,
MAX_BASE64_DECODED_SIZE(value_len));
- if (base64_decode((*tmp)+8, value_len, NULL,
+ if (base64_decode((*tmp)+8, value_len,
client->common.forward_fields) < 0)
args_ok = FALSE;
}
int ret;
str = t_str_new(128);
- if (base64_decode(line, strlen(line), NULL, str) < 0) {
+ if (base64_decode(line, strlen(line), str) < 0) {
const char *reason = t_strdup_printf(
"Invalid base64 data in AUTH response");
login_proxy_failed(client->login_proxy,
client->common.forward_fields = str_new(
client->common.preproxy_pool,
MAX_BASE64_DECODED_SIZE(value_len));
- if (base64_decode(value, value_len, NULL,
+ if (base64_decode(value, value_len,
client->common.forward_fields) < 0) {
smtp_server_reply(cmd, 501, "5.5.4",
"Invalid FORWARD parameter");
}
str = t_str_new(128);
- if (base64_decode(line, strlen(line), NULL, str) < 0) {
+ if (base64_decode(line, strlen(line), str) < 0) {
login_proxy_failed(client->login_proxy,
login_proxy_get_event(client->login_proxy),
LOGIN_PROXY_FAILURE_TYPE_PROTOCOL,