I get "division by zero" errors in bcpowmod() when I try to login with an openid.

Using the nightly development snapshot:

Nightly development snapshot from DRUPAL-4-7--2
Download: openid-4.7.x-2.x-dev.tar.gz
Size: 20.68 KB
md5_file hash: ceb708cfde00b9820e2cfb78c3ed8d4d
First released: January 13, 2007 - 08:14
Last updated: February 17, 2007 - 14:07

The function openid_association() in openid.module seems to contain an error:

<?php
function openid_association($claimed_id, $idp_endpoint) {
  // Remove Old Associations:
  db_query("DELETE FROM {openid_association} WHERE created + expires_in < %d", time());

  // Check to see if we have an association for this IdP already
  $assoc_handle = db_result(db_query("SELECT assoc_handle FROM {openid_association} WHERE idp_endpoint_uri = '%s'", $idp_endpoint));
  if (empty($assoc_handle)) {
    $r = _openid_dh_rand(OPENID_DH_DEFAULT_MOD);
    $private = bcadd($r, 1);
    $public = bcpowmod($gen, $private, $mod);
    ...
?>    

Both $gen and $mod are not defined in this function; but they are used in the call to bcpowmod(), causing a division by zero.
Am I missing something ?

Comments

walkah’s picture

Status: Active » Fixed

sloppy re-factor my bad. committed fix.

Jo Wouters’s picture

Thank you!
No more 'division by zero's

Anonymous’s picture

Status: Fixed » Closed (fixed)