comparison src/http/modules/ngx_http_auth_basic_module.c @ 130:82d695e3d662 NGINX_0_3_12

nginx 0.3.12 *) Security: if nginx was built with the ngx_http_realip_module and the "satisfy_any on" directive was used, then access and authorization directives did not work. The ngx_http_realip_module was not built and is not built by default. *) Change: the "$time_gmt" variable name was changed to "$time_local". *) Change: the "proxy_header_buffer_size" and "fastcgi_header_buffer_size" directives was renamed to the "proxy_buffer_size" and "fastcgi_buffer_size" directives. *) Feature: the ngx_http_memcached_module. *) Feature: the "proxy_buffering" directive. *) Bugfix: the changes in accept mutex handling when the "rtsig" method was used; bug appeared in 0.3.0. *) Bugfix: if the client sent the "Transfer-Encoding: chunked" header line, then nginx returns the 411 error. *) Bugfix: if the "auth_basic" directive was inherited from the http level, then the realm in the "WWW-Authenticate" header line was without the "Basic realm" text. *) Bugfix: if the "combined" format was explicitly specified in the "access_log" directive, then the empty lines was written to the log; bug appeared in 0.3.8. *) Bugfix: nginx did not run on the sparc platform under any OS except Solaris. *) Bugfix: now it is not necessary to place space between the quoted string and closing bracket in the "if" directive.
author Igor Sysoev <http://sysoev.ru>
date Sat, 26 Nov 2005 00:00:00 +0300
parents 71c46860eb55
children 91372f004adf
comparison
equal deleted inserted replaced
129:a27c77ef3ad8 130:82d695e3d662
330 ngx_http_auth_basic_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child) 330 ngx_http_auth_basic_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
331 { 331 {
332 ngx_http_auth_basic_loc_conf_t *prev = parent; 332 ngx_http_auth_basic_loc_conf_t *prev = parent;
333 ngx_http_auth_basic_loc_conf_t *conf = child; 333 ngx_http_auth_basic_loc_conf_t *conf = child;
334 334
335 size_t len; 335 if (conf->realm.data == NULL) {
336 u_char *realm, *p;
337
338 if (conf->realm.data) {
339 if (conf->realm.len) {
340 len = sizeof("Basic realm=\"") - 1 + conf->realm.len + 1;
341
342 realm = ngx_palloc(cf->pool, len);
343 if (realm == NULL) {
344 return NGX_CONF_ERROR;
345 }
346
347 p = ngx_cpymem(realm, "Basic realm=\"",
348 sizeof("Basic realm=\"") - 1);
349 p = ngx_cpymem(p, conf->realm.data, conf->realm.len);
350 *p = '"';
351
352 conf->realm.len = len;
353 conf->realm.data = realm;
354 }
355
356 } else {
357 conf->realm = prev->realm; 336 conf->realm = prev->realm;
358 } 337 }
359
360 338
361 if (conf->user_file.data) { 339 if (conf->user_file.data) {
362 if (ngx_conf_full_name(cf->cycle, &conf->user_file) != NGX_OK) { 340 if (ngx_conf_full_name(cf->cycle, &conf->user_file) != NGX_OK) {
363 return NGX_CONF_ERROR; 341 return NGX_CONF_ERROR;
364 } 342 }
393 static char * 371 static char *
394 ngx_http_auth_basic(ngx_conf_t *cf, void *post, void *data) 372 ngx_http_auth_basic(ngx_conf_t *cf, void *post, void *data)
395 { 373 {
396 ngx_str_t *realm = data; 374 ngx_str_t *realm = data;
397 375
376 size_t len;
377 u_char *basic, *p;
378
398 if (ngx_strcmp(realm->data, "off") == 0) { 379 if (ngx_strcmp(realm->data, "off") == 0) {
399 realm->len = 0; 380 realm->len = 0;
400 realm->data = (u_char *) ""; 381 realm->data = (u_char *) "";
401 } 382 }
402 383
384 len = sizeof("Basic realm=\"") - 1 + realm->len + 1;
385
386 basic = ngx_palloc(cf->pool, len);
387 if (basic == NULL) {
388 return NGX_CONF_ERROR;
389 }
390
391 p = ngx_cpymem(basic, "Basic realm=\"", sizeof("Basic realm=\"") - 1);
392 p = ngx_cpymem(p, realm->data, realm->len);
393 *p = '"';
394
395 realm->len = len;
396 realm->data = basic;
397
403 return NGX_CONF_OK; 398 return NGX_CONF_OK;
404 } 399 }