Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
b9883b5
updating C standard to C11
eaescob Sep 23, 2025
56fb7b9
more changes to get to c11
eaescob Sep 23, 2025
8f0b858
add definitions for u_types if system does not provide
eaescob Sep 23, 2025
813d917
force c11 and other declarations errors when compiling on Linux
eaescob Sep 23, 2025
2b15fc1
adding code definition to make res functions work
eaescob Sep 23, 2025
2489b55
attempting to not override our definition of res
eaescob Sep 24, 2025
6db4c03
Only use the needed guard definitions
eaescob Sep 24, 2025
24ebd3f
Fix HEADER rcode compilation error on Linux x86_64
eaescob Sep 24, 2025
8b120f6
Fixing compilation errors to refer to h_addr_list[0] instead of just …
eaescob Sep 24, 2025
739e270
remove version.c as we do not need it tracked
eaescob Sep 24, 2025
74c869e
Fix C11 compilation issues and reduce warnings
eaescob Sep 24, 2025
6011fb7
Uncomment random() and srandom()
eaescob Sep 24, 2025
5efcef0
Significantly reduce compilation warnings and fix C11 compatibility
eaescob Sep 24, 2025
c7b21e5
Eliminate unused return value and implicit declaration warnings
eaescob Sep 24, 2025
76c8ee8
Fix all compilation errors and significantly reduce warnings
eaescob Sep 24, 2025
413028c
Fixing compilation warnings and addressing buffer sizes to comply wit…
eaescob Sep 24, 2025
9160f5f
More fixes for handling new buffer sizes to address compilation warnings
eaescob Sep 24, 2025
2348e88
Moved buffer length definitions earlier in file so they can be used t…
eaescob Sep 24, 2025
f28b1bd
Fixing compilation issues
eaescob Sep 24, 2025
29672ca
Increase buffer sizes to address compilation warnings
eaescob Sep 24, 2025
0add355
Resetting PATH_MAX to an appropriate value. Changed to strncpyzt to e…
eaescob Sep 24, 2025
f51ee01
Fixing write_pid to accommodate longer pids but also truncate file in…
eaescob Sep 24, 2025
9855690
Removing USE_SSL definition
eaescob Sep 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,10 @@ dnl Checks for programs.
AC_PROG_CC
AX_CFLAGS_WARN_ALL
AX_CHECK_COMPILE_FLAG([-fno-strict-aliasing], [CFLAGS="$CFLAGS -fno-strict-aliasing"])
AX_CHECK_COMPILE_FLAG([-fgnu89-inline], [CFLAGS="$CFLAGS -fgnu89-inline"])
# Use modern C standard instead of GNU C89 inline behavior
AX_CHECK_COMPILE_FLAG([-std=c11], [CFLAGS="$CFLAGS -std=c11"])
# Remove -fgnu89-inline flag as it conflicts with C11 standard
CFLAGS=`echo "$CFLAGS" | sed 's/-fgnu89-inline//g'`
AC_CANONICAL_TARGET
AC_SEARCH_LIBS([strerror],[cposix])
AC_PROG_MAKE_SET
Expand Down
2 changes: 1 addition & 1 deletion include/confparse.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ struct TopConf
unsigned int flag; /* our token flag */
unsigned int nest; /* tokens we allow to nest here */
sConf *subtok; /* sub-tokens allowed in here */
int (*func) (); /* function to call to add this */
int (*func) (cVar **, int); /* function to call to add this */
};

/* sub-token options */
Expand Down
36 changes: 17 additions & 19 deletions include/h.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ extern int local_ip_limit, local_ip24_limit, global_ip_limit,
global_ip24_limit;

#ifndef PATH_MAX
#define PATH_MAX 4096
#define PATH_MAX 4120 /* 4096 + reasonable space for appended filenames and null terminators */
#endif
extern char dpath[PATH_MAX], spath[PATH_MAX];
Comment on lines +72 to 74
Copy link

