On Tue, 1 Aug 2000, Rob Giseburt wrote:

> I want to modify the User cofiguration directive in a perl handler ... for
> example in a PerlTransHandler. I'm trying to use mod_perl to implement Named
> Virtual Hosting, and I have everything I need done except User and Group
> mapping so that SuEXEC will pick up the correct user and group to setuid the
> non-mod_perl CGI execution to. I cannot find what variable to change. I know
> that in a <Perl>...</Perl> section it's simple $User, but in a
> PerlTransHandler context it seems you can only view it via $r->server->uid.
> Any suggestions?

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


Reply via email to