I've tested the module and there's a bug in HTPasswdSync.module with the member name separator in the group file. I have to remove the comma after every member name in the group file in order to use the file for authentication.

Authentication, Authorization, and Access Control - Apache HTTP Server (1.3, 2.0)

Each line of the group file contains a groupname followed by a colon, followed by the member usernames separated by spaces.
Example: mygroup: bob joe anne

Comments

fasdalf@fasdalf.ru’s picture

use this hack. Change function

 function _htpasswdsync_updategroup() {
  
  $file = _htpasswdsync_grpfilename();
  $groups = array();
  _htpasswdsync_read_htfile($groups, $file);
  
  foreach (_htpasswdsync_roles() as $rid) {
    // get role name
    $res = db_fetch_object(db_query('SELECT name FROM {role} WHERE rid = %d', $rid));
    $name = $res->name;
    
    //empty group
    $groups[$name] = "";
    
    // add members to the group
    $res = db_query('SELECT name FROM {users} u, {users_roles} ur WHERE ur.rid = %d AND ur.uid = u.uid', $rid);
    while ($r = db_fetch_object($res)) {
      $groups[$name] .= $r->name .", ";
    }

    // get rid of tailing characters
    $groups[$name] = rtrim($groups[$name], ", ");
  }
  _htpasswdsync_write_htfile($groups, $file);
 }

to the following

 function _htpasswdsync_updategroup() {
  
  $file = _htpasswdsync_grpfilename();
  $groups = array();
  _htpasswdsync_read_htfile($groups, $file);
  
  foreach (_htpasswdsync_roles() as $rid) {
    // get role name
    $res = db_fetch_object(db_query('SELECT name FROM {role} WHERE rid = %d', $rid));
    $name = $res->name;
    
    //empty group
    $groups[$name] = "";
    
    // add members to the group
    $res = db_query('SELECT name FROM {users} u, {users_roles} ur WHERE ur.rid = %d AND ur.uid = u.uid', $rid);
    while ($r = db_fetch_object($res)) {
      $groups[$name] .=  " ".$r->name;
    }

  }
  _htpasswdsync_write_htfile($groups, $file);
 }
m.fu’s picture

Status: Active » Fixed

thanks for the patch.
it has been integrated.

m.fu’s picture

Status: Fixed » Closed (fixed)
Anonymous’s picture

Please mark an issue as fixed only. The issue is closed automatically after two weeks. During this time one can see that the problem was solved. ;-)

Thank you.

m.fu’s picture

Status: Closed (fixed) » Fixed

ok, I have put it back to fixed.

Status: Fixed » Closed (fixed)
Issue tags: -.htaccess

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