Copilot AI Sep 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The PATH_MAX increase to 4120 with a comment about 'reasonable space' is arbitrary. Consider using a more systematic approach like PATH_MAX + NAME_MAX + 1 for proper path construction bounds.

Suggested change
#define PATH_MAX 4120 /* 4096 + reasonable space for appended filenames and null terminators */
#endif
extern char dpath[PATH_MAX], spath[PATH_MAX];
#define PATH_MAX 4096 /* Typical Linux value for maximum path length */
#endif
#ifndef NAME_MAX
#define NAME_MAX 255 /* Typical POSIX value for maximum filename length */
#endif
#define PATH_BUFSIZE (PATH_MAX + NAME_MAX + 1)
extern char dpath[PATH_BUFSIZE], spath[PATH_BUFSIZE];

Copilot uses AI. Check for mistakes.

Expand All @@ -90,7 +90,7 @@ extern struct stats *ircstp;
extern int bootopt;

extern char *canonize(char *);
extern void check_fdlists();
extern void check_fdlists(void);
extern aChannel *find_channel(char *, aChannel *);
extern void flush_user_banserial(aClient *);
extern aBan *nick_is_banned(aChannel *, char *, aClient *);
Expand Down Expand Up @@ -119,9 +119,9 @@ extern aClient *find_chasing(aClient *, char *, int *);
extern int find_restrict(aClient *);
extern int rehash(aClient *, aClient *, int);
extern int initconf(char *);
extern inline char *finishconf(void);
extern void merge_confs();
extern int lock_kline_file();
extern char *finishconf(void);
extern void merge_confs(void);
extern int lock_kline_file(void);

extern void clear_scache_hash_table(void);
extern char *find_or_add(char *);
Expand Down Expand Up @@ -195,13 +195,13 @@ extern void add_local_domain(char *, int);
extern int check_client(aClient *);
extern int check_server_init(aClient *);
extern void close_connection(aClient *);
extern void close_listeners();
extern void open_listeners();
extern void close_listeners(void);
extern void open_listeners(void);
extern int connect_server(aConnect *, aClient *, struct hostent *);
extern void get_my_name(aClient *, char *, int);
extern int get_sockerr(aClient *);
extern int inetport(aClient *, char *, int, u_long);
extern void init_sys();
extern void init_sys(void);
extern int read_message(time_t, fdlist *);
extern void report_error(char *, aClient *);
extern void set_non_blocking(int, aClient *);
Expand All @@ -218,7 +218,7 @@ extern int do_client_queue(aClient *);
extern void read_error_exit(aClient *, int, int);
extern int readwrite_client(aClient *, int, int);

extern inline char *get_listener_name(aListener *);
extern char *get_listener_name(aListener *);
extern int attach_Iline(aClient *, struct hostent *, char *);
extern aConnect *find_aConnect(char *);
extern aOper *find_oper(char *, char *, char *, char *);
Expand All @@ -238,8 +238,8 @@ extern void terminate(void), write_pidfile(void);
extern int match(char *, char *);
extern char *collapse(char *);

extern int load_settings();
extern int save_settings();
extern int load_settings(void);
extern int save_settings(void);

extern int writecalls, writeb[];
#ifdef WRITEV_IOV
Expand All @@ -263,7 +263,7 @@ extern int do_numeric(int, aClient *, aClient *, int, char **);
extern int hunt_server(aClient *, aClient *, char *, int, int, char **);
extern aClient *next_client(aClient *, char *);
extern aClient *next_client_double(aClient *, char *);
extern inline void verbose_to_opers(aClient *sptr, aChannel *chptr, char *cmd, char *reason); /* for m_message() */
extern void verbose_to_opers(aClient *sptr, aChannel *chptr, char *cmd, char *reason); /* for m_message() */

