[Pmwiki-users] Handling unsupported functions (getrusage, crypt) AND Password never accepted

Michael Harris michaelharris
Fri Dec 17 18:03:09 CST 2004


Being away from work today, I have time to post this :-) but don't have exact version numbers used in my environment :-( to supply.  Will add them to this thread when I get back to work.  Generally, Novell Netware 6.5 server with NDS/eDirectory running Novell's port/implementation of Apache and PHP.  Browser is primarily MS Internet Explorer 6.x on Windows XPsp2.

Two topics:
- handling unsupported functions (due to old/incomplete/??? PHP implementation?)
- password entry never being accepted

I have searched the archives.... but failed to find or recognize a discussion related to this.

============================================================

Topic 1: Handling Unsupported Functions (getrusage, crypt)

GETRUSAGE:

pmwiki.php was abending on the
    if (function_exists('getrusage') && ($dat=getrusage())) {
line in function StopWatch.  This was presumably due to 1) getrusage not being supported and 2) the PHP processor not evaluating the complex conditional expression left-to-right (as it should?).

My quick fix was to comment out that if and its related code, and rely on the code that immediately follows it:
  function StopWatch($x) { 
    #if (function_exists('getrusage') && ($dat=getrusage())) {
    #  $GLOBALS['StopWatch'][] = 
    #    ($dat['ru_utime.tv_sec']+$dat['ru_utime.tv_usec']/1000000)." $x";
    #  return;
    #}
    list($usec,$sec) = explode(' ',microtime());
    $GLOBALS['StopWatch'][] = ($sec+$usec)." $x"; 
  }

I'm guessing that a nested if might work to assure order of evaluation?
    if (function_exists('getrusage') {
        If ($dat=getrusage() {
        ....
        ....

CRYPT:

When I added site passwords in config.php, pmwiki.php was abending on the
    if (crypt($AllowPassword,$passwd)==$passwd) return $page;    
line in function BasicAuth (and probably earlier was abending on the password line in config.php, as it also used crypt).  This was presumably due to 1) crypt not being supported and 2) lack of checking for not being supported.

My quick fix was to remove use of crypt from the password lines in config.php
and to comment out that if in pmwiki.php, and rely on the code the immediately preceeds it:
  if ($passwd=='') return $page;
  # if (crypt($AllowPassword,$passwd)==$passwd) return $page;

I'm guessing that checking for support of and only making conditional use of, the crypt function, as for the getrusage function, is desirable. 


============================================================

Topic 2: Password Never Accepted

Perhaps related to the crypt discussion above.....

PmWiki works fine when passwords are not set.  

When I set site's edit password (avoiding use of crypt as discussed above), clicking the edit link results in the password prompt/screen being presented..... but it never accepts the password (even when I copy/paste it out of the config.php)..... instead, it just keeps re-presenting the password prompt/screen.  

I haven't dug into the related code, but will.

In the meantime, any thoughts or suggestions?



I'm open to looking at other server OSs and versions of Apache and PHP at some point, but for now I need to try to get this working on the platform descirbed at the start of this note.

Thanks.

P.S.  Thanks for PmWiki.  Very fine work.  Strikes the balance just right.


    
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/pmwiki-users_pmichaud.com/attachments/20041217/2b90bd7c/attachment-0001.htm


More information about the pmwiki-users mailing list