Since this is an authentication module it's really unnecessary for it to do a lot of thinking upon each page load, even when the user is already logged in. Wrapping most of webserver_auth_init() in if (!$user->uid) is my fix:

function webserver_auth_init() {
  global $user, $domain, $account;
  if (!$user->uid) {
 
   [SNIP]

  }
}

The reason why I need this very much is because I've made another module which is called upon hook_user('load') and would be called upon each and every page load, due to user_external_load($name) calling it.

Comments

moshe weitzman’s picture

Status: Needs review » Active

that makes sense but there was some reason i did it that way. i think in some cases you want to login as another user and we won't be able to change users if we never execute this code. note end of this comment:

//do nothing because user is already logged into Drupal, and hasn't presented different credentials vis web server

ronnqvist’s picture

OK... problem solved, wrap the code in this instead.
if ($user->name != $_SERVER["REMOTE_USER"]) {
(Of course you might want to do the trimming stuff to $_SERVER["REMOTE_USER"] first, but this worked for me.)

geste’s picture

With respect to Moshe's point #1....

In my circumstance, I never want to allow anybody to log in to Drupal as any ID other than what they are showing in REMOTE_USER. Although it was tricky at first to get my REMOTE_USER account promoted to admin.

After it was all set I simply removed login block. There's probably a gotcha here somewhere :)

ronnqvist’s picture

geste, I think you might have misunderstood Moshe here a little bit. I think he was talking about that if one wanted to log in as a different user, Drupal wouldn't recognise that change of user. My later patch fixes that however.

gaards’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

Closed because Drupal 4.7 is not supported. If the issue verifiably applies to later versions, please reopen with details and update the version.