Auth_basic_user_file on 0.7.44

hi,

in 0.7.44 the auth_basic_user_file directive doesn"t seem to work
using relative path.

here is the part of the conf I used for testing.

location /c {
auth_basic “Authentication required”;
auth_basic_user_file users.db;
}

location /d {
auth_basic “Authentication required”;
auth_basic_user_file conf/users.db;
}

location /e {
auth_basic “Authentication required”;
auth_basic_user_file /usr/local/nginx/conf/users.db;
}

Everything has been compiled all by default.
Here is debug lines I have with each case

/c
2009/03/26 23:19:28 [error] 12347#0: *1 open() “users.db” failed (2:
No such file or directory), client: 127.0.0.1, server: localhost,
request: “GET /c HTTP/1.1”, host: “localhost:89”

/d
2009/03/26 23:19:54 [error] 12347#0: *2 open() “conf/users.db” failed
(2: No such file or directory), client: 127.0.0.1, server: localhost,
request: “GET /d HTTP/1.1”, host: “localhost:89”

/e
2009/03/26 23:21:01 [debug] 12357#0: *1 rc: 0 user: “toto” salt:
“btO5GKhJaEtBQ”
2009/03/26 23:21:01 [debug] 12357#0: *1 post access phase: 8
2009/03/26 23:21:01 [debug] 12357#0: *1 content phase: 9
2009/03/26 23:21:01 [debug] 12357#0: *1 content phase: 10
2009/03/26 23:21:01 [debug] 12357#0: *1 content phase: 11
2009/03/26 23:21:01 [debug] 12357#0: *1 http filename:
“/usr/local/nginx/html/e”

I’ll dig into :slight_smile:

++ Jerome

}

(2: No such file or directory), client: 127.0.0.1, server: localhost,
I’ll dig into :slight_smile:

it seems there is a bug in the function ngx_http_compile_complex_value
of src/http/ngx_http_script.c.

— src/http/ngx_http_script.c.orig 2009-03-27 00:53:18.000000000
+0100
+++ src/http/ngx_http_script.c 2009-03-27 00:53:33.000000000 +0100
@@ -148,6 +148,7 @@
}

 if (nv == 0 && nc == 0) {
  •    ccv->complex_value->value = *v;
       return NGX_OK;
    
    }

it works for auth_basic_user_file but I didn’t yet try other
directives or functions which can rely on this function. What do you
think ?

}

(2: No such file or directory), client: 127.0.0.1, server: localhost,
I’ll dig into :slight_smile:
if (nv == 0 && nc == 0) {

  •    ccv->complex_value->value = *v;
      return NGX_OK;
    
    }

it works for auth_basic_user_file but I didn’t yet try other
directives or functions which can rely on this function. What do you
think ?

or maybe more that:

— src/http/ngx_http_script.c.orig 2009-03-27 00:53:18.000000000
+0100
+++ src/http/ngx_http_script.c 2009-03-27 01:03:05.000000000 +0100
@@ -118,10 +118,6 @@
return NGX_ERROR;
}

  • ccv->complex_value->value = *v;

  • ccv->complex_value->flushes = NULL;

  • ccv->complex_value->lengths = NULL;

  • ccv->complex_value->values = NULL;

    nv = 0;
    nc = 0;
    @@ -147,6 +143,11 @@
    ccv->root_prefix = 0;
    }

  • ccv->complex_value->value = *v;
  • ccv->complex_value->flushes = NULL;
  • ccv->complex_value->lengths = NULL;
  • ccv->complex_value->values = NULL;
  • if (nv == 0 && nc == 0) {
    return NGX_OK;
    }

don’t know :slight_smile:

On Fri, Mar 27, 2009 at 01:03:39AM +0100, J?r?me Loyet wrote:

}

(2: No such file or directory), client: 127.0.0.1, server: localhost,
I’ll dig into :slight_smile:
š š if (nv == 0 && nc == 0) {

  • if (nv == 0 && nc == 0) {
    return NGX_OK;
    }

don’t know :slight_smile:

Yes, thank you, the second patch is better.