From 05030fa6036d1b5fef1e374f6c19d59de49fd924 Mon Sep 17 00:00:00 2001 From: codemastr Date: Thu, 19 Feb 2004 00:16:26 +0000 Subject: [PATCH] Fixed allow::options::noident --- Changes | 1 + include/h.h | 4 ++-- src/s_bsd.c | 4 ++-- src/s_conf.c | 17 +++++++++++++---- src/s_user.c | 2 +- 5 files changed, 19 insertions(+), 9 deletions(-) diff --git a/Changes b/Changes index 2ddb874cd..9b4478eda 100644 --- a/Changes +++ b/Changes @@ -2902,3 +2902,4 @@ seen. gmtime warning still there if you added an invalid regex. Reported by Tony (#0001556). - Fixed the problem with services and SETHOST for unknown user errors (#0000893) reported by vorte[x] +- Made allow::options::noident work correctly (#0001416) reported by Zifnab diff --git a/include/h.h b/include/h.h index 1dbf4bacd..e051b816f 100644 --- a/include/h.h +++ b/include/h.h @@ -129,7 +129,7 @@ ConfigItem_vhost *Find_vhost(char *name); ConfigItem_deny_channel *Find_channel_allowed(char *name); ConfigItem_alias *Find_alias(char *name); ConfigItem_help *Find_Help(char *command); -int AllowClient(aClient *cptr, struct hostent *hp, char *sockhost); +int AllowClient(aClient *cptr, struct hostent *hp, char *sockhost, char *username); int parse_netmask(const char *text, struct IN_ADDR *addr, int *b); int match_ipv4(struct IN_ADDR *addr, struct IN_ADDR *mask, int b); #ifdef INET6 @@ -231,7 +231,7 @@ extern int readcalls, udpfd, resfd; extern aClient *add_connection(aClient *, int); extern int add_listener(aConfItem *); extern void add_local_domain(char *, int); -extern int check_client(aClient *); +extern int check_client(aClient *, char *); extern int check_server(aClient *, struct hostent *, aConfItem *, aConfItem *, int); extern int check_server_init(aClient *); diff --git a/src/s_bsd.c b/src/s_bsd.c index ebe9ffbf2..ca3446e8d 100644 --- a/src/s_bsd.c +++ b/src/s_bsd.c @@ -743,7 +743,7 @@ static int check_init(aClient *cptr, char *sockn, size_t size) * -1 = Access denied * -2 = Bad socket. */ -int check_client(aClient *cptr) +int check_client(aClient *cptr, char *username) { static char sockname[HOSTLEN + 1]; struct hostent *hp = NULL; @@ -776,7 +776,7 @@ int check_client(aClient *cptr) } } - if ((i = AllowClient(cptr, hp, sockname))) + if ((i = AllowClient(cptr, hp, sockname, username))) { return i; } diff --git a/src/s_conf.c b/src/s_conf.c index 939c02454..73c5a2db0 100644 --- a/src/s_conf.c +++ b/src/s_conf.c @@ -2265,7 +2265,7 @@ ConfigItem_ban *Find_banEx(char *host, short type, short type2) return NULL; } -int AllowClient(aClient *cptr, struct hostent *hp, char *sockhost) +int AllowClient(aClient *cptr, struct hostent *hp, char *sockhost, char *username) { ConfigItem_allow *aconf; char *hname; @@ -2299,7 +2299,10 @@ int AllowClient(aClient *cptr, struct hostent *hp, char *sockhost) * ALREADY sure that it is proper * lengths */ - (void)strcpy(uhost, cptr->username); + if (aconf->flags.noident) + strcpy(uhost, username); + else + (void)strcpy(uhost, cptr->username); (void)strcat(uhost, "@"); } else @@ -2316,7 +2319,10 @@ int AllowClient(aClient *cptr, struct hostent *hp, char *sockhost) if (index(aconf->ip, '@')) { - strncpyzt(uhost, cptr->username, sizeof(uhost)); + if (aconf->flags.noident) + strncpyzt(uhost, username, sizeof(uhost)); + else + strncpyzt(uhost, cptr->username, sizeof(uhost)); (void)strcat(uhost, "@"); } else @@ -2331,7 +2337,10 @@ int AllowClient(aClient *cptr, struct hostent *hp, char *sockhost) { if (index(aconf->hostname, '@')) { - strcpy(uhost, cptr->username); + if (aconf->flags.noident) + strcpy(uhost, username); + else + strcpy(uhost, cptr->username); strcat(uhost, "@localhost"); } else diff --git a/src/s_user.c b/src/s_user.c index ce9c38450..caf32a381 100644 --- a/src/s_user.c +++ b/src/s_user.c @@ -808,7 +808,7 @@ extern int register_user(aClient *cptr, aClient *sptr, char *nick, char *usernam if (MyConnect(sptr)) { - if ((i = check_client(sptr))) { + if ((i = check_client(sptr, username))) { /* This had return i; before -McSkaf */ if (i == -5) return FLUSH_BUFFER;