diff -Naur drupal-5.1/includes/xmlrpcs.inc drupal-5.1+xmlrpc-authpatch/includes/xmlrpcs.inc
--- drupal-5.1/includes/xmlrpcs.inc	2007-03-23 13:28:52.000000000 +0100
+++ drupal-5.1+xmlrpc-authpatch/includes/xmlrpcs.inc	2007-03-23 13:33:34.000000000 +0100
@@ -8,6 +8,8 @@
  *   Array of external XML-RPC method names with the callbacks they map to.
  */
 function xmlrpc_server($callbacks) {
+  global $user;
+  
   $xmlrpc_server = new stdClass();
   // Define built-in XML-RPC method names
   $defaults = array(
@@ -33,7 +35,18 @@
       'system.methodHelp',
       'xmlrpc_server_method_help',
       array('string', 'string'),
-      'Returns a documentation string for the specified method.')
+      'Returns a documentation string for the specified method.'),
+    array(
+      'system.getToken',
+      'xmlrpc_server_get_token',
+      array('string','string','string'),
+      'Returns an authentication token'),
+    'system.destroyToken' => 'xmlrpc_server_destroy_token',
+    array(
+      'system.whoAmI',
+      'xmlrpc_server_whoami',
+      array('string'),
+      'Returns information about who you are')
   );
   // We build an array of all method names by combining the built-ins
   // with those defined by modules implementing the _xmlrpc hook.
@@ -316,3 +329,21 @@
   $xmlrpc_server = xmlrpc_server_get();
   return $xmlrpc_server->help[$method];
 }
+
+function xmlrpc_server_get_token($username,$password) {
+  global $user;
+  $user = user_authenticate($username,$password);
+  if ($user->uid)
+    return session_id();
+  }
+}
+function xmlrpc_server_destroy_token() {
+  sess_destroy(session_id());
+}
+
+function xmlrpc_server_whoami() {
+  global $user;
+  if ($user->uid == 0)
+    return variable_get('anonymous', 'Anonymous');
+  return $user->name;
+}
diff -Naur drupal-5.1/xmlrpc.php drupal-5.1+xmlrpc-authpatch/xmlrpc.php
--- drupal-5.1/xmlrpc.php	2007-03-23 13:29:15.000000000 +0100
+++ drupal-5.1+xmlrpc-authpatch/xmlrpc.php	2007-02-01 12:51:18.000000000 +0100
@@ -11,4 +11,16 @@
 include_once './includes/xmlrpc.inc';
 include_once './includes/xmlrpcs.inc';
 
+# Workaround needed for sess_read() and sess_write().
+$_COOKIE[session_name()] = true;
+
+if (isset($_GET['token'])) {
+    $token = trim($_GET['token']);
+    if (db_result(db_query("SELECT 1 FROM {sessions} WHERE sid='%s'",$token))) {
+        sess_destroy_sid(session_id()); // destroy the current anonymous session id
+        sess_read($token);
+        session_id($token);
+    }
+}
+
 xmlrpc_server(module_invoke_all('xmlrpc'));
