/*****************************************************************************/
/*
Upd.c
This module implements a full multi-threaded, AST-driven, asynchronous file
and directory update facility.
It provides for directory navigation, allowing subdirectories to be created,
moved to, listed and deleted. Files within directories may be selected for
viewing, update, copying and deletion. The module honours the directory
access controls implemented by the directory module (e.g. ".WWW_HIDDEN",
etc., see Dir.c).
It allows the creation or update of "text/*" files via an editing page. The
tag widget is used as the edit window.
The file editing page also has custom functionality for providing for the
partial administration of HTTPd server configuration files.
This module behaves as if it was an external script :^). This allows the
generic script processing functionality of the the request module to provide
all necessary parsing of the script and file components of the path, as well
as the all-important authorization checking of these. The script component
of the path is detected before an external script is launched, and the request
redirected to this module. This has certain efficiencies as well as allowing
a "generic" module to provide some of the functionality for server
configuration. This module does its own query string parsing.
An essential component of this modules functionality is the ability to
generate a redirection. This allows the parent directory and name to be
reconstructed as a path and then processed as if a new request. Although
resulting in a higher overhead this considerably simplifies the handling of
these requests.
VERSION HISTORY
---------------
12-SEP-2022 MGD move onclick=s to addEventListener()s to support
content-security-policy: 'strict-dynamic'
14-SEP-2019 MGD bugfix; UpdEnd() call HTAdminEnd() (e.g. $HTL)
12-NOV-2017 MGD bugfix; (long-standing) always use UpdEnd() not SysDclAst()
28-SEP-2013 MGD some refinements to Upd..() layout and functionality
03-AUG-2013 MGD bugfix; UpdFileRename() ACCVIO with AuthAccessEnable()
10-MAR-2010 JPP bugfix; UpdBegin() [goto] processing
23-AUG-2009 MGD WasdCss[] and some refinements
11-AUG-2007 MGD AuthAccessEnable() to control access
refine edit with a little JavaScript
26-AUG-2003 MGD rework access to server configuration files
15-AUG-2003 MGD where CDATA constraints make using
entity impossible
use a field name of hidden$lf and ^ substituted for it
08-MAR-2003 MGD set html= directory listing header and footer,
there are now three directory listing styles implementing
set dir=style[=default|wasd1|wasd2|abi]
15-OCT-2002 MGD demo mode ignores .WWW_HIDDEN, etc.
05-OCT-2002 MGD refine VMS security profile usage
24-SEP-2002 MGD add AuthAccessReadCheck() to special-case file
parse/open() in UpdEditFileBegin()
23-AUG-2002 MGD supply fab$b_rfm and fab$b_rat as file copy fields to allow
PUT.C to set these attributes identically to the original,
modify formatting for SRI and PWK ODS encodings,
bugfix; change protection for directories,
bugfix; enable SYSPRV to rename (ACP remove) file,
bugfix; enable SYSPRV to change protection (ACP modify) file
27-APR-2002 MGD make SYSPRV enabled ASTs asynchronous
02-FEB-2002 MGD rework file processing due to request body processing changes
03-JAN-2002 MGD bugfix; server admin revise
04-AUG-2001 MGD support module WATCHing
15-FEB-2001 MGD refine 'view' and 'list' redirection
22-DEC-2000 MGD allow navigation on wildcard file specification,
provide special case edit (only) HTL list and
CA verification files
29-JUN-2000 MGD bugfix; ODS-5 file rename
18-JUN-2000 MGD support site log update
04-MAR-2000 MGD support ODS-2 and ODS-5 using ODS module,
substantial rework of entire module,
remove browser check for file upload (many now support)
10-OCT-1999 MGD change AuthCheckVmsUserAccess() always supply 'rqptr'
04-APR-1999 MGD bugfix; rule check still included (woops, obsoleted in v5.3)
07-NOV-1998 MGD WATCH facility
12-MAR-1998 MGD add file protection selector
24-FEB-1998 MGD request scheme ("http:" or "https:") for hard-wired "http:"
18-OCT-1997 MGD facility to wildcard file deletes
17-AUG-1997 MGD message database,
internationalized file date/times,
SYSUAF-authenticated users security-profile
07-JUL-1997 MGD apparently MSIE 3.0ff allows file upload
30-JUN-1997 MGD bugfix; rename failed without SYSPRV (wonders will never)
12-APR-1997 MGD extended tree facility to providing general directory tree
25-MAR-1997 MGD added tree and filter capabilities
01-FEB-1997 MGD new for HTTPd version 4 (adapted from the UPD script)
*/
/*****************************************************************************/
#ifdef WASD_VMS_V7
#undef _VMS__V6__SOURCE
#define _VMS__V6__SOURCE
#undef __VMS_VER
#define __VMS_VER 70000000
#undef __CRTL_VER
#define __CRTL_VER 70000000
#endif
/* standard C header files */
#include
#include
#include
#include
#include
/* VMS related header files */
#include
#include
#include
#include
#include
#include
#include
/* application related header */
#include "wasd.h"
#define WASD_MODULE "UPD"
/****************/
/* global stuff */
/****************/
/* number of rows in directory and file lists */
#define NAVIGATE_SIZE 15
#define REFRESH_SYMBOL "⟳";
/* this could be relocated without change by using a mapping rule */
#define UPD_HELP_PATH "/httpd/-/UpdHelp.html"
/*
The preview note is introduced at the start of a file being previewed.
See PUT.C module for how it is further processed.
Experimentation (Navigator 3 and MSIE 3) has shown it can contain text
but no page or line layup tags (e.g. ).
Here is a choice between an animated GIF and text.
*/
#define UPD_PREVIEW_NOTE_PLAIN "***** PREVIEW *****^^"
#ifndef UPD_PREVIEW_TEXT
#define UPD_PREVIEW_NOTE_HTML \
"<IMG SRC="/httpd/-/UpdPreview.gif" \
ALT="-PREVIEW- "><BR>"
#define UPD_PREVIEW_NOTE_HTML_NEWLINE "^"
#define UPD_PREVIEW_NOTE_MENU_NEWLINE "<BR>"
#else
#define UPD_PREVIEW_NOTE_HTML \
"<FONT size=\"1\" COLOR="#ff0000">\
<SUP><BLINK><B>-PREVIEW-</B></BLINK></SUP>\
</FONT> "
#define UPD_PREVIEW_NOTE_HTML_NEWLINE "^"
#define UPD_PREVIEW_NOTE_MENU_NEWLINE "<BR>"
#endif /* UPD_PREVIEW_TEXT */
char UpdProtectionListFao [] =
"!AZ name=\"protection\">\n\