Only requried changes I found were:

  • on line 18, changed module_exist to module_exists
  • the .info file

Comments

skor’s picture

StatusFileSize
new95 bytes

Here's the .info

By the way, I've only tested it with Apache NTLM auth.

pillarsdotnet’s picture

Title: Udpate webserver_auth to 5.x » Update webserver_auth to 5.x
StatusFileSize
new2.75 KB

Here's another, more comprehensive patch.

Works with Apache/NTLM and pgsql.

(Should work with MySQL as well...)

geste’s picture

I am assuming that use of webserver_auth LDAP features under Drupal 5.x is dependent on recently-orphaned LDAP integration module getting sorted out and updated to version 5. I see some activity on that module, but hard to tell if it is coming to a 5.x conclusion.

pillarsdotnet’s picture

geste wrote:

I am assuming that use of webserver_auth LDAP features under Drupal 5.x is dependent on recently-orphaned LDAP integration module...

No, it doesn't. However, it does rely on a working Samba installation, which is not for the faint of heart or the lacking in cluefulness...

geste’s picture

My apologies. I was getting my modules mixed up. I have a working Samba+LDAP installation, but am using PubCookie for auth. Looking back at my 4.7, installation I see that the function I was concerned with (mapping LDAP info into Drupal profiles) is actually in ldap integration. So my question was misplaced.

skor’s picture

Status: Needs review » Reviewed & tested by the community

I have verified both of these patches work. As you can tell from the creativity of my patch, I'm not exactly qualified to comment on which is better, but either way, I'd call one of them RTBC. I'll leave it up to the module owner to decide.

Thanks Bob. Sorry it took me so long to check yours out.
Sean

geste’s picture

It may simply be my noob cluelessness, but I had no luck with either of these patches (applied against 4.7-dev download). This was on a new Drupal 5.1 install with LDAP integration added. Maybe it ios benign, but Bob's longer patch complains of a couple chunks not processed and produced a .rej file (which I could certainly forward). When I put that patched module in place, it errs out (blank page) when I log out and try to let WebAuth take over.

Anyhow, I am curious to know if you might be on the verge of committing this as 5.x. I am thinking if I can work with a new revision, I am less likely to shoot myself in the foot, patch-wise.

I have this running with 4.7 and it is grand. Thanks. Jim

skor’s picture

Are you sure you were applying the patch agains webserver_auth 4.7 Head? When I first tried to apply it against the released 4.7, I got a few rejected hunks as well.

skor’s picture

Just to be clear, my comment #8 above applies to Bob's more extensive patch. I believe my patch was against the released 4.7 webserver auth. Although it's only a 1 character change, so you could probably just edit the module yourself, seach for "module_exist" and change it to "module_exists". Then add the .info file and it should work.

geste’s picture

Skor,

Thanks. Just to get the basics going, I tried the "simple" update again (edit 4.7 "module_exist/s" and add info). I had it choke (go blank) once when I reloaded admin page, but it is working now.

A couple of points/questions:

Under 4.7 I had one small webserver_auth admin/settings page that let me set the email domain. If that exists under 5.x I am not seeing it. So I am trying to set in webserver_auth.module webserver_auth_settings with '#default_value' => "example.com", but this is not working yet.

New users are added to Drupal, but it does not add email yet and users initially get the following set of warnings (just on first access):

warning: array_keys() [function.array-keys]: The first argument should be an array in /var/www/html/modules/user/user.module on line 361.
warning: implode() [function.implode]: Bad arguments. in /var/www/html/modules/user/user.module on line 361. user
warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1 query: SELECT DISTINCT(p.perm) FROM role r INNER JOIN permission p ON p.rid = r.rid WHERE r.rid IN () in /var/www/html/includes/database.mysql.inc on line 172.

This set of warnings only appeared after I added webserver_auth module.

This is on an install with ldap_integration installed (though ldap_data is not released for 5.x yet) Not sure what is interacting with user.module here -- webserver_auth or ldap_integratyion....

