Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

[mp1 bug] mp_preload_module() bustage: msg#00128

apache.mod-perl.devel

Subject: [mp1 bug] mp_preload_module() bustage

After squirrelling down some source code, tracking something
completely unrelated, I came to notice something I believe
is busted.

mp_preload_module(char **name) gets called in perl_config.c
whenever processing a directive like Perl*Handler. Like this bit:

CHAR_P perl_cmd_push_handlers(char *hook, PERL_CMD_TYPE **cmd, char
*arg, pool *p)
{
SV *sva;
/* XXX ---> */ mp_preload_module(&arg);
sva = newSVpv(arg,0);

[...]

static void mp_preload_module(char **name)
{
if(ind(*name, ' ') >= 0) return;
if(**name == '-' && ++*name) return;
if(**name == '+') ++*name;
else if(!PERL_AUTOPRELOAD) return;
if(!PERL_RUNNING()) return;

if(!perl_module_is_loaded(*name)) {
MP_TRACE_d(fprintf(stderr,
"mod_perl: attempting to pre-load module `%s'\n",
*name));
perl_require_module(*name,NULL);
}
}

The extra logic at the top of mp_preload_module fixes up the module
name when calling PerlLogHandler (+|-)My::Handler.

Problem happens when you do either:

PerlLogHandler My::Module->somehandler
or
PerlLogHandler $My::Obj->somehandler

Each of those 2 cases will fall through to:
perl_require_module("My::Module->somehandler", NULL);
or
perl_require_module("$My::Obj->somehandler", NULL);

And that does little more than

eval "require My::Module->somehandler";

or

eval "require $My::Obj->somehandler";

In both cases, you have multiple problems...

First of them is that My::Module->somehandler gets called on startup (or
once per request if in a .htaccess) without a valid $r as argument.

Second one, the require call itself will most likely fail, trying to
require the value of Apache::OK.

I propose to fix mp_preload_module to be a bit smarter and skip those
odd cases...

But I wonder how come this issue hasn't been reported already? Am I
missing something terribly simple here?

Gozer out.

--
-- -----------------------------------------------------------------------------
Philippe M. Chiasson /gozer\@(cpan|ectoplasm)\.org/ 88C3A5A5 (122FF51B/C634E37B)
http://gozer.ectoplasm.org/ F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3 A5A5
Q: It is impossible to make anything foolproof because fools are so ingenious.
perl -e'$$=\${gozer};{$_=unpack(P7,pack(L,$$));/^JAm_pH\n$/&&print||$$++&&redo}'

Attachment: signature.asc
Description: This is a digitally signed message part

<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
hardware.arm.at...    cms.citadel.dev...    video.gstreamer...    java.facelets.u...    misc.basics.qna...    web.wiki.instik...    network.uip.use...    xdg.devel/2003-...    tex.bibtex.bibd...    finance.quotesp...    ietf.zeroconf/2...    redhat.blinux.g...    suse.db2/2003-0...    php.phpesp/2004...    uml.devel/2003-...    gnome.labyrinth...    qnx.openqnx.dev...    boot-loaders.gr...    db.dataperfect....    audio.audacity....    linux.uclinux.m...    editors.j.devel...    os.openbsd.tech...    kde.users.multi...   
Home | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe

Navigation