lists.barton.de
Anmelden
Registrieren
Anmelden
Registrieren
Diese Liste verwalten
×
Tastenkürzel
Thread-Ansicht
j
: Nächste ungelesene Nachricht
k
: Vorherige ungelesene Nachricht
j a
: Zu allen Threads wechseln
j l
: Zur Listenübersicht springen
2024
Dezember
November
Oktober
September
August
Juli
Juni
Mai
April
März
Februar
Januar
2023
Dezember
November
Oktober
September
August
Juli
Juni
Mai
April
März
Februar
Januar
2022
Dezember
November
Oktober
September
August
Juli
Juni
Mai
April
März
Februar
Januar
2021
Dezember
November
Oktober
September
August
Juli
Juni
Mai
April
März
Februar
Januar
2020
Dezember
November
Oktober
September
August
Juli
Juni
Mai
April
März
Februar
Januar
2019
Dezember
November
Oktober
September
August
Juli
Juni
Mai
April
März
Februar
Januar
2018
Dezember
November
Oktober
September
August
Juli
Juni
Mai
April
März
Februar
Januar
2017
Dezember
November
Oktober
September
August
Juli
Juni
Mai
April
März
Februar
Januar
2016
Dezember
November
Oktober
September
August
Juli
Juni
Mai
April
März
Februar
Januar
2015
Dezember
November
Oktober
September
August
Juli
Juni
Mai
April
März
Februar
Januar
2014
Dezember
November
Oktober
September
August
Juli
Juni
Mai
April
März
Februar
Januar
2013
Dezember
November
Oktober
September
August
Juli
Juni
Mai
April
März
Februar
Januar
2012
Dezember
November
Oktober
September
August
Juli
Juni
Mai
April
März
Februar
Januar
2011
Dezember
November
Oktober
September
August
Juli
Juni
Mai
April
März
Februar
Januar
2010
Dezember
November
Oktober
September
August
Juli
Juni
Mai
April
März
Februar
Januar
2009
Dezember
November
Oktober
September
August
Juli
Juni
Mai
April
März
Februar
Januar
2008
Dezember
November
Oktober
September
August
Juli
Juni
Mai
April
März
Februar
Januar
2007
Dezember
November
Oktober
September
August
Juli
Juni
Mai
April
März
Februar
Januar
2006
Dezember
November
Oktober
September
August
Juli
Juni
Mai
April
März
Februar
Januar
2005
Dezember
November
Oktober
September
August
Juli
Juni
Mai
April
März
Listenübersicht
Herunterladen
ngIRCd GIT Updates
September 2009
----- 2024 -----
Dezember 2024
November 2024
Oktober 2024
September 2024
August 2024
Juli 2024
Juni 2024
Mai 2024
April 2024
März 2024
Februar 2024
Januar 2024
----- 2023 -----
Dezember 2023
November 2023
Oktober 2023
September 2023
August 2023
Juli 2023
Juni 2023
Mai 2023
April 2023
März 2023
Februar 2023
Januar 2023
----- 2022 -----
Dezember 2022
November 2022
Oktober 2022
September 2022
August 2022
Juli 2022
Juni 2022
Mai 2022
April 2022
März 2022
Februar 2022
Januar 2022
----- 2021 -----
Dezember 2021
November 2021
Oktober 2021
September 2021
August 2021
Juli 2021
Juni 2021
Mai 2021
April 2021
März 2021
Februar 2021
Januar 2021
----- 2020 -----
Dezember 2020
November 2020
Oktober 2020
September 2020
August 2020
Juli 2020
Juni 2020
Mai 2020
April 2020
März 2020
Februar 2020
Januar 2020
----- 2019 -----
Dezember 2019
November 2019
Oktober 2019
September 2019
August 2019
Juli 2019
Juni 2019
Mai 2019
April 2019
März 2019
Februar 2019
Januar 2019
----- 2018 -----
Dezember 2018
November 2018
Oktober 2018
September 2018
August 2018
Juli 2018
Juni 2018
Mai 2018
April 2018
März 2018
Februar 2018
Januar 2018
----- 2017 -----
Dezember 2017
November 2017
Oktober 2017
September 2017
August 2017
Juli 2017
Juni 2017
Mai 2017
April 2017
März 2017
Februar 2017
Januar 2017
----- 2016 -----
Dezember 2016
November 2016
Oktober 2016
September 2016
August 2016
Juli 2016
Juni 2016
Mai 2016
April 2016
März 2016
Februar 2016
Januar 2016
----- 2015 -----
Dezember 2015
November 2015
Oktober 2015
September 2015
August 2015
Juli 2015
Juni 2015
Mai 2015
April 2015
März 2015
Februar 2015
Januar 2015
----- 2014 -----
Dezember 2014
November 2014
Oktober 2014
September 2014
August 2014
Juli 2014
Juni 2014
Mai 2014
April 2014
März 2014
Februar 2014
Januar 2014
----- 2013 -----
Dezember 2013
November 2013
Oktober 2013
September 2013
August 2013
Juli 2013
Juni 2013
Mai 2013
April 2013
März 2013
Februar 2013
Januar 2013
----- 2012 -----
Dezember 2012
November 2012
Oktober 2012
September 2012
August 2012
Juli 2012
Juni 2012
Mai 2012
April 2012
März 2012
Februar 2012
Januar 2012
----- 2011 -----
Dezember 2011
November 2011
Oktober 2011
September 2011
August 2011
Juli 2011
Juni 2011
Mai 2011
April 2011
März 2011
Februar 2011
Januar 2011
----- 2010 -----
Dezember 2010
November 2010
Oktober 2010
September 2010
August 2010
Juli 2010
Juni 2010
Mai 2010
April 2010
März 2010
Februar 2010
Januar 2010
----- 2009 -----
Dezember 2009
November 2009
Oktober 2009
September 2009
August 2009
Juli 2009
Juni 2009
Mai 2009
April 2009
März 2009
Februar 2009
Januar 2009
----- 2008 -----
Dezember 2008
November 2008
Oktober 2008
September 2008
August 2008
Juli 2008
Juni 2008
Mai 2008
April 2008
März 2008
Februar 2008
Januar 2008
----- 2007 -----
Dezember 2007
November 2007
Oktober 2007
September 2007
August 2007
Juli 2007
Juni 2007
Mai 2007
April 2007
März 2007
Februar 2007
Januar 2007
----- 2006 -----
Dezember 2006
November 2006
Oktober 2006
September 2006
August 2006
Juli 2006
Juni 2006
Mai 2006
April 2006
März 2006
Februar 2006
Januar 2006
----- 2005 -----
Dezember 2005
November 2005
Oktober 2005
September 2005
August 2005
Juli 2005
Juni 2005
Mai 2005
April 2005
März 2005
ngircd-commits@lists.barton.de
2 Teilnehmer
36 Diskussionen
Einen n
N
euen Thread beginnen
Alexander Barton : CONNECT, DISCONNECT: generate WALLOPS messages
by alex@arthur.barton.de
30 Sep '09
30 Sep '09
Module: ngircd.git Branch: master Commit: 30b584c2e8632f94312dc9575fccc510a2b437c0 URL:
http://ngircd.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git&a=commit;h=30b584c2…
Author: Alexander Barton <alex(a)barton.de> Date: Tue May 6 17:51:45 2008 +0200 CONNECT, DISCONNECT: generate WALLOPS messages --- src/ngircd/irc-oper.c | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/src/ngircd/irc-oper.c b/src/ngircd/irc-oper.c index aae071b..0824149 100644 --- a/src/ngircd/irc-oper.c +++ b/src/ngircd/irc-oper.c @@ -16,6 +16,7 @@ #include "imp.h" #include <assert.h> +#include <stdio.h> #include <stdlib.h> #include <string.h> @@ -206,6 +207,7 @@ IRC_RESTART( CLIENT *Client, REQUEST *Req ) GLOBAL bool IRC_CONNECT(CLIENT * Client, REQUEST * Req) { + char msg[LINE_LEN + 64]; assert(Client != NULL); assert(Req != NULL); @@ -223,6 +225,10 @@ IRC_CONNECT(CLIENT * Client, REQUEST * Req) return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG, Client_ID(Client), Req->command); + snprintf(msg, sizeof(msg), "Received CONNECT %s from %s", + Req->argv[0], Client_ID(Client)); + IRC_SendWallops(Client_ThisServer(), Client_ThisServer(), msg); + Log(LOG_NOTICE | LOG_snotice, "Got CONNECT command from \"%s\" for \"%s\".", Client_Mask(Client), Req->argv[0]); @@ -263,6 +269,7 @@ GLOBAL bool IRC_DISCONNECT(CLIENT * Client, REQUEST * Req) { CONN_ID my_conn; + char msg[LINE_LEN + 64]; assert(Client != NULL); assert(Req != NULL); @@ -275,6 +282,10 @@ IRC_DISCONNECT(CLIENT * Client, REQUEST * Req) return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG, Client_ID(Client), Req->command); + snprintf(msg, sizeof(msg), "Received DISCONNECT %s from %s", + Req->argv[0], Client_ID(Client)); + IRC_SendWallops(Client_ThisServer(), Client_ThisServer(), msg); + Log(LOG_NOTICE | LOG_snotice, "Got DISCONNECT command from \"%s\" for \"%s\".", Client_Mask(Client), Req->argv[0]);
1
0
0
0
Alexander Barton : New function IRC_SendWallops().
by alex@arthur.barton.de
30 Sep '09
30 Sep '09
Module: ngircd.git Branch: master Commit: eaaf0c3bd5ce4f48205ca928fba994d0c44e59b2 URL:
http://ngircd.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git&a=commit;h=eaaf0c3b…
Author: Alexander Barton <alex(a)barton.de> Date: Tue May 6 15:30:29 2008 +0200 New function IRC_SendWallops(). Implement new global function IRC_SendWallops() that can be called by other functions to generate WALLOPS messages to users with +w mode. --- src/ngircd/irc-oper.c | 26 ++++---------------------- src/ngircd/irc-write.c | 30 +++++++++++++++++++++++++++++- src/ngircd/irc-write.h | 3 +++ 3 files changed, 36 insertions(+), 23 deletions(-) diff --git a/src/ngircd/irc-oper.c b/src/ngircd/irc-oper.c index 868d0ad..aae071b 100644 --- a/src/ngircd/irc-oper.c +++ b/src/ngircd/irc-oper.c @@ -298,8 +298,7 @@ IRC_DISCONNECT(CLIENT * Client, REQUEST * Req) GLOBAL bool IRC_WALLOPS( CLIENT *Client, REQUEST *Req ) { - CLIENT *to, *from; - int client_type; + CLIENT *from; assert( Client != NULL ); assert( Req != NULL ); @@ -307,8 +306,7 @@ IRC_WALLOPS( CLIENT *Client, REQUEST *Req ) if (Req->argc != 1) return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG, Client_ID(Client), Req->command); - client_type = Client_Type(Client); - switch (client_type) { + switch (Client_Type(Client)) { case CLIENT_USER: if (!Client_OperByMe(Client)) return IRC_WriteStrClient(Client, ERR_NOPRIVILEGES_MSG, Client_ID(Client)); @@ -324,25 +322,9 @@ IRC_WALLOPS( CLIENT *Client, REQUEST *Req ) if (!from) return IRC_WriteStrClient(Client, ERR_NOSUCHNICK_MSG, Client_ID(Client), Req->prefix); - for (to=Client_First(); to != NULL; to=Client_Next(to)) { - if (Client_Conn(to) < 0) /* no local connection or WALLOPS origin */ - continue; - - client_type = Client_Type(to); - switch (client_type) { - case CLIENT_USER: - if (Client_HasMode(to, 'w')) - IRC_WriteStrClientPrefix(to, from, "WALLOPS :%s", Req->argv[0]); - break; - case CLIENT_SERVER: - if (to != Client) - IRC_WriteStrClientPrefix(to, from, "WALLOPS :%s", Req->argv[0]); - break; - } - } + IRC_SendWallops(Client, from, Req->argv[0]); return CONNECTED; -} - +} /* IRC_WALLOPS */ /* -eof- */ diff --git a/src/ngircd/irc-write.c b/src/ngircd/irc-write.c index ea0f5f8..dae78e5 100644 --- a/src/ngircd/irc-write.c +++ b/src/ngircd/irc-write.c @@ -1,6 +1,6 @@ /* * ngIRCd -- The Next Generation IRC Daemon - * Copyright (c)2001-2005 by Alexander Barton (alex(a)barton.de) + * Copyright (c)2001-2008 Alexander Barton (alex(a)barton.de) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -405,6 +405,34 @@ va_dcl } /* IRC_WriteStrRelatedPrefix */ +/** + * Send WALLOPS message. + */ +GLOBAL void +IRC_SendWallops(CLIENT *Client, CLIENT *From, const char *Message) +{ + CLIENT *to; + + for (to=Client_First(); to != NULL; to=Client_Next(to)) { + if (Client_Conn(to) == NONE) /* no local connection */ + continue; + + switch (Client_Type(to)) { + case CLIENT_USER: + if (Client_HasMode(to, 'w')) + IRC_WriteStrClientPrefix(to, From, + "WALLOPS :%s", Message); + break; + case CLIENT_SERVER: + if (to != Client) + IRC_WriteStrClientPrefix(to, From, + "WALLOPS :%s", Message); + break; + } + } +} /* IRC_SendWallops */ + + GLOBAL void IRC_SetPenalty( CLIENT *Client, time_t Seconds ) { diff --git a/src/ngircd/irc-write.h b/src/ngircd/irc-write.h index 51c8f0c..5bac0de 100644 --- a/src/ngircd/irc-write.h +++ b/src/ngircd/irc-write.h @@ -35,6 +35,9 @@ GLOBAL void IRC_WriteStrServersPrefixFlag_CB PARAMS((CLIENT *ExceptOf, GLOBAL bool IRC_WriteStrRelatedPrefix PARAMS((CLIENT *Client, CLIENT *Prefix, bool Remote, char *Format, ...)); +GLOBAL void IRC_SendWallops PARAMS((CLIENT *Client, CLIENT *From, + const char *Message)); + GLOBAL void IRC_SetPenalty PARAMS((CLIENT *Client, time_t Seconds)); #endif
1
0
0
0
Alexander Barton : Code cleanup of IRC_DISCONNECT().
by alex@arthur.barton.de
30 Sep '09
30 Sep '09
Module: ngircd.git Branch: master Commit: 9a7499af8bb3c4b781492fef216c86cf7ab04134 URL:
http://ngircd.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git&a=commit;h=9a7499af…
Author: Alexander Barton <alex(a)barton.de> Date: Sun Apr 13 03:19:29 2008 +0200 Code cleanup of IRC_DISCONNECT(). --- src/ngircd/irc-oper.c | 37 +++++++++++++++++++++++-------------- 1 files changed, 23 insertions(+), 14 deletions(-) diff --git a/src/ngircd/irc-oper.c b/src/ngircd/irc-oper.c index 7033031..868d0ad 100644 --- a/src/ngircd/irc-oper.c +++ b/src/ngircd/irc-oper.c @@ -1,6 +1,6 @@ /* * ngIRCd -- The Next Generation IRC Daemon - * Copyright (c)2001,2002 by Alexander Barton (alex(a)barton.de) + * Copyright (c)2001-2008 Alexander Barton (alex(a)barton.de) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -256,34 +256,43 @@ IRC_CONNECT(CLIENT * Client, REQUEST * Req) } /* IRC_CONNECT */ +/** + * Disconnect (and disable) configured server. + */ GLOBAL bool -IRC_DISCONNECT(CLIENT *Client, REQUEST *Req ) +IRC_DISCONNECT(CLIENT * Client, REQUEST * Req) { - /* Disconnect and disable configured server */ - CONN_ID my_conn; - assert( Client != NULL ); - assert( Req != NULL ); + assert(Client != NULL); + assert(Req != NULL); if (!Check_Oper(Client)) return No_Privileges(Client, Req); /* Bad number of parameters? */ - if( Req->argc != 1 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command ); + if (Req->argc != 1) + return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG, + Client_ID(Client), Req->command); - Log( LOG_NOTICE|LOG_snotice, "Got DISCONNECT command from \"%s\" for0 \"%s\".", Client_Mask( Client ), Req->argv[0]); + Log(LOG_NOTICE | LOG_snotice, + "Got DISCONNECT command from \"%s\" for \"%s\".", + Client_Mask(Client), Req->argv[0]); /* Save ID of this connection */ - my_conn = Client_Conn( Client ); + my_conn = Client_Conn(Client); - /* Connect configured server */ - if( ! Conf_DisableServer( Req->argv[0] )) return IRC_WriteStrClient( Client, ERR_NOSUCHSERVER_MSG, Client_ID( Client ), Req->argv[0] ); + /* Disconnect configured server */ + if (!Conf_DisableServer(Req->argv[0])) + return IRC_WriteStrClient(Client, ERR_NOSUCHSERVER_MSG, + Client_ID(Client), Req->argv[0]); /* Are we still connected or were we killed, too? */ - if( Conn_GetClient( my_conn )) return CONNECTED; - else return DISCONNECTED; -} /* IRC_CONNECT */ + if (Conn_GetClient(my_conn)) + return CONNECTED; + else + return DISCONNECTED; +} /* IRC_DISCONNECT */ GLOBAL bool
1
0
0
0
Alexander Barton : Code cleanup of IRC_SQUIT() in preparation to deal with bug #73.
by alex@arthur.barton.de
30 Sep '09
30 Sep '09
Module: ngircd.git Branch: master Commit: bce16c2864309d5fc7da8d0591120466303aa966 URL:
http://ngircd.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git&a=commit;h=bce16c28…
Author: Alexander Barton <alex(a)barton.de> Date: Wed Apr 9 19:49:34 2008 +0200 Code cleanup of IRC_SQUIT() in preparation to deal with bug #73. --- src/ngircd/irc-server.c | 63 +++++++++++++++++++++++++++------------------- 1 files changed, 37 insertions(+), 26 deletions(-) diff --git a/src/ngircd/irc-server.c b/src/ngircd/irc-server.c index 3c34c20..b75a34f 100644 --- a/src/ngircd/irc-server.c +++ b/src/ngircd/irc-server.c @@ -266,44 +266,55 @@ IRC_NJOIN( CLIENT *Client, REQUEST *Req ) } /* IRC_NJOIN */ +/** + * Handler for the IRC command "SQUIT". + * See RFC 2813 section 4.1.2 and RFC 2812 section 3.1.8. + */ GLOBAL bool -IRC_SQUIT( CLIENT *Client, REQUEST *Req ) +IRC_SQUIT(CLIENT * Client, REQUEST * Req) { CLIENT *target; char msg[LINE_LEN + 64]; - assert( Client != NULL ); - assert( Req != NULL ); + assert(Client != NULL); + assert(Req != NULL); - if( Req->argc != 2 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command ); + /* Bad number of arguments? */ + if (Req->argc != 2) + return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG, + Client_ID(Client), Req->command); - Log( LOG_DEBUG, "Got SQUIT from %s for \"%s\": \"%s\" ...", Client_ID( Client ), Req->argv[0], Req->argv[1] ); + Log(LOG_DEBUG, "Got SQUIT from %s for \"%s\": \"%s\" ...", + Client_ID(Client), Req->argv[0], Req->argv[1]); - target = Client_Search( Req->argv[0] ); - if( ! target ) - { - Log( LOG_WARNING, "Got SQUIT from %s for unknown server \"%s\"!?", Client_ID( Client ), Req->argv[0] ); + target = Client_Search(Req->argv[0]); + if (!target) { + /* The server is (already) unknown */ + Log(LOG_WARNING, + "Got SQUIT from %s for unknown server \"%s\"!?", + Client_ID(Client), Req->argv[0]); return CONNECTED; } - if( Req->argv[1][0] ) - { - if( strlen( Req->argv[1] ) > LINE_LEN ) Req->argv[1][LINE_LEN] = '\0'; - snprintf( msg, sizeof( msg ), "%s (SQUIT from %s).", Req->argv[1], Client_ID( Client )); - } - else snprintf( msg, sizeof( msg ), "Got SQUIT from %s.", Client_ID( Client )); - - if( Client_Conn( target ) > NONE ) - { - /* This server has the connection */ - if( Req->argv[1][0] ) Conn_Close( Client_Conn( target ), msg, Req->argv[1], true); - else Conn_Close( Client_Conn( target ), msg, NULL, true); + if (Req->argv[1][0]) { + if (strlen(Req->argv[1]) > LINE_LEN) + Req->argv[1][LINE_LEN] = '\0'; + snprintf(msg, sizeof(msg), "%s (SQUIT from %s).", Req->argv[1], + Client_ID(Client)); + } else + snprintf(msg, sizeof(msg), "Got SQUIT from %s.", + Client_ID(Client)); + + if (Client_Conn(target) > NONE) { + /* We are directly connected to this server */ + if (Req->argv[1][0]) + Conn_Close(Client_Conn(target), msg, Req->argv[1], + true); + else + Conn_Close(Client_Conn(target), msg, NULL, true); return DISCONNECTED; - } - else - { - /* connection was on another server */ - Client_Destroy( target, msg, Req->argv[1], false ); + } else { + Client_Destroy(target, msg, Req->argv[1], false); return CONNECTED; } } /* IRC_SQUIT */
1
0
0
0
Alexander Barton : New local functions Check_Oper() and No_Privileges().
by alex@arthur.barton.de
30 Sep '09
30 Sep '09
Module: ngircd.git Branch: master Commit: 926204cacd05f49f24e79d0af404c2da4cfdbe3a URL:
http://ngircd.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git&a=commit;h=926204ca…
Author: Alexander Barton <alex(a)barton.de> Date: Sun Apr 13 19:25:46 2008 +0200 New local functions Check_Oper() and No_Privileges(). --- src/ngircd/irc-oper.c | 53 ++++++++++++++++++++++++++++++++++++------------- 1 files changed, 39 insertions(+), 14 deletions(-) diff --git a/src/ngircd/irc-oper.c b/src/ngircd/irc-oper.c index 736163c..7033031 100644 --- a/src/ngircd/irc-oper.c +++ b/src/ngircd/irc-oper.c @@ -50,6 +50,35 @@ Bad_OperPass(CLIENT *Client, char *errtoken, char *errmsg) } /* Bad_OperPass */ +/** + * Check that the client is an IRC operator allowed to administer this server. + */ +static bool +Check_Oper(CLIENT * Client) +{ + if (!Client_HasMode(Client, 'o')) + return false; + if (!Client_OperByMe(Client) && !Conf_AllowRemoteOper) + return false; + /* The client is an local IRC operator, or this server is configured + * to trust remote operators. */ + return true; +} /* CheckOper */ + + +/** + * Return and log a "no privileges" message. + */ +static bool +No_Privileges(CLIENT * Client, REQUEST * Req) +{ + Log(LOG_NOTICE, "No privileges: client \"%s\", command \"%s\"", + Client_Mask(Client), Req->command); + return IRC_WriteStrClient(Client, ERR_NOPRIVILEGES_MSG, + Client_ID(Client)); +} /* PermissionDenied */ + + GLOBAL bool IRC_OPER( CLIENT *Client, REQUEST *Req ) { @@ -98,10 +127,8 @@ IRC_DIE(CLIENT * Client, REQUEST * Req) assert(Client != NULL); assert(Req != NULL); - /* Not a local IRC operator? */ - if ((!Client_HasMode(Client, 'o')) || (!Client_OperByMe(Client))) - return IRC_WriteStrClient(Client, ERR_NOPRIVILEGES_MSG, - Client_ID(Client)); + if (!Check_Oper(Client)) + return No_Privileges(Client, Req); /* Bad number of parameters? */ #ifdef STRICT_RFC @@ -140,8 +167,8 @@ IRC_REHASH( CLIENT *Client, REQUEST *Req ) assert( Client != NULL ); assert( Req != NULL ); - /* Not a local IRC operator? */ - if(( ! Client_HasMode( Client, 'o' )) || ( ! Client_OperByMe( Client ))) return IRC_WriteStrClient( Client, ERR_NOPRIVILEGES_MSG, Client_ID( Client )); + if (!Check_Oper(Client)) + return No_Privileges(Client, Req); /* Bad number of parameters? */ if( Req->argc != 0 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command ); @@ -161,8 +188,8 @@ IRC_RESTART( CLIENT *Client, REQUEST *Req ) assert( Client != NULL ); assert( Req != NULL ); - /* Not a local IRC operator? */ - if(( ! Client_HasMode( Client, 'o' )) || ( ! Client_OperByMe( Client ))) return IRC_WriteStrClient( Client, ERR_NOPRIVILEGES_MSG, Client_ID( Client )); + if (!Check_Oper(Client)) + return No_Privileges(Client, Req); /* Bad number of parameters? */ if( Req->argc != 0 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command ); @@ -183,10 +210,8 @@ IRC_CONNECT(CLIENT * Client, REQUEST * Req) assert(Client != NULL); assert(Req != NULL); - /* Not a local IRC operator? */ - if ((!Client_HasMode(Client, 'o')) || (!Client_OperByMe(Client))) - return IRC_WriteStrClient(Client, ERR_NOPRIVILEGES_MSG, - Client_ID(Client)); + if (!Check_Oper(Client)) + return No_Privileges(Client, Req); /* Bad number of parameters? */ if ((Req->argc != 1) && (Req->argc != 2) && (Req->argc != 5)) @@ -241,8 +266,8 @@ IRC_DISCONNECT(CLIENT *Client, REQUEST *Req ) assert( Client != NULL ); assert( Req != NULL ); - /* Not a local IRC operator? */ - if(( ! Client_HasMode( Client, 'o' )) || ( ! Client_OperByMe( Client ))) return IRC_WriteStrClient( Client, ERR_NOPRIVILEGES_MSG, Client_ID( Client )); + if (!Check_Oper(Client)) + return No_Privileges(Client, Req); /* Bad number of parameters? */ if( Req->argc != 1 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
1
0
0
0
Alexander Barton : Bad_OperPass(): code cleanup.
by alex@arthur.barton.de
30 Sep '09
30 Sep '09
Module: ngircd.git Branch: master Commit: 3bf0c6f3b9cbeded68c2c7f7a6f2a020616b73f5 URL:
http://ngircd.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git&a=commit;h=3bf0c6f3…
Author: Alexander Barton <alex(a)barton.de> Date: Sun Apr 13 17:30:04 2008 +0200 Bad_OperPass(): code cleanup. --- src/ngircd/irc-oper.c | 15 ++++++++++----- 1 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/ngircd/irc-oper.c b/src/ngircd/irc-oper.c index b0271df..736163c 100644 --- a/src/ngircd/irc-oper.c +++ b/src/ngircd/irc-oper.c @@ -35,14 +35,19 @@ #include "irc-oper.h" +/** + * Handle invalid received OPER command. + * Log OPER attempt and send error message to client. + */ static bool Bad_OperPass(CLIENT *Client, char *errtoken, char *errmsg) { - Log( LOG_WARNING, "Got invalid OPER from \"%s\": \"%s\" -- %s", Client_Mask( Client ), - errtoken, errmsg); + Log(LOG_WARNING, "Got invalid OPER from \"%s\": \"%s\" -- %s", + Client_Mask(Client), errtoken, errmsg); IRC_SetPenalty(Client, 3); - return IRC_WriteStrClient( Client, ERR_PASSWDMISMATCH_MSG, Client_ID( Client )); -} + return IRC_WriteStrClient(Client, ERR_PASSWDMISMATCH_MSG, + Client_ID(Client)); +} /* Bad_OperPass */ GLOBAL bool @@ -63,7 +68,7 @@ IRC_OPER( CLIENT *Client, REQUEST *Req ) return Bad_OperPass(Client, Req->argv[0], "not configured"); if( strcmp( Conf_Oper[i].pwd, Req->argv[1] ) != 0 ) - return Bad_OperPass(Client, Conf_Oper[i].name, "Bad password"); + return Bad_OperPass(Client, Conf_Oper[i].name, "bad password"); if( Conf_Oper[i].mask && (! Match( Conf_Oper[i].mask, Client_Mask( Client ) ))) return Bad_OperPass(Client, Conf_Oper[i].mask, "hostmask check failed" );
1
0
0
0
Alexander Barton : New configuration option "AllowRemoteOper"
by alex@arthur.barton.de
30 Sep '09
30 Sep '09
Module: ngircd.git Branch: master Commit: f78b0c61e967c66386803a3dc77069c66bd664de URL:
http://ngircd.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git&a=commit;h=f78b0c61…
Author: Alexander Barton <alex(a)barton.de> Date: Sun Apr 13 16:39:08 2008 +0200 New configuration option "AllowRemoteOper" Added new configuration option "AllowRemoteOper" to control whether remote IRC operators are allowed to use administrative commands that affect this server or not This commit introduces the configuration variable, but actually no function is using it. That's up for the next patches to come ... --- doc/sample-ngircd.conf | 4 ++ man/ngircd.conf.5.tmpl | 5 +++ src/ngircd/conf.c | 94 +++++++++++++++++++++++++++--------------------- src/ngircd/conf.h | 13 ++++--- 4 files changed, 70 insertions(+), 46 deletions(-) diff --git a/doc/sample-ngircd.conf b/doc/sample-ngircd.conf index 0d0061b..b945224 100644 --- a/doc/sample-ngircd.conf +++ b/doc/sample-ngircd.conf @@ -115,6 +115,10 @@ # server? (This is a compatibility hack for ircd-irc2 servers) ;OperServerMode = no + # Are remote IRC operators allowed to control this server, e. g. + # use commands like CONNECT, SQUIT, DIE, ...? + ;AllowRemoteOper = no + # Allow Pre-Defined Channels only (see Section [Channels]) ;PredefChannelsOnly = no diff --git a/man/ngircd.conf.5.tmpl b/man/ngircd.conf.5.tmpl index a725af6..d9e6f46 100644 --- a/man/ngircd.conf.5.tmpl +++ b/man/ngircd.conf.5.tmpl @@ -179,6 +179,11 @@ If \fBOperCanUseMode\fR is enabled, this may lead the compatibility problems wit Servers that run the ircd-irc2 Software. This Option "masks" mode requests by non-chanops as if they were coming from the server. Default: no. .TP +\fBAllowRemoteOper\fR +Are IRC operators connected to remote servers allowed to control this server, +e. g. are they allowed to use administrative commands like CONNECT, DIE, +SQUIT, ... that affect this server? Default: no. +.TP \fBPredefChannelsOnly\fR If enabled, no new channels can be created. Useful if you do not want to have channels other than those defined in diff --git a/src/ngircd/conf.c b/src/ngircd/conf.c index c50f8f9..c728d55 100644 --- a/src/ngircd/conf.c +++ b/src/ngircd/conf.c @@ -263,7 +263,6 @@ Conf_Test( void ) printf( " PidFile = %s\n", Conf_PidFile); printf(" Listen = %s\n", Conf_ListenAddress); fputs(" Ports = ", stdout); - ports_puts(&Conf_ListenPorts); #ifdef SSL_SUPPORT fputs(" SSLPorts = ", stdout); @@ -272,29 +271,34 @@ Conf_Test( void ) config_valid = false; #endif - pwd = getpwuid( Conf_UID ); - if( pwd ) printf( " ServerUID = %s\n", pwd->pw_name ); - else printf( " ServerUID = %ld\n", (long)Conf_UID ); - grp = getgrgid( Conf_GID ); - if( grp ) printf( " ServerGID = %s\n", grp->gr_name ); - else printf( " ServerGID = %ld\n", (long)Conf_GID ); - printf( " PingTimeout = %d\n", Conf_PingTimeout ); - printf( " PongTimeout = %d\n", Conf_PongTimeout ); - printf( " ConnectRetry = %d\n", Conf_ConnectRetry ); - printf( " OperCanUseMode = %s\n", yesno_to_str(Conf_OperCanMode)); - printf( " OperServerMode = %s\n", yesno_to_str(Conf_OperServerMode)); - printf( " PredefChannelsOnly = %s\n", yesno_to_str(Conf_PredefChannelsOnly)); - printf( " NoDNS = %s\n", yesno_to_str(Conf_NoDNS)); - printf( " NoIdent = %s\n", yesno_to_str(Conf_NoIdent)); + pwd = getpwuid(Conf_UID); + if (pwd) + printf(" ServerUID = %s\n", pwd->pw_name); + else + printf(" ServerUID = %ld\n", (long)Conf_UID); + grp = getgrgid(Conf_GID); + if (grp) + printf(" ServerGID = %s\n", grp->gr_name); + else + printf(" ServerGID = %ld\n", (long)Conf_GID); + printf(" PingTimeout = %d\n", Conf_PingTimeout); + printf(" PongTimeout = %d\n", Conf_PongTimeout); + printf(" ConnectRetry = %d\n", Conf_ConnectRetry); + printf(" OperCanUseMode = %s\n", yesno_to_str(Conf_OperCanMode)); + printf(" OperServerMode = %s\n", yesno_to_str(Conf_OperServerMode)); + printf(" AllowRemoteOper = %s\n", yesno_to_str(Conf_AllowRemoteOper)); + printf(" PredefChannelsOnly = %s\n", yesno_to_str(Conf_PredefChannelsOnly)); + printf(" NoDNS = %s\n", yesno_to_str(Conf_NoDNS)); + printf(" NoIdent = %s\n", yesno_to_str(Conf_NoIdent)); #ifdef WANT_IPV6 printf(" ConnectIPv4 = %s\n", yesno_to_str(Conf_ConnectIPv6)); printf(" ConnectIPv6 = %s\n", yesno_to_str(Conf_ConnectIPv4)); #endif - printf( " MaxConnections = %ld\n", Conf_MaxConnections); - printf( " MaxConnectionsIP = %d\n", Conf_MaxConnectionsIP); - printf( " MaxJoins = %d\n", Conf_MaxJoins>0 ? Conf_MaxJoins : -1); - printf( " MaxNickLength = %u\n\n", Conf_MaxNickLength - 1); + printf(" MaxConnections = %ld\n", Conf_MaxConnections); + printf(" MaxConnectionsIP = %d\n", Conf_MaxConnectionsIP); + printf(" MaxJoins = %d\n", Conf_MaxJoins > 0 ? Conf_MaxJoins : -1); + printf(" MaxNickLength = %u\n\n", Conf_MaxNickLength - 1); for( i = 0; i < Conf_Oper_Count; i++ ) { if( ! Conf_Oper[i].name[0] ) continue; @@ -511,47 +515,47 @@ Conf_IsService(int ConfServer, const char *Nick) } /* Conf_IsService */ +/** + * Initialize configuration settings with their default values. + */ static void -Set_Defaults( bool InitServers ) +Set_Defaults(bool InitServers) { - /* Initialize configuration variables with default values. */ - int i; - strcpy( Conf_ServerName, "" ); - snprintf( Conf_ServerInfo, sizeof Conf_ServerInfo, "%s %s", PACKAGE_NAME, PACKAGE_VERSION ); - strcpy( Conf_ServerPwd, "" ); - - strcpy( Conf_ServerAdmin1, "" ); - strcpy( Conf_ServerAdmin2, "" ); - strcpy( Conf_ServerAdminMail, "" ); - - strlcpy( Conf_MotdFile, SYSCONFDIR, sizeof( Conf_MotdFile )); - strlcat( Conf_MotdFile, MOTD_FILE, sizeof( Conf_MotdFile )); + strcpy(Conf_ServerName, ""); + snprintf(Conf_ServerInfo, sizeof Conf_ServerInfo, "%s %s", + PACKAGE_NAME, PACKAGE_VERSION); + strcpy(Conf_ServerPwd, ""); - strlcpy( Conf_MotdPhrase, MOTD_PHRASE, sizeof( Conf_MotdPhrase )); + strcpy(Conf_ServerAdmin1, ""); + strcpy(Conf_ServerAdmin2, ""); + strcpy(Conf_ServerAdminMail, ""); - strlcpy( Conf_Chroot, CHROOT_DIR, sizeof( Conf_Chroot )); + strlcpy(Conf_MotdFile, SYSCONFDIR, sizeof(Conf_MotdFile)); + strlcat(Conf_MotdFile, MOTD_FILE, sizeof(Conf_MotdFile)); + strlcpy(Conf_MotdPhrase, MOTD_PHRASE, sizeof(Conf_MotdPhrase)); - strlcpy( Conf_PidFile, PID_FILE, sizeof( Conf_PidFile )); + Conf_UID = Conf_GID = 0; + strlcpy(Conf_Chroot, CHROOT_DIR, sizeof(Conf_Chroot)); + strlcpy(Conf_PidFile, PID_FILE, sizeof(Conf_PidFile)); free(Conf_ListenAddress); Conf_ListenAddress = NULL; - Conf_UID = Conf_GID = 0; Conf_PingTimeout = 120; Conf_PongTimeout = 20; - Conf_ConnectRetry = 60; + Conf_NoDNS = false; + Conf_NoIdent = false; Conf_Oper_Count = 0; Conf_Channel_Count = 0; Conf_OperCanMode = false; - Conf_NoDNS = false; - Conf_NoIdent = false; - Conf_PredefChannelsOnly = false; Conf_OperServerMode = false; + Conf_AllowRemoteOper = false; + Conf_PredefChannelsOnly = false; Conf_ConnectIPv4 = true; Conf_ConnectIPv6 = true; @@ -562,7 +566,10 @@ Set_Defaults( bool InitServers ) Conf_MaxNickLength = CLIENT_NICK_LEN_DEFAULT; /* Initialize server configuration structures */ - if( InitServers ) for( i = 0; i < MAX_SERVERS; Init_Server_Struct( &Conf_Server[i++] )); + if (InitServers) { + for (i = 0; i < MAX_SERVERS; + Init_Server_Struct(&Conf_Server[i++])); + } } /* Set_Defaults */ @@ -974,6 +981,11 @@ Handle_GLOBAL( int Line, char *Var, char *Arg ) Conf_OperServerMode = Check_ArgIsTrue( Arg ); return; } + if(strcasecmp(Var, "AllowRemoteOper") == 0) { + /* Are remote IRC operators allowed to control this server? */ + Conf_AllowRemoteOper = Check_ArgIsTrue(Arg); + return; + } if( strcasecmp( Var, "MaxConnections" ) == 0 ) { /* Maximum number of connections. 0 -> "no limit". */ #ifdef HAVE_ISDIGIT diff --git a/src/ngircd/conf.h b/src/ngircd/conf.h index 9bdecde..2308e4c 100644 --- a/src/ngircd/conf.h +++ b/src/ngircd/conf.h @@ -140,6 +140,14 @@ GLOBAL bool Conf_PredefChannelsOnly; /* Are IRC operators allowed to always use MODE? */ GLOBAL bool Conf_OperCanMode; +/* If an IRC op gives chanop privileges without being a chanop, + * ircd2 will ignore the command. This enables a workaround: + * It masks the command as coming from the server */ +GLOBAL bool Conf_OperServerMode; + +/* Are remote IRC operators allowed to manage this server? */ +GLOBAL bool Conf_AllowRemoteOper; + /* Disable all DNS functions? */ GLOBAL bool Conf_NoDNS; @@ -155,11 +163,6 @@ GLOBAL bool Conf_ConnectIPv6; /* same as above, but for ipv4 hosts, default: yes */ GLOBAL bool Conf_ConnectIPv4; -/* If an IRC op gives chanop privileges without being a chanop, - * ircd2 will ignore the command. This enables a workaround: - * It masks the command as coming from the server */ -GLOBAL bool Conf_OperServerMode; - /* Maximum number of connections to this server */ GLOBAL long Conf_MaxConnections;
1
0
0
0
Florian Westphal : fix assertion failure in ng_ipaddr.c
by fw@arthur.barton.de
26 Sep '09
26 Sep '09
Module: ngircd.git Branch: master Commit: fa09883c72855768a0f827a330097bf3dc5c839e URL:
http://ngircd.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git&a=commit;h=fa09883c…
Author: Florian Westphal <fw(a)strlen.de> Date: Sat Sep 26 11:12:47 2009 +0200 fix assertion failure in ng_ipaddr.c when building with debugging enabled, but without ipv6 support, ngircd dumped core when loading a config file that specified an ipv6 listen address. ngircd: ng_ipaddr.c:45: ng_ipaddr_init: Assertion `sizeof(*addr) >= res0->ai_addrlen' failed. --- src/ipaddr/ng_ipaddr.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/src/ipaddr/ng_ipaddr.c b/src/ipaddr/ng_ipaddr.c index 4f1d4ca..af524d0 100644 --- a/src/ipaddr/ng_ipaddr.c +++ b/src/ipaddr/ng_ipaddr.c @@ -30,6 +30,9 @@ ng_ipaddr_init(ng_ipaddr_t *addr, const char *ip_str, UINT16 port) memset(&hints, 0, sizeof(hints)); hints.ai_flags = AI_NUMERICHOST; +#ifndef WANT_IPV6 /* do not convert ipv6 addresses */ + hints.ai_family = AF_INET; +#endif /* some getaddrinfo implementations require that ai_socktype is set. */ hints.ai_socktype = SOCK_STREAM; @@ -38,7 +41,6 @@ ng_ipaddr_init(ng_ipaddr_t *addr, const char *ip_str, UINT16 port) snprintf(portstr, sizeof(portstr), "%u", (unsigned int) port); ret = getaddrinfo(ip_str, portstr, &hints, &res0); - assert(ret == 0); if (ret != 0) return false;
1
0
0
0
Florian Westphal : configtest: complain when ssl keys are not readable
by fw@arthur.barton.de
20 Sep '09
20 Sep '09
Module: ngircd.git Branch: master Commit: affa03b277bb479c050f2d6967ae410e49e0d2ac URL:
http://ngircd.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git&a=commit;h=affa03b2…
Author: Florian Westphal <fw(a)strlen.de> Date: Sun Sep 20 20:43:12 2009 +0200 configtest: complain when ssl keys are not readable --- src/ngircd/conf.c | 34 +++++++++++++++++++++++++++++----- 1 files changed, 29 insertions(+), 5 deletions(-) diff --git a/src/ngircd/conf.c b/src/ngircd/conf.c index 71f0fe8..c50f8f9 100644 --- a/src/ngircd/conf.c +++ b/src/ngircd/conf.c @@ -95,19 +95,42 @@ ConfSSL_Init(void) array_free_wipe(&Conf_SSLOptions.KeyFilePassword); } +static bool +can_open(const char *name, const char *file) +{ + FILE *fp = fopen(file, "r"); + if (fp) + fclose(fp); + else + fprintf(stderr, "ERROR: %s \"%s\": %s\n", + name, file, strerror(errno)); + return fp != NULL; +} -static void +static bool ConfSSL_Puts(void) { - if (Conf_SSLOptions.KeyFile) + bool ret = true; + + if (Conf_SSLOptions.KeyFile) { printf( " SSLKeyFile = %s\n", Conf_SSLOptions.KeyFile); - if (Conf_SSLOptions.CertFile) + ret = can_open("SSLKeyFile", Conf_SSLOptions.KeyFile); + } + if (Conf_SSLOptions.CertFile) { printf( " SSLCertFile = %s\n", Conf_SSLOptions.CertFile); - if (Conf_SSLOptions.DHFile) + if (!can_open("SSLCertFile", Conf_SSLOptions.CertFile)) + ret = false; + } + if (Conf_SSLOptions.DHFile) { printf( " SSLDHFile = %s\n", Conf_SSLOptions.DHFile); + if (!can_open("SSLDHFile", Conf_SSLOptions.DHFile)) + ret = false; + } if (array_bytes(&Conf_SSLOptions.KeyFilePassword)) puts(" SSLKeyFilePassword = <secret>" ); array_free_wipe(&Conf_SSLOptions.KeyFilePassword); + + return ret; } #endif @@ -245,7 +268,8 @@ Conf_Test( void ) #ifdef SSL_SUPPORT fputs(" SSLPorts = ", stdout); ports_puts(&Conf_SSLOptions.ListenPorts); - ConfSSL_Puts(); + if (!ConfSSL_Puts()) + config_valid = false; #endif pwd = getpwuid( Conf_UID );
1
0
0
0
Florian Westphal : configtest: complain when ssl keys are not readable
by fw@arthur.barton.de
20 Sep '09
20 Sep '09
Module: ngircd.git Branch: master Commit: 9a4f1532008bbae148e197a6e56f53e5f3504fd1 URL:
http://ngircd.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git&a=commit;h=9a4f1532…
Author: Florian Westphal <fw(a)strlen.de> Date: Sun Sep 20 20:43:12 2009 +0200 configtest: complain when ssl keys are not readable --- src/ngircd/conf.c | 43 ++++++++++++++++++++++++++++++++++++++----- 1 files changed, 38 insertions(+), 5 deletions(-) diff --git a/src/ngircd/conf.c b/src/ngircd/conf.c index 71f0fe8..4dcf9e6 100644 --- a/src/ngircd/conf.c +++ b/src/ngircd/conf.c @@ -96,18 +96,50 @@ ConfSSL_Init(void) } -static void +static bool ConfSSL_Puts(void) { - if (Conf_SSLOptions.KeyFile) + FILE *fp; + bool ret = true; + + if (Conf_SSLOptions.KeyFile) { printf( " SSLKeyFile = %s\n", Conf_SSLOptions.KeyFile); - if (Conf_SSLOptions.CertFile) + fp = fopen(Conf_SSLOptions.KeyFile, "r"); + if (fp) { + fclose(fp); + } else { + fprintf(stderr, "ERROR: SSLKeyFile \"%s\": %s\n", + Conf_SSLOptions.KeyFile, strerror(errno)); + ret = false; + } + } + if (Conf_SSLOptions.CertFile) { printf( " SSLCertFile = %s\n", Conf_SSLOptions.CertFile); - if (Conf_SSLOptions.DHFile) + fp = fopen(Conf_SSLOptions.CertFile, "r"); + if (fp) { + fclose(fp); + } else { + fprintf(stderr, "ERROR: SSLCertFile \"%s\": %s\n", + Conf_SSLOptions.CertFile, strerror(errno)); + ret = false; + } + } + if (Conf_SSLOptions.DHFile) { printf( " SSLDHFile = %s\n", Conf_SSLOptions.DHFile); + fp = fopen(Conf_SSLOptions.DHFile, "r"); + if (fp) { + fclose(fp); + } else { + fprintf(stderr, "ERROR: SSLDHFile \"%s\": %s\n", + Conf_SSLOptions.CertFile, strerror(errno)); + ret = false; + } + } if (array_bytes(&Conf_SSLOptions.KeyFilePassword)) puts(" SSLKeyFilePassword = <secret>" ); array_free_wipe(&Conf_SSLOptions.KeyFilePassword); + + return ret; } #endif @@ -245,7 +277,8 @@ Conf_Test( void ) #ifdef SSL_SUPPORT fputs(" SSLPorts = ", stdout); ports_puts(&Conf_SSLOptions.ListenPorts); - ConfSSL_Puts(); + if (!ConfSSL_Puts()) + config_valid = false; #endif pwd = getpwuid( Conf_UID );
1
0
0
0
← Neuer
1
2
3
4
Älter →
Springe zur Seite:
1
2
3
4
Ergebnisse pro Seite:
10
25
50
100
200