You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by George Sanderson <ge...@xorgate.com> on 2000/11/23 17:45:57 UTC

Re: User directive

At 10:20 PM 8/15/00 -0700, you wrote:
>>you want to change the uid at request time?  the patch below will let you
>say $r->server->uid($new_uid);
>
>you'll have to maintain changing it back yourself, like so:
>
>my $old_uid = $r->server->uid($new_uid);
>$r->register_cleanup(sub { shift->server->uid($old_uid) });
>
I want to set the UID of a file, perhaps as follows:
1) from within mod_perl (with the patch applied) call
$r->server->uid($new_uid).
2) change the UID of a file to $new_uid .
3) set the file permisions to 750, where the GID is Apache child GID.
3) call $r->server->uid($old_uid).

I have tried creating a new fill after a $r->server->uid($new_uid), but it
still has the original Apache child UID.

>i'm not sure if we should allow this or not, security implications?
>
>--- src/modules/perl/Server.xs  1999/08/20 08:34:43     1.6
>+++ src/modules/perl/Server.xs  2000/08/16 05:19:54
>@@ -151,11 +151,16 @@
>     RETVAL
> 
> uid_t
>-uid(server)
>+uid(server, id=0)
>     Apache::Server     server
>+    uid_t id
> 
>     CODE:
>     RETVAL = server->server_uid;
>+
>+    if (items > 1) {
>+        server->server_uid = id;
>+    }
> 
>     OUTPUT:
>     RETVAL
>