Re: No $s->uid in Apache2

John Williams <[email protected]>
Newsgroups gmane.comp.web.mason.devel
Message-ID <[email protected]>
On Wed, 1 Sep 2004, John Williams wrote:

> I could use some suggestions from the dev group on how to deal with the
> lack of $s->uid in mod_perl-2.
> <http://perl.apache.org/docs/2.0/user/porting/compat.html#C__s_E_gt_uid_>

OTOH, I just came up with this replacement:

  sub get_uid_gid
  {
	return (Apache->server->uid, Apache->server->gid) unless APACHE2;

	# Apache2 lacks $s->uid.
	# Workaround by searching the config tree.
	require Apache::Directive;
	my $conftree = Apache::Directive->conftree;
	my $user = $conftree->lookup('User');
	my $group = $conftree->lookup('Group');
	$user =~ s/^["'](.*)["']$/$1/;
	$group =~ s/^["'](.*)["']$/$1/;
	my $uid = getpwnam($user);
	my $gid = getgrnam($group);
	return ($uid,$gid);
  }

But I still have a few permissions problems on the "no_config" tests.
Apparently the $ah is create at request time, and user nobody cannot
create t/mason/obj ...

By the way, was anyone aware that we are leaving files in /tmp/one after
the tests are done running?

~ John Williams




-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.