# Auth\_basic\_user\_file on 0.7.44

**URL:** <https://www.ruby-forum.com/t/auth-basic-user-file-on-0-7-44/164019>\
**Category:** NGINX\
**Created:** [March 26, 2009, 11:31pm UTC](https://www.ruby-forum.com/t/auth-basic-user-file-on-0-7-44/164019 "2009-03-26T23:31:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![JSSSSrSSSSme\_Loyet](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ee59a6/32.png) [@JSSSSrSSSSme\_Loyet](https://www.ruby-forum.com/u/JSSSSrSSSSme_Loyet)\
**Post date:** [March 26, 2009, 11:31pm UTC](https://www.ruby-forum.com/t/auth-basic-user-file-on-0-7-44/164019/1 "2009-03-26T23:31:55Z")

</div>

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 🙂

++ Jerome

---

<div class="post-metadata">

**Author:** ![JSSSSrSSSSme\_Loyet](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ee59a6/32.png) [@JSSSSrSSSSme\_Loyet](https://www.ruby-forum.com/u/JSSSSrSSSSme_Loyet)\
**Post date:** [March 27, 2009, 1:09am UTC](https://www.ruby-forum.com/t/auth-basic-user-file-on-0-7-44/164019/2 "2009-03-27T01:09:40Z")

</div>

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

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 ?

---

<div class="post-metadata">

**Author:** ![JSSSSrSSSSme\_Loyet](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ee59a6/32.png) [@JSSSSrSSSSme\_Loyet](https://www.ruby-forum.com/u/JSSSSrSSSSme_Loyet)\
**Post date:** [March 27, 2009, 1:10am UTC](https://www.ruby-forum.com/t/auth-basic-user-file-on-0-7-44/164019/3 "2009-03-27T01:10:15Z")

</div>

> > }
> > 
> > (2: No such file or directory), client: 127.0.0.1, server: localhost,  
> > I’ll dig into 🙂  
> > 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;

- 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 🙂

---

<div class="post-metadata">

**Author:** ![JSSSSrSSSSme\_Loyet](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ee59a6/32.png) [@JSSSSrSSSSme\_Loyet](https://www.ruby-forum.com/u/JSSSSrSSSSme_Loyet)\
**Post date:** [March 27, 2009, 7:39am UTC](https://www.ruby-forum.com/t/auth-basic-user-file-on-0-7-44/164019/4 "2009-03-27T07:39:12Z")

</div>

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 🙂  
> > > š š if (nv == 0 && nc == 0) {
> 
> - if (nv == 0 && nc == 0) {  
> return NGX\_OK;  
> }
> 
> don’t know 🙂

Yes, thank you, the second patch is better.
