Ver Fonte

* Fixed some struct padding

svn: 965
Bryan Drewery há 22 anos atrás
pai
commit
5b78b7856e

+ 4 - 4
src/auth.h

@@ -6,15 +6,15 @@
 #  ifdef S_AUTHCMDS
 struct auth_t {
   struct userrec *user;
+  time_t authtime;              /* what time they authed at */
+  time_t atime;                 /* when they last were active */
+  int authed;
+  int authing;
 #    ifdef S_AUTHHASH
   char hash[MD5_HASH_LENGTH + 1];       /* used for dcc authing */
 #    endif                      /* S_AUTHHASH */
   char nick[NICKLEN];
   char host[UHOSTLEN];
-  int authed;
-  int authing;
-  time_t authtime;              /* what time they authed at */
-  time_t atime;                 /* when they last were active */
 };
 #  endif
        /* S_AUTHCMDS */

+ 41 - 42
src/chan.h

@@ -9,18 +9,18 @@
 #define _EGG_CHAN_H
 
 typedef struct memstruct {
-  char nick[NICKLEN];
-  char userhost[UHOSTLEN];
-  char server[SERVLEN];
-  int hops;
+  struct memstruct *next;
+  struct userrec *user;
   time_t joined;
-  unsigned short flags;
   time_t split;			/* in case they were just netsplit	*/
   time_t last;			/* for measuring idle time		*/
   time_t delay;                  /* for delayed autoop                   */
-  struct userrec *user;
+  int hops;
   int tried_getuser;
-  struct memstruct *next;
+  unsigned short flags;
+  char nick[NICKLEN];
+  char userhost[UHOSTLEN];
+  char server[SERVLEN];
 } memberlist;
 
 #define CHANMETA "#&!+"
