UTILBIN_TARGETS= base64$(EXEEXT) setup$(EXEEXT) \
chkpw$(EXEEXT) chkpwd$(EXEEXT) \
- aidepost$(EXEEXT) msgform$(EXEEXT) \
+ msgform$(EXEEXT) \
ctdlmigrate$(EXEEXT)
.SILENT:
-SOURCES=utils/aidepost.c utils/citmail.c \
+SOURCES=utils/citmail.c \
utils/setup.c utils/msgform.c utils/chkpw.c \
utils/sendcommand.c \
utils/ctdlmigrate.c utils/base64.c utils/chkpwd.c \
echo "CC $<"
$(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) -c $< -o $@
-aidepost$(EXEEXT): utils/aidepost.o utillib/citadel_dirs.o
- $(CC) utils/aidepost.o utillib/citadel_dirs.o \
- $(LDFLAGS) -o aidepost$(EXEEXT) $(LIBS)
-
citmail$(EXEEXT): utils/citmail.o utillib/citadel_dirs.o
$(CC) utils/citmail.o utillib/citadel_dirs.o \
$(LDFLAGS) -o citmail$(EXEEXT) $(LIBS)
extern char ctdl_run_dir[PATH_MAX];
extern char ctdl_spool_dir[PATH_MAX];
extern char ctdl_netout_dir[PATH_MAX];
-extern char ctdl_netin_dir[PATH_MAX];
extern char ctdl_netdigest_dir[PATH_MAX];
extern char ctdl_nettmp_dir[PATH_MAX];
extern char ctdl_netcfg_dir[PATH_MAX];
/*
* Server functions which handle file transfers and room directories.
*
- * Copyright (c) 1987-2017 by the citadel.org team
+ * Copyright (c) 1987-2018 by the citadel.org team
*
* This program is open source software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3.
fclose(CC->upload_fp);
CCC->upload_fp = NULL;
- if ((!strcasecmp(cmd, "1")) && (CCC->upload_type != UPL_FILE)) {
- cprintf("%d Upload completed.\n", CIT_OK);
-
- if (CCC->upload_type == UPL_NET) {
- char final_filename[PATH_MAX];
- snprintf(final_filename, sizeof final_filename, "%s/%s.%04lx.%04x", ctdl_netin_dir, CCC->net_node, (long)getpid(), ++seq);
-
- if (link(CCC->upl_path, final_filename) == 0) {
- syslog(LOG_INFO, "serv_file: ucls updoaded %s", final_filename);
- unlink(CCC->upl_path);
- }
- else {
- syslog(LOG_INFO, "serv_file: cannot link %s to %s: %s",
- CCC->upl_path, final_filename, strerror(errno)
- );
- }
- }
-
- CCC->upload_type = UPL_FILE;
- return;
- }
-
if (!strcasecmp(cmd, "1")) {
cprintf("%d File '%s' saved.\n", CIT_OK, CCC->upl_path);
fp = fopen(CCC->upl_filedir, "a");
syslog(LOG_EMERG, "netspool: unable to create directory [%s]: %s", ctdl_spool_dir, strerror(errno));
if (chown(ctdl_spool_dir, CTDLUID, (-1)) != 0)
syslog(LOG_EMERG, "netspool: unable to set the access rights for [%s]: %s", ctdl_spool_dir, strerror(errno));
- if ((mkdir(ctdl_netin_dir, 0700) != 0) && (errno != EEXIST))
- syslog(LOG_EMERG, "netspool: unable to create directory [%s]: %s", ctdl_netin_dir, strerror(errno));
- if (chown(ctdl_netin_dir, CTDLUID, (-1)) != 0)
- syslog(LOG_EMERG, "netspool: unable to set the access rights for [%s]: %s", ctdl_netin_dir, strerror(errno));
if ((mkdir(ctdl_nettmp_dir, 0700) != 0) && (errno != EEXIST))
syslog(LOG_EMERG, "netspool: unable to create directory [%s]: %s", ctdl_nettmp_dir, strerror(errno));
if (chown(ctdl_nettmp_dir, CTDLUID, (-1)) != 0)
}
-int ignet_aftersave(struct CtdlMessage *msg, recptypes *recps)
-{
- /* For IGnet mail, we have to save a new copy into the spooler for
- * each recipient, with the R and D fields set to the recipient and
- * destination-node. This has two ugly side effects: all other
- * recipients end up being unlisted in this recipient's copy of the
- * message, and it has to deliver multiple messages to the same
- * node. We'll revisit this again in a year or so when everyone has
- * a network spool receiver that can handle the new style messages.
- */
- if ((recps != NULL) && (recps->num_ignet > 0))
- {
- char *recipient;
- int rv = 0;
- struct ser_ret smr;
- FILE *network_fp = NULL;
- char submit_filename[128];
- static int seqnum = 1;
- int i;
- char *hold_R, *hold_D, *RBuf, *DBuf;
- long hrlen, hdlen, rblen, dblen, count, rlen;
- CitContext *CCC = MyContext();
-
- CM_GetAsField(msg, eRecipient, &hold_R, &hrlen);;
- CM_GetAsField(msg, eDestination, &hold_D, &hdlen);;
-
- count = num_tokens(recps->recp_ignet, '|');
- rlen = strlen(recps->recp_ignet);
- recipient = malloc(rlen + 1);
- RBuf = malloc(rlen + 1);
- DBuf = malloc(rlen + 1);
- for (i=0; i<count; ++i) {
- extract_token(recipient, recps->recp_ignet, i, '|', rlen + 1);
-
- rblen = extract_token(RBuf, recipient, 0, '@', rlen + 1);
- dblen = extract_token(DBuf, recipient, 1, '@', rlen + 1);
-
- CM_SetAsField(msg, eRecipient, &RBuf, rblen);;
- CM_SetAsField(msg, eDestination, &DBuf, dblen);;
- CtdlSerializeMessage(&smr, msg);
- if (smr.len > 0) {
- snprintf(submit_filename, sizeof submit_filename,
- "%s/netmail.%04lx.%04x.%04x",
- ctdl_netin_dir,
- (long) getpid(),
- CCC->cs_pid,
- ++seqnum);
-
- network_fp = fopen(submit_filename, "wb+");
- if (network_fp != NULL) {
- rv = fwrite(smr.ser, smr.len, 1, network_fp);
- if (rv == -1) {
- syslog(LOG_EMERG, "network: CtdlSubmitMsg() Couldn't write network spool file: %s", strerror(errno));
- }
- fclose(network_fp);
- }
- free(smr.ser);
- }
- CM_GetAsField(msg, eRecipient, &RBuf, &rblen);;
- CM_GetAsField(msg, eDestination, &DBuf, &dblen);;
- }
- free(RBuf);
- free(DBuf);
- free(recipient);
- CM_SetAsField(msg, eRecipient, &hold_R, hrlen);
- CM_SetAsField(msg, eDestination, &hold_D, hdlen);
- return 1;
- }
- return 0;
-}
-
-
/*
* Module entry point
*/
{
if (!threading)
{
- CtdlRegisterMessageHook(ignet_aftersave, EVT_AFTERSAVE);
CtdlFillSystemContext(&networker_spool_CC, "CitNetSpool");
CtdlRegisterSessionHook(network_cleanup_function, EVT_STOP, PRIO_STOP + 30);
CtdlRegisterSessionHook(network_logout_hook, EVT_LOGOUT, PRIO_LOGOUT + 10);
/*
* citadel_dirs.c : calculate pathnames for various files used in the Citadel system
*
- * Copyright (c) 1987-2017 by the citadel.org team
+ * Copyright (c) 1987-2018 by the citadel.org team
*
* This program is open source software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3.
char ctdl_run_dir[PATH_MAX]="";
char ctdl_spool_dir[PATH_MAX]="network";
char ctdl_netout_dir[PATH_MAX]="network/spoolout";
-char ctdl_netin_dir[PATH_MAX]="network/spoolin";
char ctdl_netdigest_dir[PATH_MAX]="network/digest";
char ctdl_nettmp_dir[PATH_MAX]="network/spooltmp";
char ctdl_netcfg_dir[PATH_MAX]="netconfigs";
#endif
COMPUTE_DIRECTORY(ctdl_spool_dir);
COMPUTE_DIRECTORY(ctdl_netout_dir);
- COMPUTE_DIRECTORY(ctdl_netin_dir);
COMPUTE_DIRECTORY(ctdl_netdigest_dir);
COMPUTE_DIRECTORY(ctdl_nettmp_dir);
StripSlashes(ctdl_spool_dir, 1);
StripSlashes(ctdl_netout_dir, 1);
- StripSlashes(ctdl_netin_dir, 1);
StripSlashes(ctdl_netdigest_dir, 1);
StripSlashes(ctdl_nettmp_dir, 1);
DBG_PRINT(ctdl_run_dir);
DBG_PRINT(ctdl_spool_dir);
DBG_PRINT(ctdl_netout_dir);
- DBG_PRINT(ctdl_netin_dir);
DBG_PRINT(ctdl_netdigest_dir);
DBG_PRINT(ctdl_nettmp_dir);
DBG_PRINT(ctdl_netcfg_dir);
rv += create_dir(ctdl_file_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1);
rv += create_dir(ctdl_spool_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1);
rv += create_dir(ctdl_netout_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1);
- rv += create_dir(ctdl_netin_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1);
rv += create_dir(ctdl_netdigest_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1);
rv += create_dir(ctdl_nettmp_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1);
rv += create_dir(ctdl_key_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1);
+++ /dev/null
-/*
- * This is just a little hack to copy standard input to a message in Aide>
- *
- * Copyright (c) 1987-2012 by the citadel.org team
- *
- * This program is open source software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 3.
- *
- * 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.
- */
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <limits.h>
-#include <errno.h>
-#include <string.h>
-#include <time.h>
-#include "citadel.h"
-#include "citadel_dirs.h"
-
-/*
- * Simplified function to generate a message in our format
- */
-static void ap_make_message(FILE *fp, char *target_room, char *author, char *subject)
-{
- int a;
- long bb, cc;
- time_t now;
- time(&now);
- putc(255, fp);
- putc(MES_NORMAL, fp);
- putc(1, fp);
- fprintf(fp, "Proom_aide");
- putc(0, fp);
- fprintf(fp, "T%ld", (long)now);
- putc(0, fp);
- fprintf(fp, "A%s", author);
- putc(0, fp);
- fprintf(fp, "O%s", target_room);
- putc(0, fp);
- if (strlen(subject) > 0) {
- fprintf(fp, "U%s%c", subject, 0);
- }
- putc('M', fp);
- bb = ftell(fp);
- while (a = getc(stdin), a > 0) {
- if (a != 8)
- putc(a, fp);
- else {
- cc = ftell(fp);
- if (cc != bb)
- fseek(fp, (-1L), 1);
- }
- }
- putc(0, fp);
- putc(0, fp);
- putc(0, fp);
-}
-
-
-int main(int argc, char **argv)
-{
- char tempspool[64];
- char target_room[ROOMNAMELEN];
- char author[64];
- char subject[256];
- FILE *tempfp, *spoolfp;
- int ch;
- int i;
- int relh=0;
- int home=0;
- char relhome[PATH_MAX]="";
- char ctdldir[PATH_MAX]=CTDLDIR;
-
- calc_dirs_n_files(relh, home, relhome, ctdldir, 0);
-
- strcpy(target_room, "Aide");
- strcpy(author, "Citadel");
- strcpy(subject, "");
- for (i=1; i<argc; ++i) {
- if (!strncasecmp(argv[i], "-r", 2)) {
- strncpy(target_room, &argv[i][2], sizeof(target_room));
- target_room[sizeof(target_room)-1] = 0;
- }
- else if (!strncasecmp(argv[i], "-a", 2)) {
- strncpy(author, &argv[i][2], sizeof(author));
- author[sizeof(author)-1] = 0;
- }
- else if (!strncasecmp(argv[i], "-s", 2)) {
- strncpy(subject, &argv[i][2], sizeof(subject));
- subject[sizeof(subject)-1] = 0;
- } else {
- fprintf(stderr, "%s: usage: %s "
- "[-rTargetRoom] [-aAuthor] [-sSubject]\n",
- argv[0], argv[0]);
- exit(1);
- }
- }
-
- snprintf(tempspool, sizeof tempspool, "%s/ap.%04x.%08lx", ctdl_netin_dir, getpid(), time(NULL));
- unlink(tempspool); /* unlinking it for now, keeps it from being posted prematurely */
-
- tempfp = fopen(tempspool, "w+b");
- unlink(tempspool);
- if (tempfp == NULL) {
- perror("cannot open temp file");
- exit(errno);
- }
-
- /* Generate a message from stdin */
- ap_make_message(tempfp, target_room, author, subject);
-
- /* Copy it to a new temp file in the spool directory */
- rewind(tempfp);
-
- spoolfp = fopen(tempspool, "wb");
- if (spoolfp == NULL) {
- perror("cannot open spool file");
- exit(errno);
- }
- while (ch = getc(tempfp), (ch >= 0)) {
- putc(ch, spoolfp);
- }
-
- fclose(tempfp);
- return(fclose(spoolfp));
-}