extern int m_umode(aClient *, aClient *, int, char **);
extern int m_names(aClient *, aClient *, int, char **);
Expand All @@ -278,7 +278,7 @@ extern void free_chanmember(chanMember *);
extern void free_class(aClass *);
extern void free_user(anUser *, aClient *);
extern void free_channel(aChannel *);
extern aChannel *make_channel();
extern aChannel *make_channel(char *name);
extern Link *make_link(void);
extern DLink *make_dlink(void);
extern chanMember *make_chanmember(void);
Expand All @@ -297,7 +297,7 @@ extern void block_garbage_collect(void); /* list.c */
extern void block_destroy(void); /* list.c */

extern void set_effective_class(aClient *);
extern void initclass();
extern void initclass(void);

extern struct hostent *get_res(char *);
extern struct hostent *gethost_byaddr(char *, Link *, int);
Expand Down Expand Up @@ -348,9 +348,9 @@ extern FILE *dumpfp;
#endif

#ifdef FLUD
int check_for_flood();
void free_fluders();
void free_fludees();
int check_for_flood(aClient *cptr, char *text);
void free_fluders(aClient *cptr, aChannel *chptr);
void free_fludees(aClient *cptr);
#define MyFludConnect(x) (((x)->fd >= 0) || ((x)->fd == -2))

#endif /* FLUD */
Expand Down Expand Up @@ -380,7 +380,6 @@ int probability_loadsets(char *);
void probability_fini(void);
void get_probabilities(aClient *, int *, int *, int *);

#ifdef USE_SSL
int ssl_init();
int ssl_rehash();
int safe_ssl_read(aClient *, void *, int);
Expand All @@ -389,7 +388,6 @@ int safe_ssl_accept(aClient *, int);
int ssl_smart_shutdown(SSL *);
int safe_ssl_connect(aClient *);
int ssl_verify_callback(int, X509_STORE_CTX *);
#endif


#include "find.h"
Expand Down
14 changes: 0 additions & 14 deletions include/inet.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#define __u_l unsigned long
#endif

#ifdef __STDC__
extern __u_l inet_addr(char *);
extern char *inet_ntoa(char *);
extern __u_l inet_makeaddr(int, int);
Expand All @@ -39,17 +38,4 @@ extern __u_l inet_netof(struct in_addr);
extern int inet_pton(int, const char *, void *);
extern const char *inet_ntop(int, const void *, char *, socklen_t);

#else
extern __u_l inet_addr();
extern char *inet_ntoa();

extern __u_l inet_makeaddr();

#endif
extern __u_l inet_network();
extern __u_l inet_lnaof();
extern __u_l inet_netof();
extern int inet_pton();
extern const char *inet_ntop();

#undef __u_l
3 changes: 0 additions & 3 deletions include/libcrypto-compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#define LIBCRYPTO_COMPAT_H

#include <struct.h>
#ifdef USE_SSL

#if OPENSSL_VERSION_NUMBER < 0x10100000L

Expand All @@ -16,6 +15,4 @@ int DH_set_length(DH *dh, long length);

#endif /* OPENSSL_VERSION_NUMBER */

#endif /* USE_SSL */

#endif /* LIBCRYPTO_COMPAT_H */
7 changes: 7 additions & 0 deletions include/msg.h
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,10 @@ AliasInfo aliastab[] =
{ 0 }
};

