Page MenuHomeDevCentral

D883.id2243.diff
No OneTemporary

D883.id2243.diff

diff --git a/source/helpers.c b/source/helpers.c
--- a/source/helpers.c
+++ b/source/helpers.c
@@ -245,10 +245,11 @@
strlwr (uh);
#ifdef ENABLE_ENCRYPT
- if ((ptr = crypt (pass, salt)) == NULL)
+ ptr = crypt (pass, salt)
+ if (ptr == NULL)
return 0;
#else
- ptr = (char *)pass;
+ ptr = pass;
#endif
while (c)
@@ -259,15 +260,12 @@
return 0; /* no pass set */
if (strcmp (c->pass, ptr) == 0)
{
- if (c->chan[0] == '#' && c->chan[1] == '*')
- return c->level;
-
- if (*chan == '*')
- return c->level;
-
- if (strcasecmp (c->chan, chan) == 0)
+ if (has_access_for_this_channel (c->chan, chan))
+ {
return c->level;
+ }
+ S ("NOTICE %s :Pass verified but access is only for %s.\n", nick, c->chan);
return 0; /* don't match chan access */
}
}
@@ -276,6 +274,21 @@
return 0;
}
+int
+has_access_for_this_channel (char* config_chan, char* current_chan)
+{
+ if (config_chan[0] == '#' && config_chan[1] == '*')
+ return 1;
+
+ if (*current_chan == '*')
+ return 1;
+
+ if (strcasecmp (config_chan, current_chan) == 0)
+ return 1;
+
+ return 0;
+}
+
long
get_pass (char *data)
{
diff --git a/source/prototypes.h b/source/prototypes.h
--- a/source/prototypes.h
+++ b/source/prototypes.h
@@ -95,6 +95,7 @@
load_helpers (void),
scan_chan_users (char *, char *, char *),
do_login (char *, char *);
+int has_access_for_this_channel (char*, char*);
long do_lastcomm (char *, char *, char *),
setinfo_lastcomm (char *);
void parse (char *),

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 24, 23:02 (18 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2259011
Default Alt Text
D883.id2243.diff (1 KB)

Event Timeline