* Killed off CtdlGetDynamicSymbol() and just put all the symbols in server.h
authorArt Cancro <ajc@citadel.org>
Tue, 15 Jul 2003 14:54:09 +0000 (14:54 +0000)
committerArt Cancro <ajc@citadel.org>
Tue, 15 Jul 2003 14:54:09 +0000 (14:54 +0000)
13 files changed:
citadel/ChangeLog
citadel/citserver.c
citadel/citserver.h
citadel/serv_calendar.c
citadel/serv_calendar.h
citadel/serv_imap.c
citadel/serv_imap.h
citadel/serv_network.c
citadel/serv_pop3.c
citadel/serv_smtp.c
citadel/serv_vcard.c
citadel/server.h
citadel/server_main.c

index 5cfb570258381609d6603411e6524478d748fd1f..2dbd29db25f5a059b1aa413cd79bf111bbcc95a4 100644 (file)
@@ -1,4 +1,7 @@
  $Log$
+ Revision 608.1  2003/07/15 14:54:09  ajc
+ * Killed off CtdlGetDynamicSymbol() and just put all the symbols in server.h
+
  Revision 608.0  2003/07/15 04:12:52  ajc
  * THIS IS 6.08
 
@@ -4868,4 +4871,3 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import
-
index b2c3641982f407d49d746dbbf6127ba9a9e9c06e..0fb7e7a28dfc7662944a19df83b5812ab173edda 100644 (file)
@@ -249,16 +249,6 @@ void RemoveContext (struct CitContext *con)
 
 
 
-/*
- * Get a dynamic symbol number for per-session user data.
- * This API call should be made only ONCE per symbol per citserver run.
- */
-int CtdlGetDynamicSymbol() 
-{
-       static unsigned int next_symbol = SYM_MAX;
-       return ++next_symbol;
-}
-
 
 
 /*
index 45c80754a6a0129e34be9d14d15bf21ad624e927..9c817087cb010a3969bc74508129a62c809f726a 100644 (file)
@@ -33,7 +33,6 @@ void deallocate_user_data(struct CitContext *con);
 void *CtdlGetUserData(unsigned long requested_sym);
 void CtdlAllocUserData(unsigned long requested_sym, size_t num_bytes);
 void CtdlReallocUserData(unsigned long requested_sym, size_t num_bytes);
-int CtdlGetDynamicSymbol(void);
 void do_command_loop(void);
 void begin_session(struct CitContext *con);
 void citproto_begin_session(void);
index 849eacb70e6fd3f93172c57b9b04719444d09488..a92138ec8492b1ff86807609990f05f1acbb7509 100644 (file)
@@ -42,9 +42,6 @@ struct ical_respond_data {
        icalcomponent *cal;
 };
 
-/* Session-local data for calendaring. */
-long SYM_CIT_ICAL;
-
 
 /*
  * Utility function to create a new VCALENDAR component with some of the
@@ -1745,7 +1742,6 @@ void ical_session_startup(void) {
 char *serv_calendar_init(void)
 {
 #ifdef CITADEL_WITH_CALENDAR_SERVICE
-       SYM_CIT_ICAL = CtdlGetDynamicSymbol();
        CtdlRegisterMessageHook(ical_obj_beforesave, EVT_BEFORESAVE);
        CtdlRegisterMessageHook(ical_obj_aftersave, EVT_AFTERSAVE);
        CtdlRegisterSessionHook(ical_create_room, EVT_LOGIN);
index 1ad136c0845767f19548e3d8ca0fbc9e2dbe1858..f82bba58fff2302335e0f364791268896f6f0b66 100644 (file)
@@ -5,8 +5,6 @@
  *
  */
 
-extern long SYM_CIT_ICAL;
-
 struct cit_ical {
         int avoid_sending_invitations;
 };
index 07c289219ad64abeea1eb17450fd15427559fd41..43f56f978ebaf54756036049fe346bd6877a660b 100644 (file)
@@ -85,8 +85,6 @@ struct irlparms {
        struct irl **irl;
 };
 
