Skip to content

Commit

Permalink
auth: Accept forward_fields from auth client
Browse files Browse the repository at this point in the history
  • Loading branch information
cmouse committed Mar 19, 2017
1 parent 6e76be0 commit 53f9780
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/auth/auth-request.c
Expand Up @@ -407,6 +407,9 @@ bool auth_request_import_info(struct auth_request *request,
request->debug = TRUE;
else if (strcmp(key, "client_id") == 0)
request->client_id = p_strdup(request->pool, value);
else if (strcmp(key, "forward_fields") == 0)
auth_fields_import_prefixed(request->extra_fields,
"forward_", value, 0);
else
return FALSE;
/* NOTE: keep in sync with auth_request_export() */
Expand Down
5 changes: 5 additions & 0 deletions src/lib-auth/auth-client-request.c
Expand Up @@ -90,6 +90,11 @@ static void auth_server_send_new_request(struct auth_server_connection *conn,
str_append(str, "\tclient_id=");
str_append_tabescaped(str, info->client_id);
}
if (info->forward_fields != NULL &&
*info->forward_fields != '\0') {
str_append(str, "\tforward_fields=");
str_append_tabescaped(str, info->forward_fields);
}
if (info->initial_resp_base64 != NULL) {
str_append(str, "\tresp=");
str_append_tabescaped(str, info->initial_resp_base64);
Expand Down
1 change: 1 addition & 0 deletions src/lib-auth/auth-client.h
Expand Up @@ -43,6 +43,7 @@ struct auth_request_info {
const char *cert_username;
const char *local_name;
const char *client_id;
const char *forward_fields;
enum auth_request_flags flags;

struct ip_addr local_ip, remote_ip, real_local_ip, real_remote_ip;
Expand Down
1 change: 1 addition & 0 deletions src/login-common/client-common.h
Expand Up @@ -144,6 +144,7 @@ struct client {
const char *session_id, *listener_name, *postlogin_socket_path;
const char *local_name;
string_t *client_id;
string_t *forward_fields;

int fd;
struct istream *input;
Expand Down
2 changes: 2 additions & 0 deletions src/login-common/sasl-server.c
Expand Up @@ -369,6 +369,8 @@ void sasl_server_auth_begin(struct client *client,
info.real_remote_port = client->real_remote_port;
if (client->client_id != NULL)
info.client_id = str_c(client->client_id);
if (client->forward_fields != NULL)
info.forward_fields = str_c(client->forward_fields);
info.initial_resp_base64 = initial_resp_base64;

client->auth_request =
Expand Down

0 comments on commit 53f9780

Please sign in to comment.