Thanks,

Jim

bdeegee’s picture

FWIW, I ran the patch on the HEAD version and got the same error (below) as geste did, also upon first login. I am not using ldap_integration.

* warning: array_keys() [function.array-keys]: The first argument should be an array in C:\Inetpub\wwwroot\MCB\drupal5\modules\user\user.module on line 361.
* warning: implode() [function.implode]: Bad arguments. in C:\Inetpub\wwwroot\MCB\drupal5\modules\user\user.module on line 361.
* user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1 query: SELECT DISTINCT(p.perm) FROM role r INNER JOIN permission p ON p.rid = r.rid WHERE r.rid IN () in C:\Inetpub\wwwroot\MCB\drupal5\includes\database.mysql.inc on line 172.

skor’s picture

Here's a complete copy with Bob's patch applied. Try this and see if you still have the same problem.

bdeegee’s picture

I used the above copy of the patch. No change. Still got the same error messages.

skor’s picture

Status: Reviewed & tested by the community » Needs work

This is getting over my head, but maybe it's some interaction with another module?

My install has the following optional 5.1-dev core modules installed:

  • Blog
  • Book
  • color
  • comment
  • Help
  • Menu
  • Taxonomy

and the following contrib modules:

  • Content 5.x-1.2
  • Text 5.x-1.2
  • Event HEAD
  • Basic Event HEAD
  • Event Views HEAD
  • Organic groups 5.x-1.0
  • Organic groups calendars 4.7 with this patch
  • Views 5.x-1.4-2rc1
  • Views RSS 5.x-1.4-2rc1
  • Views UI 5.x-1.4-2rc1

How about yours?

geste’s picture

FYI, I never did get the webserver_auth configuration to show up under administration, so there was nowhere to configure mail domain. However, I went back and looked at my 4.7 installation and simply added a record to"variables" table:

webserver_auth_domain s:11:"example.com";

s:11 would be replaced by s:X where X is length of email domain.

So now webserver_auth adds email when it adds new user.

Jim

bdeegee’s picture

I think I may have found the conflict with this patch: the Profiles Module.

cybertron1’s picture

I have disabled the profile module, and I still got the errors mentioned above!!

any more ideas?
this is a great module for my intranet !!

cybertron1’s picture

I think I know what the problem is now, I don't know how to fix it though

The problem is access roles, the user that is created get access role 0 in authmap which generates this error because access role or RID cannot be 0, it have to be either 1 or 2 (1 is anonymous, and 2 is authenticated users, and so on)
However, this is what the user.module complains about, it seem to create the user perfectly but it doesn't create the rid correctly (probably because we don't use hook_user and user_save correctly)

I am to bad at programming to know how to convert the user_default array and the $user = user_save ( kasdlaksldk) array to hook_user() and user_save()
but I believe that if we do, we'll solve these problems.

I tried to do a dbquery that updates the authmap table and inserts rid = 2 where rid = 0, but it doesn't work until the user does a refresh of the page after doing his/hers first login,so it has to be solved inside the user_save() funktion if we are going to solve this.

this is also similar to this: http://drupal.org/node/56663 node.

cybertron1’s picture

I got it working!! Without the errors!!

Remove the line: $user = user_external_load($account->name);

and it shoudl work as expected without the sql errors

cybertron1’s picture

ok sorry guys, doesn't quite work as expected..

when I remove that line, all work great, until I try to logout, then it tries to recreate the account (which failes with a lot of sql errors)..

so I am trying to come up with a solution, but my ideas are running out, i believe the trouble is that $user is an array but when we load with user_external_load() it isn't an array anymore, but I can't figure out what to do...

cybertron1’s picture

ok, now it actually works!
no errors, the database seems fine, and this funktion is from the 4.7 version (not head) and also not the one found in this thread, but it should work with those too..
I am doing a database request to see if the user uid exist, and based on that it uses user_external_load, OR NOT!

