AuthUser::~AuthUser() was freeing memory in the middle of an allocated
buffer. I think AuthUser needs a strdup'd copy of the username,
rather than keeping a pointer to the buffer read from the helper.
Also I found 'xfree((char *)username());' really odd. This username()
method does not return a reference so it shouldn't be used as LHS
in the macro.
/*
- * $Id: AuthUser.cc,v 1.6 2007/05/09 07:36:24 wessels Exp $
+ * $Id: AuthUser.cc,v 1.7 2007/05/09 08:26:57 wessels Exp $
*
* DEBUG: section 29 Authenticator
* AUTHOR: Robert Collins
/* free seen ip address's */
clearIp();
- if (username())
- xfree((char *)username());
+ if (username_)
+ xfree((char*)username_);
/* prevent accidental reuse */
auth_type = AUTH_UNKNOWN;
/*
- * $Id: AuthUser.cci,v 1.1 2004/08/30 03:28:56 robertc Exp $
+ * $Id: AuthUser.cci,v 1.2 2007/05/09 08:26:57 wessels Exp $
*
* DEBUG: section 29 Authenticator
* AUTHOR: Robert Collins
AuthUser::username(char const*aString)
{
assert (!username() || !aString);
- username_ = aString;
+ username_ = xstrdup(aString);
}
void
/*
- * $Id: AuthUser.h,v 1.4 2007/05/09 07:45:58 wessels Exp $
+ * $Id: AuthUser.h,v 1.5 2007/05/09 08:26:57 wessels Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
private:
static void cacheCleanup (void *unused);
+ /*
+ * DPW 2007-05-08
+ * The username_ memory will be allocated via
+ * xstrdup(). It is our responsibility.
+ */
char const *username_;
/* what ip addresses has this user been seen at?, plus a list length cache */