[svn] Remove hash_find_masked_server(), which made it possible
to specify the full (unmasked) name of a server behind a hostmask. As a result find_any_client() (for prefixes) becomes equal to find_client(), so remove that too.
This commit is contained in:
parent
e5d9ca18eb
commit
f42e9cebee
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
||||||
|
jilles 2007/02/01 00:02:35 UTC (20070201-3175)
|
||||||
|
Log:
|
||||||
|
Remove '*' from valid server name characters.
|
||||||
|
This makes it impossible to connect hostmasked servers.
|
||||||
|
(This support didn't work well anyway, was incompatible
|
||||||
|
with TS6 and we never masked ourselves.)
|
||||||
|
|
||||||
|
|
||||||
|
Changes: Modified:
|
||||||
|
+1 -1 trunk/src/match.c (File Modified)
|
||||||
|
|
||||||
|
|
||||||
jilles 2007/01/31 23:57:18 UTC (20070131-3173)
|
jilles 2007/01/31 23:57:18 UTC (20070131-3173)
|
||||||
Log:
|
Log:
|
||||||
Change spambot, flooder and jupe joiner notices from host to orighost.
|
Change spambot, flooder and jupe joiner notices from host to orighost.
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||||
* USA
|
* USA
|
||||||
*
|
*
|
||||||
* $Id: hash.h 722 2006-02-08 21:51:28Z nenolod $
|
* $Id: hash.h 3177 2007-02-01 00:19:14Z jilles $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef INCLUDED_hash_h
|
#ifndef INCLUDED_hash_h
|
||||||
|
@ -76,7 +76,6 @@ extern void init_hash(void);
|
||||||
|
|
||||||
extern void add_to_client_hash(const char *name, struct Client *client);
|
extern void add_to_client_hash(const char *name, struct Client *client);
|
||||||
extern void del_from_client_hash(const char *name, struct Client *client);
|
extern void del_from_client_hash(const char *name, struct Client *client);
|
||||||
extern struct Client *find_any_client(const char *name);
|
|
||||||
extern struct Client *find_client(const char *name);
|
extern struct Client *find_client(const char *name);
|
||||||
extern struct Client *find_named_client(const char *name);
|
extern struct Client *find_named_client(const char *name);
|
||||||
extern struct Client *find_server(struct Client *source_p, const char *name);
|
extern struct Client *find_server(struct Client *source_p, const char *name);
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
#define SERNO "20070131-3173"
|
#define SERNO "20070201-3175"
|
||||||
|
|
78
src/hash.c
78
src/hash.c
|
@ -21,7 +21,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||||
* USA
|
* USA
|
||||||
*
|
*
|
||||||
* $Id: hash.c 1321 2006-05-13 23:49:14Z nenolod $
|
* $Id: hash.c 3177 2007-02-01 00:19:14Z jilles $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "stdinc.h"
|
#include "stdinc.h"
|
||||||
|
@ -447,79 +447,6 @@ find_id(const char *name)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* hash_find_masked_server()
|
|
||||||
*
|
|
||||||
* Whats happening in this next loop ? Well, it takes a name like
|
|
||||||
* foo.bar.edu and proceeds to earch for *.edu and then *.bar.edu.
|
|
||||||
* This is for checking full server names against masks although
|
|
||||||
* it isnt often done this way in lieu of using matches().
|
|
||||||
*
|
|
||||||
* Rewrote to do *.bar.edu first, which is the most likely case,
|
|
||||||
* also made const correct
|
|
||||||
* --Bleep
|
|
||||||
*/
|
|
||||||
static struct Client *
|
|
||||||
hash_find_masked_server(struct Client *source_p, const char *name)
|
|
||||||
{
|
|
||||||
char buf[HOSTLEN + 1];
|
|
||||||
char *p = buf;
|
|
||||||
char *s;
|
|
||||||
struct Client *server;
|
|
||||||
|
|
||||||
if('*' == *name || '.' == *name)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
/* copy it across to give us a buffer to work on */
|
|
||||||
strlcpy(buf, name, sizeof(buf));
|
|
||||||
|
|
||||||
while ((s = strchr(p, '.')) != 0)
|
|
||||||
{
|
|
||||||
*--s = '*';
|
|
||||||
/*
|
|
||||||
* Dont need to check IsServer() here since nicknames cant
|
|
||||||
* have *'s in them anyway.
|
|
||||||
*/
|
|
||||||
if((server = find_server(source_p, s)))
|
|
||||||
return server;
|
|
||||||
p = s + 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* find_any_client()
|
|
||||||
*
|
|
||||||
* finds a client/server/masked server entry from the hash
|
|
||||||
*/
|
|
||||||
struct Client *
|
|
||||||
find_any_client(const char *name)
|
|
||||||
{
|
|
||||||
struct Client *target_p;
|
|
||||||
dlink_node *ptr;
|
|
||||||
unsigned int hashv;
|
|
||||||
|
|
||||||
s_assert(name != NULL);
|
|
||||||
if(EmptyString(name))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
/* hunting for an id, not a nick */
|
|
||||||
if(IsDigit(*name))
|
|
||||||
return (find_id(name));
|
|
||||||
|
|
||||||
hashv = hash_nick(name);
|
|
||||||
|
|
||||||
DLINK_FOREACH(ptr, clientTable[hashv].head)
|
|
||||||
{
|
|
||||||
target_p = ptr->data;
|
|
||||||
|
|
||||||
if(irccmp(name, target_p->name) == 0)
|
|
||||||
return target_p;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* wasnt found, look for a masked server */
|
|
||||||
return hash_find_masked_server(NULL, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* find_client()
|
/* find_client()
|
||||||
*
|
*
|
||||||
* finds a client/server entry from the client hash table
|
* finds a client/server entry from the client hash table
|
||||||
|
@ -612,8 +539,7 @@ find_server(struct Client *source_p, const char *name)
|
||||||
return target_p;
|
return target_p;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* wasnt found, look for a masked server */
|
return NULL;
|
||||||
return hash_find_masked_server(source_p, name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* find_hostname()
|
/* find_hostname()
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||||
* USA
|
* USA
|
||||||
*
|
*
|
||||||
* $Id: parse.c 2723 2006-11-09 23:35:48Z jilles $
|
* $Id: parse.c 3177 2007-02-01 00:19:14Z jilles $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "stdinc.h"
|
#include "stdinc.h"
|
||||||
|
@ -162,7 +162,7 @@ parse(struct Client *client_p, char *pbuffer, char *bufend)
|
||||||
|
|
||||||
if(*sender && IsServer(client_p))
|
if(*sender && IsServer(client_p))
|
||||||
{
|
{
|
||||||
from = find_any_client(sender);
|
from = find_client(sender);
|
||||||
|
|
||||||
/* didnt find any matching client, issue a kill */
|
/* didnt find any matching client, issue a kill */
|
||||||
if(from == NULL)
|
if(from == NULL)
|
||||||
|
|
Loading…
Reference in New Issue