develooper Front page | perl.perl5.porters | Postings from June 2003

Re: maint @ 19893

Thread Previous | Thread Next
From:
Nick Ing-Simmons
Date:
June 30, 2003 08:17
Subject:
Re: maint @ 19893
Message ID:
20030630151649.1894.7@bactrian.elixent.com
Jarkko Hietaniemi <jhi@iki.fi> writes:
>	http://www.iki.fi/jhi/perl@19893.tgz
>	http://www.iki.fi/jhi/perl@19893.tbz
>
>(or rsync -avz ftp.linux.activestate.com::perl-5.8.x perl-5.8.x)
>
>(This just in after I already rolled the tarballs: Win32ers may
> need to add dTHX; at the top of the Perl_doing_taint() in perl.c)

Which will get it to compile but it won't run.

Win32 perl starts thus:

EXTERN_C DllExport int
RunPerl(int argc, char **argv, char **env)
{
...
    PERL_SYS_INIT(&argc,&argv);

    if (!(my_perl = perl_alloc()))
	return (1);
    perl_construct(my_perl);
...


dosish.h:#    define PERL_SYS_INIT(c,v) EARLY_INIT2(*c,*v) MALLOC_CHECK_TAINT2(*c,*v) Perl_win32_init(c,v)

#ifndef EARLY_INIT2
#  define EARLY_INIT2(argcp,argvp) \
	STMT_START {		\
		PL_earlytaint = doing_taint(argcp, argvp, 0); \
	} STMT_END;
#endif


And 

Perl_doing_taint(int argc, char *argv[], char *envp[])
{
    dTHX;  // even if added
    int uid  = PerlProc_getuid();

}

Which is redirected via interpreter's "host".

So Win32 cannot call getuid() until it has an interpreter to contain a host 
to point at function to call. 

Adding the dTHX just gets a nice segfault when the NULL is de-refed.

HOWEVER as:

uid_t
getuid(void)
{
    return ROOT_UID;
}

uid_t
geteuid(void)
{
    return ROOT_UID;
}

and groups likewise (win32.c)


A fix is probably 

bool
Perl_doing_taint(int argc, char *argv[], char *envp[])
{
#ifdef WIN32
   return 0;
#else
...
#endif
}

My  guess is netware is probably similar.

So it might be easier to initialze PL_earlytaint = 0 
and not add the EARLY_INIT2() stuff to platforms which don't 
(really) "do" uid/gid.


-- 
Nick Ing-Simmons
http://www.ni-s.u-net.com/


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About