[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Exception lines (E:lines) patch



Hi,

the following patch adds exception lines (E: lines) to ircd. Exception lines
are used in conjunction with {K,k} lines. Every u@h who matches an
e-line will bypass a matching k-line, which means that the IRC server won't
deny his connection.

Example: You have a k-line for *@*.foo.bar.
         Now, if you want sane@*.foo.bar allow the access to your
         server, you can e-line him.

         K:*.foo.bar::*
         E:*.foo.bar::sane

The format for an E-line is: E:hostmask::username:port.
[Just like the format of a K-line except that the time field is not used.]

Note that this patch is only intended as an inspiration, altho it seems to
work. :-)

Bye, Kasi

--- cut here ---
diff -cr irc2.9.3b19p1.old/include/numeric.h irc2.9.3b19p1/include/numeric.h
*** irc2.9.3b19p1.old/include/numeric.h	Mon Jun  2 15:16:31 1997
--- irc2.9.3b19p1/include/numeric.h	Mon Jun 30 11:25:09 1997
***************
*** 299,304 ****
--- 299,305 ----
  #define RPL_SERVLIST         234
  #define RPL_SERVLISTEND      235
  
+ #define 	RPL_STATSELINE       239
  #define	RPL_STATSVLINE       240
  #define	RPL_STATSLLINE       241
  #define	RPL_STATSUPTIME      242
diff -cr irc2.9.3b19p1.old/include/struct.h irc2.9.3b19p1/include/struct.h
*** irc2.9.3b19p1.old/include/struct.h	Fri Jun 27 15:38:37 1997
--- irc2.9.3b19p1/include/struct.h	Mon Jun 30 09:57:32 1997
***************
*** 304,309 ****
--- 304,310 ----
  
  #define	CONF_ILLEGAL		0x80000000
  #define	CONF_MATCH		0x40000000
+ #define 	CONF_EXCEPTION          0x20000000
  #define	CONF_QUARANTINED_SERVER	0x00001
  #define	CONF_CLIENT		0x00002
  #define CONF_RCLIENT            0x00004
diff -cr irc2.9.3b19p1.old/ircd/chkconf.c irc2.9.3b19p1/ircd/chkconf.c
*** irc2.9.3b19p1.old/ircd/chkconf.c	Mon Apr 14 17:04:15 1997
--- irc2.9.3b19p1/ircd/chkconf.c	Mon Jun 30 10:04:29 1997
***************
*** 256,261 ****
--- 256,265 ----
  				ccount++;
  				aconf->status = CONF_CONNECT_SERVER;
  				break;
+ 		        case 'E': /* Exception line for kill user lines */
+ 		        case 'e':
+ 			        aconf->status = CONF_EXCEPTION;
+ 				break;
  			case 'H': /* Hub server line */
  			case 'h':
  				aconf->status = CONF_HUB;
diff -cr irc2.9.3b19p1.old/ircd/s_conf.c irc2.9.3b19p1/ircd/s_conf.c
*** irc2.9.3b19p1.old/ircd/s_conf.c	Mon Jun  9 16:43:01 1997
--- irc2.9.3b19p1/ircd/s_conf.c	Mon Jun 30 12:32:43 1997
***************
*** 841,846 ****
--- 841,850 ----
  				ccount++;
  				aconf->status = CONF_ZCONNECT_SERVER;
  				break;
+ 		        case 'E': /* Exception line for user kill lines */
+ 		        case 'e':
+                                 aconf->status = CONF_EXCEPTION;
+                                 break;
  			case 'H': /* Hub server line */
  			case 'h':
  				aconf->status = CONF_HUB;
***************
*** 1137,1143 ****
  {
  	static char	reply[256];
  	char *host, *name, *ident, *check;
! 	aConfItem *tmp;
  	int	now;
  
  	if (!cptr->user)
--- 1141,1147 ----
  {
  	static char	reply[256];
  	char *host, *name, *ident, *check;
! 	aConfItem *tmp, *temp;
  	int	now;
  
  	if (!cptr->user)
***************
*** 1178,1183 ****
--- 1182,1210 ----
  		    }
  	    }
  
+         if (tmp)
+ 	  {
+ 	    for (temp = conf; temp; temp = temp->next)
+ 	    {
+ 		if (!doall && (BadPtr(temp->passwd) || !isdigit(*temp->passwd)))
+ 		    continue;
+ 		if (!(temp->status & CONF_EXCEPTION))
+ 		    continue;
+ 		
+ 		check = name;
+ 
+ 		if (temp->host && temp->name &&
+ 		    (match(temp->host, host) == 0) &&
+ 		    (!check || match(temp->name, check) == 0) &&
+ 		    (!temp->port || (temp->port == cptr->acpt->port)))
+ 		{
+ 		    reply[0] = '\0';
+ 		    tmp = NULL;
+ 		    break;
+ 		}
+ 	    }
+ 	  }
+ 	
  	if (*reply)
  		sendto_one(cptr, reply, ME, now, cptr->name);
  	else if (tmp)
