Package: ircd-hybrid
Tags: patch
Here's the patch, that used to be part of the original SSL patch, that
allows you to set a channel to only be joinable by SSL-users or people
on localhost.
--
Joshua Kwan
#! /bin/sh /usr/share/dpatch/dpatch-run
## 19_sslonly.dpatch.dpatch by Joshua Kwan <[EMAIL PROTECTED]>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: No description.
@DPATCH@
--- ircd-hybrid-7.2.2/include/numeric.h~ 2007-01-21 10:39:19.000000000
-0800
+++ ircd-hybrid-7.2.2/include/numeric.h 2007-01-21 10:39:32.000000000 -0800
@@ -382,6 +382,7 @@
/* ERR_LINKFAIL 479 unreal */
/* ERR_CANNOTKNOCK 480 unreal */
/* ERR_NOULINE 480 austnet */
+#define ERR_SSLONLYCHAN 480
#define ERR_NOPRIVILEGES 481
#define ERR_CHANOPRIVSNEEDED 482
#define ERR_CANTKILLSERVER 483
--- ircd-hybrid-7.2.2/src/messages.tab~ 2007-01-21 10:38:11.000000000 -0800
+++ ircd-hybrid-7.2.2/src/messages.tab 2007-01-21 10:38:53.000000000 -0800
@@ -504,7 +504,7 @@
/* 477 */ {NULL, NULL, NULL},
/* 478 */ {"ERR_BANLISTFULL", ":%s 478 %s %s %s :Channel ban list is full",
NULL},
/* 479 */ {"ERR_BADCHANNAME", ":%s 479 %s %s :Illegal channel name", NULL},
-/* 480 */ {NULL, NULL, NULL},
+/* 480 */ {"ERR_SSLONLYCHAN", ":%s 480 %s %s :Cannot join channel (+S)",
NULL},
/* 481 */ {"ERR_NOPRIVILEGES", ":%s 481 %s :Permission Denied - You're not an
IRC operator", NULL},
/* 482 */ {"ERR_CHANOPRIVSNEEDED", ":%s 482 %s %s :You're not channel
operator", NULL},
/* 483 */ {"ERR_CANTKILLSERVER", ":%s 483 %s :You can't kill a server!",
NULL},
--- ircd-hybrid-7.2.2/src/channel_mode.c~ 2007-01-21 10:29:20.000000000
-0800
+++ ircd-hybrid-7.2.2/src/channel_mode.c 2007-01-21 10:33:13.000000000
-0800
@@ -332,6 +332,9 @@
{ MODE_NOPRIVMSGS, 'n' },
{ MODE_PRIVATE, 'p' },
{ MODE_SECRET, 's' },
+#ifdef HAVE_LIBCRYPTO
+ { MODE_SSLONLY, 'S' },
+#endif
{ MODE_TOPICLIMIT, 't' },
{ 0, '\0' }
};
@@ -1313,7 +1316,11 @@
{chm_nosuch, NULL}, /* P */
{chm_nosuch, NULL}, /* Q */
{chm_nosuch, NULL}, /* R */
+#ifdef HAVE_LIBCRYPTO
+ {chm_simple, (void*) MODE_SSLONLY}, /* S */
+#else
{chm_nosuch, NULL}, /* S */
+#endif
{chm_nosuch, NULL}, /* T */
{chm_nosuch, NULL}, /* U */
{chm_nosuch, NULL}, /* V */
--- ircd-hybrid-7.2.2/src/channel.c~ 2007-01-21 10:37:39.000000000 -0800
+++ ircd-hybrid-7.2.2/src/channel.c 2007-01-21 10:38:01.000000000 -0800
@@ -44,6 +44,7 @@
#include "event.h"
#include "memory.h"
#include "balloc.h"
+#include "fdlist.h"
struct config_channel_entry ConfigChannel;
dlink_list global_channel_list = { NULL, NULL, 0 };
@@ -679,6 +679,21 @@
chptr->mode.limit)
return ERR_CHANNELISFULL;
+ if (SSLonlyChannel(chptr))
+ {
+#ifdef HAVE_LIBCRYPTO
+ if (MyClient(source_p)) {
+ int fd = source_p->localClient->fd.fd;
+ fde_t *F = lookup_fd(fd);
+
+ if (F && !F->ssl && strcmp(source_p->localClient->sockhost,
"127.0.0.1"))
+ return (ERR_SSLONLYCHAN);
+ }
+#else
+ return (ERR_SSLONLYCHAN);
+#endif
+ }
+
return 0;
}
--- a/modules/core/m_sjoin.c 2007-01-21 10:54:13.000000000 -0800
+++ b/modules/core/m_sjoin.c 2007-01-21 10:54:23.000000000 -0800
@@ -171,6 +171,9 @@
case 'p':
mode.mode |= MODE_PRIVATE;
break;
+ case 'S':
+ mode.mode |= MODE_SSLONLY;
+ break;
case 'k':
strlcpy(mode.key, parv[4 + args], sizeof(mode.key));
args++;
@@ -629,6 +632,7 @@
{ MODE_SECRET, 's' },
{ MODE_MODERATED, 'm' },
{ MODE_INVITEONLY, 'i' },
+ { MODE_SSLONLY, 'S' },
{ MODE_PRIVATE, 'p' },
{ 0, '\0' }
};
--- ircd-hybrid-7.2.2.dfsg.1/include/channel_mode.h~ 2007-01-21
10:58:30.000000000 -0800
+++ ircd-hybrid-7.2.2.dfsg.1/include/channel_mode.h 2007-01-21
10:58:58.000000000 -0800
@@ -55,6 +55,7 @@
#define MODE_TOPICLIMIT 0x0008
#define MODE_INVITEONLY 0x0010
#define MODE_NOPRIVMSGS 0x0020
+#define MODE_SSLONLY 0x0040
/* cache flags for silence on ban */
#define CHFL_BAN_CHECKED 0x0080
@@ -71,6 +72,7 @@
/* name invisible */
#define SecretChannel(x) (((x)->mode.mode & MODE_SECRET))
+#define SSLonlyChannel(x) (((x)->mode.mode & MODE_SSLONLY))
#define PubChannel(x) (!SecretChannel(x))
/* knock is forbidden, halfops can't kick/deop other halfops.
* +pi means paranoid and will generate notices on each invite */