From fe749d37099c5e63f763dc07aa7eb43be150a757 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Mon, 11 Jan 2016 23:02:03 -0600 Subject: [PATCH] ircd: implement GRANT subsystem based on ircd-seven --- doc/ircd.conf.example | 2 +- doc/reference.conf | 4 +++- include/s_newconf.h | 3 ++- ircd/newconf.c | 1 + modules/Makefile.am | 1 + modules/Makefile.in | 36 ++++++++++++++++++++++-------------- modules/m_stats.c | 1 + 7 files changed, 31 insertions(+), 17 deletions(-) diff --git a/doc/ircd.conf.example b/doc/ircd.conf.example index 0466cba4..6dbdfb0f 100755 --- a/doc/ircd.conf.example +++ b/doc/ircd.conf.example @@ -239,7 +239,7 @@ privset "global_op" { privset "admin" { extends = "global_op"; - privs = oper:admin, oper:die, oper:rehash, oper:spy; + privs = oper:admin, oper:die, oper:rehash, oper:spy, oper:grant; }; operator "god" { diff --git a/doc/reference.conf b/doc/reference.conf index 31817ef3..1b1bd1a5 100755 --- a/doc/reference.conf +++ b/doc/reference.conf @@ -431,6 +431,7 @@ privset "local_op" { * oper:hidden: hides the oper from /stats p * oper:remoteban: allows remote kline etc * oper:mass_notice: allows sending wallops and mass notices + * oper:grant: allows using the GRANT command */ privs = oper:local_kill, oper:operwall; }; @@ -449,7 +450,7 @@ privset "global_op" { privset "admin" { extends = "global_op"; - privs = oper:admin, oper:die, oper:rehash, oper:spy; + privs = oper:admin, oper:die, oper:rehash, oper:spy, oper:grant; }; /* operator {}: defines ircd operators. (OLD O:) */ @@ -667,6 +668,7 @@ shared { * dline - allow setting perm/temp dlines * tdline - allow setting temp dlines * undline - allow removing dlines + * grant - allow granting operator status * none - disallow everything */ diff --git a/include/s_newconf.h b/include/s_newconf.h index 0f1c171d..3dbcab71 100644 --- a/include/s_newconf.h +++ b/include/s_newconf.h @@ -96,10 +96,11 @@ struct remote_conf #define SHARED_TDLINE 0x0800 #define SHARED_PDLINE 0x1000 #define SHARED_UNDLINE 0x2000 +#define SHARED_GRANT 0x4000 #define SHARED_ALL (SHARED_TKLINE | SHARED_PKLINE | SHARED_UNKLINE |\ SHARED_PXLINE | SHARED_TXLINE | SHARED_UNXLINE |\ - SHARED_TRESV | SHARED_PRESV | SHARED_UNRESV) + SHARED_TRESV | SHARED_PRESV | SHARED_UNRESV | SHARED_GRANT) #define CLUSTER_ALL (SHARED_ALL | SHARED_LOCOPS) /* flags used in hub/leaf */ diff --git a/ircd/newconf.c b/ircd/newconf.c index 23701c82..65693084 100644 --- a/ircd/newconf.c +++ b/ircd/newconf.c @@ -388,6 +388,7 @@ static struct mode_table shared_table[] = { "unresv", SHARED_UNRESV }, { "locops", SHARED_LOCOPS }, { "rehash", SHARED_REHASH }, + { "grant", SHARED_GRANT }, { "all", SHARED_ALL }, { "none", 0 }, {NULL, 0} diff --git a/modules/Makefile.am b/modules/Makefile.am index 413a792c..3a1a7b83 100644 --- a/modules/Makefile.am +++ b/modules/Makefile.am @@ -24,6 +24,7 @@ auto_load_mod_LTLIBRARIES = \ m_dline.la \ m_encap.la \ m_etrace.la \ + m_grant.la \ m_help.la \ m_info.la \ m_invite.la \ diff --git a/modules/Makefile.in b/modules/Makefile.in index e60e0c25..321d840c 100644 --- a/modules/Makefile.in +++ b/modules/Makefile.in @@ -226,6 +226,9 @@ m_encap_la_OBJECTS = m_encap.lo m_etrace_la_LIBADD = m_etrace_la_SOURCES = m_etrace.c m_etrace_la_OBJECTS = m_etrace.lo +m_grant_la_LIBADD = +m_grant_la_SOURCES = m_grant.c +m_grant_la_OBJECTS = m_grant.lo m_help_la_LIBADD = m_help_la_SOURCES = m_help.c m_help_la_OBJECTS = m_help.lo @@ -419,13 +422,13 @@ SOURCES = chm_nocolour.c chm_noctcp.c core/m_ban.c core/m_die.c \ core/m_quit.c core/m_server.c core/m_squit.c m_accept.c \ m_admin.c m_away.c m_cap.c m_capab.c m_certfp.c m_challenge.c \ m_chghost.c m_close.c m_cmessage.c m_connect.c m_dline.c \ - m_encap.c m_etrace.c m_help.c m_info.c m_invite.c m_ison.c \ - m_kline.c m_knock.c m_links.c m_list.c m_locops.c m_lusers.c \ - m_map.c m_monitor.c m_motd.c m_names.c m_oper.c m_operspy.c \ - m_pass.c m_ping.c m_pong.c m_post.c m_privs.c m_rehash.c \ - m_restart.c m_resv.c m_sasl.c m_scan.c m_services.c m_set.c \ - m_signon.c m_snote.c m_starttls.c m_stats.c m_svinfo.c m_tb.c \ - m_testline.c m_testmask.c m_tginfo.c m_time.c m_topic.c \ + m_encap.c m_etrace.c m_grant.c m_help.c m_info.c m_invite.c \ + m_ison.c m_kline.c m_knock.c m_links.c m_list.c m_locops.c \ + m_lusers.c m_map.c m_monitor.c m_motd.c m_names.c m_oper.c \ + m_operspy.c m_pass.c m_ping.c m_pong.c m_post.c m_privs.c \ + m_rehash.c m_restart.c m_resv.c m_sasl.c m_scan.c m_services.c \ + m_set.c m_signon.c m_snote.c m_starttls.c m_stats.c m_svinfo.c \ + m_tb.c m_testline.c m_testmask.c m_tginfo.c m_time.c m_topic.c \ m_trace.c m_unreject.c m_user.c m_userhost.c m_users.c \ m_version.c m_wallops.c m_who.c m_whois.c m_whowas.c m_xline.c \ sno_routing.c @@ -435,13 +438,13 @@ DIST_SOURCES = chm_nocolour.c chm_noctcp.c core/m_ban.c core/m_die.c \ core/m_quit.c core/m_server.c core/m_squit.c m_accept.c \ m_admin.c m_away.c m_cap.c m_capab.c m_certfp.c m_challenge.c \ m_chghost.c m_close.c m_cmessage.c m_connect.c m_dline.c \ - m_encap.c m_etrace.c m_help.c m_info.c m_invite.c m_ison.c \ - m_kline.c m_knock.c m_links.c m_list.c m_locops.c m_lusers.c \ - m_map.c m_monitor.c m_motd.c m_names.c m_oper.c m_operspy.c \ - m_pass.c m_ping.c m_pong.c m_post.c m_privs.c m_rehash.c \ - m_restart.c m_resv.c m_sasl.c m_scan.c m_services.c m_set.c \ - m_signon.c m_snote.c m_starttls.c m_stats.c m_svinfo.c m_tb.c \ - m_testline.c m_testmask.c m_tginfo.c m_time.c m_topic.c \ + m_encap.c m_etrace.c m_grant.c m_help.c m_info.c m_invite.c \ + m_ison.c m_kline.c m_knock.c m_links.c m_list.c m_locops.c \ + m_lusers.c m_map.c m_monitor.c m_motd.c m_names.c m_oper.c \ + m_operspy.c m_pass.c m_ping.c m_pong.c m_post.c m_privs.c \ + m_rehash.c m_restart.c m_resv.c m_sasl.c m_scan.c m_services.c \ + m_set.c m_signon.c m_snote.c m_starttls.c m_stats.c m_svinfo.c \ + m_tb.c m_testline.c m_testmask.c m_tginfo.c m_time.c m_topic.c \ m_trace.c m_unreject.c m_user.c m_userhost.c m_users.c \ m_version.c m_wallops.c m_who.c m_whois.c m_whowas.c m_xline.c \ sno_routing.c @@ -672,6 +675,7 @@ auto_load_mod_LTLIBRARIES = \ m_dline.la \ m_encap.la \ m_etrace.la \ + m_grant.la \ m_help.la \ m_info.la \ m_invite.la \ @@ -949,6 +953,9 @@ m_encap.la: $(m_encap_la_OBJECTS) $(m_encap_la_DEPENDENCIES) $(EXTRA_m_encap_la_ m_etrace.la: $(m_etrace_la_OBJECTS) $(m_etrace_la_DEPENDENCIES) $(EXTRA_m_etrace_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) -rpath $(auto_load_moddir) $(m_etrace_la_OBJECTS) $(m_etrace_la_LIBADD) $(LIBS) +m_grant.la: $(m_grant_la_OBJECTS) $(m_grant_la_DEPENDENCIES) $(EXTRA_m_grant_la_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) -rpath $(auto_load_moddir) $(m_grant_la_OBJECTS) $(m_grant_la_LIBADD) $(LIBS) + m_help.la: $(m_help_la_OBJECTS) $(m_help_la_DEPENDENCIES) $(EXTRA_m_help_la_DEPENDENCIES) $(AM_V_CCLD)$(LINK) -rpath $(auto_load_moddir) $(m_help_la_OBJECTS) $(m_help_la_LIBADD) $(LIBS) @@ -1126,6 +1133,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m_dline.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m_encap.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m_etrace.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m_grant.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m_help.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m_info.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m_invite.Plo@am__quote@ diff --git a/modules/m_stats.c b/modules/m_stats.c index ba524a62..a59d604b 100644 --- a/modules/m_stats.c +++ b/modules/m_stats.c @@ -1053,6 +1053,7 @@ static struct shared_flags shared_flagtable[] = { SHARED_TDLINE, 'd' }, { SHARED_PDLINE, 'D' }, { SHARED_UNDLINE, 'E' }, + { SHARED_GRANT, 'G' }, { 0, '\0'} };