/oper autojoin channel added. Fixed a server mode bug. Fixed a Hidden Host issues

This commit is contained in:
fishwaldo 2002-09-17 06:09:35 +00:00
parent 04a07e95a7
commit 35485ff7c5
11 changed files with 122 additions and 29 deletions

View file

@ -4,6 +4,11 @@ Symbols are:
(F) - Fish (fish@dynam.ac)
(S) - Shmad (shmad@#neostats.net)
(HP) - Hybrid Team Patches to Hybrid Source
* NeoIRCd Version 0.9.2 - 17th Sept, 2002 - Fish
(F) - Fixed a problem with servers setting modes
(F) - Fixed a problem with sethost I think (wasn't setting on other servers correctly)
(F) - OperAutoJoin is now a new option when you /oper up, you will be autojoined to a channel.
* NeoIRCd Version 0.9.1 - 12th August, 2002 - Fish
@ -52,4 +57,4 @@ Symbols are:
(F) - Added SWHOIS to whois. Opers and servers can set swhois
(F) - Fixed a hook api issue with hooks not getting added correctly (Patch sent to hybird team)
(F) - Fixed a chanadmin bug that eggy found (Duh), Stupid Bug
(F) - Admin mode is now represented by ¤
(F) - Admin mode is now represented by ¤

View file

@ -3,7 +3,7 @@
*
* ported from Hybrid7 by fish
*
* $Id: example.conf,v 1.4 2002/09/16 04:57:20 fishwaldo Exp $
* $Id: example.conf,v 1.5 2002/09/17 06:09:35 fishwaldo Exp $
*/
/* IMPORTANT NOTES:
@ -135,6 +135,7 @@ class {
number_per_ip = 10;
max_number = 100;
sendq = 100kbytes;
auto_join="#ircop";
};
class {
@ -505,6 +506,13 @@ general {
*/
default_floodcount = 10;
/* autojoin: when anyone opers up, they will automatically be
* joined to this channel.
* if the channel doesn't exist, it will be set +ntO
*/
autojoin = "#ircops";
/* failed oper notice: send a notice to all opers on the server when
* someone tries to OPER and uses the wrong password, host or ident.
*/

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: class.h,v 1.3 2002/09/13 06:50:06 fishwaldo Exp $
* $Id: class.h,v 1.4 2002/09/17 06:09:35 fishwaldo Exp $
*/
#ifndef INCLUDED_class_h
@ -31,6 +31,7 @@ struct Client;
struct Class {
struct Class* next; /* list node pointer */
char* className;
char* autojoin;
int type;
int conFreq;
int pingFreq;
@ -69,7 +70,7 @@ extern int get_client_ping (struct Client *);
extern void check_class(void);
extern void initclass(void);
extern void free_class(struct Class* );
extern void add_class (char *, int, int, int, long);
extern void add_class(char *, int, int, int, long);
extern void fix_class (struct ConfItem *, struct ConfItem *);
extern void report_classes (struct Client *);

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: config.h,v 1.5 2002/09/16 07:36:01 fishwaldo Exp $
* $Id: config.h,v 1.6 2002/09/17 06:09:35 fishwaldo Exp $
*/
#ifndef INCLUDED_config_h
@ -32,7 +32,6 @@
#define DEBUG
#endif
#undef DEBUG
/*
* NeoIRCd COMPILE TIME CONFIGURATION OPTIONS
*

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: s_conf.h,v 1.5 2002/09/13 06:50:06 fishwaldo Exp $
* $Id: s_conf.h,v 1.6 2002/09/17 06:09:35 fishwaldo Exp $
*/
#ifndef INCLUDED_s_conf_h
@ -178,6 +178,8 @@ struct config_file_entry
char* network_name;
char* network_desc;
char operautojoin[CHANNELLEN+1];
char fname_operlog[MAXPATHLEN];
char fname_userlog[MAXPATHLEN];
char fname_foperlog[MAXPATHLEN];

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: m_swhois.c,v 1.1 2002/09/14 16:00:20 fishwaldo Exp $
* $Id: m_swhois.c,v 1.2 2002/09/17 06:09:35 fishwaldo Exp $
*/
#include "stdinc.h"
#include "tools.h"
@ -70,14 +70,14 @@ _moddeinit(void)
mod_del_cmd(&swhois_msgtab);
}
const char *_version = "$Revision: 1.1 $";
const char *_version = "$Revision: 1.2 $";
/* show a whois notice
source_p does a /whois on client_p */
int
send_swhois(struct hook_mfunc_data *data)
{
if (data->client_p->swhois)
if (strlen(data->client_p->swhois) > 1)
sendto_one(data->source_p, form_str(RPL_SWHOIS), me.name, data->source_p->name, data->client_p->name, data->client_p->swhois);
return 0;
}

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: channel_mode.c,v 1.14 2002/09/16 09:31:20 fishwaldo Exp $
* $Id: channel_mode.c,v 1.15 2002/09/17 06:09:35 fishwaldo Exp $
*/
#include "stdinc.h"
@ -1696,7 +1696,7 @@ get_channel_access(struct Client *source_p, struct Channel *chptr)
{
/* Let hacked servers in for now... */
if (IsUlined(source_p) || IsServices(source_p))
if (!MyClient(source_p) || IsServices(source_p))
return CHACCESS_ADMIN;
if (is_chan_admin(chptr, source_p))

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: class.c,v 1.3 2002/09/13 06:50:08 fishwaldo Exp $
* $Id: class.c,v 1.4 2002/09/17 06:09:35 fishwaldo Exp $
*/
#include "stdinc.h"
@ -169,6 +169,7 @@ int get_con_freq(struct Class *clptr)
* - connection frequency
* - maximum links
* - max sendq
- autojoin channel
* output - NONE
* side effects -
* When adding a class, check to see if it is already present first.

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: ircd_lexer.l,v 1.5 2002/09/13 06:50:08 fishwaldo Exp $
* $Id: ircd_lexer.l,v 1.6 2002/09/17 06:09:35 fishwaldo Exp $
*/
%option case-insensitive
@ -137,6 +137,7 @@ administrator { return ADMIN; }
aftype { return AFTYPE; }
auth { return AUTH; }
autoconn { return AUTOCONN; }
autojoin { return OPERAUTOJOIN; }
caller_id_wait { return CALLER_ID_WAIT; }
channel { return CHANNEL; }
cipher_preference { return CIPHER_PREFERENCE; }

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: ircd_parser.y,v 1.5 2002/09/13 06:50:08 fishwaldo Exp $
* $Id: ircd_parser.y,v 1.6 2002/09/17 06:09:35 fishwaldo Exp $
*/
%{
@ -99,6 +99,7 @@ int class_redirport_var;
%token ANTI_SPAM_EXIT_MESSAGE_TIME
%token AUTH
%token AUTOCONN
%token OPERAUTOJOIN
%token BYTES KBYTES MBYTES GBYTES TBYTES
%token CALLER_ID_WAIT
%token CHANNEL
@ -889,7 +890,7 @@ class_entry: CLASS
add_class(class_name_var,class_ping_time_var,
class_number_per_ip_var, class_max_number_var,
class_sendq_var );
class_sendq_var);
MyFree(class_name_var);
class_name_var = NULL;
@ -1883,6 +1884,7 @@ general_item: general_failed_oper_notice |
general_compression_level | general_client_flood |
general_throttle_time | general_havent_read_conf |
general_dot_in_ip6_addr | general_ping_cookie |
general_oper_autojoin |
error;
general_failed_oper_notice: FAILED_OPER_NOTICE '=' TYES ';'
@ -1895,6 +1897,27 @@ general_failed_oper_notice: FAILED_OPER_NOTICE '=' TYES ';'
ConfigFileEntry.failed_oper_notice = 0;
} ;
general_oper_autojoin: OPERAUTOJOIN '=' QSTRING ';'
{
if (strlen(yylval.string) > CHANNELLEN) {
sendto_realops_flags(FLAGS_ALL, L_ALL, "Invalid autojoin Channel %s", yylval.string);
ilog(L_ERROR, "Invalid autojoin channel '%s'", yylval.string);
return;
}
if (!check_channel_name(yylval.string) || !IsChannelName(yylval.string)) {
sendto_realops_flags(FLAGS_ALL, L_ALL, "Invalid Autojoin Channelname %s", yylval.string);
ilog(L_ERROR, "Invalid autojoin Channelname %s", yylval.string);
return;
}
if (*yylval.string == '&') {
sendto_realops_flags(FLAGS_ALL, L_ALL, "Cannot set Autojoin Channel to a local channel");
ilog(L_ERROR, "Cannot set Autojoin Channel to a local channel");
return;
}
strlcpy(ConfigFileEntry.operautojoin, yylval.string,
CHANNELLEN);
} ;
general_anti_nick_flood: ANTI_NICK_FLOOD '=' TYES ';'
{
ConfigFileEntry.anti_nick_flood = 1;

View file

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* $Id: s_user.c,v 1.12 2002/09/13 16:30:05 fishwaldo Exp $
* $Id: s_user.c,v 1.13 2002/09/17 06:09:35 fishwaldo Exp $
*/
#include "stdinc.h"
@ -1055,10 +1055,8 @@ user_mode(struct Client *client_p, struct Client *source_p, int parc, char *parv
}
strncpy(target_p->vhost, target_p->host, HOSTLEN);
}
break;
sendto_server(NULL, target_p, NULL, NOCAPS, NOCAPS, LL_ICLIENT, ":%s SETHOST %s :%s", me.name, target_p->name, target_p->vhost);
break;
/* we may not get these,
* but they shouldnt be in default
@ -1135,14 +1133,6 @@ user_mode(struct Client *client_p, struct Client *source_p, int parc, char *parv
*/
send_umode_out(client_p, target_p, setflags);
/*
* only send out a sethost if +x mode was added
*/
if (!(setflags & FLAGS_HIDDEN) && IsHidden(target_p)) {
sendto_server(NULL, target_p, NULL, NOCAPS, NOCAPS, LL_ICLIENT, ":%s SETHOST %s :%s", target_p->name, target_p->name, target_p->vhost);
ilog(L_WARN, "Sending sethost for %s", target_p->name);
}
return 0;
}
@ -1368,6 +1358,9 @@ oper_up( struct Client *source_p, struct ConfItem *aconf )
dlink_node *ptr;
struct ConfItem *found_aconf;
dlink_node *m;
struct Channel *chptr = NULL;
int flags;
SetOper(source_p);
if((int)aconf->hold)
@ -1422,6 +1415,66 @@ oper_up( struct Client *source_p, struct ConfItem *aconf )
sendto_one(source_p, ":%s NOTICE %s :*** Oper privs are %s", me.name,
source_p->name, operprivs);
SendMessageFile(source_p, &ConfigFileEntry.opermotd);
/* autojoin them to a channel if its defined */
if (ConfigFileEntry.operautojoin) {
sendto_one(source_p, "%s NOTICE %s :Autojoining you to %s", me.name, source_p->name, ConfigFileEntry.operautojoin);
if ((chptr = hash_find_channel(ConfigFileEntry.operautojoin)) != NULL) {
if (IsMember(source_p, chptr))
return(1);
if (chptr->users = 0)
flags = CHFL_ADMIN;
} else {
flags = CHFL_ADMIN;
if (!ServerInfo.hub) {
/* lazy links */
if (uplink && IsCapable(uplink, CAP_LL)) {
sendto_one(uplink, ":%s CBURST %s %s %s", me.name, ConfigFileEntry.operautojoin, source_p->name, "");
/* and wait */
return 1;
}
}
}
/* no point doing it fi I already have it */
if (chptr == NULL)
chptr = get_or_create_channel(source_p, ConfigFileEntry.operautojoin, NULL);
/* now add the user to the channel */
add_user_to_channel(chptr, source_p, flags);
/* propogate out to the other servers */
if (flags & CHFL_ADMIN) {
chptr->channelts = CurrentTime;
sendto_server(NULL, source_p, chptr, NOCAPS, NOCAPS, LL_ICLIENT, ":%s SJOIN %lu %s + :¤%s", me.name, (unsigned long) chptr->channelts, chptr->chname, source_p->name);
} else {
sendto_server(NULL, source_p, chptr, NOCAPS, NOCAPS, LL_ICLIENT, ":%s SJOIN %lu %s + :%s", me.name, (unsigned long) chptr->channelts, chptr->chname, source_p->name);
}
/* notify all local clients */
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@%s JOIN :%s", source_p->name, source_p->username, source_p->vhost, chptr->chname);
/* set the modes */
if (flags & CHFL_ADMIN) {
chptr->mode.mode |= MODE_TOPICLIMIT;
chptr->mode.mode |= MODE_NOPRIVMSGS;
chptr->mode.mode |= MODE_OPERSONLY;
sendto_channel_local(ONLY_CHANOPS_HALFOPS, chptr, ":%s MODE %s +ntO", me.name, chptr->chname);
sendto_server(NULL, source_p, chptr, NOCAPS, NOCAPS, LL_ICLIENT, ":%s MODE %s +ntO", me.name, chptr->chname);
}
/* send the topic */
if (chptr->topic != NULL) {
sendto_one(source_p, form_str(RPL_TOPIC), me.name, source_p->name, chptr->chname, chptr->topic);
/* hide who topic and time in hideops mode? */
if (!(chptr->mode.mode & MODE_HIDEOPS) || (flags & CHFL_CHANOP) || (flags & CHFL_HALFOP) || (flags & CHFL_ADMIN)) {
sendto_one(source_p, form_str(RPL_TOPICWHOTIME), me.name, source_p->name, chptr->chname, chptr->topic_info, chptr->topic_time);
} else { /* hide from non ops */
sendto_one(source_p, form_str(RPL_TOPICWHOTIME), me.name, source_p->name, chptr->chname, me.name, chptr->topic_time);
}
}
channel_member_names(source_p, chptr, chptr->chname, 1);
source_p->localClient->last_join_time = CurrentTime;
}
return(1);
}