summaryrefslogtreecommitdiff
path: root/src/sessions.c
diff options
context:
space:
mode:
authortrystan trystan@31f1291d-b8d6-0310-a050-a5561fc1590b <trystan trystan@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>2004-12-02 06:06:47 +0000
committertrystan trystan@31f1291d-b8d6-0310-a050-a5561fc1590b <trystan trystan@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>2004-12-02 06:06:47 +0000
commitf18d506cad80b9ed28f02ee33f35332320f3ea04 (patch)
tree2d9d0cd5a48e4677dfefa114aca17e3f28926a79 /src/sessions.c
parent541f11e4b80cbb2cc76da34fb2e1659b5e8b0090 (diff)
BUILD : 1.7.6 (468) BUGS : N/A NOTES : 1. fixes del_session() warning when LimitSessions is disabled 2. actions.c is doxygen ready, along with code clean up 3. sessions.c cleaned up and moved some items around 4. ChanServ AKICK (pointed to freed memory) 5. servers.c is doxygen ready, along with some code clean up
git-svn-id: svn://svn.anope.org/anope/trunk@468 31f1291d-b8d6-0310-a050-a5561fc1590b git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@322 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/sessions.c')
-rw-r--r--src/sessions.c51
1 files changed, 26 insertions, 25 deletions
diff --git a/src/sessions.c b/src/sessions.c
index 939c92afb..86a440b35 100644
--- a/src/sessions.c
+++ b/src/sessions.c
@@ -51,36 +51,19 @@
/*************************************************************************/
-typedef struct session_ Session;
-struct session_ {
- Session *prev, *next;
- char *host;
- int count; /* Number of clients with this host */
- int hits; /* Number of subsequent kills for a host */
-};
-
/* I'm sure there is a better way to hash the list of hosts for which we are
* storing session information. This should be sufficient for the mean time.
* -TheShadow */
#define HASH(host) (((host)[0]&31)<<5 | ((host)[1]&31))
-static Session *sessionlist[1024];
-static int32 nsessions = 0;
+Session *sessionlist[1024];
+int32 nsessions = 0;
Exception *exceptions = NULL;
int16 nexceptions = 0;
/*************************************************************************/
-
-static Session *findsession(const char *host);
-
-static Exception *find_host_exception(const char *host);
-static int exception_add(User * u, const char *mask, const int limit,
- const char *reason, const char *who,
- const time_t expires);
-
-/*************************************************************************/
/****************************** Statistics *******************************/
/*************************************************************************/
@@ -195,13 +178,14 @@ int do_session(User * u)
/********************* Internal Session Functions ************************/
/*************************************************************************/
-static Session *findsession(const char *host)
+Session *findsession(const char *host)
{
Session *session;
int i;
- if (!host)
+ if (!host) {
return NULL;
+ }
for (i = 0; i < 1024; i++) {
for (session = sessionlist[i]; session; session = session->next) {
@@ -282,6 +266,20 @@ void del_session(const char *host)
{
Session *session;
+ if (!LimitSessions) {
+ if (debug) {
+ alog("debug: del_session called when LimitSessions is disabled");
+ }
+ return;
+ }
+
+ if (!host || !*host) {
+ if (debug) {
+ alog("debug: del_session called with NULL values");
+ }
+ return;
+ }
+
if (debug >= 2)
alog("debug: del_session() called");
@@ -291,7 +289,10 @@ void del_session(const char *host)
anope_cmd_global(s_OperServ,
"WARNING: Tried to delete non-existant session: \2%s",
host);
- alog("session: Tried to delete non-existant session: %s", host);
+ if (debug) {
+ alog("session: Tried to delete non-existant session: %s",
+ host);
+ }
return;
}
@@ -479,9 +480,9 @@ void save_rdb_exceptions()
/************************ Exception Manipulation *************************/
/*************************************************************************/
-static int exception_add(User * u, const char *mask, const int limit,
- const char *reason, const char *who,
- const time_t expires)
+int exception_add(User * u, const char *mask, const int limit,
+ const char *reason, const char *who,
+ const time_t expires)
{
int i;