]> code.citadel.org Git - citadel.git/blobdiff - citadel/modules/expire/serv_expire.c
* Yup, that's it ... the expression (long)*(cdboi->ptr) does NOT work reliably...
[citadel.git] / citadel / modules / expire / serv_expire.c
index d45ca51211e809c45cb8c926de6f3a2686de31ac..ab1d3a35909d765021bd681c00e6b0f40e0f9839 100644 (file)
@@ -3,10 +3,11 @@
  *
  * This module handles the expiry of old messages and the purging of old users.
  *
- */
-
-
-/*
+ * You might also see this module affectionately referred to as the DAP (the Dreaded Auto-Purger).
+ *
+ * Copyright (c) 1988-2009 by citadel.org (Art Cancro, Wilifried Goesgens, and others)
+ * Brought to you, our happy user community, under the terms of the GNU General Public License v3
+ *
  * A brief technical discussion:
  *
  * Several of the purge operations found in this module operate in two
@@ -66,7 +67,7 @@
 #include "msgbase.h"
 #include "user_ops.h"
 #include "control.h"
-#include "serv_network.h"      /* Needed for defenition of UseTable */
+#include "serv_network.h"      /* Needed for definition of UseTable */
 #include "threads.h"
 
 #include "ctdl_module.h"
@@ -805,6 +806,7 @@ int PurgeStaleOpenIDassociations(void) {
        void *Value;
        const char *Key;
        int num_deleted = 0;
+       long usernum = 0L;
 
        keys = NewHash(1, NULL);
        if (!keys) return(0);
@@ -813,8 +815,7 @@ int PurgeStaleOpenIDassociations(void) {
        cdb_rewind(CDB_OPENID);
        while (cdboi = cdb_next_item(CDB_OPENID), cdboi != NULL) {
                if (cdboi->len > sizeof(long)) {
-                       long usernum;
-                       usernum = ((long)*(cdboi->ptr));
+                       memcpy(&usernum, cdboi->ptr, sizeof(long));
                        if (getuserbynumber(&usbuf, usernum) != 0) {
                                deleteme = strdup(cdboi->ptr + sizeof(long)),
                                Put(keys, deleteme, strlen(deleteme), deleteme, generic_free_handler);