Re: [PHPLIB] making an auth that uses LDAP From: Sam C. Nicholson !! (scion <email protected>)
Date: 10/31/99

I have been having a fair bit of trouble making what I think are
the mose basic changes to local.inc to get myself started on
instantiating a subclass of auth for other than SQL lookups.

I am currently trying just hardcoded returns. $uid=25;

I was tripping over some things that were leading me in what
looked to ba a promising direction, but alas, I am pretty well
lost now, and need some help in geting started again.

I am running apache-1.3.9 and mod_php 3.0.12, and am using phplib-7.2.

I had something kind of working, and then I broke something badly.
I started all over again (including untarring the tarball-dist),
and now I get some errors that I haven't seen before, and I am
wondering if perhaps this is a bug in the lib?

The errors and my local.inc and prepend.php3 are attached. Other
than local and prepend, I am using the code from the tarball.

Any help would be greatly appreciated. Barring that, a hammer to
the head would probably make me feel better :)

Regards,
-sam

Here are the errors I get back through apache:

Warning: Uninitialized variable or array index or property (sid) in session.inc on line 396

Warning: Uninitialized variable in session.inc on line 96

Warning: Oops, php3_SetCookie called after header has been sent in session.inc on line 120

Warning: Cannot add more header information - the header was already sent (header information may be added only before any output is generated from the script - check for text or whitespace outside PHP tags, or calls to functions that output text) in session.inc on line 404

Here is my prepend.php3:

require($_PHPLIB["libdir"] . "ct_shm.inc");
require($_PHPLIB["libdir"] . "session.inc");
require($_PHPLIB["libdir"] . "auth.inc");
require($_PHPLIB["libdir"] . "perm.inc");
require($_PHPLIB["libdir"] . "user.inc");

/* Additional require statements go below this line */

/* Additional require statements go before this line */

require($_PHPLIB["libdir"] . "local.inc");
require($_PHPLIB["libdir"] . "page.inc");

Here is my local.inc:

class Example_CT_Shm extends CT_Shm {
  var $max_sessions = 500; ## number of maximum sessions
  var $shm_key = 0x123754; ## unique shm identifier
  var $shm_size = 64000; ## size of segment
}

class Example_Session extends Session {
  var $classname = "Example_Session";

  var $cookiename = ""; ## defaults to classname
  var $magic = "Hocuspocus"; ## ID seed
  var $mode = "cookie"; ## We propagate session IDs with cookies
  var $fallback_mode = "get";
  var $lifetime = 0; ## 0 = do session cookies, else minutes
  var $that_class = "Example_CT_Shm"; ## name of data storage container
  var $gc_probability = 5;
}

class Example_User extends User {
  var $classname = "Example_User";

  var $magic = "Abracadabra"; ## ID seed
  var $that_class = "Example_CT_Shm"; ## data storage container
}

class Example_Auth extends Auth {
  var $classname = "Example_Auth";

  var $lifetime = 15;

  function auth_loginform() {
    global $sess;
    global $_PHPLIB;

    include($_PHPLIB["libdir"] . "loginform.ihtml");
  }
  
  function auth_validatelogin() {
    global $username, $password;

    if(isset($username)) {
      $this->auth["uname"]=$username; ## This provides access for "loginform.ihtml"
    }
    
    
    $uid = false;
    
      $uid = 25;
      $this->auth["perm"] = "admin";
    return $uid;
  }
}

class Example_Default_Auth extends Example_Auth {
  var $classname = "Example_Default_Auth";
  
  var $nobody = true;
}

-
PHP3 Base Library Mailing List. Send messages to <phplib <email protected>>.
To unsubscribe, send "unsubscribe" to <phplib-request <email protected>> in
the body, not the subject, of your message.