+2001-06-08 Kevin L. Mitchell <klmitch@mit.edu>
+
+ * ircd/s_user.c: remove deprecated struct Gline* argument to
+ register_user(); remove GLINE rebroadcast; do not send GLINE
+ acknowledgement parameter to NICK; do not look for GLINE
+ acknowledgement parameter to NICK while parsing
+
+ * ircd/s_serv.c (server_estab): remove deprecated struct Jupe*
+ argument to server_estab(); do not send JUPE/GLINE acknowledgement
+ parameters for SERVER or NICK
+
+ * ircd/m_user.c (m_user): remove deprecated argument to
+ register_user()
+
+ * ircd/m_server.c: remove deprecated argument to server_estab();
+ remove documentation comment regarding JUPE acknowledgement
+ parameter to SERVER; remove JUPE rebroadcast
+
+ * ircd/m_pong.c (mr_pong): remove deprecated argument to
+ register_user()
+
+ * ircd/m_nick.c: remove documentation comment regarding GLINE
+ acknowledgement parameter to NICK
+
+ * ircd/jupe.c: use user's real name in JUPE server notices if
+ HEAD_IN_SAND_SNOTICES is defined
+
+ * ircd/ircd.c: remove deprecated chroot() code; remove deprecated
+ setuid code; correct ancient DEBUG vs DEBUGMODE typo
+
+ * ircd/gline.c: use user's real name in GLINE server notices if
+ HEAD_IN_SAND_SNOTICES is defined
+
+ * ircd/channel.c (modebuf_flush_int): make apparent source be
+ local server, not oper's server; use user's real name in hack
+ notices and DESYNC notices if HEAD_IN_SAND_SNOTICES is defined
+
+ * include/s_user.h: remove struct Gline pre-declaration; remove
+ deprecated struct Gline argument from register_user()
+
+ * include/s_serv.h: remove struct Jupe pre-declaration; remove
+ deprecated struct Jupe argument from server_estab()
+
2001-06-07 Kevin L. Mitchell <klmitch@mit.edu>
* ircd/s_stats.c (hunt_stats): forward-port from pl15 of all the
struct ConfItem;
struct Client;
-struct Jupe;
extern unsigned int max_connection_count;
extern unsigned int max_client_count;
extern int exit_new_server(struct Client* cptr, struct Client* sptr,
const char* host, time_t timestamp, const char* fmt, ...);
extern int a_kills_b_too(struct Client *a, struct Client *b);
-extern int server_estab(struct Client *cptr, struct ConfItem *aconf,
- struct Jupe *ajupe);
+extern int server_estab(struct Client *cptr, struct ConfItem *aconf);
#endif /* INCLUDED_s_serv_h */
struct Client;
struct User;
-struct Gline;
struct Channel;
struct MsgBuf;
extern struct User* make_user(struct Client *cptr);
extern void free_user(struct User *user);
extern int register_user(struct Client* cptr, struct Client* sptr,
- const char* nick, char* username,
- struct Gline *agline);
+ const char* nick, char* username);
extern void user_count_memory(size_t* count_out, size_t* bytes_out);
/* Ok, if we were given the OPMODE flag, hide the source if its a user */
if (mbuf->mb_dest & MODEBUF_DEST_OPMODE && !IsServer(mbuf->mb_source))
- app_source = (cli_user(mbuf->mb_source))->server;
+ app_source = &me;
else
app_source = mbuf->mb_source;
/* send the messages off to their destination */
if (mbuf->mb_dest & MODEBUF_DEST_HACK2) {
sendto_opmask_butone(0, SNO_HACK2, "HACK(2): %s MODE %s %s%s%s%s%s%s "
- "[%Tu]", cli_name(app_source),
+ "[%Tu]",
+#ifdef HEAD_IN_SAND_SNOTICES
+ cli_name(mbuf->mb_source),
+#else
+ cli_name(app_source),
+#endif
mbuf->mb_channel->chname,
rembuf_i ? "-" : "", rembuf, addbuf_i ? "+" : "",
addbuf, remstr, addstr,
mbuf->mb_channel->creationtime);
sendcmdto_serv_butone(&me, CMD_DESYNCH, mbuf->mb_connect,
":HACK: %s MODE %s %s%s%s%s%s%s [%Tu]",
- cli_name(app_source), mbuf->mb_channel->chname,
+#ifdef HEAD_IN_SAND_SNOTICES
+ cli_name(mbuf->mb_source),
+#else
+ cli_name(app_source),
+#endif
+ mbuf->mb_channel->chname,
rembuf_i ? "-" : "", rembuf,
addbuf_i ? "+" : "", addbuf, remstr, addstr,
mbuf->mb_channel->creationtime);
if (mbuf->mb_dest & MODEBUF_DEST_HACK3)
sendto_opmask_butone(0, SNO_HACK3, "BOUNCE or HACK(3): %s MODE %s "
- "%s%s%s%s%s%s [%Tu]", cli_name(app_source),
+ "%s%s%s%s%s%s [%Tu]",
+#ifdef HEAD_IN_SAND_SNOTICES
+ cli_name(mbuf->mb_source),
+#else
+ cli_name(app_source),
+#endif
mbuf->mb_channel->chname, rembuf_i ? "-" : "",
rembuf, addbuf_i ? "+" : "", addbuf, remstr, addstr,
mbuf->mb_channel->creationtime);
if (mbuf->mb_dest & MODEBUF_DEST_HACK4)
sendto_opmask_butone(0, SNO_HACK4, "HACK(4): %s MODE %s %s%s%s%s%s%s "
- "[%Tu]", cli_name(app_source),
+ "[%Tu]",
+#ifdef HEAD_IN_SAND_SNOTICES
+ cli_name(mbuf->mb_source),
+#else
+ cli_name(app_source),
+#endif
mbuf->mb_channel->chname,
rembuf_i ? "-" : "", rembuf, addbuf_i ? "+" : "",
addbuf, remstr, addstr,
#include "ircd.h"
#include "ircd_alloc.h"
#include "ircd_log.h"
+#include "ircd_policy.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "match.h"
/* Inform ops... */
sendto_opmask_butone(0, SNO_GLINE, "%s adding %s %s for %s, expiring at "
- "%Tu: %s", IsServer(sptr) ? cli_name(sptr) :
+ "%Tu: %s",
+#ifdef HEAD_IN_SAND_SNOTICES
+ cli_name(sptr),
+#else
+ IsServer(sptr) ? cli_name(sptr) :
cli_name((cli_user(sptr))->server),
+#endif
flags & GLINE_LOCAL ? "local" : "global",
flags & GLINE_BADCHAN ? "BADCHAN" : "GLINE", userhost,
expire + TSoffset, reason);
/* Inform ops and log it */
sendto_opmask_butone(0, SNO_GLINE, "%s activating global %s for %s%s%s, "
- "expiring at %Tu: %s", IsServer(sptr) ? cli_name(sptr) :
+ "expiring at %Tu: %s",
+#ifdef HEAD_IN_SAND_SNOTICES
+ cli_name(sptr),
+#else
+ IsServer(sptr) ? cli_name(sptr) :
cli_name((cli_user(sptr))->server),
+#endif
GlineIsBadChan(gline) ? "BADCHAN" : "GLINE",
gline->gl_user, GlineIsBadChan(gline) ? "" : "@",
GlineIsBadChan(gline) ? "" : gline->gl_host,
/* Inform ops and log it */
sendto_opmask_butone(0, SNO_GLINE, "%s %s %s for %s%s%s, expiring at %Tu: "
- "%s", IsServer(sptr) ? cli_name(sptr) :
+ "%s",
+#ifdef HEAD_IN_SAND_SNOTICES
+ cli_name(sptr),
+#else
+ IsServer(sptr) ? cli_name(sptr) :
cli_name((cli_user(sptr))->server),
+#endif
msg, GlineIsBadChan(gline) ? "BADCHAN" : "GLINE",
gline->gl_user, GlineIsBadChan(gline) ? "" : "@",
GlineIsBadChan(gline) ? "" : gline->gl_host,
"recompile to correct this.\n",
which, path, strerror(errno));
-#ifdef CHROOTDIR
- fprintf(stderr, "Keep in mind that paths are relative to CHROOTDIR.\n");
-#endif
-
return 0;
}
-/*----------------------------------------------------------------------------
- * set_chroot_environment
- *--------------------------------------------------------------------------*/
-#ifdef CHROOTDIR
-static char set_chroot_environment(void) {
- /* Must be root to chroot! Silly if you ask me... */
- if (geteuid())
- seteuid(0);
-
- if (chdir(dpath)) {
- fprintf(stderr, "Fail: Cannot chdir(%s): %s\n", dpath, strerror(errno));
- return 0;
- }
- if (chroot(dpath)) {
- fprintf(stderr, "Fail: Cannot chroot(%s): %s\n", dpath, strerror(errno));
- return 0;
- }
- dpath = "/";
- return 1;
-}
-#endif
-
-
/*----------------------------------------------------------------------------
* set_userid_if_needed()
*--------------------------------------------------------------------------*/
static int set_userid_if_needed(void) {
- /* TODO: Drop privs correctly! */
-#if defined(IRC_GID) && defined(IRC_UID)
- setgid (IRC_GID);
- setegid(IRC_GID);
- setuid (IRC_UID);
- seteuid(IRC_UID);
-#endif
-
if (getuid() == 0 || geteuid() == 0 ||
getgid() == 0 || getegid() == 0) {
fprintf(stderr, "ERROR: This server will not run as superuser.\n");
thisServer.uid = getuid();
thisServer.euid = geteuid();
-#ifdef CHROOTDIR
- if (!set_chroot_environment())
- return 1;
-#endif
-
#if defined(HAVE_SETRLIMIT) && defined(RLIMIT_CORE)
set_core_limit();
#endif
!check_file_access(configfile, 'C', R_OK))
return 4;
-#ifdef DEBUG
+#ifdef DEBUGMODE
if (!check_file_access(LPATH, 'L', W_OK))
return 5;
#endif
#include "ircd.h"
#include "ircd_alloc.h"
#include "ircd_log.h"
+#include "ircd_policy.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "match.h"
/* Inform ops and log it */
sendto_opmask_butone(0, SNO_NETWORK, "%s adding %sJUPE for %s, expiring at "
- "%Tu: %s", IsServer(sptr) ? cli_name(sptr) :
+ "%Tu: %s",
+#ifdef HEAD_IN_SAND_SNOTICES
+ cli_name(sptr),
+#else
+ IsServer(sptr) ? cli_name(sptr) :
cli_name(cli_user(sptr)->server),
+#endif
flags & JUPE_LOCAL ? "local " : "", server,
expire + TSoffset, reason);
/* Inform ops and log it */
sendto_opmask_butone(0, SNO_NETWORK, "%s activating JUPE for %s, expiring "
"at %Tu: %s",
- IsServer(sptr) ? cli_name(sptr) : cli_name(cli_user(sptr)->server),
+#ifdef HEAD_IN_SAND_SNOTICES
+ cli_name(sptr),
+#else
+ IsServer(sptr) ? cli_name(sptr) :
+ cli_name(cli_user(sptr)->server),
+#endif
jupe->ju_server, jupe->ju_expire + TSoffset,
jupe->ju_reason);
/* Inform ops and log it */
sendto_opmask_butone(0, SNO_NETWORK, "%s %s JUPE for %s, expiring at %Tu: "
"%s",
- IsServer(sptr) ? cli_name(sptr) : cli_name(cli_user(sptr)->server),
+#ifdef HEAD_IN_SAND_SNOTICES
+ cli_name(sptr),
+#else
+ IsServer(sptr) ? cli_name(sptr) :
+ cli_name(cli_user(sptr)->server),
+#endif
JupeIsLocal(jupe) ? "removing local" : "deactivating",
jupe->ju_server, jupe->ju_expire + TSoffset,
jupe->ju_reason);
* parv[4] = username
* parv[5] = hostname
* parv[6] = umode (optional)
- * parv[parc-4] = %<lastmod>:<mask> <- Only if matching GLINE
* parv[parc-3] = IP# <- Only Protocol >= 10
* parv[parc-2] = YXX, numeric nick <- Only Protocol >= 10
* parv[parc-1] = info
/*
* NICK and USER OK
*/
- return register_user(cptr, sptr, cli_name(sptr), cli_user(sptr)->username, 0);
+ return register_user(cptr, sptr, cli_name(sptr), cli_user(sptr)->username);
}
else
send_reply(sptr, SND_EXPLICIT | ERR_BADPING,
}
}
- ret = server_estab(cptr, aconf, ajupe);
+ ret = server_estab(cptr, aconf);
}
else
ret = 0;
* parv[6] = "YMM", where 'Y' is the server numeric and "MM" is the
* numeric nick mask of this server.
* parv[7] = 0 (not used yet, mandatory unsigned int after u2.10.06)
- * parv[8] = %<lastmod> - optional parameter only present if there's an
- * outstanding JUPE; specifies the JUPE's lastmod field
*/
int ms_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
{
struct Client* LHcptr = 0;
struct ConfItem* aconf = 0;
struct ConfItem* lhconf = 0;
- struct Jupe* ajupe = 0;
int hop;
int ret;
int active_lh_line = 0;
time_t timestamp = 0;
time_t recv_time;
time_t ghost = 0;
- time_t lastmod = 0;
if (IsUserPort(cptr))
return exit_client_msg(cptr, cptr, &me,
return exit_new_server(cptr, sptr, host, timestamp,
"Incompatible protocol: %s", parv[5]);
}
- if (parc > 9 && *parv[8] == '%')
- lastmod = atoi(parv[8] + 1);
- /* If there's a jupe that matches, and it's a global jupe, and the
- * introducer didn't indicate it knew of the jupe or has an older
- * version of the jupe, and the connection isn't in a BURST, resynch
- * the jupe.
- */
- if ((ajupe = jupe_find(host)) && !JupeIsLocal(ajupe) &&
- JupeLastMod(ajupe) > lastmod && !IsBurstOrBurstAck(cptr))
- jupe_resend(cptr, ajupe);
/*
* Check for "FRENCH " infection ;-) (actually this should
* be replaced with routine to check the hostname syntax in
}
}
- ret = server_estab(cptr, aconf, ajupe);
+ ret = server_estab(cptr, aconf);
}
else
ret = 0;
/*
* NICK and PONG already received, now we have USER...
*/
- return register_user(cptr, sptr, cli_name(sptr), username, 0);
+ return register_user(cptr, sptr, cli_name(sptr), username);
}
else {
ircd_strncpy(user->username, username, USERLEN);
* May only be called after a SERVER was received from cptr,
* and thus make_server was called, and serv->prot set. --Run
*/
-int server_estab(struct Client *cptr, struct ConfItem *aconf,
- struct Jupe *ajupe)
+int server_estab(struct Client *cptr, struct ConfItem *aconf)
{
struct Client* acptr = 0;
const char* inpath;
continue;
if (!match(cli_name(&me), cli_name(cptr)))
continue;
- if (ajupe)
- sendcmdto_one(&me, CMD_SERVER, acptr,
- "%s 2 0 %Tu J%02u %s%s 0 %%%Tu :%s", cli_name(cptr),
- cli_serv(cptr)->timestamp, Protocol(cptr), NumServCap(cptr),
- JupeLastMod(ajupe), cli_info(cptr));
- else
- sendcmdto_one(&me, CMD_SERVER, acptr,
- "%s 2 0 %Tu J%02u %s%s 0 :%s", cli_name(cptr),
- cli_serv(cptr)->timestamp, Protocol(cptr), NumServCap(cptr),
- cli_info(cptr));
+ sendcmdto_one(&me, CMD_SERVER, acptr,
+ "%s 2 0 %Tu J%02u %s%s 0 :%s", cli_name(cptr),
+ cli_serv(cptr)->timestamp, Protocol(cptr), NumServCap(cptr),
+ cli_info(cptr));
}
/*
split = (MyConnect(acptr) &&
0 != ircd_strcmp(cli_name(acptr), cli_sockhost(acptr)) &&
0 != ircd_strncmp(cli_info(acptr), "JUPE", 4));
- if ((ajupe = jupe_find(cli_name(acptr))) && !JupeIsLocal(ajupe))
- sendcmdto_one(cli_serv(acptr)->up, CMD_SERVER, cptr,
- "%s %d 0 %Tu %s%u %s%s 0 %%%Tu :%s", cli_name(acptr),
- cli_hopcount(acptr) + 1, cli_serv(acptr)->timestamp,
- protocol_str, Protocol(acptr), NumServCap(acptr),
- JupeLastMod(ajupe), cli_info(acptr));
- else
- sendcmdto_one(cli_serv(acptr)->up, CMD_SERVER, cptr,
- "%s %d 0 %Tu %s%u %s%s 0 :%s", cli_name(acptr),
- cli_hopcount(acptr) + 1, cli_serv(acptr)->timestamp,
- protocol_str, Protocol(acptr), NumServCap(acptr),
- cli_info(acptr));
+ sendcmdto_one(cli_serv(acptr)->up, CMD_SERVER, cptr,
+ "%s %d 0 %Tu %s%u %s%s 0 :%s", cli_name(acptr),
+ cli_hopcount(acptr) + 1, cli_serv(acptr)->timestamp,
+ protocol_str, Protocol(acptr), NumServCap(acptr),
+ cli_info(acptr));
}
}
{
char xxx_buf[8];
char *s = umode_str(acptr);
- struct Gline *agline = 0;
- if ((agline = gline_lookup(acptr, GLINE_GLOBAL | GLINE_LASTMOD)))
- sendcmdto_one(cli_user(acptr)->server, CMD_NICK, cptr,
- "%s %d %Tu %s %s %s%s%s%%%Tu:%s@%s %s %s%s :%s",
- cli_name(acptr), cli_hopcount(acptr) + 1, cli_lastnick(acptr),
- cli_user(acptr)->username, cli_user(acptr)->host,
- *s ? "+" : "", s, *s ? " " : "",
- GlineLastMod(agline), GlineUser(agline),
- GlineHost(agline),
- inttobase64(xxx_buf, ntohl(cli_ip(acptr).s_addr), 6),
- NumNick(acptr), cli_info(acptr));
- else
- sendcmdto_one(cli_user(acptr)->server, CMD_NICK, cptr,
- "%s %d %Tu %s %s %s%s%s%s %s%s :%s",
- cli_name(acptr), cli_hopcount(acptr) + 1, cli_lastnick(acptr),
- cli_user(acptr)->username, cli_user(acptr)->host,
- *s ? "+" : "", s, *s ? " " : "",
- inttobase64(xxx_buf, ntohl(cli_ip(acptr).s_addr), 6),
- NumNick(acptr), cli_info(acptr));
+ sendcmdto_one(cli_user(acptr)->server, CMD_NICK, cptr,
+ "%s %d %Tu %s %s %s%s%s%s %s%s :%s",
+ cli_name(acptr), cli_hopcount(acptr) + 1, cli_lastnick(acptr),
+ cli_user(acptr)->username, cli_user(acptr)->host,
+ *s ? "+" : "", s, *s ? " " : "",
+ inttobase64(xxx_buf, ntohl(cli_ip(acptr).s_addr), 6),
+ NumNick(acptr), cli_info(acptr));
}
}
/*
#include "channel.h"
#include "class.h"
#include "client.h"
-#include "gline.h"
#include "hash.h"
#include "ircd.h"
#include "ircd_alloc.h"
* nick from local user or kill him/her...
*/
int register_user(struct Client *cptr, struct Client *sptr,
- const char *nick, char *username, struct Gline *agline)
+ const char *nick, char *username)
{
struct ConfItem* aconf;
char* parv[3];
}
SetUser(sptr);
- /* a gline wasn't passed in, so find a matching global one that isn't
- * a Uworld-set one, and propagate it if there is such an animal.
- */
- if (!agline &&
- (agline = gline_lookup(sptr, GLINE_GLOBAL | GLINE_LASTMOD)) &&
- !IsBurstOrBurstAck(cptr))
- gline_resend(cptr, agline);
-
if (IsInvisible(sptr))
++UserStats.inv_clients;
if (IsOper(sptr))
}
}
tmpstr = umode_str(sptr);
- if (agline)
- sendcmdto_serv_butone(user->server, CMD_NICK, cptr,
- "%s %d %Tu %s %s %s%s%s%%%Tu:%s@%s %s %s%s :%s",
- nick, cli_hopcount(sptr) + 1, cli_lastnick(sptr),
- user->username, user->host,
- *tmpstr ? "+" : "", tmpstr, *tmpstr ? " " : "",
- GlineLastMod(agline), GlineUser(agline),
- GlineHost(agline),
- inttobase64(ip_base64, ntohl(cli_ip(sptr).s_addr), 6),
- NumNick(sptr), cli_info(sptr));
- else
- sendcmdto_serv_butone(user->server, CMD_NICK, cptr,
- "%s %d %Tu %s %s %s%s%s%s %s%s :%s",
- nick, cli_hopcount(sptr) + 1, cli_lastnick(sptr),
- user->username, user->host,
- *tmpstr ? "+" : "", tmpstr, *tmpstr ? " " : "",
- inttobase64(ip_base64, ntohl(cli_ip(sptr).s_addr), 6),
- NumNick(sptr), cli_info(sptr));
+ sendcmdto_serv_butone(user->server, CMD_NICK, cptr,
+ "%s %d %Tu %s %s %s%s%s%s %s%s :%s",
+ nick, cli_hopcount(sptr) + 1, cli_lastnick(sptr),
+ user->username, user->host,
+ *tmpstr ? "+" : "", tmpstr, *tmpstr ? " " : "",
+ inttobase64(ip_base64, ntohl(cli_ip(sptr).s_addr), 6),
+ NumNick(sptr), cli_info(sptr));
/* Send umode to client */
if (MyUser(sptr))
if (IsServer(sptr)) {
int i;
const char* p;
- char *t;
- struct Gline *agline = 0;
/*
* A server introducing a new client, change source
ircd_strncpy(cli_user(new_client)->host, parv[5], HOSTLEN);
ircd_strncpy(cli_info(new_client), parv[parc - 1], REALLEN);
- /* Deal with GLINE parameters... */
- if (*parv[parc - 4] == '%' && (t = strchr(parv[parc - 4] + 1, ':'))) {
- time_t lastmod;
-
- *(t++) = '\0';
- lastmod = atoi(parv[parc - 4] + 1);
-
- if (lastmod &&
- (agline = gline_find(t, GLINE_EXACT | GLINE_GLOBAL | GLINE_LASTMOD))
- && GlineLastMod(agline) > lastmod && !IsBurstOrBurstAck(cptr))
- gline_resend(cptr, agline);
- }
- return register_user(cptr, new_client, cli_name(new_client), parv[4], agline);
+ return register_user(cptr, new_client, cli_name(new_client), parv[4]);
}
else if ((cli_name(sptr))[0]) {
/*
* for it - must test this and exit m_nick too !
*/
cli_lastnick(sptr) = TStime(); /* Always local client */
- if (register_user(cptr, sptr, nick, cli_user(sptr)->username, 0) == CPTR_KILLED)
+ if (register_user(cptr, sptr, nick, cli_user(sptr)->username) == CPTR_KILLED)
return CPTR_KILLED;
}
}