Attached is a patch which makes the following changes:

  • Support for 123.123.*.*, 123.*.*.*, as well as the original 123.123.123.123 & 123.123.123.* IP formats.
  • Some extra logging information with watchdog.
  • Coder module formatting compliant thanks to deekayen's patch http://drupal.org/node/509028#comment-1973444 - however, the hook_boot support doesn't seem to work so switched back to hook_init.

The reason, I didn't go with tripper's patch, is because it seemed to require quite a bit more processing to do a simple task of checking more wildcarded IP addresses.

I've also listed below, a few new features and bug fixes that should be implemented to keep the module alive:

  • Auto logging out the user if the IP address configured in the user profile field is changed.
  • If the user does attempt to log out, they can't auto log back in without clearing their cookies (something to do with $_SESSION['ip_login_complete'] i think).
  • add a profile field type, so that some validation of the IP address format can be performed.
  • Add support for IP ranges in different formats, i.e. a from and to range (like tripper's patch), but also an IP with a subnet address.

I'd be happy to fix these issues above if given co-maintainer privileges, but the current module maintainer hasn't replied to any of my emails. Anyone have any contact with davidwhthomas, he still seems active on other module issues queues?

Thanks.

CommentFileSizeAuthor
#1 ip_login-ipranges.patch7.32 KBalexkb

Comments

alexkb’s picture

StatusFileSize
new7.32 KB

For whatever reason, the patch didn't attach. Trying again!

Also, this work is sponsored by The Monthly magazine.

davidwhthomas’s picture

Thanks, have these patches been reviewed and tested by the community?

alexkb’s picture

Hey David - no this is a new patch, so I guess we'll wait and see if anyone has any issues with it. Thanks for the prompt reply.

davidwhthomas’s picture

Looks good at a glance but would like it reviewed and approved by others before committing, thanks.
DT

awolfey’s picture

I have not tried alexkb's patch, but want to submit this as another option for the same effect.

<?php>

  //DB lookup uid with passed ip address or range
  $result = db_fetch_object(
    db_query("SELECT pv.uid, pv.value FROM {profile_values} pv
             INNER JOIN {profile_fields} pf ON pv.fid = pf.fid
             WHERE pf.name = '%s' AND (pv.value LIKE '%s' OR pv.value LIKE '%s')", $profile_field, '%'. $ip .'%', '%'. $ip_range. '%')
  );

?>

This allows you to use a textfield, list field or textarea to have any number of IPs for a user. I think this could be combined with the above patch's range changes.

My work on this was sponsored by Data-Scribe.

If you need to I can provide a patch.

generalelektrix’s picture

Thanks,

I did exactly the same thing to support multiple IP numbers and ranges. I'd love to see that implemented in the module as well as other ways to write ranges like subnet masks, etc.

jim kirkpatrick’s picture

Please see #791410: Improved: now supports logging in as alternate user plus comma separated values, IP ranges and wildcards for an improved D6 version supporting values like "10.11.12.13, 123.123.123.100-200, 123.123.124.*"

jim kirkpatrick’s picture

Status: Needs review » Closed (fixed)