--- webserver_auth.module	2008-08-07 09:38:49.000000000 -0700
+++ webserver_auth.insert_and_hook.module	2009-08-25 11:05:00.000000000 -0700
@@ -54,7 +54,19 @@ function webserver_auth_init() {
         // If unsuccessful, register the user. This will trigger
         // webserver_auth_user() and any other _user() hooks.
         user_external_login_register($authname, 'webserver_auth');
+        
+        // If the user exists and is still not in the authmap, inserts. This applies to users registered but not through authmap.
+        if ($user) {
+          $result = db_query("SELECT uid FROM {authmap} WHERE authname = '%s' AND module = 'webserver_auth'", $authname);
+          $expected = db_fetch_array($result);
+          if ($expected === FALSE) {
+            db_query("INSERT INTO {authmap} (uid, authname, module) VALUES (%s, '%s','webserver_auth')", $user->uid, $authname);
+          }
+        }        
       }
+      
+      // Call hook_webserver_auth_post_login($user);
+      module_invoke_all('webserver_auth_post_login', $user);
     }
   }
 }
