[PATCH 2 of 3] Mail: add IMAP client ID value to mail auth script
Filipe da Silva
fdasilvayy at gmail.com
Sun Jan 19 11:10:56 UTC 2014
# HG changeset patch
# User Filipe da Silva <fdasilvayy at 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);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 001-ImapID_AuthScriptSupport.diff
Type: text/x-patch
Size: 2177 bytes
Desc: not available
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20140119/cdf320cb/attachment.bin>
More information about the nginx-devel
mailing list