This is happening to me with both the module for Drupal 6 & Drupal 5 on different sites. Whether I enter one IP address or a range, when I click 'Save Configuration' it adds 0.0.0.0 authenticates to: authenticated user to the list of Current IP Authenticators.

My Drupal 6 is a fresh install (6.2) with only TinyMCE and IMCE installed as additional modules. I'm testing using the Garland theme.

Let me know if I can provide any more info.
Any help would be appreciated - would be great module if I can get it to work for me.

All the best,
~ Dave

Comments

jonfrancisskydiver’s picture

I am working with the development version made for drupal 6. There is a slight problem. I have included a new version of the ipauth.install file here. After you overwrite your current .install file, please run the update.php script. The update will make certain that your ip_authenticator database table is named properly.

Looking again at your description of the problem, I am uncertain if this will fix your problem however. Are you certain that you're using the development version of Drupal 6?

Update:

Alright, I can't attach the file since drupal won't let me so I'll include it here (just cut and paste it). You can alternatively download it from the CVS:

// $Id: ipauth.install,v 1.5 2008/05/22 17:43:13 jonfrancisskydiver Exp $
/**
 * IP based authenticator
 * @author Jonathan T. Francis
 *
 */


/**
 * Implementation of hook_install().
 */
function ipauth_install() {

  if (!db_table_exists("ip_authenticator"))
    drupal_install_schema('ipauth');

  cache_clear_all();
  menu_rebuild();
}


/**
 * Implementation of hook_uninstall().
 */
function ipauth_uninstall() {
  if (db_table_exists("ip_authenticator")) {
    drupal_uninstall_schema('ipauth');
  }
  
  cache_clear_all('*', 'cache', TRUE);
  cache_clear_all('*', 'cache_filter', TRUE);
  cache_clear_all('*', 'cache_menu', TRUE);
  cache_clear_all('*', 'cache_page', TRUE);  
}


/**
 * Implementation of hook_schema().
 */
function ipauth_schema() {
  $schema['ip_authenticator'] = array(
    'description' => t('This table stores the single IP address and the IP ranges for specific user roles.'),
    'fields' => array(
      'id' => array(
        'description' => t('contains the unique ID for this IP authenticator'),
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'size' => 'normal'
      ),
      'ip1' => array(
        'description' => t('contains the first IP address'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE
      ),
      'ip2' => array(
        'description' => t('contains the second IP address'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE
      ),
      'roles' => array(
        'description' => t('Contains the role'),
        'type' => 'int',
        'size' => 'normal'
      )
    ),
    'primary key' => array('id')
  );
  return $schema;
}

function ipauth_update_1() {
  
  db_query("ALTER TABLE {ipAuthenticator} RENAME TO {ip_authenticator}");

}
function ipauth_update_2() {
  if (db_table_exists("ipAuthenticator"))
    db_query("ALTER TABLE {ipAuthenticator} RENAME TO {ip_authenticator}");
  
  if (db_table_exists("ip_auth"))
    db_query("ALTER TABLE {ip_auth} RENAME TO {ip_authenticator}");
  
  if (!db_table_exists("ip_authenticator"))
    drupal_install_schema('ipauth'); 
  

}
nico059’s picture

Sorry for not checking the issue queue before submitting the solution here:
http://drupal.org/node/272572

I had the same problem, due to negative ip2long conversion and database want integer unsigned.

jonfrancisskydiver’s picture

Could you give me your PHP version that you're using? I am using the un altered version and am not having this issue. Perhaps it is a PHP thing?

nico059’s picture

my php version is 5.2.4 on Mac OSX (same probleme on Windows XP)

Regards.

jonfrancisskydiver’s picture

Status: Active » Fixed

I have updated the code to properly use ip2long(). So I updated all occurrences of ip2long() to sprintf("%u", ip2long($ip)) That way the unsigned integer will be treated as a string and not an int at all. I had fixed this on the drupal5 version, but I guess I didn't do the same on drupal6. Once the dev snapshop of the module updates on 10/18/2008, try it out. You may have to update your database to include the unsigned integer and not the signed integer.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.