- Split up headers into smaller headers.
-channels.o: channels.c efserv.h
-commands.o: commands.c efserv.h
-config.o: config.c efserv.h
-clients.o: clients.c efserv.h
-clones.o: clones.c efserv.h
-efserv.o: efserv.c efserv.h
match.o: match.c
-msg.o: msg.c efserv.h
-utils.o: utils.c efserv.h
-sconfig.tab.o: sconfig.tab.c efserv.h
-lex.yy.o: lex.yy.c efserv.h sconfig.tab.h
CC=gcc
-CFLAGS=-Wall -ggdb
+CFLAGS=-Wall -ggdb -Iincludes/
BIN=efserv
LEX=lex
BISON=bison
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA.
- * $Id: channels.c,v 1.5 2001/05/31 07:52:10 a1kmm Exp $
+ * $Id: channels.c,v 1.6 2001/05/31 08:52:03 a1kmm Exp $
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include "efserv.h"
+#include "define.h"
+#include "struct.h"
+#include "utils.h"
+#include "funcs.h"
void
check_channel_status(struct Channel *ch)
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA.
- * $Id: clients.c,v 1.4 2001/05/30 04:10:14 a1kmm Exp $
+ * $Id: clients.c,v 1.5 2001/05/31 08:52:03 a1kmm Exp $
*/
#include <stdlib.h>
#include <string.h>
#include <assert.h>
-#include "efserv.h"
+#include "define.h"
+#include "struct.h"
+#include "utils.h"
+#include "funcs.h"
void cleanup_hosts(void);
void m_chmode(char *sender, int parc, char **parv);
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA.
- * $Id: clones.c,v 1.3 2001/05/29 09:29:44 a1kmm Exp $
+ * $Id: clones.c,v 1.4 2001/05/31 08:52:03 a1kmm Exp $
*/
#include <stdlib.h>
#include <string.h>
-#include "efserv.h"
+#include "define.h"
+#include "struct.h"
+#include "utils.h"
+#include "funcs.h"
void
cleanup_hosts(void)
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA.
- * $Id: commands.c,v 1.7 2001/05/30 04:10:14 a1kmm Exp $
+ * $Id: commands.c,v 1.8 2001/05/31 08:52:03 a1kmm Exp $
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
-#include "efserv.h"
+#include "define.h"
+#include "struct.h"
+#include "utils.h"
void m_ping(char*, int, char**);
void m_part(char*, int, char**);
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA.
- * $Id: config.c,v 1.7 2001/05/31 07:52:10 a1kmm Exp $
+ * $Id: config.c,v 1.8 2001/05/31 08:52:04 a1kmm Exp $
*/
-#include "efserv.h"
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
+#include "define.h"
+#include "struct.h"
+#include "utils.h"
+#include "funcs.h"
char *values[200][2];
int keyc;
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA.
- * $Id: database.c,v 1.1 2001/05/30 04:10:15 a1kmm Exp $
+ * $Id: database.c,v 1.2 2001/05/31 08:52:04 a1kmm Exp $
*/
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <string.h>
-#include "efserv.h"
+#include "define.h"
+#include "struct.h"
+#include "utils.h"
+#include "funcs.h"
#define EFCDB_MAJOR_VERSION 0
#define EFCDB_MINOR_VERSION 1
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA.
- * $Id: efserv.c,v 1.6 2001/05/30 04:10:15 a1kmm Exp $
+ * $Id: efserv.c,v 1.7 2001/05/31 08:52:04 a1kmm Exp $
*/
#include <stdarg.h>
#include <netinet/in.h>
#include <sys/errno.h>
#include <string.h>
-#include "efserv.h"
+#include <time.h>
+#include "define.h"
+#include "struct.h"
+#include "utils.h"
+#include "funcs.h"
int send_error = 0;
time_t timenow;
+++ /dev/null
-/*
- * efserv.h: The main header file for efserv.
- * This is part of efserv, a services.int implementation.
- * efserv is Copyright(C) 2001 by Andrew Miller, and others.
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA.
- * $Id: efserv.h,v 1.8 2001/05/31 07:52:10 a1kmm Exp $
- */
-
-#include <time.h>
-
-#define NICKLEN 20
-#define HOSTLEN 64
-#define USERLEN 40
-#define SERVLEN 80
-#define CHANLEN 255
-
-#define MAXCLONES_UHOST 4
-#define MAXCLONES_HOST 6
-
-#define JUPE_EXPIRE_TIME 45 /* *60 */
-#define MINIMUM_OPS 0 /* 4 */
-#define EXOP_EXPIRE_TIME 2*60 /* *60 */
-#define CHAN_SLICE_LENGTH 5
-
-#define NETNAME "test net"
-#define LOGFILE "efserv.log"
-#define CHANNEL_DB "efchans.db"
-#define VERSION "pre0.1-test"
-
-struct Command
-{
- char *name;
- void (*func)(char *sender, int argc, char **parv);
-};
-
-struct User
-{
- struct Server *server;
- char nick[NICKLEN], user[USERLEN], host[HOSTLEN];
- unsigned long flags, caps;
- struct ServAdmin *sa;
- struct List *node, *monnode;
-};
-
-struct Server
-{
- char name[SERVLEN];
- unsigned long flags;
- struct List *node;
- struct Server *uplink;
- struct Jupe *jupe;
-};
-
-struct Channel
-{
- char name[CHANLEN];
- int flags;
- time_t ts;
- struct List *ops, *nonops, *exops;
- time_t last_notempty;
-};
-
-struct ChanopUser
-{
- time_t last_opped;
- unsigned long slices;
- char uhost_md5[16];
-};
-
-struct AdminHost
-{
- char *server, *host, *user;
-};
-
-struct ServAdmin
-{
- char *name, *pass;
- int refcount, caps;
- struct List *hosts;
-};
-
-struct VoteServer
-{
- struct List *names;
- int flags;
- int refcount;
-};
-
-struct Host
-{
- char host[HOSTLEN+USERLEN+1];
- int count, rate, full;
- time_t last_recalc, last_report;
-};
-
-struct JupeVote
-{
- struct VoteServer *vs;
- struct ServAdmin *vsa;
- int score;
-};
-
-struct Jupe
-{
- char reason[255];
- int flags;
- /* Note: 15 activates an inactive JUPE, 0 deactivates an active JUPE. */
- int score;
- struct List *jupevotes;
- time_t last_active;
-};
-
-struct Hub
-{
- char *host;
- char *pass;
- int port;
-};
-
-enum
-{
- HASH_COMMAND,
- HASH_SERVER,
- HASH_USER,
- HASH_CHAN,
- HASH_HOST,
-};
-
-enum
-{
- ALEVEL_ADMIN,
- ALEVEL_OPER,
- ALEVEL_SERVADMIN,
- ALEVEL_ANY,
-};
-
-struct HashEntry
-{
- char *name;
- int type;
- void *data;
- struct HashEntry *next;
-};
-
-struct List
-{
- struct List *next, *prev;
- void *data;
-};
-
-extern struct Command Commands[];
-extern struct Server *first_server;
-extern struct List *Servers, *Users, *Channels, *Hosts, *Monitors,
- *serv_admins, *VoteServers, *Hubs, *HKeywords;
-extern struct Server *first_server;
-extern char *server_name, *server_pass, *server_host, *sn;
-extern int port;
-extern int reload_module, die;
-extern time_t timenow, channel_record_time;
-extern int server_count, minimum_servers;
-
-void add_to_hash(int type, char *name, void *data);
-void remove_from_hash(int type, char *name);
-void* find_in_hash(int type, const char *name);
-struct List* add_to_list(struct List **list, void *data);
-struct List* add_to_list_before(struct List **list, struct List *before,
- void *data);
-void move_list(struct List **dest, struct List **src);
-void remove_from_list(struct List **list, struct List *node);
-void process_smode(const char *chname, const char *mode);
-void pick_a_hub(void);
-int check_admin(struct User*, const char*, const char*);
-void hash_commands(void);
-void deref_admin(struct ServAdmin *a);
-void deref_voteserver(struct VoteServer *v);
-int match(const char *mask, const char *name);
-struct VoteServer *find_server_vote(const char *name);
-void destroy_server_links(struct Server *svr);
-void destroy_server(struct Server *svr);
-char *getmd5(struct User*);
-void cleanup_channels(void);
-void cleanup_jupes(void);
-void cleanup_hosts(void);
-void wipe_type_from_hash(int type, void (*cdata)(void*));
-void save_channel_opdb(void);
-void load_channel_opdb(void);
-
-#ifdef __GNUC__
-void fatal_error(const char *, ...)
- __attribute__((format(printf,1,2)));
-int send_msg(char *msg, ...)
- __attribute__((format(printf,1,2)));
-void log(const char *error, ...)
- __attribute__((format(printf,1,2)));
-#else
-void fatal_error(const char *, ...);
-int send_msg(char *msg, ...);
-void log(const char *error, ...);
-#endif
-
-#define find_server(name) (struct Server*)find_in_hash(HASH_SERVER,name)
-#define find_user(name) (struct User*)find_in_hash(HASH_USER,name)
-#define find_channel(name) (struct Channel*)find_in_hash(HASH_CHAN,name)
-#define find_host(name) (struct Host*)find_in_hash(HASH_HOST,name)
-
-#define UFLAG_ADMIN 0x00000001
-#define UFLAG_OPER 0x00000002
-#define UFLAG_SERVADMIN 0x00000004
-
-#define IsAdmin(x) (x->flags & UFLAG_ADMIN)
-#define IsOper(x) (x->flags & UFLAG_OPER)
-#define IsServAdmin(x) (x->flags & UFLAG_SERVADMIN)
-
-#define CHFLAG_BANNED 0x00000001
-#define CHFLAG_OPERONLY 0x00000002
-#define CHFLAG_ADMINONLY 0x00000004
-#define SMODES CHFLAG_BANNED | CHFLAG_OPERONLY | CHFLAG_ADMINONLY
-
-#define IsBanChan(x) (x->flags & CHFLAG_BANNED)
-#define IsOperChan(x) (x->flags & CHFLAG_OPERONLY)
-#define IsAdminChan(x) (x->flags & CHFLAG_ADMINONLY)
-#define HasSMODES(x) (x->flags & (SMODES))
-
-#define SERVFLAG_JUPED 1
-#define SERVFLAG_ACTIVE 2
-
-#define IsJuped(x) (x->flags & SERVFLAG_JUPED)
-
-/* Loop through a linked list... */
-#define FORLIST(node,list,type,var) \
- for(node=list,var=node?(type)node->data:NULL;\
- node;\
- node=node->next,var=node?(type)node->data:NULL\
- )
-/* Use this form when items could be deleted from the list... */
-#define FORLISTDEL(node,nnode,list,type,var) \
- for(node=list,nnode=node?node->next:NULL,var=node?(type)node->data:NULL;\
- node;\
- node=nnode,nnode=node?node->next:NULL,var=node?(type)node->data:NULL\
- )
-
-extern struct yystype
-{
- unsigned long number;
- char *string;
-} yylval;
-#define YYSTYPE struct yystype
--- /dev/null
+/*
+ * config.h: Defines stuff relating to the config parser.
+ * This is part of efserv, a services.int implementation.
+ * efserv is Copyright(C) 2001 by Andrew Miller, and others.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA.
+ * $Id: conf.h,v 1.1 2001/05/31 08:52:07 a1kmm Exp $
+ */
+
+extern struct yystype
+{
+ unsigned long number;
+ char *string;
+} yylval;
+#define YYSTYPE struct yystype
+
+enum
+{
+ ALEVEL_ADMIN,
+ ALEVEL_OPER,
+ ALEVEL_SERVADMIN,
+ ALEVEL_ANY,
+};
+
--- /dev/null
+/*
+ * define.h: Contains macro definitions for efserv.
+ * This is part of efserv, a services.int implementation.
+ * efserv is Copyright(C) 2001 by Andrew Miller, and others.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA.
+ * $Id: define.h,v 1.1 2001/05/31 08:52:07 a1kmm Exp $
+ */
+
+
+#define NICKLEN 20
+#define HOSTLEN 64
+#define USERLEN 40
+#define SERVLEN 80
+#define CHANLEN 255
+
+#define MAXCLONES_UHOST 4
+#define MAXCLONES_HOST 6
+
+#define JUPE_EXPIRE_TIME 45 /* *60 */
+#define MINIMUM_OPS 0 /* 4 */
+#define EXOP_EXPIRE_TIME 2*60 /* *60 */
+#define CHAN_SLICE_LENGTH 5
+
+#define NETNAME "test net"
+#define LOGFILE "efserv.log"
+#define CHANNEL_DB "efchans.db"
+#define VERSION "pre0.1-test"
+
+/* Below this should not be changed on setup... */
+#define UFLAG_ADMIN 0x00000001
+#define UFLAG_OPER 0x00000002
+#define UFLAG_SERVADMIN 0x00000004
+
+#define IsAdmin(x) (x->flags & UFLAG_ADMIN)
+#define IsOper(x) (x->flags & UFLAG_OPER)
+#define IsServAdmin(x) (x->flags & UFLAG_SERVADMIN)
+
+#define CHFLAG_BANNED 0x00000001
+#define CHFLAG_OPERONLY 0x00000002
+#define CHFLAG_ADMINONLY 0x00000004
+#define SMODES CHFLAG_BANNED | CHFLAG_OPERONLY | CHFLAG_ADMINONLY
+
+#define IsBanChan(x) (x->flags & CHFLAG_BANNED)
+#define IsOperChan(x) (x->flags & CHFLAG_OPERONLY)
+#define IsAdminChan(x) (x->flags & CHFLAG_ADMINONLY)
+#define HasSMODES(x) (x->flags & (SMODES))
+
+#define SERVFLAG_JUPED 1
+#define SERVFLAG_ACTIVE 2
+
+#define IsJuped(x) (x->flags & SERVFLAG_JUPED)
+
--- /dev/null
+void process_smode(const char *chname, const char *mode);
+void pick_a_hub(void);
+int check_admin(struct User*, const char*, const char*);
+void hash_commands(void);
+void deref_admin(struct ServAdmin *a);
+void deref_voteserver(struct VoteServer *v);
+int match(const char *mask, const char *name);
+struct VoteServer *find_server_vote(const char *name);
+void destroy_server_links(struct Server *svr);
+void destroy_server(struct Server *svr);
+char *getmd5(struct User*);
+void cleanup_channels(void);
+void cleanup_jupes(void);
+void cleanup_hosts(void);
+void wipe_type_from_hash(int type, void (*cdata)(void*));
+void save_channel_opdb(void);
+void load_channel_opdb(void);
+
+#ifdef __GNUC__
+void fatal_error(const char *, ...)
+ __attribute__((format(printf,1,2)));
+int send_msg(char *msg, ...)
+ __attribute__((format(printf,1,2)));
+void log(const char *error, ...)
+ __attribute__((format(printf,1,2)));
+#else
+void fatal_error(const char *, ...);
+int send_msg(char *msg, ...);
+void log(const char *error, ...);
+#endif
--- /dev/null
+/*
+ * struct.h: Defines many of the structures.
+ * This is part of efserv, a services.int implementation.
+ * efserv is Copyright(C) 2001 by Andrew Miller, and others.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA.
+ * $Id: struct.h,v 1.1 2001/05/31 08:52:08 a1kmm Exp $
+ */
+
+struct Command
+{
+ char *name;
+ void (*func)(char *sender, int argc, char **parv);
+};
+
+struct User
+{
+ struct Server *server;
+ char nick[NICKLEN], user[USERLEN], host[HOSTLEN];
+ unsigned long flags, caps;
+ struct ServAdmin *sa;
+ struct List *node, *monnode;
+};
+
+struct Server
+{
+ char name[SERVLEN];
+ unsigned long flags;
+ struct List *node;
+ struct Server *uplink;
+ struct Jupe *jupe;
+};
+
+struct Channel
+{
+ char name[CHANLEN];
+ int flags;
+ time_t ts;
+ struct List *ops, *nonops, *exops;
+ time_t last_notempty;
+};
+
+struct ChanopUser
+{
+ time_t last_opped;
+ unsigned long slices;
+ char uhost_md5[16];
+};
+
+struct AdminHost
+{
+ char *server, *host, *user;
+};
+
+struct ServAdmin
+{
+ char *name, *pass;
+ int refcount, caps;
+ struct List *hosts;
+};
+
+struct VoteServer
+{
+ struct List *names;
+ int flags;
+ int refcount;
+};
+
+struct Host
+{
+ char host[HOSTLEN+USERLEN+1];
+ int count, rate, full;
+ time_t last_recalc, last_report;
+};
+
+struct JupeVote
+{
+ struct VoteServer *vs;
+ struct ServAdmin *vsa;
+ int score;
+};
+
+struct Jupe
+{
+ char reason[255];
+ int flags;
+ /* Note: 15 activates an inactive JUPE, 0 deactivates an active JUPE. */
+ int score;
+ struct List *jupevotes;
+ time_t last_active;
+};
+
+struct Hub
+{
+ char *host;
+ char *pass;
+ int port;
+};
+
+extern struct Command Commands[];
+extern struct Server *first_server;
+extern struct List *Servers, *Users, *Channels, *Hosts, *Monitors,
+ *serv_admins, *VoteServers, *Hubs, *HKeywords;
+extern struct Server *first_server;
+extern char *server_name, *server_pass, *server_host, *sn;
+extern int port;
+extern int reload_module, die;
+extern time_t timenow, channel_record_time;
+extern int server_count, minimum_servers;
+
+void add_to_hash(int type, char *name, void *data);
+void remove_from_hash(int type, char *name);
+void* find_in_hash(int type, const char *name);
+struct List* add_to_list(struct List **list, void *data);
+struct List* add_to_list_before(struct List **list, struct List *before,
+ void *data);
+void move_list(struct List **dest, struct List **src);
+void remove_from_list(struct List **list, struct List *node);
--- /dev/null
+/*
+ * utils.h: Defines the hash and linked list tools.
+ * This is part of efserv, a services.int implementation.
+ * efserv is Copyright(C) 2001 by Andrew Miller, and others.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA.
+ * $Id: utils.h,v 1.1 2001/05/31 08:52:08 a1kmm Exp $
+ */
+
+enum
+{
+ HASH_COMMAND,
+ HASH_SERVER,
+ HASH_USER,
+ HASH_CHAN,
+ HASH_HOST,
+};
+
+struct HashEntry
+{
+ char *name;
+ int type;
+ void *data;
+ struct HashEntry *next;
+};
+
+struct List
+{
+ struct List *next, *prev;
+ void *data;
+};
+
+/* Loop through a linked list... */
+#define FORLIST(node,list,type,var) \
+ for(node=list,var=node?(type)node->data:NULL;\
+ node;\
+ node=node->next,var=node?(type)node->data:NULL\
+ )
+/* Use this form when items could be deleted from the list... */
+#define FORLISTDEL(node,nnode,list,type,var) \
+ for(node=list,nnode=node?node->next:NULL,var=node?(type)node->data:NULL;\
+ node;\
+ node=nnode,nnode=node?node->next:NULL,var=node?(type)node->data:NULL\
+ )
+
+#define find_server(name) (struct Server*)find_in_hash(HASH_SERVER,name)
+#define find_user(name) (struct User*)find_in_hash(HASH_USER,name)
+#define find_channel(name) (struct Channel*)find_in_hash(HASH_CHAN,name)
+#define find_host(name) (struct Host*)find_in_hash(HASH_HOST,name)
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA.
- * $Id: log.c,v 1.1 2001/05/30 04:10:16 a1kmm Exp $
+ * $Id: log.c,v 1.2 2001/05/31 08:52:05 a1kmm Exp $
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdarg.h>
-#include "efserv.h"
+#include <time.h>
+#include "define.h"
+#include "struct.h"
extern FILE *logfile;
--- /dev/null
+/*
+ * match.c: Performs matching of masks.
+ * This is part of efserv, a services.int implementation.
+ * efserv is Copyright(C) 2001 by Andrew Miller, and others.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA.
+ * $Id: match.c,v 1.1 2001/05/31 08:52:05 a1kmm Exp $
+ */
+#include <assert.h>
+#include <ctype.h>
+
+#define MATCH_MAX_CALLS 512 /* ACK! This dies when it's less that this
+ and we have long lines to parse */
+int
+match(const char *mask, const char *name)
+{
+ const unsigned char* m = (const unsigned char*) mask;
+ const unsigned char* n = (const unsigned char*) name;
+ const unsigned char* ma = (const unsigned char*) mask;
+ const unsigned char* na = (const unsigned char*) name;
+ int wild = 0;
+ int calls = 0;
+ int quote = 0;
+ assert(0 != mask);
+ assert(0 != name);
+ if (!mask || !name)
+ return 0;
+ while (calls++ < MATCH_MAX_CALLS)
+ {
+ if (quote)
+ quote++;
+ if (quote == 3)
+ quote = 0;
+ if (*m == '\\' && !quote)
+ {
+ m++;
+ quote = 1;
+ continue;
+ }
+ if (!quote && *m == '*')
+ {
+ /*
+ * XXX - shouldn't need to spin here, the mask should have been
+ * collapsed before match is called
+ */
+ while (*m == '*')
+ m++;
+ if (*m == '\\')
+ {
+ m++;
+ /* This means it is an invalid mask -A1kmm. */
+ if (!*m)
+ return 0;
+ quote = 2;
+ }
+ wild = 1;
+ ma = m;
+ na = n;
+ }
+ if (!*m)
+ {
+ if (!*n)
+ return 1;
+ if (quote)
+ return 0;
+ for (m--; (m > (const unsigned char*) mask) && (*m == '?'); m--)
+ ;
+ if (*m == '*' && (m > (const unsigned char*) mask))
+ return 1;
+ if (!wild)
+ return 0;
+ m = ma;
+ n = ++na;
+ } else if (!*n)
+ {
+ /*
+ * XXX - shouldn't need to spin here, the mask should have been
+ * collapsed before match is called
+ */
+ if (quote)
+ return 0;
+ while (*m == '*')
+ m++;
+ return (*m == 0);
+ }
+ if (tolower(*m) != tolower(*n) && !(!quote && *m == '?'))
+ {
+ if (!wild)
+ return 0;
+ m = ma;
+ n = ++na;
+ } else
+ {
+ if (*m)
+ m++;
+ if (*n)
+ n++;
+ }
+ }
+ return 0;
+}
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA.
- * $Id: md5.c,v 1.1 2001/05/29 09:29:45 a1kmm Exp $
+ * $Id: md5.c,v 1.2 2001/05/31 08:52:05 a1kmm Exp $
*/
#include <string.h>
-#include "efserv.h"
+#include <time.h>
+#include "define.h"
+#include "struct.h"
void md5_block(unsigned long *in, unsigned long *out, unsigned long *x);
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA.
- * $Id: msg.c,v 1.5 2001/05/31 07:52:11 a1kmm Exp $
+ * $Id: msg.c,v 1.6 2001/05/31 08:52:05 a1kmm Exp $
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include "efserv.h"
+#include "define.h"
+#include "struct.h"
+#include "utils.h"
+#include "funcs.h"
+#include "config.h"
void
pm_monitor(struct User *usr, char *str)
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA.
- * $Id: sconfig.l,v 1.3 2001/05/31 07:52:11 a1kmm Exp $
+ * $Id: sconfig.l,v 1.4 2001/05/31 08:52:06 a1kmm Exp $
*/
%option case-insensitive
%option noyywrap
%{
-#include "efserv.h"
+#include "config.h"
#include "sconfig.tab.h"
#include <stdio.h>
#include <stdlib.h>
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA.
- * $Id: sconfig.y,v 1.4 2001/05/31 07:52:11 a1kmm Exp $
+ * $Id: sconfig.y,v 1.5 2001/05/31 08:52:06 a1kmm Exp $
*/
%{
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
- #include "efserv.h"
+ #include "define.h"
+ #include "struct.h"
+ #include "utils.h"
+ #include "funcs.h"
+ #include "config.h"
int yylex();
void yyerror();
struct ServAdmin *ad;
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA.
- * $Id: utils.c,v 1.6 2001/05/30 04:10:17 a1kmm Exp $
+ * $Id: utils.c,v 1.7 2001/05/31 08:52:06 a1kmm Exp $
*/
#include <ctype.h>
#include <stdlib.h>
#include <strings.h>
#include <assert.h>
-#include "efserv.h"
+#include "define.h"
+#include "utils.h"
#define HASHSIZE 0x1000