Welcome! Log In Create A New Profile

Advanced

[PATCH 2 of 3] Mail: add IMAP client ID value to mail auth script

Filipe da Silva
January 19, 2014 06:12AM
# HG changeset patch
# User Filipe da Silva <fdasilvayy@gmail.com>
# Date 1390129340 -3600
# Sun Jan 19 12:02:20 2014 +0100
# Node ID cb11ea53da365c2debed88d8d72864cdc3ae07d2
# Parent 3ad4498760c6fcd2ba24ae84f6d924b3a1a35a31
Mail: add IMAP client ID value to mail auth script.

Push the ID command argument received from client to auth script.
So this client information is available for custom auth script.

diff -r 3ad4498760c6 -r cb11ea53da36 src/mail/ngx_mail_auth_http_module.c
--- a/src/mail/ngx_mail_auth_http_module.c Sun Jan 19 12:02:13 2014 +0100
+++ b/src/mail/ngx_mail_auth_http_module.c Sun Jan 19 12:02:20 2014 +0100
@@ -1142,7 +1142,7 @@ ngx_mail_auth_http_create_request(ngx_ma
{
size_t len;
ngx_buf_t *b;
- ngx_str_t login, passwd;
+ ngx_str_t login, passwd, imap_id;
ngx_mail_core_srv_conf_t *cscf;

if (ngx_mail_auth_http_escape(pool, &s->login, &login) != NGX_OK) {
@@ -1153,6 +1153,10 @@ ngx_mail_auth_http_create_request(ngx_ma
return NULL;
}

+ if (ngx_mail_auth_http_escape(pool, &s->imap_id, &imap_id) != NGX_OK) {
+ return NULL;
+ }
+
cscf = ngx_mail_get_module_srv_conf(s, ngx_mail_core_module);

len = sizeof("GET ") - 1 + ahcf->uri.len + sizeof(" HTTP/1.0" CRLF) - 1
@@ -1176,6 +1180,11 @@ ngx_mail_auth_http_create_request(ngx_ma
+ ahcf->header.len
+ sizeof(CRLF) - 1;

+ if (s->protocol == NGX_MAIL_IMAP_PROTOCOL) {
+ len += sizeof("Auth-IMAP-Id: ") - 1
+ + imap_id.len + sizeof(CRLF) - 1;
+ }
+
b = ngx_create_temp_buf(pool, len);
if (b == NULL) {
return NULL;
@@ -1255,6 +1264,13 @@ ngx_mail_auth_http_create_request(ngx_ma

}

+ if (s->protocol == NGX_MAIL_IMAP_PROTOCOL) {
+ b->last = ngx_cpymem(b->last, "Auth-IMAP-Id: ",
+ sizeof("Auth-IMAP-Id: ") - 1);
+ b->last = ngx_copy(b->last, imap_id.data, imap_id.len);
+ *b->last++ = CR; *b->last++ = LF;
+ }
+
if (ahcf->header.len) {
b->last = ngx_copy(b->last, ahcf->header.data, ahcf->header.len);
}
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[PATCH 2 of 3] Mail: add IMAP client ID value to mail auth script

Filipe da Silva 568 January 19, 2014 06:12AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 138
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready