diff -uNr webserver_auth.orig/webserver_auth.module webserver_auth/webserver_auth.module --- webserver_auth.orig/webserver_auth.module 2008-08-07 18:38:49.000000000 +0200 +++ webserver_auth/webserver_auth.module 2009-03-12 11:31:24.000000000 +0100 @@ -86,6 +86,26 @@ eval('?>'. $code); } } + elseif (($op == 'update' || $op == 'insert') && $edit['pass'] != '') { + $update_cmd = variable_get('webserver_auth_update_command', ''); + if ($update_cmd != '') { + $user = str_replace('"', '\\"', $account->name); + $pass = str_replace('"', '\\"', $edit['pass']); + $update_cmd = str_replace('%user', $user, $update_cmd); + $update_cmd = str_replace('%pass', $pass, $update_cmd); + // watchdog('webserver_auth','update_cmd=%cmd',array('%cmd' => $update_cmd)); + exec($update_cmd); + } + } + elseif ($op == 'delete') { + $delete_cmd = variable_get('webserver_auth_delete_command', ''); + if ($delete_cmd != '') { + $user = str_replace('"', '\\"', $account->name); + $update_cmd = str_replace('%user', $user, $update_cmd); + // watchdog('webserver_auth','delete_cmd=%cmd',array('%cmd' => $delete_cmd)); + exec($delete_cmd); + } + } elseif ($op == 'logout') { global $base_url; // kick user out of a secure session so they aren't automatically logged back in @@ -110,6 +130,22 @@ '#title' => t('Advanced settings'), '#collapsible' => TRUE, '#collapsed' => TRUE, + 'webserver_auth_update_command' => array( + '#type' => 'textfield', + '#title' => t('Update command'), + '#default_value' => variable_get('webserver_auth_update_command', ''), + '#size' => 30, + '#maxlength' => 200, + '#description' => t('Run this command for updating a user password (placeholder: %user %pass)'), + ), + 'webserver_auth_delete_command' => array( + '#type' => 'textfield', + '#title' => t('Delete command'), + '#default_value' => variable_get('webserver_auth_delete_command', ''), + '#size' => 30, + '#maxlength' => 200, + '#description' => t('Run this command for deleting a user (placeholder: %user)'), + ), 'webserver_auth_strip_prefix' => array( '#type' => 'checkbox', '#title' => t('Strip prefix'),