-long SYM_IMAP;
-
 
 /*
  * If there is a message ID map in memory, free it
@@ -1345,7 +1343,6 @@ void imap_command_loop(void) {
  */
 char *serv_imap_init(void)
 {
-       SYM_IMAP = CtdlGetDynamicSymbol();
        CtdlRegisterServiceHook(config.c_imap_port,
                                NULL,
                                imap_greeting,
index 8f37c1b4ead8e84d2250cca7ecd1c865fd6cd36d..b5a536129454d17a58f444ecd9bc5585722be4d0 100644 (file)
@@ -1,8 +1,6 @@
 /* $Id$ 
  */
 
-extern long SYM_IMAP;
-
 
 void imap_cleanup_function(void);
 void imap_greeting(void);
index a60e73cf5196fbbe00d5d9438c91b2853ba83237..3088de2debfa478e8d89535cecee6fbe18c50753 100644 (file)
@@ -693,7 +693,6 @@ void network_spoolout_room(char *room_to_spool) {
        int skipthisline = 0;
        int i;
 
-       lprintf(7, "Spooling <%s>\n", room_to_spool);
        if (getroom(&CC->room, room_to_spool) != 0) {
                lprintf(1, "ERROR: cannot load <%s>\n", room_to_spool);
                return;
@@ -707,14 +706,11 @@ void network_spoolout_room(char *room_to_spool) {
 
        fp = fopen(filename, "r");
        if (fp == NULL) {
-               lprintf(7, "Outbound batch processing skipped for <%s>\n",
-                       CC->room.QRname);
                end_critical_section(S_NETCONFIGS);
                return;
        }
 
-       lprintf(5, "Outbound batch processing started for <%s>\n",
-               CC->room.QRname);
+       lprintf(5, "Networking started for <%s>\n", CC->room.QRname);
 
        while (fgets(buf, sizeof buf, fp) != NULL) {
                buf[strlen(buf)-1] = 0;
@@ -843,9 +839,6 @@ void network_spoolout_room(char *room_to_spool) {
                fclose(fp);
        }
        end_critical_section(S_NETCONFIGS);
-
-       lprintf(5, "Outbound batch processing finished for <%s>\n",
-               CC->room.QRname);
 }
 
 
index 26851523b6502bc2a72920dc05daa14fdddb91ab..e0adfa0a41dd4771d706a01db763cfeb3ca44465 100644 (file)
@@ -59,8 +59,6 @@
 #include "serv_pop3.h"
 #include "md5.h"
 
-long SYM_POP3;
-
 
 /*
  * This cleanup function blows away the temporary memory and files used by
@@ -618,7 +616,6 @@ void pop3_command_loop(void) {
 
 char *serv_pop3_init(void)
 {
-       SYM_POP3 = CtdlGetDynamicSymbol();
        CtdlRegisterServiceHook(config.c_pop3_port,
                                NULL,
                                pop3_greeting,
index 28a2ec01534ece1ce522d8b11bad3c088ad037e3..8ea505e3d72ede3e9730624e2a43390f0249a07e 100644 (file)
@@ -88,9 +88,6 @@ enum {                                /* Delivery modes */
 #define SMTP_RECPS     ((char *)CtdlGetUserData(SYM_SMTP_RECPS))
 #define SMTP_ROOMS     ((char *)CtdlGetUserData(SYM_SMTP_ROOMS))
 
-long SYM_SMTP;
-long SYM_SMTP_RECPS;
-long SYM_SMTP_ROOMS;
 
 int run_queue_now = 0; /* Set to 1 to ignore SMTP send retry times */
 
@@ -1433,8 +1430,6 @@ void smtp_init_spoolout(void) {
 
 char *serv_smtp_init(void)
 {
-       SYM_SMTP = CtdlGetDynamicSymbol();
-
        CtdlRegisterServiceHook(config.c_smtp_port,     /* On the net... */
                                NULL,
                                smtp_greeting,
index b3bb09b1e72fb8b158b6a380cfb4329a0c7b35f7..08d1280168a008585afa39217245e8dc2d66e685 100644 (file)
@@ -69,7 +69,6 @@ struct vcard_internal_info {
 };
 
 /* Message number symbol used internally by these functions */
-unsigned long SYM_VCARD;
 #define VC ((struct vcard_internal_info *)CtdlGetUserData(SYM_VCARD))
 
 
@@ -784,7 +783,6 @@ void vcard_session_login_hook(void) {
 
 char *serv_vcard_init(void)
 {
-       SYM_VCARD = CtdlGetDynamicSymbol();
        CtdlRegisterSessionHook(vcard_session_startup_hook, EVT_START);
        CtdlRegisterSessionHook(vcard_session_login_hook, EVT_LOGIN);
        CtdlRegisterMessageHook(vcard_upload_beforesave, EVT_BEFORESAVE);
index cd2502e9d44ce51342b6f16566ec89d0994af8b7..e8cebf98d80f921339f2607abac63f380fb18112 100644 (file)
@@ -5,9 +5,6 @@
  */
 /* #define DEBUG_MEMORY_LEAKS */
 
-/*
- * New format for a message in memory
- */
 
 #ifndef SERVER_H
 #define SERVER_H
 #include <openssl/ssl.h>
 #endif
 
-#define        CTDLMESSAGE_MAGIC               0x159d
+/*
+ * New format for a message in memory
+ */
 struct CtdlMessage {
-       int cm_magic;                   /* Self-check */
+       int cm_magic;                   /* Self-check (NOT SAVED TO DISK) */
        char cm_anon_type;              /* Anonymous or author-visible */
        char cm_format_type;            /* Format type */
        char *cm_fields[256];           /* Data fields */
        unsigned int cm_flags;          /* How to handle (NOT SAVED TO DISK) */
 };
 
+#define        CTDLMESSAGE_MAGIC               0x159d
 #define        CM_SKIP_HOOKS   0x01            /* Don't run server-side handlers */
 
 
@@ -45,12 +45,20 @@ struct CtdlSessData {
 };
 
 /*
- * Static user data symbol types
+ * Static user data symbol types.  Server extensions can ask for dynamic
+ * extensions to per-session data, but the symbol ID has to be listed here.
  */
 enum {
        SYM_DESIRED_SECTION,            /* Used by the MIME parser */
        SYM_MA_INFO,                    /* Handles multipart/alternative */
        SYM_REPL,                       /* Used for replication checking */
+       SYM_CIT_ICAL,                   /* Used by the calendar service */
+       SYM_IMAP,                       /* Used by the IMAP service */
+       SYM_POP3,                       /* Used by the POP3 service */
+       SYM_SMTP,                       /* Used by the SMTP service */
+       SYM_SMTP_RECPS,
+       SYM_SMTP_ROOMS,
+       SYM_VCARD,                      /* vCard handling requires this */
        SYM_MAX
 };
 
index 4e574bb64b9dad00b5095cf0e8fea4917ee2fc15..014c68b4addd613d1fcfee279eb8cf0cccb0ff3a 100644 (file)
@@ -82,7 +82,7 @@ int main(int argc, char **argv)
 
                /* -t specifies where to log trace messages to */
                if (!strncmp(argv[a], "-t", 2)) {
-                       strcpy(tracefile, argv[a]);
+                       safestrncpy(tracefile, argv[a], sizeof tracefile);
                        strcpy(tracefile, &tracefile[2]);
                        freopen(tracefile, "r", stdin);
                        freopen(tracefile, "w", stdout);