Log message:
Type safety and const correctness cleanups.
git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@180
c9e4aea6-c8fd-4c43-8297-
357d70d61c8c
16 files changed:
#
# BUGS file for ircu2.10
#
#
# BUGS file for ircu2.10
#
-# $Id: BUGS,v 1.5 2000-04-14 17:08:06 kev Exp $
+# $Id: BUGS,v 1.6 2000-04-15 04:20:14 bleep Exp $
+* crule parser coredumps on invalid input
* /mode #foo +o Thisnickdoesntexist -> Core dump. Kev?
- FIXED
* /mode #foo +o Thisnickdoesntexist -> Core dump. Kev?
- FIXED
+2000-04-15 Thomas Helvey <tomh@inxpress.net>
+
+ * ircd/*.c: const correctness and type safety cleanups to
+ get code to compile with C++ compiler. Still has
+ signed/unsigned comparison warnings.
+
2000-04-15 Greg Sikorski <gte@atomicrevs.demon.co.uk>
* ircd/userload.c: change <sys/time.h> include to <time.h> for
2000-04-15 Greg Sikorski <gte@atomicrevs.demon.co.uk>
* ircd/userload.c: change <sys/time.h> include to <time.h> for
#
# ChangeLog for ircu2.10.11
#
#
# ChangeLog for ircu2.10.11
#
-# $Id: ChangeLog,v 1.88 2000-04-15 03:47:32 gte Exp $
+# $Id: ChangeLog,v 1.89 2000-04-15 04:20:14 bleep Exp $
#
# Insert new changes at beginning of the change list.
#
#
# Insert new changes at beginning of the change list.
#
(No idea)
Medium Priority:
(No idea)
Medium Priority:
+* crule parser coredumps on invalid input
* why do the allocation counts change the first time you rehash
after a server boot without changing the conf file:
*** Allocations: 416(41848)
* why do the allocation counts change the first time you rehash
after a server boot without changing the conf file:
*** Allocations: 416(41848)
-#ifdef __cplusplus
-extern "C" {
-#endif
-
extern size_t fda_get_byte_count(void);
extern size_t fda_get_block_count(void);
extern size_t fda_sizeof(const void* p);
extern size_t fda_get_byte_count(void);
extern size_t fda_get_block_count(void);
extern size_t fda_sizeof(const void* p);
extern void fda_set_lowmem_handler(void (*fn)(void));
extern void fda_set_nomem_handler(void (*fn)(void));
extern void fda_set_lowmem_handler(void (*fn)(void));
extern void fda_set_nomem_handler(void (*fn)(void));
-#ifdef __cplusplus
-}
-#endif
#endif /* !defined(NDEBUG) */
#endif /* INCLUDED_fda_h */
#endif /* !defined(NDEBUG) */
#endif /* INCLUDED_fda_h */
const char* conf_eval_crule(struct ConfItem* conf);
extern void det_confs_butmask(struct Client *cptr, int mask);
const char* conf_eval_crule(struct ConfItem* conf);
extern void det_confs_butmask(struct Client *cptr, int mask);
-extern int attach_iline(struct Client *cptr);
extern int detach_conf(struct Client *cptr, struct ConfItem *aconf);
extern int detach_conf(struct Client *cptr, struct ConfItem *aconf);
-extern int attach_conf(struct Client *cptr, struct ConfItem *aconf);
+extern enum AuthorizationCheckResult attach_conf(struct Client *cptr, struct ConfItem *aconf);
extern struct ConfItem* find_admin(void);
extern struct ConfItem* find_me(void);
extern struct ConfItem* find_conf_exact(const char* name,
extern struct ConfItem* find_admin(void);
extern struct ConfItem* find_me(void);
extern struct ConfItem* find_conf_exact(const char* name,
-extern int exit_new_server(struct Client *cptr, struct Client *sptr,
- char *host, time_t timestamp, char *fmt, ...);
+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);
extern int a_kills_b_too(struct Client *a, struct Client *b);
extern int server_estab(struct Client *cptr, struct ConfItem *aconf);
#include <assert.h>
#include <stdio.h> /* NULL ... bleah */
#include <assert.h>
#include <stdio.h> /* NULL ... bleah */
+#include <string.h> /* memset */
} else if ((fld_s.flags & CONV_MASK) == CONV_STRING ||
fld_s.value.v_ptr == 0) { /* spaces or null pointers */
int slen, plen;
} else if ((fld_s.flags & CONV_MASK) == CONV_STRING ||
fld_s.value.v_ptr == 0) { /* spaces or null pointers */
int slen, plen;
- char *str = fld_s.value.v_ptr;
+ char *str = (char*) fld_s.value.v_ptr;
if (!str) /* NULL pointers print "(null)" */
str = "(null)";
if (!str) /* NULL pointers print "(null)" */
str = "(null)";
do_pad(buf_p, plen, spaces); /* post-padding */
} else if ((fld_s.flags & CONV_MASK) == CONV_VARARGS) {
struct BufData buf_s = BUFDATA_INIT;
do_pad(buf_p, plen, spaces); /* post-padding */
} else if ((fld_s.flags & CONV_MASK) == CONV_VARARGS) {
struct BufData buf_s = BUFDATA_INIT;
- struct VarData *vdata = fld_s.value.v_ptr;
+ struct VarData *vdata = (struct VarData*) fld_s.value.v_ptr;
int plen, tlen;
buf_s.buf = buf_p->buf + buf_p->buf_loc;
int plen, tlen;
buf_s.buf = buf_p->buf + buf_p->buf_loc;
vdata->vd_chars = buf_s.buf_loc; /* return relevant data */
vdata->vd_overflow = SNP_MAX(buf_s.buf_overflow, buf_s.overflow);
} else if ((fld_s.flags & CONV_MASK) == CONV_CLIENT) {
vdata->vd_chars = buf_s.buf_loc; /* return relevant data */
vdata->vd_overflow = SNP_MAX(buf_s.buf_overflow, buf_s.overflow);
} else if ((fld_s.flags & CONV_MASK) == CONV_CLIENT) {
- struct Client *cptr = fld_s.value.v_ptr;
+ struct Client *cptr = (struct Client*) fld_s.value.v_ptr;
char *str1 = 0, *str2 = 0;
int slen1 = 0, slen2 = 0, plen = 0;
char *str1 = 0, *str2 = 0;
int slen1 = 0, slen2 = 0, plen = 0;
buf_s.buf = buf; /* initialize buffer settings */
buf_s.buf_size = buf_len - 1;
buf_s.buf = buf; /* initialize buffer settings */
buf_s.buf_size = buf_len - 1;
+ /*
+ * XXX - assignment of -1 to size_t
+ */
buf_s.limit = -1;
va_start(args, format);
buf_s.limit = -1;
va_start(args, format);
buf_s.buf = buf; /* initialize buffer settings */
buf_s.buf_size = buf_len - 1;
buf_s.buf = buf; /* initialize buffer settings */
buf_s.buf_size = buf_len - 1;
+ /*
+ * XXX - assignment of -1 to size_t
+ */
buf_s.limit = -1;
doprintf(dest, &buf_s, format, args); /* fill the buffer */
buf_s.limit = -1;
doprintf(dest, &buf_s, format, args); /* fill the buffer */
*/
int ms_error(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
{
*/
int ms_error(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
{
para = (parc > 1 && *parv[parc - 1] != '\0') ? parv[parc - 1] : "<>";
para = (parc > 1 && *parv[parc - 1] != '\0') ? parv[parc - 1] : "<>";
*/
int mr_error(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
{
*/
int mr_error(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
{
para = (parc > 1 && *parv[parc - 1] != '\0') ? parv[parc - 1] : "<>";
para = (parc > 1 && *parv[parc - 1] != '\0') ? parv[parc - 1] : "<>";
int m_user(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
{
char* username;
int m_user(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
{
char* username;
- char* umode;
- char* snomask;
- char* info;
+ const char* umode;
+ const char* snomask;
+ const char* info;
struct User* user;
assert(0 != cptr);
struct User* user;
assert(0 != cptr);
struct Channel* chptr;
char* nick;
char* tmp;
struct Channel* chptr;
char* nick;
char* tmp;
char* p = 0;
int found;
int len;
char* p = 0;
int found;
int len;
struct Channel* chptr;
char* nick;
char* tmp;
struct Channel* chptr;
char* nick;
char* tmp;
char* p = 0;
int found;
int len;
char* p = 0;
int found;
int len;
struct Channel* chptr;
char* nick;
char* tmp;
struct Channel* chptr;
char* nick;
char* tmp;
char* p = 0;
int found;
int len;
char* p = 0;
int found;
int len;
Debug((DEBUG_DNS, "Resolver: query_name: %s %d %d", name, query_class, type));
memset(buf, 0, sizeof(buf));
if ((request_len = res_mkquery(QUERY, name, query_class, type,
Debug((DEBUG_DNS, "Resolver: query_name: %s %d %d", name, query_class, type));
memset(buf, 0, sizeof(buf));
if ((request_len = res_mkquery(QUERY, name, query_class, type,
- NULL, 0, NULL, buf, sizeof(buf))) > 0) {
+ 0, 0, 0, (unsigned char*) buf, sizeof(buf))) > 0) {
HEADER* header = (HEADER*) buf;
#ifndef LRAND48
int k = 0;
HEADER* header = (HEADER*) buf;
#ifndef LRAND48
int k = 0;
++request->sends;
Debug((DEBUG_DNS, "Resolver: query_name %d: %s %d %d", request->id,
name, query_class, type));
++request->sends;
Debug((DEBUG_DNS, "Resolver: query_name %d: %s %d %d", request->id,
name, query_class, type));
- request->sent += send_res_msg(buf, request_len, request->sends);
+ request->sent += send_res_msg((const unsigned char*) buf, request_len, request->sends);
Debug((DEBUG_DNS, "Resolver: read"));
if (IO_SUCCESS != os_recvfrom_nonb(ResolverFileDescriptor,
Debug((DEBUG_DNS, "Resolver: read"));
if (IO_SUCCESS != os_recvfrom_nonb(ResolverFileDescriptor,
- buf, sizeof(buf), &rc, &sin)) {
+ (char*) buf, sizeof(buf), &rc, &sin)) {
return 0;
}
if (rc < sizeof(HEADER)) {
return 0;
}
if (rc < sizeof(HEADER)) {
ocp->hname_next = hashtable[hashv].name_list;
hashtable[hashv].name_list = ocp;
ocp->hname_next = hashtable[hashv].name_list;
hashtable[hashv].name_list = ocp;
- hashv = hash_number(ocp->he.h.h_addr);
+ hashv = hash_number((const unsigned char*) ocp->he.h.h_addr);
ocp->hnum_next = hashtable[hashv].num_list;
hashtable[hashv].num_list = ocp;
ocp->hnum_next = hashtable[hashv].num_list;
hashtable[hashv].num_list = ocp;
int i;
assert(0 != addr);
int i;
assert(0 != addr);
- hashv = hash_number(addr);
+ hashv = hash_number((const unsigned char*) addr);
cp = hashtable[hashv].num_list;
for (; cp; cp = cp->hnum_next) {
cp = hashtable[hashv].num_list;
for (; cp; cp = cp->hnum_next) {
* are looking for, its been done already.
*/
if (!cp->he.h.h_addr_list[1] ||
* are looking for, its been done already.
*/
if (!cp->he.h.h_addr_list[1] ||
- hashv == hash_number(cp->he.h.h_addr_list[0]))
+ hashv == hash_number((const unsigned char*) cp->he.h.h_addr_list[0]))
continue;
for (i = 1; cp->he.h.h_addr_list[i]; ++i) {
if (!memcmp(cp->he.h.h_addr_list[i], addr, sizeof(struct in_addr))) {
continue;
for (i = 1; cp->he.h.h_addr_list[i]; ++i) {
if (!memcmp(cp->he.h.h_addr_list[i], addr, sizeof(struct in_addr))) {
/*
* remove cache entry from hashed number list
*/
/*
* remove cache entry from hashed number list
*/
- hashv = hash_number(hp->h_addr);
+ hashv = hash_number((const unsigned char*) hp->h_addr);
assert(-1 < hashv);
for (cp = &hashtable[hashv].num_list; *cp; cp = &((*cp)->hnum_next)) {
assert(-1 < hashv);
for (cp = &hashtable[hashv].num_list; *cp; cp = &((*cp)->hnum_next)) {
- new_client = make_client(NULL,
+ new_client = make_client(0,
(listener->server) ? STAT_UNKNOWN_SERVER : STAT_UNKNOWN_USER);
/*
* Copy ascii address to 'sockhost' just in case. Then we
(listener->server) ? STAT_UNKNOWN_SERVER : STAT_UNKNOWN_USER);
/*
* Copy ascii address to 'sockhost' just in case. Then we
/*
* check_limit_and_attach - check client limits and attach I:line
*/
/*
* check_limit_and_attach - check client limits and attach I:line
*/
-static int check_limit_and_attach(struct Client* cptr, struct ConfItem* aconf)
+static enum AuthorizationCheckResult
+check_limit_and_attach(struct Client* cptr, struct ConfItem* aconf)
{
if (aconf->passwd) {
/* Special case: exactly one digit */
{
if (aconf->passwd) {
/* Special case: exactly one digit */
/*
* Find the first (best) I line to attach.
*/
/*
* Find the first (best) I line to attach.
*/
-int attach_iline(struct Client* cptr)
+enum AuthorizationCheckResult attach_iline(struct Client* cptr)
{
struct ConfItem* aconf;
const char* hname;
{
struct ConfItem* aconf;
const char* hname;
* connection). Note, that this automaticly changes the
* attachment if there was an old one...
*/
* connection). Note, that this automaticly changes the
* attachment if there was an old one...
*/
-int attach_conf(struct Client *cptr, struct ConfItem *aconf)
+enum AuthorizationCheckResult attach_conf(struct Client *cptr, struct ConfItem *aconf)
*/
enum AuthorizationCheckResult conf_check_client(struct Client *cptr)
{
*/
enum AuthorizationCheckResult conf_check_client(struct Client *cptr)
{
+ enum AuthorizationCheckResult acr = ACR_OK;
unsigned int max_connection_count = 0;
unsigned int max_client_count = 0;
unsigned int max_connection_count = 0;
unsigned int max_client_count = 0;
-int exit_new_server(struct Client *cptr, struct Client *sptr,
- char *host, time_t timestamp, char *fmt, ...)
+int exit_new_server(struct Client* cptr, struct Client* sptr,
+ const char* host, time_t timestamp, const char* fmt, ...)
{
va_list vl;
char *buf =
{
va_list vl;
char *buf =
"Bleep Thomas Helvey <tomh@inxpress.net>",
"",
"Contributors to this release:",
"Bleep Thomas Helvey <tomh@inxpress.net>",
"",
"Contributors to this release:",
- "Isomer, Gte-, WildThang, David M, Run, Nemesi",
+ "Kev, Isomer, Gte, Ghostwolf, Bleep",
"Debugging and support:",
"Debugging and support:",
- "SeKs, Maniac-, HeKTik, OmniDynmc, Aurorian, Quantum, Jesus",
+ "SeKs, Maniac-, HeKTik, OmniDynmc, Liandrin, Dianora",
"Special thanks to Angel and Buff for believing in us and putting"
"up with frantic late night phone calls"
"",
"Special thanks to Angel and Buff for believing in us and putting"
"up with frantic late night phone calls"
"",