Index: yubikey.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/yubikey/yubikey.inc,v
retrieving revision 1.1.2.1
diff -u -p -r1.1.2.1 yubikey.inc
--- yubikey.inc	4 Feb 2009 06:23:35 -0000	1.1.2.1
+++ yubikey.inc	8 Sep 2010 00:22:36 -0000
@@ -18,6 +18,11 @@ function yubikey_validate($otp, &$errstr
     return FALSE;
   }
 
+  if (!function_exists('curl_init')) {
+    drupal_set_message(t('A required PHP library is missing. Check the !status_report.', array('!status_report', l('status report', 'admin/reports/status'))), 'error');
+    return t('An error has occurred.');
+  }
+
   $api_key = variable_get('yubikey_apikey', NULL);
   $id      = variable_get('yubikey_apiid', NULL);
   $timeout = variable_get('yubikey_timeout', 10);
diff -u -p -r1.1.2.1 yubikey.install
--- yubikey.install	1970-01-01 10:00:00.000000000 +1000
+++ yubikey.install	2010-09-08 10:06:12.928901673 +1000
@@ -0,0 +1,42 @@
+<?php
+// $Id$
+/**
+ * Implementation of hook_requirements()
+ *
+ * Check that curl functions exist or refuse to install. This stops
+ * users without php-curl seeing a WSOD.
+ */
+function yubikey_requirements($phase) {
+  $requirements = array();
+  $t = get_t();
+  if ($phase == 'install') {
+    if (!function_exists('curl_init')) {
+      $requirements['curl_init'] = array(
+        'title' => $t('cURL Library'),
+        'value' => $t('Not installed'),
+        'description' => $t('cURL is a library that is required by Yubikey.'),
+        'severity' => REQUIREMENT_ERROR,
+      );
+    }
+  }
+
+  else if ($phase == 'runtime') {
+    if (!function_exists('curl_init')) {
+      $requirements['curl_init'] = array(
+        'title' => $t('cURL Library'),
+        'value' => $t('Not installed'),
+        'description' => $t('cURL is a library that is required by Yubikey.'),
+        'severity' => REQUIREMENT_ERROR,
+      );
+    }
+    else {
+      $curl_version = curl_version();
+      $requirements['curl_init'] = array(
+        'title' => $t('cURL Library'),
+        'value' => $t('PHP cURL Library !version', array('!version' => $curl_version['version'])),
+        'severity' => REQUIREMENT_OK,
+      );
+    }
+  }
+  return $requirements;
+}
