2 * This module handles shared rooms, inter-Citadel mail, and outbound
3 * mailing list processing.
5 * Copyright (c) 2000-2012 by the citadel.org team
7 * This program is open source software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License, version 3.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * ** NOTE ** A word on the S_NETCONFIGS semaphore:
16 * This is a fairly high-level type of critical section. It ensures that no
17 * two threads work on the netconfigs files at the same time. Since we do
18 * so many things inside these, here are the rules:
19 * 1. begin_critical_section(S_NETCONFIGS) *before* begin_ any others.
20 * 2. Do *not* perform any I/O with the client during these sections.
25 * Duration of time (in seconds) after which pending list subscribe/unsubscribe
26 * requests that have not been confirmed will be deleted.
28 #define EXP 259200 /* three days */
40 #include <sys/types.h>
42 #if TIME_WITH_SYS_TIME
43 # include <sys/time.h>
47 # include <sys/time.h>
55 # if HAVE_SYS_SYSCALL_H
56 # include <sys/syscall.h>
63 #include <libcitadel.h>
66 #include "citserver.h"
72 #include "internet_addressing.h"
73 #include "serv_network.h"
74 #include "clientsocket.h"
76 #include "citadel_dirs.h"
79 #include "netconfig.h"
82 #include "ctdl_module.h"
84 int read_spoolcontrol_file(SpoolControl **scc, char *filename)
90 char roomname[ROOMNAMELEN];
94 namelist *nptr = NULL;
98 fp = fopen(filename, "r");
102 sc = malloc(sizeof(SpoolControl));
103 memset(sc, 0, sizeof(SpoolControl));
106 while (fgets(buf, sizeof buf, fp) != NULL) {
107 buf[strlen(buf)-1] = 0;
109 extract_token(instr, buf, 0, '|', sizeof instr);
110 if (!strcasecmp(instr, strof(lastsent))) {
111 sc->lastsent = extract_long(buf, 1);
113 else if (!strcasecmp(instr, strof(listrecp))) {
115 malloc(sizeof(namelist));
116 nptr->next = sc->listrecps;
117 extract_token(nptr->name, buf, 1, '|', sizeof nptr->name);
118 sc->listrecps = nptr;
120 else if (!strcasecmp(instr, strof(participate))) {
122 malloc(sizeof(namelist));
123 nptr->next = sc->participates;
124 extract_token(nptr->name, buf, 1, '|', sizeof nptr->name);
125 sc->participates = nptr;
127 else if (!strcasecmp(instr, strof(digestrecp))) {
129 malloc(sizeof(namelist));
130 nptr->next = sc->digestrecps;
131 extract_token(nptr->name, buf, 1, '|', sizeof nptr->name);
132 sc->digestrecps = nptr;
134 else if (!strcasecmp(instr, strof(ignet_push_share))) {
135 extract_token(nodename, buf, 1, '|', sizeof nodename);
136 extract_token(roomname, buf, 2, '|', sizeof roomname);
137 mptr = (maplist *) malloc(sizeof(maplist));
138 mptr->next = sc->ignet_push_shares;
139 strcpy(mptr->remote_nodename, nodename);
140 strcpy(mptr->remote_roomname, roomname);
141 sc->ignet_push_shares = mptr;
144 /* Preserve 'other' lines ... *unless* they happen to
145 * be subscribe/unsubscribe pendings with expired
149 if (!strncasecmp(buf, strof(subpending)"|", 11)) {
150 if (time(NULL) - extract_long(buf, 4) > EXP) {
154 if (!strncasecmp(buf, strof(unsubpending)"|", 13)) {
155 if (time(NULL) - extract_long(buf, 3) > EXP) {
160 if (skipthisline == 0) {
161 linesize = strlen(buf);
162 sc->misc = realloc(sc->misc,
163 (miscsize + linesize + 2) );
164 sprintf(&sc->misc[miscsize], "%s\n", buf);
165 miscsize = miscsize + linesize + 1;
175 void free_spoolcontrol_struct(SpoolControl **scc)
178 namelist *nptr = NULL;
179 maplist *mptr = NULL;
182 while (sc->listrecps != NULL) {
183 nptr = sc->listrecps->next;
185 sc->listrecps = nptr;
187 /* Do the same for digestrecps */
188 while (sc->digestrecps != NULL) {
189 nptr = sc->digestrecps->next;
190 free(sc->digestrecps);
191 sc->digestrecps = nptr;
193 /* Do the same for participates */
194 while (sc->participates != NULL) {
195 nptr = sc->participates->next;
196 free(sc->participates);
197 sc->participates = nptr;
199 while (sc->ignet_push_shares != NULL) {
200 mptr = sc->ignet_push_shares->next;
201 free(sc->ignet_push_shares);
202 sc->ignet_push_shares = mptr;
209 int writenfree_spoolcontrol_file(SpoolControl **scc, char *filename)
211 char tempfilename[PATH_MAX];
214 namelist *nptr = NULL;
215 maplist *mptr = NULL;
219 long reltid; /* if we don't have SYS_gettid, use "random" value */
223 len = strlen(filename);
224 memcpy(tempfilename, filename, len + 1);
227 #if defined(HAVE_SYSCALL_H) && defined (SYS_gettid)
228 reltid = syscall(SYS_gettid);
230 gettimeofday(&tv, NULL);
231 /* Promote to time_t; types differ on some OSes (like darwin) */
232 unixtime = tv.tv_sec;
234 sprintf(tempfilename + len, ".%ld-%ld", reltid, unixtime);
237 TmpFD = open(tempfilename, O_CREAT|O_EXCL|O_RDWR, S_IRUSR|S_IWUSR);
239 if ((TmpFD < 0) || (errno != 0)) {
240 syslog(LOG_CRIT, "ERROR: cannot open %s: %s\n",
241 filename, strerror(errno));
242 free_spoolcontrol_struct(scc);
243 unlink(tempfilename);
246 fchown(TmpFD, config.c_ctdluid, 0);
247 StrBufAppendPrintf(Cfg, "lastsent|%ld\n", sc->lastsent);
249 /* Write out the listrecps while freeing from memory at the
250 * same time. Am I clever or what? :)
252 while (sc->listrecps != NULL) {
253 StrBufAppendPrintf(Cfg, "listrecp|%s\n", sc->listrecps->name);
254 nptr = sc->listrecps->next;
256 sc->listrecps = nptr;
258 /* Do the same for digestrecps */
259 while (sc->digestrecps != NULL) {
260 StrBufAppendPrintf(Cfg, "digestrecp|%s\n", sc->digestrecps->name);
261 nptr = sc->digestrecps->next;
262 free(sc->digestrecps);
263 sc->digestrecps = nptr;
265 /* Do the same for participates */
266 while (sc->participates != NULL) {
267 StrBufAppendPrintf(Cfg, "participate|%s\n", sc->participates->name);
268 nptr = sc->participates->next;
269 free(sc->participates);
270 sc->participates = nptr;
272 while (sc->ignet_push_shares != NULL) {
273 StrBufAppendPrintf(Cfg, "ignet_push_share|%s", sc->ignet_push_shares->remote_nodename);
274 if (!IsEmptyStr(sc->ignet_push_shares->remote_roomname)) {
275 StrBufAppendPrintf(Cfg, "|%s", sc->ignet_push_shares->remote_roomname);
277 StrBufAppendPrintf(Cfg, "\n");
278 mptr = sc->ignet_push_shares->next;
279 free(sc->ignet_push_shares);
280 sc->ignet_push_shares = mptr;
282 if (sc->misc != NULL) {
283 StrBufAppendBufPlain(Cfg, sc->misc, -1, 0);
287 rc = write(TmpFD, ChrPtr(Cfg), StrLength(Cfg));
288 if ((rc >=0 ) && (rc == StrLength(Cfg)))
291 rename(tempfilename, filename);
295 "unable to write %s; [%s]; not enough space on the disk?\n",
299 unlink(tempfilename);
307 int is_recipient(SpoolControl *sc, const char *Name)
313 nptr = sc->listrecps;
314 while (nptr != NULL) {
315 if (strncmp(Name, nptr->name, len)==0)
319 /* Do the same for digestrecps */
320 nptr = sc->digestrecps;
321 while (nptr != NULL) {
322 if (strncmp(Name, nptr->name, len)==0)
326 /* Do the same for participates */
327 nptr = sc->participates;
328 while (nptr != NULL) {
329 if (strncmp(Name, nptr->name, len)==0)
338 * Batch up and send all outbound traffic from the current room
340 void network_spoolout_room(RoomProcList *room_to_spool,
341 HashList *working_ignetcfg,
342 HashList *the_netmap)
345 char filename[PATH_MAX];
350 * If the room doesn't exist, don't try to perform its networking tasks.
351 * Normally this should never happen, but once in a while maybe a room gets
352 * queued for networking and then deleted before it can happen.
354 if (CtdlGetRoom(&CC->room, room_to_spool->name) != 0) {
355 syslog(LOG_CRIT, "ERROR: cannot load <%s>\n", room_to_spool->name);
359 assoc_file_name(filename, sizeof filename, &CC->room, ctdl_netcfg_dir);
360 begin_critical_section(S_NETCONFIGS);
362 /* Only do net processing for rooms that have netconfigs */
363 if (!read_spoolcontrol_file(&sc, filename))
365 end_critical_section(S_NETCONFIGS);
368 syslog(LOG_INFO, "Networking started for <%s>\n", CC->room.QRname);
370 sc->working_ignetcfg = working_ignetcfg;
371 sc->the_netmap = the_netmap;
373 /* If there are digest recipients, we have to build a digest */
374 if (sc->digestrecps != NULL) {
375 sc->digestfp = tmpfile();
376 fprintf(sc->digestfp, "Content-type: text/plain\n\n");
379 /* Do something useful */
380 CtdlForEachMessage(MSGS_GT, sc->lastsent, NULL, NULL, NULL,
381 network_spool_msg, sc);
383 /* If we wrote a digest, deliver it and then close it */
384 snprintf(buf, sizeof buf, "room_%s@%s",
385 CC->room.QRname, config.c_fqdn);
386 for (i=0; buf[i]; ++i) {
387 buf[i] = tolower(buf[i]);
388 if (isspace(buf[i])) buf[i] = '_';
390 if (sc->digestfp != NULL) {
391 fprintf(sc->digestfp, " -----------------------------------"
392 "------------------------------------"
394 "You are subscribed to the '%s' "
396 "To post to the list: %s\n",
399 network_deliver_digest(sc); /* deliver and close */
402 /* Now rewrite the config file */
403 writenfree_spoolcontrol_file(&sc, filename);
404 end_critical_section(S_NETCONFIGS);
408 * Process a buffer containing a single message from a single file
409 * from the inbound queue
411 void network_process_buffer(char *buffer, long size, HashList *working_ignetcfg, HashList *the_netmap, int *netmap_changed)
413 struct CitContext *CCC = CC;
415 struct CtdlMessage *msg = NULL;
418 struct recptypes *recp = NULL;
419 char target_room[ROOMNAMELEN];
420 struct ser_ret sermsg;
421 char *oldpath = NULL;
422 char filename[PATH_MAX];
424 const StrBuf *nexthop = NULL;
425 unsigned char firstbyte;
426 unsigned char lastbyte;
428 QN_syslog(LOG_DEBUG, "network_process_buffer() processing %ld bytes\n", size);
430 /* Validate just a little bit. First byte should be FF and * last byte should be 00. */
431 firstbyte = buffer[0];
432 lastbyte = buffer[size-1];
433 if ( (firstbyte != 255) || (lastbyte != 0) ) {
434 QN_syslog(LOG_ERR, "Corrupt message ignored. Length=%ld, firstbyte = %d, lastbyte = %d\n",
435 size, firstbyte, lastbyte);
439 /* Set default target room to trash */
440 strcpy(target_room, TWITROOM);
442 /* Load the message into memory */
443 msg = (struct CtdlMessage *) malloc(sizeof(struct CtdlMessage));
444 memset(msg, 0, sizeof(struct CtdlMessage));
445 msg->cm_magic = CTDLMESSAGE_MAGIC;
446 msg->cm_anon_type = buffer[1];
447 msg->cm_format_type = buffer[2];
449 for (pos = 3; pos < size; ++pos) {
451 msg->cm_fields[field] = strdup(&buffer[pos+1]);
452 pos = pos + strlen(&buffer[(int)pos]);
455 /* Check for message routing */
456 if (msg->cm_fields['D'] != NULL) {
457 if (strcasecmp(msg->cm_fields['D'], config.c_nodename)) {
459 /* route the message */
460 Buf = NewStrBufPlain(msg->cm_fields['D'], -1);
461 if (is_valid_node(&nexthop,
467 /* prepend our node to the path */
468 if (msg->cm_fields['P'] != NULL) {
469 oldpath = msg->cm_fields['P'];
470 msg->cm_fields['P'] = NULL;
473 oldpath = strdup("unknown_user");
475 size = strlen(oldpath) + SIZ;
476 msg->cm_fields['P'] = malloc(size);
477 snprintf(msg->cm_fields['P'], size, "%s!%s",
478 config.c_nodename, oldpath);
481 /* serialize the message */
482 serialize_message(&sermsg, msg);
485 if (StrLength(nexthop) == 0) {
496 QN_syslog(LOG_DEBUG, "Appending to %s\n", filename);
497 fp = fopen(filename, "ab");
499 fwrite(sermsg.ser, sermsg.len, 1, fp);
503 QN_syslog(LOG_ERR, "%s: %s\n", filename, strerror(errno));
506 CtdlFreeMessage(msg);
511 else { /* invalid destination node name */
515 "A message you sent could not be delivered due to an invalid destination node"
516 " name. Please check the address and try sending the message again.\n");
525 * Check to see if we already have a copy of this message, and
526 * abort its processing if so. (We used to post a warning to Aide>
527 * every time this happened, but the network is now so densely
528 * connected that it's inevitable.)
530 if (network_usetable(msg) != 0) {
531 CtdlFreeMessage(msg);
535 /* Learn network topology from the path */
536 if ((msg->cm_fields['N'] != NULL) && (msg->cm_fields['P'] != NULL)) {
537 network_learn_topology(msg->cm_fields['N'],
543 /* Is the sending node giving us a very persuasive suggestion about
544 * which room this message should be saved in? If so, go with that.
546 if (msg->cm_fields['C'] != NULL) {
547 safestrncpy(target_room, msg->cm_fields['C'], sizeof target_room);
550 /* Otherwise, does it have a recipient? If so, validate it... */
551 else if (msg->cm_fields['R'] != NULL) {
552 recp = validate_recipients(msg->cm_fields['R'], NULL, 0);
553 if (recp != NULL) if (recp->num_error != 0) {
555 "A message you sent could not be delivered due to an invalid address.\n"
556 "Please check the address and try sending the message again.\n");
558 free_recipients(recp);
559 QNM_syslog(LOG_DEBUG, "Bouncing message due to invalid recipient address.\n");
562 strcpy(target_room, ""); /* no target room if mail */
565 /* Our last shot at finding a home for this message is to see if
566 * it has the O field (Originating room) set.
568 else if (msg->cm_fields['O'] != NULL) {
569 safestrncpy(target_room, msg->cm_fields['O'], sizeof target_room);
572 /* Strip out fields that are only relevant during transit */
573 if (msg->cm_fields['D'] != NULL) {
574 free(msg->cm_fields['D']);
575 msg->cm_fields['D'] = NULL;
577 if (msg->cm_fields['C'] != NULL) {
578 free(msg->cm_fields['C']);
579 msg->cm_fields['C'] = NULL;
582 /* save the message into a room */
583 if (PerformNetprocHooks(msg, target_room) == 0) {
584 msg->cm_flags = CM_SKIP_HOOKS;
585 CtdlSubmitMsg(msg, recp, target_room, 0);
587 CtdlFreeMessage(msg);
588 free_recipients(recp);
593 * Process a single message from a single file from the inbound queue
595 void network_process_message(FILE *fp,
598 HashList *working_ignetcfg,
599 HashList *the_netmap,
606 hold_pos = ftell(fp);
607 size = msgend - msgstart + 1;
608 buffer = malloc(size);
609 if (buffer != NULL) {
610 fseek(fp, msgstart, SEEK_SET);
611 if (fread(buffer, size, 1, fp) > 0) {
612 network_process_buffer(buffer,
621 fseek(fp, hold_pos, SEEK_SET);
626 * Process a single file from the inbound queue
628 void network_process_file(char *filename,
629 HashList *working_ignetcfg,
630 HashList *the_netmap,
633 struct CitContext *CCC = CC;
635 long msgstart = (-1L);
641 fp = fopen(filename, "rb");
643 QN_syslog(LOG_CRIT, "Error opening %s: %s\n", filename, strerror(errno));
647 fseek(fp, 0L, SEEK_END);
648 QN_syslog(LOG_INFO, "network: processing %ld bytes from %s\n", ftell(fp), filename);
651 /* Look for messages in the data stream and break them out */
652 while (ch = getc(fp), ch >= 0) {
655 if (msgstart >= 0L) {
657 network_process_message(fp,
671 if (msgstart >= 0L) {
672 network_process_message(fp,
686 * Process anything in the inbound queue
688 void network_do_spoolin(HashList *working_ignetcfg, HashList *the_netmap, int *netmap_changed)
690 struct CitContext *CCC = CC;
694 char filename[PATH_MAX];
695 static time_t last_spoolin_mtime = 0L;
698 * Check the spoolin directory's modification time. If it hasn't
699 * been touched, we don't need to scan it.
701 if (stat(ctdl_netin_dir, &statbuf)) return;
702 if (statbuf.st_mtime == last_spoolin_mtime) {
703 QNM_syslog(LOG_DEBUG, "network: nothing in inbound queue\n");
706 last_spoolin_mtime = statbuf.st_mtime;
707 QNM_syslog(LOG_DEBUG, "network: processing inbound queue\n");
710 * Ok, there's something interesting in there, so scan it.
712 dp = opendir(ctdl_netin_dir);
713 if (dp == NULL) return;
715 while (d = readdir(dp), d != NULL) {
716 if ((strcmp(d->d_name, ".")) && (strcmp(d->d_name, ".."))) {
723 network_process_file(filename,
734 * Step 1: consolidate files in the outbound queue into one file per neighbor node
735 * Step 2: delete any files in the outbound queue that were for neighbors who no longer exist.
737 void network_consolidate_spoolout(HashList *working_ignetcfg, HashList *the_netmap)
739 struct CitContext *CCC = CC;
745 struct dirent *filedir_entry;
747 char spooloutfilename[PATH_MAX];
748 char filename[PATH_MAX];
749 const StrBuf *nexthop;
755 /* Step 1: consolidate files in the outbound queue into one file per neighbor node */
756 d = (struct dirent *)malloc(offsetof(struct dirent, d_name) + PATH_MAX + 1);
757 if (d == NULL) return;
759 dp = opendir(ctdl_netout_dir);
765 NextHop = NewStrBuf();
766 memset(&IOB, 0, sizeof(IOBuffer));
767 memset(&FDIO, 0, sizeof(FDIOBuffer));
770 while ((readdir_r(dp, d, &filedir_entry) == 0) &&
771 (filedir_entry != NULL))
773 #ifdef _DIRENT_HAVE_D_NAMELEN
774 d_namelen = filedir_entry->d_namelen;
783 #define IFTODT(mode) (((mode) & 0170000) >> 12)
784 #define DTTOIF(dirtype) ((dirtype) << 12)
786 d_namelen = strlen(filedir_entry->d_name);
788 if ((d_namelen > 1) && filedir_entry->d_name[d_namelen - 1] == '~')
789 continue; /* Ignore backup files... */
791 if ((d_namelen == 1) &&
792 (filedir_entry->d_name[0] == '.'))
795 if ((d_namelen == 2) &&
796 (filedir_entry->d_name[0] == '.') &&
797 (filedir_entry->d_name[1] == '.'))
800 pch = strchr(filedir_entry->d_name, '@');
808 filedir_entry->d_name);
811 filedir_entry->d_name,
812 pch - filedir_entry->d_name);
814 snprintf(spooloutfilename,
815 sizeof spooloutfilename,
820 QN_syslog(LOG_DEBUG, "Consolidate %s to %s\n", filename, ChrPtr(NextHop));
821 if (network_talking_to(SKEY(NextHop), NTT_CHECK)) {
824 "Currently online with %s - skipping for now\n",
832 const char *err = NULL;
833 network_talking_to(SKEY(NextHop), NTT_ADD);
835 infd = open(filename, O_RDONLY);
839 "failed to open %s for reading due to %s; skipping.\n",
840 filename, strerror(errno)
842 network_talking_to(SKEY(NextHop), NTT_REMOVE);
846 outfd = open(spooloutfilename,
847 O_EXCL|O_CREAT|O_NONBLOCK|O_WRONLY,
851 outfd = open(spooloutfilename,
852 O_EXCL|O_NONBLOCK|O_WRONLY,
858 "failed to open %s for reading due to %s; skipping.\n",
859 spooloutfilename, strerror(errno)
862 network_talking_to(SKEY(NextHop), NTT_REMOVE);
866 dsize = lseek(outfd, 0, SEEK_END);
867 lseek(outfd, -dsize, SEEK_SET);
869 fstat(infd, &statbuf);
870 fsize = statbuf.st_size;
872 fsize = lseek(infd, 0, SEEK_END);
875 FDIOBufferInit(&FDIO, &IOB, outfd, fsize + dsize);
876 FDIO.ChunkSendRemain = fsize;
877 FDIO.TotalSentAlready = dsize;
880 do {} while ((FileMoveChunked(&FDIO, &err) > 0) && (err == NULL));
887 "failed to append to %s [%s]; rolling back..\n",
888 spooloutfilename, strerror(errno)
890 /* whoops partial append?? truncate spooloutfilename again! */
891 ftruncate(outfd, dsize);
893 FDIOBufferDelete(&FDIO);
896 network_talking_to(SKEY(NextHop), NTT_REMOVE);
902 FreeStrBuf(&NextHop);
904 "skipping Spoolcleanup because of %d files unprocessed.\n",
911 /* Step 2: delete any files in the outbound queue that were for neighbors who no longer exist */
912 dp = opendir(ctdl_netout_dir);
914 FreeStrBuf(&NextHop);
919 while ((readdir_r(dp, d, &filedir_entry) == 0) &&
920 (filedir_entry != NULL))
922 #ifdef _DIRENT_HAVE_D_NAMELEN
923 d_namelen = filedir_entry->d_namelen;
924 d_type = filedir_entry->d_type;
933 #define IFTODT(mode) (((mode) & 0170000) >> 12)
934 #define DTTOIF(dirtype) ((dirtype) << 12)
936 d_namelen = strlen(filedir_entry->d_name);
938 if ((d_namelen == 1) &&
939 (filedir_entry->d_name[0] == '.'))
942 if ((d_namelen == 2) &&
943 (filedir_entry->d_name[0] == '.') &&
944 (filedir_entry->d_name[1] == '.'))
947 pch = strchr(filedir_entry->d_name, '@');
948 if (pch == NULL) /* no @ in name? consolidated file. */
952 filedir_entry->d_name,
953 pch - filedir_entry->d_name);
959 filedir_entry->d_name
962 i = is_valid_node(&nexthop,
968 if ( (i != 0) || (StrLength(nexthop) > 0) ) {
972 FreeStrBuf(&NextHop);
981 * It's ok if these directories already exist. Just fail silently.
983 void create_spool_dirs(void) {
984 if ((mkdir(ctdl_spool_dir, 0700) != 0) && (errno != EEXIST))
985 syslog(LOG_EMERG, "unable to create directory [%s]: %s", ctdl_spool_dir, strerror(errno));
986 if (chown(ctdl_spool_dir, CTDLUID, (-1)) != 0)
987 syslog(LOG_EMERG, "unable to set the access rights for [%s]: %s", ctdl_spool_dir, strerror(errno));
988 if ((mkdir(ctdl_netin_dir, 0700) != 0) && (errno != EEXIST))
989 syslog(LOG_EMERG, "unable to create directory [%s]: %s", ctdl_netin_dir, strerror(errno));
990 if (chown(ctdl_netin_dir, CTDLUID, (-1)) != 0)
991 syslog(LOG_EMERG, "unable to set the access rights for [%s]: %s", ctdl_netin_dir, strerror(errno));
992 if ((mkdir(ctdl_nettmp_dir, 0700) != 0) && (errno != EEXIST))
993 syslog(LOG_EMERG, "unable to create directory [%s]: %s", ctdl_nettmp_dir, strerror(errno));
994 if (chown(ctdl_nettmp_dir, CTDLUID, (-1)) != 0)
995 syslog(LOG_EMERG, "unable to set the access rights for [%s]: %s", ctdl_nettmp_dir, strerror(errno));
996 if ((mkdir(ctdl_netout_dir, 0700) != 0) && (errno != EEXIST))
997 syslog(LOG_EMERG, "unable to create directory [%s]: %s", ctdl_netout_dir, strerror(errno));
998 if (chown(ctdl_netout_dir, CTDLUID, (-1)) != 0)
999 syslog(LOG_EMERG, "unable to set the access rights for [%s]: %s", ctdl_netout_dir, strerror(errno));
1003 * Module entry point
1005 CTDL_MODULE_INIT(network_spool)
1009 create_spool_dirs();
1010 //////todo CtdlRegisterCleanupHook(destroy_network_queue_room);
1012 return "network_spool";