comparison src/mail/ngx_mail_smtp_module.c @ 2049:2a92804f4109

*) back out r2040 *) refactor ngx_palloc() *) introduce ngx_pnalloc() *) additional pool blocks have smaller header
author Igor Sysoev <igor@sysoev.ru>
date Tue, 17 Jun 2008 15:00:30 +0000
parents 4c060e30476b
children 8156bc03982a
comparison
equal deleted inserted replaced
2048:824615f3b4ec 2049:2a92804f4109
158 158
159 cscf = ngx_mail_conf_get_module_srv_conf(cf, ngx_mail_core_module); 159 cscf = ngx_mail_conf_get_module_srv_conf(cf, ngx_mail_core_module);
160 160
161 size = sizeof("220 ESMTP ready" CRLF) - 1 + cscf->server_name.len; 161 size = sizeof("220 ESMTP ready" CRLF) - 1 + cscf->server_name.len;
162 162
163 p = ngx_palloc(cf->pool, size); 163 p = ngx_pnalloc(cf->pool, size);
164 if (p == NULL) { 164 if (p == NULL) {
165 return NGX_CONF_ERROR; 165 return NGX_CONF_ERROR;
166 } 166 }
167 167
168 conf->greeting.len = size; 168 conf->greeting.len = size;
173 ngx_memcpy(p, " ESMTP ready" CRLF, sizeof(" ESMTP ready" CRLF) - 1); 173 ngx_memcpy(p, " ESMTP ready" CRLF, sizeof(" ESMTP ready" CRLF) - 1);
174 174
175 175
176 size = sizeof("250 " CRLF) - 1 + cscf->server_name.len; 176 size = sizeof("250 " CRLF) - 1 + cscf->server_name.len;
177 177
178 p = ngx_palloc(cf->pool, size); 178 p = ngx_pnalloc(cf->pool, size);
179 if (p == NULL) { 179 if (p == NULL) {
180 return NGX_CONF_ERROR; 180 return NGX_CONF_ERROR;
181 } 181 }
182 182
183 conf->server_name.len = size; 183 conf->server_name.len = size;
207 if (m & conf->auth_methods) { 207 if (m & conf->auth_methods) {
208 size += 1 + ngx_mail_smtp_auth_methods_names[i].len; 208 size += 1 + ngx_mail_smtp_auth_methods_names[i].len;
209 } 209 }
210 } 210 }
211 211
212 p = ngx_palloc(cf->pool, size); 212 p = ngx_pnalloc(cf->pool, size);
213 if (p == NULL) { 213 if (p == NULL) {
214 return NGX_CONF_ERROR; 214 return NGX_CONF_ERROR;
215 } 215 }
216 216
217 conf->capability.len = size; 217 conf->capability.len = size;
245 245
246 *p++ = CR; *p = LF; 246 *p++ = CR; *p = LF;
247 247
248 size += sizeof("250 STARTTLS" CRLF) - 1; 248 size += sizeof("250 STARTTLS" CRLF) - 1;
249 249
250 p = ngx_palloc(cf->pool, size); 250 p = ngx_pnalloc(cf->pool, size);
251 if (p == NULL) { 251 if (p == NULL) {
252 return NGX_CONF_ERROR; 252 return NGX_CONF_ERROR;
253 } 253 }
254 254
255 conf->starttls_capability.len = size; 255 conf->starttls_capability.len = size;
266 *p = '-'; 266 *p = '-';
267 267
268 size = (auth - conf->capability.data) 268 size = (auth - conf->capability.data)
269 + sizeof("250 STARTTLS" CRLF) - 1; 269 + sizeof("250 STARTTLS" CRLF) - 1;
270 270
271 p = ngx_palloc(cf->pool, size); 271 p = ngx_pnalloc(cf->pool, size);
272 if (p == NULL) { 272 if (p == NULL) {
273 return NGX_CONF_ERROR; 273 return NGX_CONF_ERROR;
274 } 274 }
275 275
276 conf->starttls_only_capability.len = size; 276 conf->starttls_only_capability.len = size;