#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#endif
struct Message msgtab[] =
{
{MSG_PRIVATE, m_private, MAXPARA, MF_RIDLE, 0},
Expand Down Expand Up @@ -381,6 +385,9 @@ struct Message msgtab[] =
{MSG_WEBIRC, m_webirc, MAXPARA, MF_UNREG, 0},
{ 0 }
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif

MESSAGE_TREE *msg_tree_root;
#else
Expand Down
2 changes: 1 addition & 1 deletion include/nameser.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
#if defined(vax) || defined(ns32000) || defined(sun386) || defined(MIPSEL) || \
defined(BIT_ZERO_ON_RIGHT) || defined(i386) ||\
defined(___vax__) || defined(__ns32000__) || defined(__sun386__) ||\
defined(__alpha)
defined(__alpha) || defined(__x86_64__) || defined(__i386__) || defined(__amd64__)

#define BYTE_ORDER LITTLE_ENDIAN

Expand Down
12 changes: 8 additions & 4 deletions include/resolv.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,11 @@ struct state {
extern struct state _res;
#endif

extern char *p_cdname(), *p_rr(), *p_type(), *p_class(), *p_time();
extern char *p_cdname(char *, char *, char **);
extern char *p_rr(char *, char *, char **);
extern char *p_type(int);
extern char *p_class(int);
extern char *p_time(u_int32_t);

#if !defined(HAVE_RES_INIT) && defined(HAVE___RES_INIT)
#define res_init __res_init
Expand All @@ -116,7 +120,7 @@ extern char *p_cdname(), *p_rr(), *p_type(), *p_class(), *p_time();
#define dn_expand __dn_expand
#endif

extern int res_mkquery ();
extern int dn_expand ();
extern int res_init();
extern int res_mkquery(int, char *, int, int, char *, int, char *, char *, int);
extern int dn_expand(unsigned char *, unsigned char *, unsigned char *, char *, int);
extern int res_init(void);
#endif
8 changes: 5 additions & 3 deletions include/send.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ extern int send_queued(aClient *);
#include <stdarg.h>
#include "fdlist.h"

extern void init_send();
extern void init_send(void);

#ifndef ATTRIBUTE_PRINTF
#if defined(__GNUC__) && __GNUC__ >= 4
Expand Down Expand Up @@ -93,6 +93,8 @@ extern void vsendto_prefix_one(aClient *to, aClient *from,
char *pattern, va_list vl);
extern void vsendto_realops(char *pattern, va_list vl);

extern void flush_connections();
extern void dump_connections();
extern void flush_connections(int fd);
extern void dump_connections(int fd);
extern void free_fluders(aClient *cptr, aChannel *chptr);
extern void free_fludees(aClient *cptr);
#endif
70 changes: 36 additions & 34 deletions include/struct.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,46 @@
#endif
#endif

#ifdef USE_SSL
#include <openssl/rsa.h> /* OpenSSL stuff */
#include <openssl/crypto.h>
#include <openssl/x509.h>
#include <openssl/objects.h>
#include <openssl/pem.h>
#include <openssl/ssl.h>
#include <openssl/err.h>
#endif

/* ========================================================================
* Buffer Length Definitions - defined early for use in extern declarations
* ======================================================================== */

/* Core IRC protocol lengths */
#define HOSTLEN 255 /* Length of hostname. RFC1123 compliant - maximum FQDN length is 255 */
Copy link

Copilot AI Sep 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Increasing HOSTLEN from 63 to 255 bytes will significantly increase memory usage for all hostname-related structures throughout the application. This change should be carefully evaluated for memory impact.

Suggested change
#define HOSTLEN 255 /* Length of hostname. RFC1123 compliant - maximum FQDN length is 255 */
#define HOSTLEN 63 /* Length of hostname. Most hostnames are <64 chars; reduces memory usage */

Copilot uses AI. Check for mistakes.
#define HOSTIPLEN 45 /* Length of an IPv4 or IPv6 address */
#define NICKLEN 30 /* Maximum nickname length */
#define USERLEN 10 /* Maximum username length */
#define CHANNELLEN 32 /* Maximum channel name length */
#define KEYLEN 23 /* Maximum channel key length */

/* Message and content lengths */
#define REALLEN 50 /* Maximum real name length */
#define TOPICLEN 307 /* Maximum topic length */
#define PASSWDLEN 63 /* Maximum password length */
#define MOTDLINELEN 90 /* Maximum MOTD line length */
#define MAX_DATE_STRING 64 /* Maximum string length for a date string */
#define MAXSILELENGTH 128 /* Maximum silence mask length */

/* Calculated lengths */
#define KILLLEN (HOSTLEN * 3 + USERLEN + 10) /* 3 hostnames + username + separators */
#define USERHOST_REPLYLEN (NICKLEN+HOSTLEN+USERLEN+5) /* nick!user@host format */

/* System buffer sizes */
#define BUFSIZE 512 /* WARNING: *DONT* CHANGE THIS!!!! */

/* Protocol limits */
#define MAXRECIPIENTS 20 /* Maximum recipients per message */
#define MAXBANS 200 /* Maximum bans per channel */
#define MAXINVITELIST 100 /* Maximum invite list entries */
#define MAXEXEMPTLIST 100 /* Maximum exempt list entries */

#define REPORT_DO_DNS_ ":%s NOTICE AUTH :*** Looking up your hostname..."
#define REPORT_FIN_DNS_ ":%s NOTICE AUTH :*** Found your hostname"
Expand All @@ -70,9 +101,9 @@
#define REPORT_REJECT_ID_ ":%s NOTICE AUTH :*** Ignoring encrypted/unusable "\
"Ident response"

extern char REPORT_DO_DNS[256], REPORT_FIN_DNS[256], REPORT_FIN_DNSC[256],
REPORT_FAIL_DNS[256], REPORT_DO_ID[256], REPORT_FIN_ID[256],
REPORT_FAIL_ID[256], REPORT_REJECT_ID[256];
extern char REPORT_DO_DNS[HOSTLEN + 100], REPORT_FIN_DNS[HOSTLEN + 100], REPORT_FIN_DNSC[HOSTLEN + 100],
REPORT_FAIL_DNS[HOSTLEN + 100], REPORT_DO_ID[HOSTLEN + 100], REPORT_FIN_ID[HOSTLEN + 100],
REPORT_FAIL_ID[HOSTLEN + 100], REPORT_REJECT_ID[HOSTLEN + 100];

#include "hash.h"

Expand Down Expand Up @@ -111,47 +142,22 @@ typedef struct SServicesTag ServicesTag;



#define HOSTLEN 63 /* Length of hostname. Updated to */

/* comply with RFC1123 */

#define HOSTIPLEN 45 /* Length of an IPv4 or IPv6 address */

#define NICKLEN 30

/* Necessary to put 9 here instead of 10 if
* s_msg.c/m_nick has been corrected. This
* preserves compatibility with old * servers --msa
*/

#define MAX_DATE_STRING 32 /* maximum string length for a date string */

#define USERLEN 10
#define REALLEN 50
#define TOPICLEN 307
#define KILLLEN 400
#define CHANNELLEN 32
#define PASSWDLEN 63
#define KEYLEN 23
#define BUFSIZE 512 /* WARNING: *DONT* CHANGE THIS!!!! */
#define MAXRECIPIENTS 20
#define MAXBANS 200
#define MAXINVITELIST 100
#define MAXEXEMPTLIST 100

#define MOTDLINELEN 90

#define MAXSILES 10
#define MAXSILELENGTH 128

#define MAXDCCALLOW 5
#define DCC_LINK_ME 0x01 /* This is my dcc allow */
#define DCC_LINK_REMOTE 0x02 /* I need to remove these dcc allows from
* these clients when I die
*/

#define USERHOST_REPLYLEN (NICKLEN+HOSTLEN+USERLEN+5)

/*
* 'offsetof' is defined in ANSI-C. The following definition * is not
* absolutely portable (I have been told), but so far * it has worked
Expand Down Expand Up @@ -833,10 +839,8 @@ struct Listener {
int clients; /* number of clients currently on this */
aPort *aport; /* link to the P: line I came from */
int flags; /* Flags for ssl (and nodns/noidentd in the future) */
#ifdef USE_SSL
SSL *ssl;
X509 *client_cert;
#endif
};

struct SServicesTag
Expand Down Expand Up @@ -1064,10 +1068,8 @@ struct Client
unsigned int num_target_errors;
#endif

#ifdef USE_SSL
SSL *ssl;
X509 *client_cert;
#endif

char *webirc_username;
char *webirc_ip;
Expand Down
Loading