--- enrol.php   2008-10-14 11:39:10.000000000 +0100
+++ enrol.php   2009-09-01 10:48:45.000000000 +0100
@@ -605,7 +605,7 @@
     if(preg_match('{<userid.*>(.*?)</userid>}is', $tagcontents, $matches)){ // added .* to <userid> tag, to allow <userid password="(.+)">
         $person->username = trim($matches[1]);
     }
-    if (preg_match('{userid password="(.+)">.*</userid>}is', $tagcontents, $matches)) {  // Password may be specified in IMS documents
+    if (preg_match('{userid.*password="(.+)".*</userid>}is', $tagcontents, $matches)) {  // Password may be specified in IMS documents
         $person->password = md5($matches[1]);
         $person->auth     = 'manual'; // A password has been specified in the IMS-E doc, so use it.
     }