[wp-trac] Re: [WordPress Trac] #7779: Automatic plugin upgrade doesn't detect the effective uid correctly.

WordPress Trac wp-trac at lists.automattic.com
Mon Oct 6 03:11:50 GMT 2008


#7779: Automatic plugin upgrade doesn't detect the effective uid correctly.
-------------------------------+--------------------------------------------
 Reporter:  jamuraa            |        Owner:  DD32 
     Type:  defect             |       Status:  new  
 Priority:  normal             |    Milestone:       
Component:  Administration     |      Version:  2.6.1
 Severity:  normal             |   Resolution:       
 Keywords:  reporter-feedback  |  
-------------------------------+--------------------------------------------
Changes (by DD32):

  * keywords:  => reporter-feedback

Comment:

 Ok, After reading the docs and checking with some tests, No, This isnt the
 way to go.

 {{{getmyuid()}}} returns the user ID of the current script[[BR]]
 {{{posix_getuid()}}} returns the user ID of the current process

 Are there any examples of a case where it doesnt detect the owner
 correctly?

 A Better way of writing that function could be:

 {{{
 if ( fileowner(ABSPATH . '/wp-settings.php') == fileowner($temp_file) )
 }}}
 instead of
 {{{
 if ( getmyuid() == fileowner($temp_file) )
 }}}

 That way it's comparing file owners instead, and not relying on the
 current script knowing its effective UID -- But i dont have any setups i
 can test that on (They all work with getmyuid() ok)

 (Note: I've only got 2 setups which i can test direct access on at
 present, definately not a cover-all-bases setup)

 Setting to '''Reporter-Feedback''' for examples of a case where direct fs
 access is available, but not used.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/7779#comment:4>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list