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 as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 * ** NOTE ** A word on the S_NETCONFIGS semaphore:
22 * This is a fairly high-level type of critical section. It ensures that no
23 * two threads work on the netconfigs files at the same time. Since we do
24 * so many things inside these, here are the rules:
25 * 1. begin_critical_section(S_NETCONFIGS) *before* begin_ any others.
26 * 2. Do *not* perform any I/O with the client during these sections.
31 * Duration of time (in seconds) after which pending list subscribe/unsubscribe
32 * requests that have not been confirmed will be deleted.
34 #define EXP 259200 /* three days */
46 #include <sys/types.h>
48 #if TIME_WITH_SYS_TIME
49 # include <sys/time.h>
53 # include <sys/time.h>
61 # if HAVE_SYS_SYSCALL_H
62 # include <sys/syscall.h>
69 #include <libcitadel.h>
72 #include "citserver.h"
78 #include "internet_addressing.h"
79 #include "serv_network.h"
80 #include "clientsocket.h"
82 #include "citadel_dirs.h"
90 #include "netconfig.h"
93 #include "ctdl_module.h"
98 int read_spoolcontrol_file(SpoolControl **scc, char *filename)
104 char roomname[ROOMNAMELEN];
107 int skipthisline = 0;
108 namelist *nptr = NULL;
109 maplist *mptr = NULL;
112 fp = fopen(filename, "r");
116 sc = malloc(sizeof(SpoolControl));
117 memset(sc, 0, sizeof(SpoolControl));
120 while (fgets(buf, sizeof buf, fp) != NULL) {
121 buf[strlen(buf)-1] = 0;
123 extract_token(instr, buf, 0, '|', sizeof instr);
124 if (!strcasecmp(instr, strof(lastsent))) {
125 sc->lastsent = extract_long(buf, 1);
127 else if (!strcasecmp(instr, strof(listrecp))) {
129 malloc(sizeof(namelist));
130 nptr->next = sc->listrecps;
131 extract_token(nptr->name, buf, 1, '|', sizeof nptr->name);
132 sc->listrecps = nptr;
134 else if (!strcasecmp(instr, strof(participate))) {
136 malloc(sizeof(namelist));
137 nptr->next = sc->participates;
138 extract_token(nptr->name, buf, 1, '|', sizeof nptr->name);
139 sc->participates = nptr;
141 else if (!strcasecmp(instr, strof(digestrecp))) {
143 malloc(sizeof(namelist));
144 nptr->next = sc->digestrecps;
145 extract_token(nptr->name, buf, 1, '|', sizeof nptr->name);
146 sc->digestrecps = nptr;
148 else if (!strcasecmp(instr, strof(ignet_push_share))) {
149 extract_token(nodename, buf, 1, '|', sizeof nodename);
150 extract_token(roomname, buf, 2, '|', sizeof roomname);
151 mptr = (maplist *) malloc(sizeof(maplist));
152 mptr->next = sc->ignet_push_shares;
153 strcpy(mptr->remote_nodename, nodename);
154 strcpy(mptr->remote_roomname, roomname);
155 sc->ignet_push_shares = mptr;
158 /* Preserve 'other' lines ... *unless* they happen to
159 * be subscribe/unsubscribe pendings with expired
163 if (!strncasecmp(buf, strof(subpending)"|", 11)) {
164 if (time(NULL) - extract_long(buf, 4) > EXP) {
168 if (!strncasecmp(buf, strof(unsubpending)"|", 13)) {
169 if (time(NULL) - extract_long(buf, 3) > EXP) {
174 if (skipthisline == 0) {
175 linesize = strlen(buf);
176 sc->misc = realloc(sc->misc,
177 (miscsize + linesize + 2) );
178 sprintf(&sc->misc[miscsize], "%s\n", buf);
179 miscsize = miscsize + linesize + 1;
189 void free_spoolcontrol_struct(SpoolControl **scc)
192 namelist *nptr = NULL;
193 maplist *mptr = NULL;
196 while (sc->listrecps != NULL) {
197 nptr = sc->listrecps->next;
199 sc->listrecps = nptr;
201 /* Do the same for digestrecps */
202 while (sc->digestrecps != NULL) {
203 nptr = sc->digestrecps->next;
204 free(sc->digestrecps);
205 sc->digestrecps = nptr;
207 /* Do the same for participates */
208 while (sc->participates != NULL) {
209 nptr = sc->participates->next;
210 free(sc->participates);
211 sc->participates = nptr;
213 while (sc->ignet_push_shares != NULL) {
214 mptr = sc->ignet_push_shares->next;
215 free(sc->ignet_push_shares);
216 sc->ignet_push_shares = mptr;
223 int writenfree_spoolcontrol_file(SpoolControl **scc, char *filename)
225 char tempfilename[PATH_MAX];
228 namelist *nptr = NULL;
229 maplist *mptr = NULL;
233 long reltid; /* if we don't have SYS_gettid, use "random" value */
237 len = strlen(filename);
238 memcpy(tempfilename, filename, len + 1);
241 #if defined(HAVE_SYSCALL_H) && defined (SYS_gettid)
242 reltid = syscall(SYS_gettid);
244 gettimeofday(&tv, NULL);
245 /* Promote to time_t; types differ on some OSes (like darwin) */
246 unixtime = tv.tv_sec;
248 sprintf(tempfilename + len, ".%ld-%ld", reltid, unixtime);
251 TmpFD = open(tempfilename, O_CREAT|O_EXCL|O_RDWR, S_IRUSR|S_IWUSR);
253 if ((TmpFD < 0) || (errno != 0)) {
254 syslog(LOG_CRIT, "ERROR: cannot open %s: %s\n",
255 filename, strerror(errno));
256 free_spoolcontrol_struct(scc);
257 unlink(tempfilename);
260 fchown(TmpFD, config.c_ctdluid, 0);
261 StrBufAppendPrintf(Cfg, "lastsent|%ld\n", sc->lastsent);
263 /* Write out the listrecps while freeing from memory at the
264 * same time. Am I clever or what? :)
266 while (sc->listrecps != NULL) {
267 StrBufAppendPrintf(Cfg, "listrecp|%s\n", sc->listrecps->name);
268 nptr = sc->listrecps->next;
270 sc->listrecps = nptr;
272 /* Do the same for digestrecps */
273 while (sc->digestrecps != NULL) {
274 StrBufAppendPrintf(Cfg, "digestrecp|%s\n", sc->digestrecps->name);
275 nptr = sc->digestrecps->next;
276 free(sc->digestrecps);
277 sc->digestrecps = nptr;
279 /* Do the same for participates */
280 while (sc->participates != NULL) {
281 StrBufAppendPrintf(Cfg, "participate|%s\n", sc->participates->name);
282 nptr = sc->participates->next;
283 free(sc->participates);
284 sc->participates = nptr;
286 while (sc->ignet_push_shares != NULL) {
287 StrBufAppendPrintf(Cfg, "ignet_push_share|%s", sc->ignet_push_shares->remote_nodename);
288 if (!IsEmptyStr(sc->ignet_push_shares->remote_roomname)) {
289 StrBufAppendPrintf(Cfg, "|%s", sc->ignet_push_shares->remote_roomname);
291 StrBufAppendPrintf(Cfg, "\n");
292 mptr = sc->ignet_push_shares->next;
293 free(sc->ignet_push_shares);
294 sc->ignet_push_shares = mptr;
296 if (sc->misc != NULL) {
297 StrBufAppendBufPlain(Cfg, sc->misc, -1, 0);
301 rc = write(TmpFD, ChrPtr(Cfg), StrLength(Cfg));
302 if ((rc >=0 ) && (rc == StrLength(Cfg)))
305 rename(tempfilename, filename);
309 "unable to write %s; [%s]; not enough space on the disk?\n",
313 unlink(tempfilename);
321 int is_recipient(SpoolControl *sc, const char *Name)
327 nptr = sc->listrecps;
328 while (nptr != NULL) {
329 if (strncmp(Name, nptr->name, len)==0)
333 /* Do the same for digestrecps */
334 nptr = sc->digestrecps;
335 while (nptr != NULL) {
336 if (strncmp(Name, nptr->name, len)==0)
340 /* Do the same for participates */
341 nptr = sc->participates;
342 while (nptr != NULL) {
343 if (strncmp(Name, nptr->name, len)==0)
352 * Batch up and send all outbound traffic from the current room
354 void network_spoolout_room(RoomProcList *room_to_spool,
355 HashList *working_ignetcfg,
356 HashList *the_netmap)
359 char filename[PATH_MAX];
364 * If the room doesn't exist, don't try to perform its networking tasks.
365 * Normally this should never happen, but once in a while maybe a room gets
366 * queued for networking and then deleted before it can happen.
368 if (CtdlGetRoom(&CC->room, room_to_spool->name) != 0) {
369 syslog(LOG_CRIT, "ERROR: cannot load <%s>\n", room_to_spool->name);
373 assoc_file_name(filename, sizeof filename, &CC->room, ctdl_netcfg_dir);
374 begin_critical_section(S_NETCONFIGS);
376 /* Only do net processing for rooms that have netconfigs */
377 if (!read_spoolcontrol_file(&sc, filename))
379 end_critical_section(S_NETCONFIGS);
382 syslog(LOG_INFO, "Networking started for <%s>\n", CC->room.QRname);
384 sc->working_ignetcfg = working_ignetcfg;
385 sc->the_netmap = the_netmap;
387 /* If there are digest recipients, we have to build a digest */
388 if (sc->digestrecps != NULL) {
389 sc->digestfp = tmpfile();
390 fprintf(sc->digestfp, "Content-type: text/plain\n\n");
393 /* Do something useful */
394 CtdlForEachMessage(MSGS_GT, sc->lastsent, NULL, NULL, NULL,
395 network_spool_msg, sc);
397 /* If we wrote a digest, deliver it and then close it */
398 snprintf(buf, sizeof buf, "room_%s@%s",
399 CC->room.QRname, config.c_fqdn);
400 for (i=0; buf[i]; ++i) {
401 buf[i] = tolower(buf[i]);
402 if (isspace(buf[i])) buf[i] = '_';
404 if (sc->digestfp != NULL) {
405 fprintf(sc->digestfp, " -----------------------------------"
406 "------------------------------------"
408 "You are subscribed to the '%s' "
410 "To post to the list: %s\n",
413 network_deliver_digest(sc); /* deliver and close */
416 /* Now rewrite the config file */
417 writenfree_spoolcontrol_file(&sc, filename);
418 end_critical_section(S_NETCONFIGS);
422 * Process a buffer containing a single message from a single file
423 * from the inbound queue
425 void network_process_buffer(char *buffer, long size, HashList *working_ignetcfg, HashList *the_netmap, int *netmap_changed)
428 struct CtdlMessage *msg = NULL;
431 struct recptypes *recp = NULL;
432 char target_room[ROOMNAMELEN];
433 struct ser_ret sermsg;
434 char *oldpath = NULL;
435 char filename[PATH_MAX];
437 const StrBuf *nexthop = NULL;
438 unsigned char firstbyte;
439 unsigned char lastbyte;
441 syslog(LOG_DEBUG, "network_process_buffer() processing %ld bytes\n", size);
443 /* Validate just a little bit. First byte should be FF and * last byte should be 00. */
444 firstbyte = buffer[0];
445 lastbyte = buffer[size-1];
446 if ( (firstbyte != 255) || (lastbyte != 0) ) {
447 syslog(LOG_ERR, "Corrupt message ignored. Length=%ld, firstbyte = %d, lastbyte = %d\n",
448 size, firstbyte, lastbyte);
452 /* Set default target room to trash */
453 strcpy(target_room, TWITROOM);
455 /* Load the message into memory */
456 msg = (struct CtdlMessage *) malloc(sizeof(struct CtdlMessage));
457 memset(msg, 0, sizeof(struct CtdlMessage));
458 msg->cm_magic = CTDLMESSAGE_MAGIC;
459 msg->cm_anon_type = buffer[1];
460 msg->cm_format_type = buffer[2];
462 for (pos = 3; pos < size; ++pos) {
464 msg->cm_fields[field] = strdup(&buffer[pos+1]);
465 pos = pos + strlen(&buffer[(int)pos]);
468 /* Check for message routing */
469 if (msg->cm_fields['D'] != NULL) {
470 if (strcasecmp(msg->cm_fields['D'], config.c_nodename)) {
472 /* route the message */
473 Buf = NewStrBufPlain(msg->cm_fields['D'], -1);
474 if (is_valid_node(&nexthop,
480 /* prepend our node to the path */
481 if (msg->cm_fields['P'] != NULL) {
482 oldpath = msg->cm_fields['P'];
483 msg->cm_fields['P'] = NULL;
486 oldpath = strdup("unknown_user");
488 size = strlen(oldpath) + SIZ;
489 msg->cm_fields['P'] = malloc(size);
490 snprintf(msg->cm_fields['P'], size, "%s!%s",
491 config.c_nodename, oldpath);
494 /* serialize the message */
495 serialize_message(&sermsg, msg);
498 if (StrLength(nexthop) == 0) {
509 syslog(LOG_DEBUG, "Appending to %s\n", filename);
510 fp = fopen(filename, "ab");
512 fwrite(sermsg.ser, sermsg.len, 1, fp);
516 syslog(LOG_ERR, "%s: %s\n", filename, strerror(errno));
519 CtdlFreeMessage(msg);
524 else { /* invalid destination node name */
528 "A message you sent could not be delivered due to an invalid destination node"
529 " name. Please check the address and try sending the message again.\n");
538 * Check to see if we already have a copy of this message, and
539 * abort its processing if so. (We used to post a warning to Aide>
540 * every time this happened, but the network is now so densely
541 * connected that it's inevitable.)
543 if (network_usetable(msg) != 0) {
544 CtdlFreeMessage(msg);
548 /* Learn network topology from the path */
549 if ((msg->cm_fields['N'] != NULL) && (msg->cm_fields['P'] != NULL)) {
550 network_learn_topology(msg->cm_fields['N'],
556 /* Is the sending node giving us a very persuasive suggestion about
557 * which room this message should be saved in? If so, go with that.
559 if (msg->cm_fields['C'] != NULL) {
560 safestrncpy(target_room, msg->cm_fields['C'], sizeof target_room);
563 /* Otherwise, does it have a recipient? If so, validate it... */
564 else if (msg->cm_fields['R'] != NULL) {
565 recp = validate_recipients(msg->cm_fields['R'], NULL, 0);
566 if (recp != NULL) if (recp->num_error != 0) {
568 "A message you sent could not be delivered due to an invalid address.\n"
569 "Please check the address and try sending the message again.\n");
571 free_recipients(recp);
572 syslog(LOG_DEBUG, "Bouncing message due to invalid recipient address.\n");
575 strcpy(target_room, ""); /* no target room if mail */
578 /* Our last shot at finding a home for this message is to see if
579 * it has the O field (Originating room) set.
581 else if (msg->cm_fields['O'] != NULL) {
582 safestrncpy(target_room, msg->cm_fields['O'], sizeof target_room);
585 /* Strip out fields that are only relevant during transit */
586 if (msg->cm_fields['D'] != NULL) {
587 free(msg->cm_fields['D']);
588 msg->cm_fields['D'] = NULL;
590 if (msg->cm_fields['C'] != NULL) {
591 free(msg->cm_fields['C']);
592 msg->cm_fields['C'] = NULL;
595 /* save the message into a room */
596 if (PerformNetprocHooks(msg, target_room) == 0) {
597 msg->cm_flags = CM_SKIP_HOOKS;
598 CtdlSubmitMsg(msg, recp, target_room, 0);
600 CtdlFreeMessage(msg);
601 free_recipients(recp);
606 * Process a single message from a single file from the inbound queue
608 void network_process_message(FILE *fp,
611 HashList *working_ignetcfg,
612 HashList *the_netmap,
619 hold_pos = ftell(fp);
620 size = msgend - msgstart + 1;
621 buffer = malloc(size);
622 if (buffer != NULL) {
623 fseek(fp, msgstart, SEEK_SET);
624 if (fread(buffer, size, 1, fp) > 0) {
625 network_process_buffer(buffer,
634 fseek(fp, hold_pos, SEEK_SET);
639 * Process a single file from the inbound queue
641 void network_process_file(char *filename,
642 HashList *working_ignetcfg,
643 HashList *the_netmap,
647 long msgstart = (-1L);
653 fp = fopen(filename, "rb");
655 syslog(LOG_CRIT, "Error opening %s: %s\n", filename, strerror(errno));
659 fseek(fp, 0L, SEEK_END);
660 syslog(LOG_INFO, "network: processing %ld bytes from %s\n", ftell(fp), filename);
663 /* Look for messages in the data stream and break them out */
664 while (ch = getc(fp), ch >= 0) {
667 if (msgstart >= 0L) {
669 network_process_message(fp,
683 if (msgstart >= 0L) {
684 network_process_message(fp,
698 * Process anything in the inbound queue
700 void network_do_spoolin(HashList *working_ignetcfg, HashList *the_netmap, int *netmap_changed)
705 char filename[PATH_MAX];
706 static time_t last_spoolin_mtime = 0L;
709 * Check the spoolin directory's modification time. If it hasn't
710 * been touched, we don't need to scan it.
712 if (stat(ctdl_netin_dir, &statbuf)) return;
713 if (statbuf.st_mtime == last_spoolin_mtime) {
714 syslog(LOG_DEBUG, "network: nothing in inbound queue\n");
717 last_spoolin_mtime = statbuf.st_mtime;
718 syslog(LOG_DEBUG, "network: processing inbound queue\n");
721 * Ok, there's something interesting in there, so scan it.
723 dp = opendir(ctdl_netin_dir);
724 if (dp == NULL) return;
726 while (d = readdir(dp), d != NULL) {
727 if ((strcmp(d->d_name, ".")) && (strcmp(d->d_name, ".."))) {
734 network_process_file(filename,
745 * Step 1: consolidate files in the outbound queue into one file per neighbor node
746 * Step 2: delete any files in the outbound queue that were for neighbors who no longer exist.
748 void network_consolidate_spoolout(HashList *working_ignetcfg, HashList *the_netmap)
755 struct dirent *filedir_entry;
757 char spooloutfilename[PATH_MAX];
758 char filename[PATH_MAX];
759 const StrBuf *nexthop;
764 /* Step 1: consolidate files in the outbound queue into one file per neighbor node */
765 d = (struct dirent *)malloc(offsetof(struct dirent, d_name) + PATH_MAX + 1);
766 if (d == NULL) return;
768 dp = opendir(ctdl_netout_dir);
774 NextHop = NewStrBuf();
775 memset(&IOB, 0, sizeof(IOBuffer));
776 memset(&FDIO, 0, sizeof(FDIOBuffer));
779 while ((readdir_r(dp, d, &filedir_entry) == 0) &&
780 (filedir_entry != NULL))
782 #ifdef _DIRENT_HAVE_D_NAMELEN
783 d_namelen = filedir_entry->d_namelen;
792 #define IFTODT(mode) (((mode) & 0170000) >> 12)
793 #define DTTOIF(dirtype) ((dirtype) << 12)
795 d_namelen = strlen(filedir_entry->d_name);
797 if ((d_namelen > 1) && filedir_entry->d_name[d_namelen - 1] == '~')
798 continue; /* Ignore backup files... */
800 if ((d_namelen == 1) &&
801 (filedir_entry->d_name[0] == '.'))
804 if ((d_namelen == 2) &&
805 (filedir_entry->d_name[0] == '.') &&
806 (filedir_entry->d_name[1] == '.'))
809 pch = strchr(filedir_entry->d_name, '@');
817 filedir_entry->d_name);
820 filedir_entry->d_name,
821 pch - filedir_entry->d_name);
823 snprintf(spooloutfilename,
824 sizeof spooloutfilename,
829 syslog(LOG_DEBUG, "Consolidate %s to %s\n", filename, ChrPtr(NextHop));
830 if (network_talking_to(SKEY(NextHop), NTT_CHECK)) {
833 "Currently online with %s - skipping for now\n",
841 const char *err = NULL;
842 network_talking_to(SKEY(NextHop), NTT_ADD);
844 IOB.fd = open(filename, O_RDONLY);
848 "failed to open %s for reading due to %s; skipping.\n",
849 filename, strerror(errno)
851 network_talking_to(SKEY(NextHop), NTT_REMOVE);
855 fd = open(spooloutfilename,
856 O_EXCL|O_CREAT|O_NONBLOCK|O_WRONLY,
860 fd = open(spooloutfilename,
861 O_EXCL|O_NONBLOCK|O_WRONLY,
867 "failed to open %s for reading due to %s; skipping.\n",
868 spooloutfilename, strerror(errno)
871 network_talking_to(SKEY(NextHop), NTT_REMOVE);
874 dsize = lseek(fd, 0, SEEK_END);
875 fsize = lseek(IOB.fd, 0, SEEK_END);
877 FDIOBufferInit(&FDIO, &IOB, fd, fsize + dsize);
878 FDIO.ChunkSendRemain = fsize;
879 FDIO.TotalSentAlready = dsize;
881 do {} while (FileRecvChunked(&FDIO, &err) > 0);
888 "failed to append to %s [%s]; rolling back..\n",
889 spooloutfilename, strerror(errno)
891 /* whoops partial append?? truncate spooloutfilename again! */
892 ftruncate(fd, dsize);
894 FDIOBufferDelete(&FDIO);
897 network_talking_to(SKEY(NextHop), NTT_REMOVE);
903 FreeStrBuf(&NextHop);
905 "skipping Spoolcleanup because of %d files unprocessed.\n",
912 /* Step 2: delete any files in the outbound queue that were for neighbors who no longer exist */
913 dp = opendir(ctdl_netout_dir);
915 FreeStrBuf(&NextHop);
920 while ((readdir_r(dp, d, &filedir_entry) == 0) &&
921 (filedir_entry != NULL))
923 #ifdef _DIRENT_HAVE_D_NAMELEN
924 d_namelen = filedir_entry->d_namelen;
925 d_type = filedir_entry->d_type;
934 #define IFTODT(mode) (((mode) & 0170000) >> 12)
935 #define DTTOIF(dirtype) ((dirtype) << 12)
937 d_namelen = strlen(filedir_entry->d_name);
939 if ((d_namelen == 1) &&
940 (filedir_entry->d_name[0] == '.'))
943 if ((d_namelen == 2) &&
944 (filedir_entry->d_name[0] == '.') &&
945 (filedir_entry->d_name[1] == '.'))
948 pch = strchr(filedir_entry->d_name, '@');
949 if (pch == NULL) /* no @ in name? consolidated file. */
953 filedir_entry->d_name,
954 pch - filedir_entry->d_name);
960 filedir_entry->d_name
963 i = is_valid_node(&nexthop,
969 if ( (i != 0) || (StrLength(nexthop) > 0) ) {
973 FreeStrBuf(&NextHop);
982 * It's ok if these directories already exist. Just fail silently.
984 void create_spool_dirs(void) {
985 if ((mkdir(ctdl_spool_dir, 0700) != 0) && (errno != EEXIST))
986 syslog(LOG_EMERG, "unable to create directory [%s]: %s", ctdl_spool_dir, strerror(errno));
987 if (chown(ctdl_spool_dir, CTDLUID, (-1)) != 0)
988 syslog(LOG_EMERG, "unable to set the access rights for [%s]: %s", ctdl_spool_dir, strerror(errno));
989 if ((mkdir(ctdl_netin_dir, 0700) != 0) && (errno != EEXIST))
990 syslog(LOG_EMERG, "unable to create directory [%s]: %s", ctdl_netin_dir, strerror(errno));
991 if (chown(ctdl_netin_dir, CTDLUID, (-1)) != 0)
992 syslog(LOG_EMERG, "unable to set the access rights for [%s]: %s", ctdl_netin_dir, strerror(errno));
993 if ((mkdir(ctdl_nettmp_dir, 0700) != 0) && (errno != EEXIST))
994 syslog(LOG_EMERG, "unable to create directory [%s]: %s", ctdl_nettmp_dir, strerror(errno));
995 if (chown(ctdl_nettmp_dir, CTDLUID, (-1)) != 0)
996 syslog(LOG_EMERG, "unable to set the access rights for [%s]: %s", ctdl_nettmp_dir, strerror(errno));
997 if ((mkdir(ctdl_netout_dir, 0700) != 0) && (errno != EEXIST))
998 syslog(LOG_EMERG, "unable to create directory [%s]: %s", ctdl_netout_dir, strerror(errno));
999 if (chown(ctdl_netout_dir, CTDLUID, (-1)) != 0)
1000 syslog(LOG_EMERG, "unable to set the access rights for [%s]: %s", ctdl_netout_dir, strerror(errno));
1004 * Module entry point
1006 CTDL_MODULE_INIT(network_spool)
1010 create_spool_dirs();
1011 //////todo CtdlRegisterCleanupHook(destroy_network_queue_room);
1013 return "network_spool";