diff --git a/TODO b/TODO index 661c35dda..76eb97c43 100644 --- a/TODO +++ b/TODO @@ -59,7 +59,7 @@ [?] native win32 (VS2005/VS2008) [/] Bug fixes [x] Compilation without zlib headers fails - fixed - [ ] Compilation date and time in server welcome message is in OS locale - looks ugly 'cause often it's not match user's codepage + [x] Compilation date and time in server welcome message is in OS locale - looks ugly 'cause often it's not match user's codepage [ ] Improvments [ ] ircd shouldn't need bison/byacc/yacc or flex for compilation --- other stuff diff --git a/include/client.h b/include/client.h index 6c8564928..33491442a 100644 --- a/include/client.h +++ b/include/client.h @@ -298,6 +298,8 @@ struct PreClient rb_dlink_list dnsbl_queries; /* list of struct BlacklistClient * */ struct Blacklist *dnsbl_listed; /* first dnsbl where it's listed */ + + struct rb_sockaddr_storage lip; /* address of our side of the connection */ }; struct ListClient diff --git a/modules/core/m_message.c b/modules/core/m_message.c index fc0896ff3..658a2a309 100644 --- a/modules/core/m_message.c +++ b/modules/core/m_message.c @@ -916,7 +916,6 @@ handle_special(int p_or_n, const char *command, struct Client *client_p, struct Client *target_p; char *server; char *s; - int count; /* user[%host]@server addressed? * NOTE: users can send to user@server, but not user%host@server @@ -931,8 +930,6 @@ handle_special(int p_or_n, const char *command, struct Client *client_p, return; } - count = 0; - if(!IsOper(source_p)) { if(strchr(nick, '%') || (strncmp(nick, "opers", 5) == 0)) diff --git a/modules/core/m_server.c b/modules/core/m_server.c index 95926f10c..e9362df01 100644 --- a/modules/core/m_server.c +++ b/modules/core/m_server.c @@ -292,12 +292,6 @@ ms_server(struct Client *client_p, struct Client *source_p, int parc, const char * doesnt exist, although ircd can handle it, its not a realistic * solution.. --fl_ */ - /* It is behind a host-masked server. Completely ignore the - * server message(don't propagate or we will delink from whoever - * we propagate to). -A1kmm */ - if(irccmp(target_p->name, name) && target_p->from == client_p) - return 0; - sendto_one(client_p, "ERROR :Server %s already exists", name); sendto_realops_snomask(SNO_GENERAL, L_ALL, diff --git a/modules/m_whois.c b/modules/m_whois.c index 54c71a1d5..40a8d52e6 100644 --- a/modules/m_whois.c +++ b/modules/m_whois.c @@ -239,16 +239,9 @@ single_whois(struct Client *source_p, struct Client *target_p, int operspy) char *t; int tlen; hook_data_client hdata; - char *name; - char quest[] = "?"; int visible; int extra_space = 0; - if(target_p->name[0] == '\0') - name = quest; - else - name = target_p->name; - if(target_p->user == NULL) { s_assert(0); diff --git a/src/client.c b/src/client.c index 8e8dd6810..0f717bc77 100644 --- a/src/client.c +++ b/src/client.c @@ -1361,15 +1361,12 @@ static int qs_server(struct Client *client_p, struct Client *source_p, struct Client *from, const char *comment) { - struct Client *target_p; - if(source_p->servptr && source_p->servptr->serv) rb_dlinkDelete(&source_p->lnode, &source_p->servptr->serv->servers); else s_assert(0); rb_dlinkFindDestroy(source_p, &global_serv_list); - target_p = source_p->from; if(has_id(source_p)) del_from_id_hash(source_p->id, source_p); diff --git a/src/extban.c b/src/extban.c index c8a04df98..8890fccaf 100644 --- a/src/extban.c +++ b/src/extban.c @@ -68,17 +68,14 @@ int valid_extban(const char *banstr, struct Client *client_p, struct Channel *chptr, long mode_type) { const char *p; - int invert = 0, result = EXTBAN_INVALID; + int result = EXTBAN_INVALID; ExtbanFunc f; if (*banstr != '$') return 0; p = banstr + 1; if (*p == '~') - { - invert = 1; p++; - } f = extban_table[(unsigned char) ToLower(*p)]; if (*p != '\0') { diff --git a/src/hostmask.c b/src/hostmask.c index a0a193d5c..d02404882 100644 --- a/src/hostmask.c +++ b/src/hostmask.c @@ -446,7 +446,6 @@ find_exact_conf_by_address(const char *address, int type, const char *username) if(address == NULL) address = "/NOMATCH!/"; - arec = rb_malloc(sizeof(struct AddressRec)); masktype = parse_netmask(address, (struct sockaddr *)&addr, &bits); #ifdef RB_IPV6 if(masktype == HM_IPV6) diff --git a/src/listener.c b/src/listener.c index 0849ab63d..7f270a153 100644 --- a/src/listener.c +++ b/src/listener.c @@ -435,7 +435,7 @@ close_listeners() * any client list yet. */ static void -add_connection(struct Listener *listener, rb_fde_t *F, struct sockaddr *sai, void *ssl_ctl) +add_connection(struct Listener *listener, rb_fde_t *F, struct sockaddr *sai, struct sockaddr *lai, void *ssl_ctl) { struct Client *new_client; s_assert(NULL != listener); @@ -447,6 +447,7 @@ add_connection(struct Listener *listener, rb_fde_t *F, struct sockaddr *sai, voi new_client = make_client(NULL); memcpy(&new_client->localClient->ip, sai, sizeof(struct rb_sockaddr_storage)); + memcpy(&new_client->preClient->lip, lai, sizeof(struct rb_sockaddr_storage)); /* * copy address to 'sockhost' as a string, copy it to host too @@ -553,7 +554,7 @@ accept_ssld(rb_fde_t *F, struct sockaddr *addr, struct sockaddr *laddr, struct L rb_fde_t *xF[2]; rb_socketpair(AF_UNIX, SOCK_STREAM, 0, &xF[0], &xF[1], "Incoming ssld Connection"); ctl = start_ssld_accept(F, xF[1], rb_get_fd(xF[0])); /* this will close F for us */ - add_connection(listener, xF[0], addr, ctl); + add_connection(listener, xF[0], addr, laddr, ctl); } static void @@ -567,13 +568,13 @@ accept_callback(rb_fde_t *F, int status, struct sockaddr *addr, rb_socklen_t add if(getsockname(rb_get_fd(F), (struct sockaddr *) &lip, &locallen) < 0) { - /* this shouldn't fail so... */ - /* XXX add logging of this */ + /* this can fail if the connection disappeared in the meantime */ rb_close(F); + return; } if(listener->ssl) accept_ssld(F, addr, (struct sockaddr *)&lip, listener); else - add_connection(listener, F, addr, NULL); + add_connection(listener, F, addr, (struct sockaddr *)&lip, NULL); } diff --git a/src/newconf.c b/src/newconf.c index b8fcee13b..33bd7e023 100644 --- a/src/newconf.c +++ b/src/newconf.c @@ -560,6 +560,10 @@ conf_end_oper(struct TopConf *tc) return 0; } + + if (!yy_oper->privset) + yy_oper->privset = privilegeset_get("default"); + /* now, yy_oper_list contains a stack of oper_conf's with just user * and host in, yy_oper contains the rest of the information which * we need to copy into each element in yy_oper_list @@ -630,9 +634,6 @@ static void conf_set_oper_privset(void *data) { yy_oper->privset = privilegeset_get((char *) data); - - if (!yy_oper->privset) - yy_oper->privset = privilegeset_get("default"); } static void diff --git a/src/s_auth.c b/src/s_auth.c index 83407b37b..a6143bb11 100644 --- a/src/s_auth.c +++ b/src/s_auth.c @@ -297,7 +297,6 @@ static int start_auth_query(struct AuthRequest *auth) { struct rb_sockaddr_storage localaddr, destaddr; - socklen_t locallen = sizeof(struct rb_sockaddr_storage); rb_fde_t *F; int family; @@ -333,14 +332,7 @@ start_auth_query(struct AuthRequest *auth) * since the ident request must originate from that same address-- * and machines with multiple IP addresses are common now */ - memset(&localaddr, 0, locallen); - if(getsockname(rb_get_fd(auth->client->localClient->F), - (struct sockaddr *) &localaddr, &locallen) == -1) - { - /* can happen if connection was just closed */ - rb_close(F); - return 0; - } + localaddr = auth->client->preClient->lip; /* XXX mangle_mapped_sockaddr((struct sockaddr *)&localaddr); */ #ifdef RB_IPV6 diff --git a/src/s_user.c b/src/s_user.c index adbcea69b..6c81df8ea 100644 --- a/src/s_user.c +++ b/src/s_user.c @@ -975,6 +975,8 @@ user_mode(struct Client *client_p, struct Client *source_p, int parc, const char source_p->localClient->opername = NULL; rb_dlinkFindDestroy(source_p, &local_oper_list); + privilegeset_unref(source_p->localClient->privset); + source_p->localClient->privset = NULL; } rb_dlinkFindDestroy(source_p, &oper_list); diff --git a/src/version.c.SH b/src/version.c.SH index 769daf83e..59a5ee820 100644 --- a/src/version.c.SH +++ b/src/version.c.SH @@ -19,7 +19,7 @@ generation=`expr $generation + 1` uname=`uname -a` -creation=`date | \ +creation=`LC_ALL=C date | \ awk '{if (NF == 6) \ { print $1 " " $2 " " $3 " " $6 " at " $4 " " $5 } \ else \ diff --git a/ssld/ssld.c b/ssld/ssld.c index 58e1bd0f9..83ba7655e 100644 --- a/ssld/ssld.c +++ b/ssld/ssld.c @@ -1076,7 +1076,6 @@ main(int argc, char **argv) close(x); } -#if 0 x = open("/dev/null", O_RDWR); if(x >= 0) { @@ -1089,7 +1088,7 @@ main(int argc, char **argv) if(x > 2) close(x); } -#endif + setup_signals(); rb_lib_init(NULL, NULL, NULL, 0, maxfd, 1024, 4096); rb_init_rawbuffers(1024); diff --git a/tools/genssl.sh b/tools/genssl.sh index a55ae97ae..5e435487d 100755 --- a/tools/genssl.sh +++ b/tools/genssl.sh @@ -1,9 +1,6 @@ #!/bin/sh -echo "Generating certificate request .. " -openssl req -new -nodes -out ../etc/req.pem - echo "Generating self-signed certificate .. " -openssl req -x509 -days 365 -in ../etc/req.pem -key ../etc/rsa.key -out ../etc/cert.pem +openssl req -x509 -nodes -newkey rsa:1024 -keyout ../etc/test.key -out ../etc/test.cert echo "Generating Diffie-Hellman file for secure SSL/TLS negotiation .. " openssl dhparam -out ../etc/dh.pem 1024 @@ -11,8 +8,8 @@ openssl dhparam -out ../etc/dh.pem 1024 echo " Now change these lines in the IRCd config file: - ssl_private_key = "etc/rsa.key"; - ssl_cert = "etc/cert.pem"; + ssl_private_key = "etc/test.key"; + ssl_cert = "etc/test.cert"; ssl_dh_params = "etc/dh.pem"; Enjoy using ssl.