diff -cr irc2.9.3b19p1.old/ircd/s_err.c irc2.9.3b19p1/ircd/s_err.c
*** irc2.9.3b19p1.old/ircd/s_err.c	Mon Jun  2 15:17:16 1997
--- irc2.9.3b19p1/ircd/s_err.c	Mon Jun 30 11:26:14 1997
***************
*** 246,252 ****
  /* 234 */	RPL_SERVLIST, "%s %s %s %d %d :%s",
  /* 235 */	RPL_SERVLISTEND, "%s %d :End of service listing",
  		0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL,
! 		0, (char *)NULL,
  /* 240 */	RPL_STATSVLINE, "%c %s %s %s %d %d",
  /* 241 */	RPL_STATSLLINE, "%c %s %s %s %d %d",
  /* 242 */	RPL_STATSUPTIME, ":Server Up %d days, %d:%02d:%02d",
--- 246,252 ----
  /* 234 */	RPL_SERVLIST, "%s %s %s %d %d :%s",
  /* 235 */	RPL_SERVLISTEND, "%s %d :End of service listing",
  		0, (char *)NULL, 0, (char *)NULL, 0, (char *)NULL,
! /* 239 */   	RPL_STATSELINE, "%c %s %s %s %d %d",
  /* 240 */	RPL_STATSVLINE, "%c %s %s %s %d %d",
  /* 241 */	RPL_STATSLLINE, "%c %s %s %s %d %d",
  /* 242 */	RPL_STATSUPTIME, ":Server Up %d days, %d:%02d:%02d",
diff -cr irc2.9.3b19p1.old/ircd/s_serv.c irc2.9.3b19p1/ircd/s_serv.c
*** irc2.9.3b19p1.old/ircd/s_serv.c	Mon Jun  9 16:50:16 1997
--- irc2.9.3b19p1/ircd/s_serv.c	Mon Jun 30 11:14:59 1997
***************
*** 1188,1199 ****
  **	      it--not reversed as in ircd.conf!
  */
  
! static int report_array[16][3] = {
  		{ CONF_ZCONNECT_SERVER,	  RPL_STATSCLINE, 'c'},
  		{ CONF_CONNECT_SERVER,	  RPL_STATSCLINE, 'C'},
  		{ CONF_NOCONNECT_SERVER,  RPL_STATSNLINE, 'N'},
  		{ CONF_CLIENT,		  RPL_STATSILINE, 'I'},
  		{ CONF_RCLIENT,		  RPL_STATSILINE, 'i'},
  		{ CONF_OTHERKILL,	  RPL_STATSKLINE, 'k'},
  		{ CONF_KILL,		  RPL_STATSKLINE, 'K'},
  		{ CONF_QUARANTINED_SERVER,RPL_STATSQLINE, 'Q'},
--- 1188,1200 ----
  **	      it--not reversed as in ircd.conf!
  */
  
! static int report_array[17][3] = {
  		{ CONF_ZCONNECT_SERVER,	  RPL_STATSCLINE, 'c'},
  		{ CONF_CONNECT_SERVER,	  RPL_STATSCLINE, 'C'},
  		{ CONF_NOCONNECT_SERVER,  RPL_STATSNLINE, 'N'},
  		{ CONF_CLIENT,		  RPL_STATSILINE, 'I'},
  		{ CONF_RCLIENT,		  RPL_STATSILINE, 'i'},
+ 		{ CONF_EXCEPTION,         RPL_STATSELINE, 'E'},
  		{ CONF_OTHERKILL,	  RPL_STATSKLINE, 'k'},
  		{ CONF_KILL,		  RPL_STATSKLINE, 'K'},
  		{ CONF_QUARANTINED_SERVER,RPL_STATSQLINE, 'Q'},
***************
*** 1364,1369 ****
--- 1365,1373 ----
  		break;
  	case 'd' : case 'D' : /* defines */
  		send_defines(cptr, parv[0]);
+ 		break;
+         case 'E' : case 'e' : /* E lines */
+ 	        report_configured_links(cptr, parv[0], CONF_EXCEPTION);
  		break;
  	case 'H' : case 'h' : /* H and L conf lines */
  		report_configured_links(cptr, parv[0], CONF_HUB|CONF_LEAF);
--- cut here ---

-- 
Kaspar Landsberg, <kl@xxxxxxxxxxxxxxx>