@@ -57,22 +57,22 @@ typedef struct memstruct {
  * name? <cybah>
  */
 typedef struct maskstruct {
+  struct maskstruct *next;
+  time_t timer;
   char *mask;
   char *who;
-  time_t timer;
-  struct maskstruct *next;
 } masklist;
 
 /* Used for temporary bans, exempts and invites */
 typedef struct maskrec {
   struct maskrec *next;
-  char *mask,
-       *desc,
-       *user;
   time_t expire,
          added,
          lastactive;
   int flags;
+  char *mask,
+       *desc,
+       *user;
 } maskrec;
 extern maskrec *global_bans, *global_exempts, *global_invites;
 #define MASKREC_STICKY 1
@@ -84,12 +84,6 @@ struct chan_t {
   masklist *ban;
   masklist *exempt;
   masklist *invite;
-  char *topic;
-  char *key;
-  unsigned short int mode;
-  int maxmembers;
-  int members;
-  int do_opreq;
   time_t jointime;
   time_t parttime;
   time_t no_op;
@@ -99,6 +93,12 @@ struct chan_t {
 #ifdef G_BACKUP
   int backup_time;              /* If non-0, set +backup when now>backup_time */
 #endif /* G_BACKUP */
+  int maxmembers;
+  int members;
+  int do_opreq;
+  char *topic;
+  char *key;
+  unsigned short int mode;
 };
 
 #define CHANINV    BIT0		/* +i					*/
@@ -124,10 +124,16 @@ struct chan_t {
 struct chanset_t {
   struct chanset_t *next;
   struct chan_t channel;	/* current information			*/
-  char dname[81];               /* what the users know the channel as,
-				   like !eggdev				*/
-  char name[81];                /* what the servers know the channel
-				   as, like !ABCDEeggdev		*/
+  maskrec *bans,		/* temporary channel bans		*/
+          *exempts,		/* temporary channel exempts		*/
+          *invites;		/* temporary channel invites		*/
+  time_t added_ts;		/* ..and when? */
+  struct {
+    char *op;
+    int type;
+  } cmode[MODES_PER_LINE_MAX];                 /* parameter-type mode changes -        */
+  /* detect floods */
+  time_t floodtime[FLOOD_CHAN_MAX];
   int flood_pub_thr;
   int flood_pub_time;
   int flood_join_thr;
@@ -155,38 +161,31 @@ struct chanset_t {
   int invite_time;
   int exempt_time;
 
-  maskrec *bans,		/* temporary channel bans		*/
-          *exempts,		/* temporary channel exempts		*/
-          *invites;		/* temporary channel invites		*/
   /* desired channel modes: */
   int mode_pls_prot;		/* modes to enforce			*/
   int mode_mns_prot;		/* modes to reject			*/
   int limit_prot;		/* desired limit			*/
+  /* queued mode changes: */
+  int limit;			/* new limit to set			*/
+  int bytes;			/* total bytes so far			*/
+  int compat;			/* to prevent mixing old/new modes	*/
+  int floodnum[FLOOD_CHAN_MAX];
+  int opreqtime[5];             /* remember when ops was requested */
+
+  char *key;			/* new key to set			*/
+  char *rmkey;			/* old key to remove			*/
+  char pls[21];			/* positive mode changes		*/
+  char mns[21];			/* negative mode changes		*/
   char key_prot[121];		/* desired password			*/
 /* Chanchar template
  *char temp[121];
  */
   char topic[121];
   char added_by[NICKLEN];	/* who added the channel? */
-  time_t added_ts;		/* ..and when? */
-  /* queued mode changes: */
-  char pls[21];			/* positive mode changes		*/
-  char mns[21];			/* negative mode changes		*/
-  char *key;			/* new key to set			*/
-  char *rmkey;			/* old key to remove			*/
-  int limit;			/* new limit to set			*/
-  int bytes;			/* total bytes so far			*/
-  int compat;			/* to prevent mixing old/new modes	*/
-  struct {
-    char *op;
-    int type;
-  } cmode[MODES_PER_LINE_MAX];                 /* parameter-type mode changes -        */
-  /* detect floods */
   char floodwho[FLOOD_CHAN_MAX][81];
-  time_t floodtime[FLOOD_CHAN_MAX];
-  int floodnum[FLOOD_CHAN_MAX];
   char deopd[NICKLEN];		/* last person deop'd (must change	*/
-  int opreqtime[5];             /* remember when ops was requested */
+  char dname[81];               /* what the users know the channel as like !eggdev */
+  char name[81];                /* what the servers know the channel as, like !ABCDEeggdev */
 };
 
 /* behavior modes for the channel */

+ 0 - 3
src/chanprog.h

@@ -6,9 +6,6 @@
 #define DO_LOCAL	1
 #define DO_NET		2
 
-extern struct chanset_t *chanset;
-extern char botname[];
-
 int do_chanset(char *, struct chanset_t *, char *, int);
 void checkchans(int);
 void tell_verbose_uptime(int);

+ 0 - 4
src/cmds.c

@@ -1125,10 +1125,6 @@ static void cmd_channels(struct userrec *u, int idx, char *par) {
 
 int dns_report(int, int);  
 void channels_report(int, int);
-#ifdef LEAF
-void server_report(int, int);
-void irc_report(int, int);
-#endif /* LEAF */
 void transfer_report(int, int);
 void share_report(int, int);
 void update_report(int, int);

+ 3 - 0
src/compat/memutil.c

@@ -1,7 +1,10 @@
 #include <stdlib.h>
 #include <string.h>
+#undef strdup
+#undef str_redup
 #include "memcpy.h"
 
+
 void str_redup(char **str, const char *newstr)
 {
         int len;

+ 45 - 44
src/dcc.h

@@ -25,27 +25,8 @@ struct dcc_table {
 };
 
 struct dcc_t {
-  long sock;                    /* This should be a long to keep 64-bit
-                                   machines sane                         */
-  IP addr;                      /* IP address in host byte order         */
-#ifdef USE_IPV6
-  char addr6[121];              /* easier.. ipv6 address in regular notation (3ffe:80c0:225::) */
-#endif /* USE_IPV6 */
-  port_t port;
-  int ssl;                      /* use ssl on this dcc? */
-  struct userrec *user;
-  char simulbot[NICKLEN];       /* used for hub->leaf cmd simulation, holds bot that results should be sent to */
-  time_t simultime;             /* the time when the simul dcc is initiated, expires after a number of seconds */
-  int simul;                    /* this will hold the idx on the remote bot to return result. */
-  char hash[MD5_HASH_LENGTH + 1];                /* used for dcc authing */
-  char nick[NICKLEN];
-  char host[UHOSTLEN];
   struct dcc_table *type;
-  time_t timeval;               /* Use for any timing stuff
-                                   - this is used for timeout checking  */
-  time_t pingtime;
-  unsigned long status;         /* A LOT of dcc types have status
-                                   thingos, this makes it more avaliabe */
+  struct userrec *user;
   union {
     struct chat_info *chat;
     struct file_info *file;
@@ -58,22 +39,42 @@ struct dcc_t {
     int ident_sock;
     void *other;
   } u;                          /* Special use depending on type        */
+
+  IP addr;                      /* IP address in host byte order         */
+  time_t simultime;             /* the time when the simul dcc is initiated, expires after a number of seconds */
+  time_t timeval;               /* Use for any timing stuff
+                                   - this is used for timeout checking  */
+  time_t pingtime;
+  unsigned long status;         /* A LOT of dcc types have status
+                                   thingos, this makes it more avaliabe */
+  long sock;                    /* This should be a long to keep 64-bit
+                                   machines sane                         */
+  int ssl;                      /* use ssl on this dcc? */
+  int simul;                    /* this will hold the idx on the remote bot to return result. */
+  port_t port;
+#ifdef USE_IPV6
+  char addr6[121];              /* easier.. ipv6 address in regular notation (3ffe:80c0:225::) */
+#endif /* USE_IPV6 */
+  char simulbot[NICKLEN];       /* used for hub->leaf cmd simulation, holds bot that results should be sent to */
+  char hash[MD5_HASH_LENGTH + 1];                /* used for dcc authing */
+  char nick[NICKLEN];
+  char host[UHOSTLEN];
 };
 
 
 struct chat_info {
-  char *away;                   /* non-NULL if user is away             */
-  int msgs_per_sec;             /* used to stop flooding                */
-  int con_flags;                /* with console: what to show           */
-  int strip_flags;              /* what codes to strip (b,r,u,c,a,g,*)  */
-  char con_chan[81];            /* with console: what channel to view   */
-  int channel;                  /* 0=party line, -1=off                 */
   struct msgq *buffer;          /* a buffer of outgoing lines
                                    (for .page cmd)                      */
   int max_line;                 /* maximum lines at once                */
   int line_count;               /* number of lines sent since last page */
   int current_lines;            /* number of lines total stored         */
+  int msgs_per_sec;             /* used to stop flooding                */
+  int con_flags;                /* with console: what to show           */
+  int strip_flags;              /* what codes to strip (b,r,u,c,a,g,*)  */
+  int channel;                  /* 0=party line, -1=off                 */
+  char *away;                   /* non-NULL if user is away             */
   char *su_nick;
+  char con_chan[81];            /* with console: what channel to view   */
 };
 
 struct file_info {
@@ -82,44 +83,44 @@ struct file_info {
 };
 
 struct xfer_info {
-  char *filename;
-  char *origname;
-  char dir[DIRLEN];             /* used when uploads go to the current dir */
-  long unsigned int length;
-  long unsigned int acked;
-  char buf[4];                  /* you only need 5 bytes!                  */
-  unsigned char sofar;          /* how much of the byte count received     */
-  char from[NICKLEN];           /* [GET] user who offered the file         */
   FILE *f;                      /* pointer to file being sent/received     */
-  unsigned int type;            /* xfer connection type, see enum below    */
-  unsigned short ack_type;      /* type of ack                             */
-  long unsigned int offset;     /* offset from beginning of file, during
+  unsigned long int length;
+  unsigned long int acked;
+  unsigned long int offset;     /* offset from beginning of file, during
                                    resend.                                 */
-  long unsigned int block_pending;  	/* bytes of this DCC block which weren't
+  unsigned long int block_pending;  	/* bytes of this DCC block which weren't
                                    sent yet.                               */
+  unsigned int type;            /* xfer connection type, see enum below    */
   time_t start_time;            /* Time when a xfer was started.           */
+  char *filename;
+  char *origname;
+  unsigned short ack_type;      /* type of ack                             */
+  unsigned char sofar;          /* how much of the byte count received     */
+  char dir[DIRLEN];             /* used when uploads go to the current dir */
+  char from[NICKLEN];           /* [GET] user who offered the file         */
+  char buf[4];                  /* you only need 5 bytes!                  */
 };
 
 struct bot_info {
-  char version[121];            /* channel/version info                 */
   time_t bts;                   /* build timestamp */
-  char linker[NOTENAMELEN + 1]; /* who requested this link              */
   int  numver;
-  char sysname[121];
-  port_t port;		        /* base port                            */
   int  uff_flags;               /* user file feature flags              */
+  port_t port;		        /* base port                            */
+  char linker[NOTENAMELEN + 1]; /* who requested this link              */
+  char sysname[121];
+  char version[121];            /* channel/version info                 */
 };
 
 struct relay_info {
   struct chat_info *chat;
   int sock;
-  port_t port;
   int old_status;
+  port_t port;
 };
 
 struct dupwait_info {
-  int atr;                      /* the bots attributes                  */
   struct chat_info *chat;       /* holds current chat data              */
+  int atr;                      /* the bots attributes                  */
 };
 
 

+ 5 - 5
src/dns.h

@@ -16,17 +16,17 @@
 #define RES_IPBYHOST  2         /* IP address to hostname               */
 
 struct dns_info {
+  struct dcc_table *type;       /* type of the dcc table we are making the
+                                   lookup for                              */
+  IP ip;                        /* IP address                              */
+  int ibuf;                     /* temporary buffer for one integer        */
   void (*dns_success)(int);     /* is called if the dns request succeeds   */
   void (*dns_failure)(int);     /* is called if it fails                   */
   char *host;                   /* hostname                                */
   char *cbuf;                   /* temporary buffer. Memory will be free'd
                                    as soon as dns_info is free'd           */
   char *cptr;                   /* temporary pointer                       */
-  IP ip;                        /* IP address                              */
-  int ibuf;                     /* temporary buffer for one integer        */
   char dns_type;                /* lookup type, e.g. RES_HOSTBYIP          */
-  struct dcc_table *type;       /* type of the dcc table we are making the
-                                   lookup for                              */
 };
 
 typedef struct {
@@ -42,12 +42,12 @@ typedef struct {
 typedef struct devent_str {
   struct devent_str *next;	/* Pointer to next dns_event	  */
   devent_type	*type;
-  u_8bit_t	lookup;		/* RES_IPBYHOST or RES_HOSTBYIP	  */
   union {
     IP		ip_addr;	/* IP address			  */
     char	*hostname; 	/* Hostname			  */
   } res_data;
   void		*other;		/* Data specific to the event type */
+  u_8bit_t	lookup;		/* RES_IPBYHOST or RES_HOSTBYIP	  */
 } devent_t;
 
 void block_dns_hostbyip(IP);

+ 1 - 1
src/mod/channels.mod/cmdschan.c

@@ -1041,7 +1041,7 @@ static void cmd_mns_chan(struct userrec *u, int idx, char *par)
 
 /* thanks Excelsior */
 #define FLAG_COLS 4
-void show_flag(int idx, char *work, int *cnt, char *name, int state)
+void show_flag(int idx, char *work, int *cnt, char *name, unsigned int state)
 {
   char tmp[101] = "", chr_state[15] = "";
   /* empty buffer if no (char *) name */

+ 0 - 2
src/mod/irc.mod/irc.c

@@ -58,8 +58,6 @@ struct cfg_entry CFG_OPBOTS,
 #endif /* S_AUTOLOCK */
   CFG_OPREQUESTS;
 
-
-
 static int net_type = 0;
 static int wait_split = 300;		/* Time to wait for user to return from
 					   net-split. */

+ 1 - 1
src/mod/irc.mod/irc.h

@@ -61,7 +61,7 @@ static int gotmode(char *, char *);
 
 #endif /* MAKING_IRC */
 
-void add_mode(struct chanset_t *, char, char, char *);
+void add_mode(struct chanset_t *, unsigned char, unsigned char, char *);
 int me_op(struct chanset_t *);
 void check_this_ban(struct chanset_t *, char *, int);
 void check_this_user(char *, int, char *);

+ 1 - 1
src/mod/irc.mod/mode.c

@@ -182,7 +182,7 @@ static void flush_mode(struct chanset_t *chan, int pri)
 
 /* Queue a channel mode change
  */
-void add_mode(struct chanset_t *chan, char plus, char mode, char *op)
+void add_mode(struct chanset_t *chan, unsigned char plus, unsigned char mode, char *op)
 {
   int type, modes, l;
   unsigned int i;

+ 1 - 2
src/mod/server.mod/server.h

@@ -22,11 +22,10 @@
 
 struct server_list {
   struct server_list	*next;
-
   char			*name;
-  port_t		 port;
   char			*pass;
   char			*realname;
+  port_t		 port;
 };
 
 /* Available net types.  */

+ 3 - 3
src/mod/transfer.mod/transfer.h

@@ -36,20 +36,20 @@ int raw_dcc_send(char *, char *, char *, char *);
 #define TRANSFER_REGET_PACKETID 0xfeab
 
 typedef struct {
+  u_32bit_t byte_offset;	/* Number of bytes to skip relative to
+				   the file beginning			*/
   u_16bit_t packet_id;		/* Identification ID, should be equal
 	 			   to TRANSFER_REGET_PACKETID		*/
   u_8bit_t  byte_order;		/* Byte ordering, see byte_order_test()	*/
-  u_32bit_t byte_offset;	/* Number of bytes to skip relative to
-				   the file beginning			*/
 } transfer_reget;
 
 typedef struct zarrf {
+  struct zarrf *next;
   char *dir;			/* Absolute dir if it starts with '*',
 				   otherwise dcc dir.			*/
   char *file;
   char nick[NICKLEN];		/* Who queued this file			*/
   char to[NICKLEN];		/* Who will it be sent to		*/
-  struct zarrf *next;
 } fileq_t;
 
 #endif				/* MAKING_TRANSFER */

+ 9 - 9
src/net.h

@@ -97,24 +97,24 @@ union sockaddr_union {
  * queued on them
  */
 typedef struct {
-  int            sock;
-  short          flags;
-  char          *inbuf;
-  char          *outbuf;
   size_t outbuflen;             /* Outbuf could be binary data  */
   size_t inbuflen;              /* Inbuf could be binary data   */
+#ifdef USE_IPV6
+  unsigned int af;
+#endif /* USE_IPV6 */
   int encstatus;                        /* encrypted botlink */
   int oseed;                            /* botlink out seed */
   int iseed;                            /* botlink in seed */
-  char okey[33];                        /* botlink enckey: out */
-  char ikey[33];                        /* botlink enckey: in  */
+  int            sock;
   int gz; /* gzip compression */
-#ifdef USE_IPV6
-  unsigned int af;
-#endif /* USE_IPV6 */
 #ifdef HAVE_SSL
   SSL           *ssl;
 #endif /* HAVE_SSL */
+  short          flags;
+  char okey[33];                        /* botlink enckey: out */
+  char ikey[33];                        /* botlink enckey: in  */
+  char          *inbuf;
+  char          *outbuf;
 } sock_list;
 
 

+ 1 - 1
src/shell.c

@@ -307,7 +307,7 @@ void check_trace()
       if (i == (-1) && errno == EPERM)
         detected(DETECT_TRACE, "I'm being traced!");
       else {
-        waitpid(parent, &i, 0);
+        //waitpid(parent, &i, 0);
         kill(parent, SIGCHLD);
         ptrace(PTRACE_DETACH, parent, 0, 0);
         kill(parent, SIGCHLD);

+ 7 - 7
src/tandem.h

@@ -8,28 +8,28 @@
 
 /* Keep track of tandem-bots in the chain */
 typedef struct tand_t_struct {
-  char bot[HANDLEN + 1];
-  char *not_chans;
   struct tand_t_struct *via;
   struct tand_t_struct *uplink;
   struct tand_t_struct *next;
-  char version[121];
   time_t buildts;
   int localhub;
+  char *not_chans;
+  char bot[HANDLEN + 1];
+  char version[121];
   char share;
 } tand_t;
 
 /* Keep track of party-line members */
 typedef struct {
-  char nick[HANDLEN + 1];
-  char bot[HANDLEN + 1];
+  time_t timer;			/* Track idle time */
   int sock;
   int chan;
   char *from;
+  char *away;
+  char nick[HANDLEN + 1];
+  char bot[HANDLEN + 1];
   char flag;
   char status;
-  time_t timer;			/* Track idle time */
-  char *away;
 } party_t;
 
 /* Status: */

+ 12 - 13
src/users.h

@@ -60,12 +60,12 @@ struct laston_info {
 };
 
 struct bot_addr {
-  port_t telnet_port;
-  port_t relay_port;
-  unsigned short hublevel;
+  unsigned int roleid;
   char *address;
   char *uplink;
-  unsigned int roleid;
+  unsigned short hublevel;
+  port_t telnet_port;
+  port_t relay_port;
 };
 
 struct user_entry {
@@ -114,30 +114,30 @@ int set_user(struct user_entry_type *, struct userrec *, void *);
  */
 struct chanuserrec {
   struct chanuserrec *next;
-  char channel[81];
-  time_t laston;
   flag_t flags;
+  time_t laston;
   char *info;
+  char channel[81];
 };
 
 /* New-style userlist
  */
 struct userrec {
+  struct user_entry *entries;
+  struct chanuserrec *chanrec;
   struct userrec *next;
-  char handle[HANDLEN + 1];
   flag_t flags;
-  struct chanuserrec *chanrec;
-  struct user_entry *entries;
+  char handle[HANDLEN + 1];
 };
 
 struct igrec {
   struct igrec *next;
-  char *igmask;
   time_t expire;
-  char *user;
   time_t added;
-  char *msg;
   int flags;
+  char *igmask;
+  char *user;
+  char *msg;
 };
 extern struct igrec *global_ign;
 
@@ -147,7 +147,6 @@ extern struct igrec *global_ign;
  * Note: Flags are in eggdrop.h
  */
 
-struct userrec *adduser();
 struct userrec *get_user_by_handle(struct userrec *, char *);
 struct userrec *get_user_by_host(char *);
 struct userrec *get_user_by_nick(char *);