From f15df94047f9c4f9a2faddd4700ac24b46afd923 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Tue, 18 May 2010 18:51:49 +0000 Subject: [PATCH] * Documented all of the 'TODO: document me.' commands in file_ops.c * Set up a new directory ./network/spooltmp, this will be part of the solution to allow the processing of network spool files to occur independently of the transfer of network spool files. --- citadel/file_ops.c | 26 +++++++++++++------------- citadel/include/citadel_dirs.h | 1 + citadel/modules/network/serv_network.c | 4 ++++ citadel/utillib/citadel_dirs.c | 4 ++++ 4 files changed, 22 insertions(+), 13 deletions(-) diff --git a/citadel/file_ops.c b/citadel/file_ops.c index 96e00a0fd..0a790832a 100644 --- a/citadel/file_ops.c +++ b/citadel/file_ops.c @@ -761,7 +761,7 @@ void cmd_nuop(char *cmdbuf) snprintf(CC->upl_path, sizeof CC->upl_path, "%s/%s.%04lx.%04x", - ctdl_netin_dir, + ctdl_nettmp_dir, CC->net_node, (long)getpid(), ++seq); @@ -794,18 +794,18 @@ void cmd_nuop(char *cmdbuf) CTDL_MODULE_INIT(file_ops) { if (!threading) { - CtdlRegisterProtoHook(cmd_delf, "DELF", "Autoconverted. TODO: document me."); - CtdlRegisterProtoHook(cmd_movf, "MOVF", "Autoconverted. TODO: document me."); - CtdlRegisterProtoHook(cmd_open, "OPEN", "Autoconverted. TODO: document me."); - CtdlRegisterProtoHook(cmd_clos, "CLOS", "Autoconverted. TODO: document me."); - CtdlRegisterProtoHook(cmd_uopn, "UOPN", "Autoconverted. TODO: document me."); - CtdlRegisterProtoHook(cmd_ucls, "UCLS", "Autoconverted. TODO: document me."); - CtdlRegisterProtoHook(cmd_read, "READ", "Autoconverted. TODO: document me."); - CtdlRegisterProtoHook(cmd_writ, "WRIT", "Autoconverted. TODO: document me."); - CtdlRegisterProtoHook(cmd_oimg, "OIMG", "Autoconverted. TODO: document me."); - CtdlRegisterProtoHook(cmd_ndop, "NDOP", "Autoconverted. TODO: document me."); - CtdlRegisterProtoHook(cmd_nuop, "NUOP", "Autoconverted. TODO: document me."); - CtdlRegisterProtoHook(cmd_uimg, "UIMG", "Autoconverted. TODO: document me."); + CtdlRegisterProtoHook(cmd_delf, "DELF", "Delete a file"); + CtdlRegisterProtoHook(cmd_movf, "MOVF", "Move a file"); + CtdlRegisterProtoHook(cmd_open, "OPEN", "Open a download file transfer"); + CtdlRegisterProtoHook(cmd_clos, "CLOS", "Close a download file transfer"); + CtdlRegisterProtoHook(cmd_uopn, "UOPN", "Open an upload file transfer"); + CtdlRegisterProtoHook(cmd_ucls, "UCLS", "Close an upload file transfer"); + CtdlRegisterProtoHook(cmd_read, "READ", "File transfer read operation"); + CtdlRegisterProtoHook(cmd_writ, "WRIT", "File transfer write operation"); + CtdlRegisterProtoHook(cmd_ndop, "NDOP", "Open a network spool file for download"); + CtdlRegisterProtoHook(cmd_nuop, "NUOP", "Open a network spool file for upload"); + CtdlRegisterProtoHook(cmd_oimg, "OIMG", "Open an image file for download"); + CtdlRegisterProtoHook(cmd_uimg, "UIMG", "Upload an image file"); } /* return our Subversion id for the Log */ return "$Id$"; diff --git a/citadel/include/citadel_dirs.h b/citadel/include/citadel_dirs.h index 1586ba6ec..19856270a 100644 --- a/citadel/include/citadel_dirs.h +++ b/citadel/include/citadel_dirs.h @@ -26,6 +26,7 @@ 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_nettmp_dir[PATH_MAX]; extern char ctdl_netcfg_dir[PATH_MAX]; extern char ctdl_bbsbase_dir[PATH_MAX]; extern char ctdl_sbin_dir[PATH_MAX]; diff --git a/citadel/modules/network/serv_network.c b/citadel/modules/network/serv_network.c index 4a6dac4c5..fa5050660 100644 --- a/citadel/modules/network/serv_network.c +++ b/citadel/modules/network/serv_network.c @@ -2131,6 +2131,10 @@ void create_spool_dirs(void) { CtdlLogPrintf(CTDL_EMERG, "unable to create directory [%s]: %s", ctdl_netin_dir, strerror(errno)); if (chown(ctdl_netin_dir, CTDLUID, (-1)) != 0) CtdlLogPrintf(CTDL_EMERG, "unable to set the access rights for [%s]: %s", ctdl_netin_dir, strerror(errno)); + if ((mkdir(ctdl_nettmp_dir, 0700) != 0) && (errno != EEXIST)) + CtdlLogPrintf(CTDL_EMERG, "unable to create directory [%s]: %s", ctdl_nettmp_dir, strerror(errno)); + if (chown(ctdl_nettmp_dir, CTDLUID, (-1)) != 0) + CtdlLogPrintf(CTDL_EMERG, "unable to set the access rights for [%s]: %s", ctdl_nettmp_dir, strerror(errno)); if ((mkdir(ctdl_netout_dir, 0700) != 0) && (errno != EEXIST)) CtdlLogPrintf(CTDL_EMERG, "unable to create directory [%s]: %s", ctdl_netout_dir, strerror(errno)); if (chown(ctdl_netout_dir, CTDLUID, (-1)) != 0) diff --git a/citadel/utillib/citadel_dirs.c b/citadel/utillib/citadel_dirs.c index 9bc46c8e9..1aecdcded 100644 --- a/citadel/utillib/citadel_dirs.c +++ b/citadel/utillib/citadel_dirs.c @@ -64,6 +64,7 @@ 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_nettmp_dir[PATH_MAX]="network/spooltmp"; char ctdl_netcfg_dir[PATH_MAX]="netconfigs"; char ctdl_utilbin_dir[PATH_MAX]=""; char ctdl_sbin_dir[PATH_MAX]=""; @@ -212,10 +213,12 @@ void calc_dirs_n_files(int relh, int home, const char *relhome, char *ctdldir, COMPUTE_DIRECTORY(ctdl_spool_dir); COMPUTE_DIRECTORY(ctdl_netout_dir); COMPUTE_DIRECTORY(ctdl_netin_dir); + COMPUTE_DIRECTORY(ctdl_nettmp_dir); StripSlashes(ctdl_spool_dir, 1); StripSlashes(ctdl_netout_dir, 1); StripSlashes(ctdl_netin_dir, 1); + StripSlashes(ctdl_nettmp_dir, 1); /* ok, now we know the dirs, calc some commonly used files */ @@ -341,6 +344,7 @@ void calc_dirs_n_files(int relh, int home, const char *relhome, char *ctdldir, DBG_PRINT(ctdl_spool_dir); DBG_PRINT(ctdl_netout_dir); DBG_PRINT(ctdl_netin_dir); + DBG_PRINT(ctdl_nettmp_dir); DBG_PRINT(ctdl_netcfg_dir); DBG_PRINT(ctdl_bbsbase_dir); DBG_PRINT(ctdl_sbin_dir); -- 2.30.2