new_ipdata = static_cast<AuthUserIP *>(from->ip_list.head->data);
/* If this IP has expired - ignore the expensive merge actions. */
- if (new_ipdata->ip_expiretime + ::Config.authenticateIpTTL < squid_curtime) {
+ if (new_ipdata->ip_expiretime <= squid_curtime) {
/* This IP has expired - remove from the source list */
dlinkDelete(&new_ipdata->node, &(from->ip_list));
cbdataFree(new_ipdata);
/* update IP ttl and stop searching. */
ipdata->ip_expiretime = max(ipdata->ip_expiretime, new_ipdata->ip_expiretime);
break;
- } else if (ipdata->ip_expiretime + ::Config.authenticateIpTTL < squid_curtime) {
+ } else if (ipdata->ip_expiretime <= squid_curtime) {
/* This IP has expired - cleanup the destination list */
dlinkDelete(&ipdata->node, &ip_list);
cbdataFree(ipdata);
found = 1;
/* update IP ttl */
ipdata->ip_expiretime = squid_curtime;
- } else if (ipdata->ip_expiretime + ::Config.authenticateIpTTL < squid_curtime) {
+ } else if (ipdata->ip_expiretime <= squid_curtime) {
/* This IP has expired - remove from the seen list */
dlinkDelete(&ipdata->node, &ip_list);
cbdataFree(ipdata);
/* This ip is not in the seen list */
ipdata = cbdataAlloc(AuthUserIP);
- ipdata->ip_expiretime = squid_curtime;
+ ipdata->ip_expiretime = squid_curtime + ::Config.authenticateIpTTL;
ipdata->ipaddr = ipaddr;
// AYJ: must match re-definition in helpers/negotiate_auth/kerberos/negotiate_kerb_auth.cc
#define MAX_AUTHTOKEN_LEN 32768
-/// \ingroup AuthAPI
+/**
+ * Node used to link an IP address to some user credentials
+ * for the max_user_ip ACL feature.
+ *
+ * \ingroup AuthAPI
+ */
class AuthUserIP
{
public:
dlink_node node;
- /* IP addr this user authenticated from */
+ /// IP address this user authenticated from
Ip::Address ipaddr;
+
+ /** When this IP should be forgotten.
+ * Set to the time of last request made from this
+ * (user,IP) pair plus authenticate_ip_ttl seconds
+ */
time_t ip_expiretime;
};
NAME: authenticate_ip_ttl
TYPE: time_t
LOC: Config.authenticateIpTTL
-DEFAULT: 0 seconds
+DEFAULT: 1 second
DOC_START
If you use proxy authentication and the 'max_user_ip' ACL,
this directive controls how long Squid remembers the IP