function webserver_auth_init() {
  global $user, $account;

  if ($user->uid) {
    //do nothing because user is already logged into Drupal
  }
  else {
    if ($name = $_SERVER["REMOTE_USER"]) {
      // user is logged into webserver.
      $account->name = $name;
      //modules get to change the user bits before saving. use a global $account to do so.
      // only loaded modules will see this hook
      module_invoke_all("webserver_auth");
      // if we are in bootstrap, load user.module ourselves
      if (!module_exists('user')) {
       drupal_load('module', 'user');
      }

      // try to log into Drupal. if unsuccessful, register the user
     //if ($user = user_external_load($account->name);
    $query = db_query("select * from users where name = '%s'", $account->name);
    $user_exist = db_result($query);
    print $user_exist;
if ($user_exist == 0)
{
	  if (!$user->uid) {
        if (variable_get("user_register", 1) == 1) {
          $user_default = array("name" => $account->name, "pass" => "cyan", "init" => db_escape_string($name), "authname_webserver_auth" => $account->name, "status" => 1, "roles" => array(DRUPAL_AUTHENTICATED_RID));
          // TODO - the hook_user('register') will fire but only for loaded modules. cold be a problem for sites using page cache and that hook+operation
          $user = user_save("", array_merge($user_default, (array)$account));
          watchdog("user", "new user: $user->name (webserver_auth)", l(t("edit user"), "admin/user/edit/$user->uid"));
        }
else {
}
      }
      else {
       }
       
     }
     else {
    $user = user_external_load($account->name); 
	  }
      
    }
  }
}
freimers’s picture

Title: Update webserver_auth to 5.x » New PHPAUTH Module - Can't get webserver_auth to work under 5.1
StatusFileSize
new7.81 KB

I've been reading these emails and was not able to get webserver_auth to work.

I'm using mod_auth_mysql to authenticate to the Drupal database and needed an auto login to Drupal using the PHP basic authentication variables. Attached is the module I've called "phpauth".

You might want to look at it, I started with webserver_auth and looked at ldapauth.
It's very simple when you use the $user->name field instead of looking up the $account information and use user_authenticate.

I'm new to Drupal and don't begin to fully understand the module system.

I'm not sure why webserver_auth isn't using a password field and I have no idea what the function webserver_auth_webserver_auth is doing.

I added a phpauth_info function as it says it's required.

Although I couldn't get webserver_auth to work, it got me started in the right direction.

The attachment is a zip file that I put a .patch extension on to get it to send.

Thanks...

traveaux’s picture

Category: task » feature

Hello, I'm new on Drupal. Will there be a release for drupal 5.1?

skor’s picture

Title: New PHPAUTH Module - Can't get webserver_auth to work under 5.1 » Udpate webserver_auth to 5.x

Changing the issue title back to my original.

@freimers, you can easily get a CVS account to work on proposed new modules.

@traveaux, this module's author is a contributor to a lot of drupal modules, and collaborates on drupal core pretty heavily, so my guess is, he's either been very busy with other modules/projects (and for sure is busy right down trying to get stuff into core by the drupal 6.0 core code freeze July 1), or has the impression that this module isn't used much. Either way, I wouldn't expect a released 5.x version any time soon

My recommendation, if you're willing to get your hands dirty:
First - try my instructions in post #9 above to download the 4.7 version, seach for "module_exist" and change it to "module_exists". Then add the .info file from post #1 and it see if that works.

If not delete all that and download the 4.7-dev version, and apply Bob's patch from post #3.

Hopefully one of those will work for you. I'm not much of a programmer, and for webserver related reasons, I've moved on to the LDAP integration module, but post back here if you run into problems and I'll help where I can.

pillarsdotnet’s picture

Title: Udpate webserver_auth to 5.x » Update webserver_auth to 5.x

Correct typo in Title

moshe weitzman’s picture

Status: Needs work » Fixed

I committed the original patches, and added a menu callback so you could use the one setting that this module offers. If there are more bugs, please file them in new issues. So sorry for the massive delay.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.