aboutsummaryrefslogtreecommitdiffstats
path: root/WWW/Library/Implementation
diff options
context:
space:
mode:
Diffstat (limited to 'WWW/Library/Implementation')
-rw-r--r--WWW/Library/Implementation/CommonMakefile91
-rw-r--r--WWW/Library/Implementation/HTAAFile.c203
-rw-r--r--WWW/Library/Implementation/HTAAFile.h116
-rw-r--r--WWW/Library/Implementation/HTAAProt.c5
-rw-r--r--WWW/Library/Implementation/HTAAServ.c646
-rw-r--r--WWW/Library/Implementation/HTAAServ.h137
-rw-r--r--WWW/Library/Implementation/HTAAUtil.c30
-rw-r--r--WWW/Library/Implementation/HTACL.c210
-rw-r--r--WWW/Library/Implementation/HTACL.h100
-rw-r--r--WWW/Library/Implementation/HTAccess.c28
-rw-r--r--WWW/Library/Implementation/HTAnchor.c4
-rw-r--r--WWW/Library/Implementation/HTAnchor.h19
-rw-r--r--WWW/Library/Implementation/HTAtom.c4
-rw-r--r--WWW/Library/Implementation/HTAuth.c206
-rw-r--r--WWW/Library/Implementation/HTAuth.h58
-rw-r--r--WWW/Library/Implementation/HTFTP.c90
-rw-r--r--WWW/Library/Implementation/HTFile.c40
-rw-r--r--WWW/Library/Implementation/HTFormat.c4
-rw-r--r--WWW/Library/Implementation/HTGopher.c61
-rw-r--r--WWW/Library/Implementation/HTHistory.c156
-rw-r--r--WWW/Library/Implementation/HTHistory.h100
-rw-r--r--WWW/Library/Implementation/HTMIME.c14
-rw-r--r--WWW/Library/Implementation/HTNews.c2
-rw-r--r--WWW/Library/Implementation/HTParse.c4
-rw-r--r--WWW/Library/Implementation/HTPasswd.c295
-rw-r--r--WWW/Library/Implementation/HTPasswd.h119
-rw-r--r--WWW/Library/Implementation/HTRules.c3
-rw-r--r--WWW/Library/Implementation/HTTCP.c11
-rw-r--r--WWW/Library/Implementation/HTTP.c14
-rw-r--r--WWW/Library/Implementation/HTTelnet.c6
-rw-r--r--WWW/Library/Implementation/HTUtils.h1
-rw-r--r--WWW/Library/Implementation/LYexit.h5
-rw-r--r--WWW/Library/Implementation/SGML.c62
33 files changed, 278 insertions, 2566 deletions
diff --git a/WWW/Library/Implementation/CommonMakefile b/WWW/Library/Implementation/CommonMakefile
index af0d200c..c176beda 100644
--- a/WWW/Library/Implementation/CommonMakefile
+++ b/WWW/Library/Implementation/CommonMakefile
@@ -12,7 +12,7 @@
# make uninstall Unlink installed version from the system
# make clean Remove intermediate files
# make cleanall Remove intremediate files and products
-#
+#
# Macros required to be defined already for make:
#
# CC The C compiler
@@ -20,7 +20,7 @@
# LFLAGS Flags for ld
# LYFLAGS Flags for Lynx
#
-# WWW The WWW source tree directory
+# WWW The WWW source tree directory
#
# Macros needed for make install:
#
@@ -60,15 +60,15 @@ LOB = $(WTMP)/Library/$(WWW_MACH)
#HTWAIS_o = $(LOB)/HTWAIS.o
#WAIS = YES
#WAISINC = -I../../../../freeWAIS-0.202/ir
-#WAISCFLAGS = -DDIRECT_WAIS
+#WAISCFLAGS = -DDIRECT_WAIS
#
# XMOsAIC hack is only for server to cope with xmosaic kludge for mmedia
#
# add -DNEW_GATEWAY here for the new gateway config stuff
-CFLAGS2 = $(CFLAGS) $(LYFLAGS) $(WAISCFLAGS) -I$(CMN) -DXMOSAIC_HACK -DACCESS_AUTH
+CFLAGS2 = $(CFLAGS) $(LYFLAGS) $(WAISCFLAGS) -I$(CMN) -DXMOSAIC_HACK -DACCESS_AUTH
-COMPILE = $(ECHO) $(CC) $(CFLAGS2) -c
+COMPILE = $(ECHO) $(CC) $(CFLAGS2) -c
CERNLIBBIN = $(WWW)/bin
@@ -80,48 +80,48 @@ COMMON = $(LOB)/HTParse.o $(LOB)/HTAccess.o $(LOB)/HTTP.o \
$(LOB)/HTAtom.o $(LOB)/HTAnchor.o $(LOB)/HTStyle.o \
$(LOB)/HTList.o $(LOB)/HTString.o \
$(LOB)/HTRules.o $(LOB)/HTFormat.o $(LOB)/HTMIME.o \
- $(LOB)/HTHistory.o $(LOB)/HTNews.o $(LOB)/HTGopher.o \
+ $(LOB)/HTNews.o $(LOB)/HTGopher.o \
$(LOB)/HTTelnet.o $(LOB)/HTFinger.o $(LOB)/HTWSRC.o $(HTWAIS_o) \
- $(LOB)/HTAAUtil.o $(LOB)/HTAAServ.o $(LOB)/HTAABrow.o \
- $(LOB)/HTAAFile.o $(LOB)/HTPasswd.o $(LOB)/HTGroup.o \
- $(LOB)/HTACL.o $(LOB)/HTAuth.o $(LOB)/HTAAProt.o \
+ $(LOB)/HTAAUtil.o $(LOB)/HTAABrow.o \
+ $(LOB)/HTGroup.o \
+ $(LOB)/HTAAProt.o \
$(LOB)/HTAssoc.o $(LOB)/HTLex.o $(LOB)/HTUU.o \
$(LOB)/HTDOS.o
CFILES = $(CMN)HTParse.c $(CMN)HTAccess.c $(CMN)HTTP.c $(CMN)HTFile.c \
- $(CMN)HTBTree.c \
- $(CMN)HTFTP.c $(CMN)HTTCP.c $(CMN)SGML.c \
+ $(CMN)HTBTree.c \
+ $(CMN)HTFTP.c $(CMN)HTTCP.c $(CMN)SGML.c \
$(CMN)HTMLDTD.c \
$(CMN)HTPlain.c $(CMN)HTWriter.c \
- $(CMN)HTMLGen.c \
- $(CMN)HTChunk.c $(CMN)HTAtom.c $(CMN)HTAnchor.c $(CMN)HTStyle.c \
- $(CMN)HTList.c $(CMN)HTString.c $(CMN)HTRules.c \
- $(CMN)HTFormat.c $(CMN)HTMIME.c $(CMN)HTHistory.c \
- $(CMN)HTNews.c $(CMN)HTGopher.c $(CMN)HTTelnet.c \
- $(CMN)HTFinger.c $(HTWAIS_c) $(CMN)HTWSRC.c \
- $(CMN)HTAAUtil.c $(CMN)HTAAServ.c $(CMN)HTAABrow.c \
- $(CMN)HTAAFile.c $(CMN)HTPasswd.c $(CMN)HTGroup.c \
- $(CMN)HTACL.c $(CMN)HTAuth.c $(CMN)HTAAProt.c \
+ $(CMN)HTMLGen.c \
+ $(CMN)HTChunk.c $(CMN)HTAtom.c $(CMN)HTAnchor.c $(CMN)HTStyle.c \
+ $(CMN)HTList.c $(CMN)HTString.c $(CMN)HTRules.c \
+ $(CMN)HTFormat.c $(CMN)HTMIME.c \
+ $(CMN)HTNews.c $(CMN)HTGopher.c $(CMN)HTTelnet.c \
+ $(CMN)HTFinger.c $(HTWAIS_c) $(CMN)HTWSRC.c \
+ $(CMN)HTAABrow.c \
+ $(CMN)HTGroup.c \
+ $(CMN)HTAAProt.c \
$(CMN)HTAssoc.c $(CMN)HTLex.c $(CMN)HTUU.c
HFILES = $(CMN)HTParse.h $(CMN)HTAccess.h $(CMN)HTTP.h $(CMN)HTFile.h \
$(CMN)HTBTree.h $(CMN)HTFTP.h $(CMN)HTTCP.h \
$(CMN)SGML.h $(CMN)HTML.h $(CMN)HTMLDTD.h $(CMN)HTChunk.h \
$(CMN)HTPlain.h $(CMN)HTWriter.h \
- $(CMN)HTFWriter.h $(CMN)HTMLGen.h \
+ $(CMN)HTFWriter.h $(CMN)HTMLGen.h \
$(CMN)HTStream.h \
$(CMN)HTAtom.h $(CMN)HTAnchor.h $(CMN)HTStyle.h \
$(CMN)HTList.h \
$(CMN)HTString.h $(CMN)HTRules.h \
$(CMN)HTFormat.h $(CMN)HTInit.h \
- $(CMN)HTMIME.h $(CMN)HTHistory.h $(CMN)HTNews.h \
+ $(CMN)HTMIME.h $(CMN)HTNews.h \
$(CMN)HTGopher.h \
$(CMN)HTUtils.h $(CMN)tcp.h $(CMN)HText.h \
$(CMN)HTTelnet.h $(CMN)HTFinger.h \
$(CMN)HTWAIS.h $(CMN)HTWSRC.h \
- $(CMN)HTAAUtil.h $(CMN)HTAAServ.h $(CMN)HTAABrow.h \
- $(CMN)HTAAFile.h $(CMN)HTPasswd.h $(CMN)HTGroup.h \
- $(CMN)HTACL.h $(CMN)HTAuth.h $(CMN)HTAAProt.h \
+ $(CMN)HTAABrow.h \
+ $(CMN)HTGroup.h \
+ $(CMN)HTAAProt.h \
$(CMN)HTAssoc.h $(CMN)HTLex.h $(CMN)HTUU.h
SOURCES = $(CFILES) $(HFILES) $(CMN)Version.make \
@@ -159,7 +159,7 @@ cleanall : clean
install : libwww.a
if [ ! -r $(LIBDIR) ] mkdir $(LIBDIR)
cp libwww.a $(LIBDIR)/libwww.a
-
+
uninstall :
rm $(LIBDIR)/libwww.a
@@ -209,7 +209,7 @@ $(WWW)/Copyright.txt : $(WWW)/../Copyright.html
/pub/www/Copyright.txt : $(WWW)/Copyright.txt
cp $(WWW)/Copyright.txt /pub/www/Copyright.txt
-# Common code
+# Common code
# -----------
# Directory for object files - .created checks it exists
@@ -234,9 +234,6 @@ $(LOB)/HTFormat.o : $(OE) $(CMN)HTFormat.c $(CMN)HTUtils.h $(CMN)HTList.h
$(LOB)/HTMIME.o : $(OE) $(CMN)HTMIME.c $(CMN)HTUtils.h $(CMN)HTList.h
$(COMPILE) $(CMN)HTMIME.c
-$(LOB)/HTHistory.o : $(OE) $(CMN)HTHistory.c $(CMN)HTUtils.h $(CMN)HTList.h
- $(COMPILE) $(CMN)HTHistory.c
-
$(LOB)/HTNews.o : $(OE) $(CMN)HTNews.c $(CMN)HTUtils.h $(CMN)HTList.h\
$(CMN)HTMLDTD.h
$(COMPILE) $(CMN)HTNews.c
@@ -265,7 +262,7 @@ $(LOB)/HTString.o : $(OE) $(CMN)HTString.c $(CMN)HTUtils.h $(CMN)Version.make
$(COMPILE) -DVC=\"$(VC)\" $(CMN)HTString.c
$(LOB)/HTRules.o : $(OE) $(CMN)HTRules.c $(CMN)HTUtils.h $(CMN)Version.make \
- $(CMN)HTAAServ.h $(CMN)HTAAProt.h
+ $(CMN)HTAAProt.h
$(COMPILE) -DVC=\"$(VC)\" $(CMN)HTRules.c
$(LOB)/SGML.o : $(OE) $(CMN)SGML.c $(CMN)HTUtils.h $(CMN)UCAux.h
@@ -297,37 +294,11 @@ $(LOB)/HTAAUtil.o : $(OE) $(CMN)HTAAUtil.c $(CMN)HTAAUtil.h \
$(CMN)HTUtils.h $(CMN)HTString.h
$(COMPILE) $(CMN)HTAAUtil.c
-$(LOB)/HTAAFile.o : $(OE) $(CMN)HTAAFile.c $(CMN)HTAAFile.h \
- $(CMN)HTAAUtil.h $(CMN)HTUtils.h $(CMN)HTList.h
- $(COMPILE) $(CMN)HTAAFile.c
-
-$(LOB)/HTPasswd.o : $(OE) $(CMN)HTPasswd.c $(CMN)HTPasswd.h \
- $(CMN)HTAAUtil.h $(CMN)HTAAFile.h
- $(COMPILE) $(CMN)HTPasswd.c
-
$(LOB)/HTGroup.o : $(OE) $(CMN)HTGroup.c $(CMN)HTGroup.h \
- $(CMN)HTAAUtil.h $(CMN)HTAAFile.h \
+ $(CMN)HTAAUtil.h \
$(CMN)HTAssoc.h $(CMN)HTLex.h
$(COMPILE) $(CMN)HTGroup.c
-$(LOB)/HTACL.o : $(OE) $(CMN)HTACL.c $(CMN)HTACL.h \
- $(CMN)HTAAUtil.h $(CMN)HTAAFile.h $(CMN)HTGroup.h \
- $(CMN)HTAssoc.h
- $(COMPILE) $(CMN)HTACL.c
-
-$(LOB)/HTAuth.o : $(OE) $(CMN)HTAuth.c $(CMN)HTAuth.h \
- $(CMN)HTAAUtil.h $(CMN)HTPasswd.h $(CMN)HTAAFile.h \
- $(CMN)HTAssoc.h
- $(COMPILE) $(CMN)HTAuth.c
-
-$(LOB)/HTAAServ.o : $(OE) $(CMN)HTAAServ.c $(CMN)HTAAServ.h \
- $(CMN)HTAAUtil.h $(CMN)HTAAFile.h $(CMN)HTPasswd.h \
- $(CMN)HTGroup.h $(CMN)HTACL.h $(CMN)HTAuth.h \
- $(CMN)HTUU.h $(CMN)HTParse.h $(CMN)HTList.h \
- $(CMN)HTUtils.h $(CMN)HTString.h $(CMN)HTRules.h \
- $(CMN)HTAAProt.h $(CMN)HTAssoc.h $(CMN)HTLex.h
- $(COMPILE) $(CMN)HTAAServ.c
-
$(LOB)/HTAABrow.o : $(OE) $(CMN)HTAABrow.c $(CMN)HTAABrow.h \
$(CMN)HTAAUtil.h $(CMN)HTUU.h \
$(CMN)HTUtils.h $(CMN)HTString.h \
@@ -336,7 +307,7 @@ $(LOB)/HTAABrow.o : $(OE) $(CMN)HTAABrow.c $(CMN)HTAABrow.h \
$(COMPILE) $(CMN)HTAABrow.c
$(LOB)/HTAAProt.o : $(OE) $(CMN)HTAAProt.c $(CMN)HTAAProt.h \
- $(CMN)HTUtils.h $(CMN)HTAAUtil.h $(CMN)HTAAFile.h \
+ $(CMN)HTUtils.h $(CMN)HTAAUtil.h \
$(CMN)HTAssoc.h $(CMN)HTLex.h
$(COMPILE) $(CMN)HTAAProt.c
@@ -360,7 +331,7 @@ $(LOB)/HTTCP.o : $(OE) $(CMN)HTTCP.c $(CMN)HTUtils.h
$(COMPILE) $(CMN)HTTCP.c
$(LOB)/HTFile.o : $(OE) $(CMN)HTFile.c $(CMN)HTUtils.h \
- $(CMN)HTMLDTD.h $(CMN)HTAAServ.h
+ $(CMN)HTMLDTD.h
$(COMPILE) $(CMN)HTFile.c
$(LOB)/HTBTree.o : $(OE) $(CMN)HTBTree.c $(CMN)HTUtils.h
diff --git a/WWW/Library/Implementation/HTAAFile.c b/WWW/Library/Implementation/HTAAFile.c
deleted file mode 100644
index 101176cf..00000000
--- a/WWW/Library/Implementation/HTAAFile.c
+++ /dev/null
@@ -1,203 +0,0 @@
-/* MODULE HTAAFile.c
-** FILE ROUTINES FOR AUTHENTICATION
-** (PASSWD AND GROUP FILES) AND
-** ACCESS CONTROL LIST (.www_acl)
-** AUTHORS:
-** AL Ari Luotonen luotonen@dxcern.cern.ch
-**
-** HISTORY:
-**
-**
-** BUGS:
-**
-**
-*/
-
-#include <HTUtils.h>
-
-#include <HTAAUtil.h> /* Common utilities used in AA */
-#include <HTAAFile.h> /* Implemented here */
-
-#include <LYLeaks.h>
-
-#define SPACE ' '
-#define TAB '\t'
-
-
-
-/* PUBLIC HTAAFile_nextRec()
-** GO TO THE BEGINNING OF THE NEXT RECORD
-** ON ENTRY:
-** fp is the file from which records are read from.
-**
-** ON EXIT:
-** returns nothing. File read pointer is located at the beginning
-** of the next record. Handles continuation lines
-** (lines ending in comma indicate a following
-** continuation line).
-**
-*/
-PUBLIC void HTAAFile_nextRec ARGS1(FILE *, fp)
-{
- int ch = getc(fp);
- int last = (char)0;
-
- do {
- while (ch != EOF && ch != CR && ch != LF) {
- if (ch != ' ' && ch != '\t')
- last = ch; /* Last non-whitespace */
- ch = getc(fp); /* Skip until end-of-line */
- }
- while (ch != EOF &&
- (ch == CR || ch == LF))/*Skip carriage returns and linefeeds*/
- ch = getc(fp);
- if (ch != EOF)
- ungetc(ch, fp);
- } while (last == ',' && ch != EOF); /* Skip also continuation lines */
-}
-
-
-/* PRIVATE read_item()
-** READ AN ITEM FROM A PASSWORD, GROUP
-** OR ACCESS CONTROL LIST FILE
-** i.e., either a field, or a list item.
-** ON ENTRY:
-** fp is the file to read the characters from
-** contents is the character array to put the characters
-** reading_list if TRUE, read a list item (ends either in
-** a comma or a colon),
-** if FALSE, read a field (ends in acolon).
-** max_len is the maximum number of characters that may
-** be read (i.e., the size of dest minus one for
-** terminating null).
-** ON EXIT:
-** returns the terminating character
-** (i.e., either separator or CR or LF or EOF).
-** contents contains a null-terminated string representing
-** the read field.
-** NOTE 1:
-** Ignores leading and trailing blanks and tabs.
-** NOTE 2:
-** If the item is more than max_len characters
-** long, the rest of the characters in that item
-** are ignored. However, contents is always
-** null-terminated!
-*/
-PRIVATE int read_item ARGS4(FILE *, fp,
- char *, contents,
- BOOL, reading_list,
- int, max_len)
-{
- char * dest = contents;
- char * end = contents;
- int cnt = 0;
- int ch = getc(fp);
-
- while (SPACE == ch || TAB == ch) /* Skip spaces and tabs */
- ch = getc(fp);
-
- while (ch != FIELD_SEPARATOR &&
- (!reading_list || ch != LIST_SEPARATOR) &&
- ch != CR && ch != LF && ch != EOF && cnt < max_len) {
- *(dest++) = ch;
- cnt++;
- if (ch != SPACE && ch != TAB)
- end = dest;
- ch = getc(fp);
- } /* while not eol or eof or too many read */
-
- if (cnt == max_len) {
- /* If the field was too long (or exactly maximum) ignore the rest */
- while (ch != FIELD_SEPARATOR &&
- (!reading_list || ch != LIST_SEPARATOR) &&
- ch != CR && ch != LF && ch != EOF)
- ch = getc(fp);
- }
-
- if (ch == CR || ch == LF)
- ungetc(ch, fp); /* Push back the record separator (NL or LF) */
-
- /* Terminate the string, truncating trailing whitespace off.
- ** Otherwise (if whitespace would be included), here would
- ** be *dest='\0'; and cnt -= ... would be left out.
- */
- *end = '\0';
- cnt -= dest-end;
-
- return ch; /* Return the terminating character */
-}
-
-
-
-/* PUBLIC HTAAFile_readField()
-** READ A FIELD FROM A PASSWORD, GROUP
-** OR ACCESS CONTROL LIST FILE
-** i.e., an item terminated by colon,
-** end-of-line, or end-of-file.
-** ON ENTRY:
-** fp is the file to read the characters from
-** contents is the character array to put the characters
-** max_len is the maximum number of characters that may
-** be read (i.e., the size of dest minus one for
-** terminating null).
-** ON EXIT:
-** returns the terminating character
-** (i.e., either separator or CR or LF or EOF).
-** contents contains a null-terminated string representing
-** the read field.
-** NOTE 1:
-** Ignores leading and trailing blanks and tabs.
-** NOTE 2:
-** If the field is more than max_len characters
-** long, the rest of the characters in that item
-** are ignored. However, contents is always
-** null-terminated!
-*/
-PUBLIC int HTAAFile_readField ARGS3(FILE *, fp,
- char *, contents,
- int, max_len)
-{
- return read_item(fp, contents, NO, max_len);
-}
-
-
-
-
-/* PUBLIC HTAAFile_readList()
-**
-** READ A LIST OF STRINGS SEPARATED BY COMMAS
-** (FROM A GROUP OR ACCESS CONTROL LIST FILE)
-** ON ENTRY:
-** fp is a pointer to the input file.
-** result is the list to which append the read items.
-** max_len is the maximum number of characters in each
-** list entry (extra characters are ignored).
-** ON EXIT:
-** returns the number of items read.
-**
-*/
-PUBLIC int HTAAFile_readList ARGS3(FILE *, fp,
- HTList *, result,
- int, max_len)
-{
- char *item = NULL;
- int terminator;
- int cnt = 0;
-
- do {
- if (!item && !(item = (char*)malloc(max_len+1)))
- outofmem(__FILE__, "HTAAFile_readList");
- terminator = read_item(fp, item, YES, max_len);
- if (strlen(item) > 0) {
- cnt++;
- HTList_addObject(result, (void*)item);
- item = NULL;
- }
- } while (terminator != FIELD_SEPARATOR &&
- terminator != CR && terminator != LF &&
- terminator != EOF);
-
- FREE(item); /* This was not needed */
- return cnt;
-}
-
diff --git a/WWW/Library/Implementation/HTAAFile.h b/WWW/Library/Implementation/HTAAFile.h
deleted file mode 100644
index 32e81664..00000000
--- a/WWW/Library/Implementation/HTAAFile.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/* FILE ROUTINES FOR ACCESS AUTHORIZATION PACKAGE
-
- This module implements the routines used for accessing (and parsing) the files used in
- the access authorization:
-
- password file
-
- group file
-
- access control list (ACL) file
-
- */
-
-
-#ifndef HTAAFILE_H
-#define HTAAFILE_H
-
-#include <HTList.h> /* HTList */
-
-
-/* Used field separators */
-
-#define FIELD_SEPARATOR ':' /* Used to separate fields */
-#define LIST_SEPARATOR ',' /* Used to separate items in a list */
- /* in group and ALC files. */
-
-/*
-
-Naming conventions
-
- Record is an entire line in file.
-
- Field is an entity separated by colons and/or by end-of-line.
-
- List is a field in which there are items separated by commas.
-
-Record-oriented Read Routines
-
- Password, group and ACL are internally read in by the following functions:
-
- HTAAFile_nextRec() skips to the beginning of the next record (must be called even
- after the last field of a record is read to proceed to the next
- record).
-
- HTAAFile_readField() reads a field (separated by colons).
-
- HTAAFile_readList() reads a field containing a comma-separated list of items.
-
- */
-
-/* PUBLIC HTAAFile_nextRec()
-** GO TO THE BEGINNING OF THE NEXT RECORD
-** ON ENTRY:
-** fp is the file from which records are read from.
-**
-** ON EXIT:
-** returns nothing. File read pointer is located at the beginning
-** of the next record.
-**
-*/
-PUBLIC void HTAAFile_nextRec PARAMS((FILE * fp));
-
-
-/* PUBLIC HTAAFile_readField()
-** READ A FIELD FROM A PASSWORD, GROUP
-** OR ACCESS CONTROL LIST FILE
-** i.e., an item terminated by colon,
-** end-of-line, or end-of-file.
-** ON ENTRY:
-** fp is the file to read the characters from
-** contents is the character array to put the characters
-** max_len is the maximum number of characters that may
-** be read (i.e., the size of dest minus one for
-** terminating null).
-** ON EXIT:
-** returns the terminating character
-** (i.e., either separator or CR or LF or EOF).
-** contents contains a null-terminated string representing
-** the read field.
-** NOTE 1:
-** Ignores leading and trailing blanks and tabs.
-** NOTE 2:
-** If the field is more than max_len characters
-** long, the rest of the characters in that item
-** are ignored. However, contents is always
-** null-terminated!
-*/
-PUBLIC int HTAAFile_readField PARAMS((FILE * fp,
- char * contents,
- int max_len));
-
-
-/* PUBLIC HTAAFile_readList()
-**
-** READ A LIST OF STRINGS SEPARATED BY COMMAS
-** (FROM A GROUP OR ACCESS CONTROL LIST FILE)
-** ON ENTRY:
-** fp is a pointer to the input file.
-** result is the list to which append the read items.
-** max_len is the maximum number of characters in each
-** list entry (extra characters are ignored).
-** ON EXIT:
-** returns the number of items read.
-**
-*/
-PUBLIC int HTAAFile_readList PARAMS((FILE * fp,
- HTList * result,
- int max_len));
-/*
-
- */
-
-#endif /* not HTAAFILE_H */
-/*
-
- End of file HTAAFile.h. */
diff --git a/WWW/Library/Implementation/HTAAProt.c b/WWW/Library/Implementation/HTAAProt.c
index 8157ed56..27e038f9 100644
--- a/WWW/Library/Implementation/HTAAProt.c
+++ b/WWW/Library/Implementation/HTAAProt.c
@@ -27,7 +27,6 @@
#endif /* not VMS */
#include <HTAAUtil.h>
-#include <HTAAFile.h>
#include <HTLex.h> /* Lexical analysor */
#include <HTAAProt.h> /* Implemented here */
@@ -73,7 +72,7 @@ PRIVATE BOOL isNumber ARGS1(CONST char *, s)
}
-#if defined (VMS) || defined (NOUSERS)
+#if defined (NOUSERS)
/* PUBLIC HTAA_getUidName()
** GET THE USER ID NAME (VMS ONLY)
** ON ENTRY:
@@ -579,6 +578,7 @@ PRIVATE HTList *known_grp = NULL;
PRIVATE HTList *known_pwd = NULL;
PRIVATE BOOL uidgid_cache_inited = NO;
+#ifdef LY_FIND_LEAKS
PRIVATE void clear_uidgid_cache NOARGS
{
USER_DATA *data;
@@ -597,6 +597,7 @@ PRIVATE void clear_uidgid_cache NOARGS
FREE(known_pwd);
}
}
+#endif /* LY_FIND_LEAKS */
PRIVATE void save_gid_info ARGS2(char *, name, int, user)
{
diff --git a/WWW/Library/Implementation/HTAAServ.c b/WWW/Library/Implementation/HTAAServ.c
deleted file mode 100644
index c8c26300..00000000
--- a/WWW/Library/Implementation/HTAAServ.c
+++ /dev/null
@@ -1,646 +0,0 @@
-
-/* MODULE HTAAServ.c
-** SERVER SIDE ACCESS AUTHORIZATION MODULE
-**
-** Contains the means for checking the user access
-** authorization for a file.
-**
-** IMPORTANT:
-** Routines in this module use dynamic allocation, but free
-** automatically all the memory reserved by them.
-**
-** Therefore the caller never has to (and never should)
-** free() any object returned by these functions.
-**
-** Therefore also all the strings returned by this package
-** are only valid until the next call to the same function
-** is made. This approach is selected, because of the nature
-** of access authorization: no string returned by the package
-** needs to be valid longer than until the next call.
-**
-** This also makes it easy to plug the AA package in:
-** you don't have to ponder whether to free() something
-** here or is it done somewhere else (because it is always
-** done somewhere else).
-**
-** The strings that the package needs to store are copied
-** so the original strings given as parameters to AA
-** functions may be freed or modified with no side effects.
-**
-** The AA package does not free() anything else than what
-** it has itself allocated.
-**
-** AUTHORS:
-** AL Ari Luotonen luotonen@dxcern.cern.ch
-**
-** HISTORY:
-**
-**
-** BUGS:
-**
-**
-*/
-
-#include <HTUtils.h>
-
-#include <HTString.h>
-#include <HTAccess.h> /* HTSecure */
-#include <HTFile.h> /* HTLocalName */
-#include <HTRules.h> /* */
-#include <HTParse.h> /* URL parsing function */
-#include <HTList.h> /* HTList object */
-
-#include <HTAAUtil.h> /* AA common parts */
-#include <HTAuth.h> /* Authentication */
-#include <HTACL.h> /* Access Control List */
-#include <HTGroup.h> /* Group handling */
-#include <HTAAProt.h> /* Protection file parsing */
-#include <HTAAServ.h> /* Implemented here */
-
-#include <LYLeaks.h>
-
-/*
-** Global variables
-*/
-PUBLIC time_t theTime;
-
-
-/*
-** Module-wide global variables
-*/
-PRIVATE FILE * htaa_logfile = NULL; /* Log file */
-PRIVATE HTAAUser *htaa_user = NULL; /* Authenticated user */
-PRIVATE HTAAFailReasonType HTAAFailReason = HTAA_OK; /* AA fail reason */
-
-
-/* SERVER PUBLIC HTAA_statusMessage()
-** RETURN A STRING EXPLAINING ACCESS
-** AUTHORIZATION FAILURE
-** (Can be used in server reply status line
-** with 401/403 replies.)
-** ON EXIT:
-** returns a string containing the error message
-** corresponding to internal HTAAFailReason.
-*/
-PUBLIC char *HTAA_statusMessage NOARGS
-{
- switch (HTAAFailReason) {
-
- /* 401 cases */
- case HTAA_NO_AUTH:
- return "Unauthorized -- authentication failed";
- case HTAA_NOT_MEMBER:
- return "Unauthorized to access the document";
-
- /* 403 cases */
- case HTAA_BY_RULE:
- return "Forbidden -- by rule";
- case HTAA_IP_MASK:
- return "Forbidden -- server refuses to serve to your IP address";
- case HTAA_NO_ACL:
- case HTAA_NO_ENTRY:
- return "Forbidden -- access to file is never allowed";
- case HTAA_SETUP_ERROR:
- return "Forbidden -- server protection setup error";
- case HTAA_DOTDOT:
- return "Forbidden -- URL containing /../ disallowed";
- case HTAA_HTBIN:
- return "Forbidden -- /htbin feature not enabled on this server";
-
- /* 404 cases */
- case HTAA_NOT_FOUND:
- return "Not found -- file doesn't exist or is read protected";
-
- /* Success */
- case HTAA_OK:
- return "AA: Access should be ok but something went wrong";
-
- case HTAA_OK_GATEWAY:
- return "AA check bypassed (gatewaying) but something went wrong";
-
- /* Others */
- default:
- return "Access denied -- unable to specify reason (bug)";
-
- } /* switch */
-}
-
-
-PRIVATE char *status_name ARGS1(HTAAFailReasonType, reason)
-{
- switch (reason) {
-
- /* 401 cases */
- case HTAA_NO_AUTH:
- return "NO-AUTHENTICATION";
- case HTAA_NOT_MEMBER:
- return "NOT-AUTHORIZED";
-
- /* 403 cases */
- case HTAA_BY_RULE:
- return "FORB-RULE";
- case HTAA_IP_MASK:
- return "FORB-IP";
- case HTAA_NO_ACL:
- return "NO-ACL-FILE";
- case HTAA_NO_ENTRY:
- return "NO-ACL-ENTRY";
- case HTAA_SETUP_ERROR:
- return "SETUP-ERROR";
- case HTAA_DOTDOT:
- return "SLASH-DOT-DOT";
- case HTAA_HTBIN:
- return "HTBIN-OFF";
-
- /* 404 cases */
- case HTAA_NOT_FOUND:
- return "NOT-FOUND";
-
- /* Success */
- case HTAA_OK:
- return "OK";
- case HTAA_OK_GATEWAY:
- return "OK-GATEWAY";
-
- /* Others */
- default:
- return "SERVER-BUG";
- } /* switch */
-}
-
-
-/* PRIVATE check_authorization()
-** CHECK IF USER IS AUTHORIZED TO ACCESS A FILE
-** ON ENTRY:
-** pathname is the physical file pathname
-** to access.
-** method method, e.g., METHOD_GET, METHOD_PUT, ...
-** scheme authentication scheme.
-** scheme_specifics authentication string (or other
-** scheme specific parameters, like
-** Kerberos-ticket).
-**
-** ON EXIT:
-** returns HTAA_OK on success.
-** Otherwise the reason for failing.
-** NOTE:
-** This function does not check whether the file
-** exists or not -- so the status 404 Not found
-** must be returned from somewhere else (this is
-** to avoid unnecessary overhead of opening the
-** file twice).
-*/
-PRIVATE HTAAFailReasonType check_authorization ARGS4(CONST char *, pathname,
- HTAAMethod, method,
- HTAAScheme, scheme,
- char *, scheme_specifics)
-{
- HTAAFailReasonType reason;
- GroupDef *allowed_groups;
- FILE *acl_file = NULL;
- HTAAProt *prot = NULL; /* Protection mode */
-
- htaa_user = NULL;
-
- if (!pathname) {
- CTRACE(tfp, "HTAA_checkAuthorization: Forbidden by rule\n");
- return HTAA_BY_RULE;
- }
- CTRACE(tfp, "%s `%s' %s %s\n",
- "HTAA_checkAuthorization: translated path:",
- pathname, "method:", HTAAMethod_name(method));
-
- /*
- ** Get protection setting (set up by callbacks from rule system)
- ** NULL, if not protected by a "protect" rule.
- */
- prot = HTAA_getCurrentProtection();
-
- /*
- ** Check ACL existence
- */
- if (!(acl_file = HTAA_openAcl(pathname))) {
- if (prot) { /* protect rule, but no ACL */
- if (prot->mask_group) {
- /*
- ** Only mask enabled, check that
- */
- GroupDefList *group_def_list =
- HTAA_readGroupFile(HTAssocList_lookup(prot->values,
- "group"));
- /*
- ** Authenticate if authentication info given
- */
- if (scheme != HTAA_UNKNOWN && scheme != HTAA_NONE) {
- htaa_user = HTAA_authenticate(scheme,
- scheme_specifics,
- prot);
- CTRACE(tfp, "Authentication returned: %s\n",
- (htaa_user ? htaa_user->username
- : "NOT-AUTHENTICATED"));
- }
- HTAA_resolveGroupReferences(prot->mask_group, group_def_list);
- reason = HTAA_userAndInetInGroup(prot->mask_group,
- htaa_user
- ? htaa_user->username : "",
- HTClientHost,
- NULL);
- if (reason != HTAA_OK) {
- CTRACE(tfp, "%s %s %s %s\n",
- "HTAA_checkAuthorization: access denied",
- "by mask (no ACL, only Protect rule)",
- "host", HTClientHost);
- } else {
- CTRACE(tfp, "%s %s %s %s\n",
- "HTAA_checkAuthorization: request from",
- HTClientHost,
- "accepted by only mask match (no ACL, only",
- "Protect rule, and only mask enabled)");
- }
- return reason;
- }
- else { /* 403 Forbidden */
- CTRACE(tfp, "%s %s\n",
- "HTAA_checkAuthorization: Protected, but",
- "no mask group nor ACL -- forbidden");
- return HTAA_NO_ACL;
- }
- }
- else { /* No protect rule and no ACL => OK 200 */
- CTRACE(tfp, "HTAA_checkAuthorization: %s\n",
- "no protect rule nor ACL -- ok\n");
- return HTAA_OK;
- }
- }
-
- /*
- ** Now we know that ACL exists
- */
- if (!prot) { /* Not protected by "protect" rule */
- CTRACE(tfp, "HTAA_checkAuthorization: default protection\n");
- prot = HTAA_getDefaultProtection(); /* Also sets current protection */
-
- if (!prot) { /* @@ Default protection not set ?? */
- CTRACE(tfp, "%s %s\n",
- "HTAA_checkAuthorization: default protection",
- "not set (internal server error)!!");
- return HTAA_SETUP_ERROR;
- }
- }
-
- /*
- ** Now we know that document is protected and ACL exists.
- ** Check against ACL entry.
- */
- {
- GroupDefList *group_def_list =
- HTAA_readGroupFile(HTAssocList_lookup(prot->values, "group"));
-
- /*
- ** Authenticate now that we know protection mode
- */
- if (scheme != HTAA_UNKNOWN && scheme != HTAA_NONE) {
- htaa_user = HTAA_authenticate(scheme,
- scheme_specifics,
- prot);
- CTRACE(tfp, "Authentication returned: %s\n",
- (htaa_user
- ? htaa_user->username : "NOT-AUTHENTICATED"));
- }
- /*
- ** Check mask group
- */
- if (prot->mask_group) {
- HTAA_resolveGroupReferences(prot->mask_group, group_def_list);
- reason=HTAA_userAndInetInGroup(prot->mask_group,
- htaa_user ? htaa_user->username : "",
- HTClientHost,
- NULL);
- if (reason != HTAA_OK) {
- CTRACE(tfp, "%s %s %s\n",
- "HTAA_checkAuthorization: access denied",
- "by mask, host:", HTClientHost);
- return reason;
- }
- else {
- CTRACE(tfp, "%s %s %s %s %s\n",
- "HTAA_checkAuthorization: request from",
- HTClientHost,
- "accepted by just mask group match",
- "(no ACL, only Protect rule, and only",
- "mask enabled)");
- /* And continue authorization checking */
- }
- }
- /*
- ** Get ACL entries; get first one first, the loop others
- ** Remember, allowed_groups is automatically freed by
- ** HTAA_getAclEntry().
- */
- allowed_groups = HTAA_getAclEntry(acl_file, pathname, method);
- if (!allowed_groups) {
- CTRACE(tfp, "%s `%s' %s\n",
- "No entry for file", pathname, "in ACL");
- HTAA_closeAcl(acl_file);
- return HTAA_NO_ENTRY; /* Forbidden -- no entry in the ACL */
- }
- else {
- do {
- HTAA_resolveGroupReferences(allowed_groups, group_def_list);
- reason = HTAA_userAndInetInGroup(allowed_groups,
- htaa_user
- ? htaa_user->username : "",
- HTClientHost,
- NULL);
- if (reason == HTAA_OK) {
- HTAA_closeAcl(acl_file);
- return HTAA_OK; /* OK */
- }
- allowed_groups = HTAA_getAclEntry(acl_file, pathname, method);
- } while (allowed_groups);
- HTAA_closeAcl(acl_file);
- return HTAA_NOT_MEMBER; /* Unauthorized */
- }
- }
-}
-
-
-/* PUBLIC HTAA_checkAuthorization()
-** CHECK IF USER IS AUTHORIZED TO ACCESS A FILE
-** ON ENTRY:
-** url is the document to be accessed.
-** method_name name of the method, e.g., "GET"
-** scheme_name authentication scheme name.
-** scheme_specifics authentication string (or other
-** scheme specific parameters, like
-** Kerberos-ticket).
-**
-** ON EXIT:
-** returns status codes uniform with those of HTTP:
-** 200 OK if file access is ok.
-** 401 Unauthorized if user is not authorized to
-** access the file.
-** 403 Forbidden if there is no entry for the
-** requested file in the ACL.
-**
-** NOTE:
-** This function does not check whether the file
-** exists or not -- so the status 404 Not found
-** must be returned from somewhere else (this is
-** to avoid unnecessary overhead of opening the
-** file twice).
-**
-*/
-PUBLIC int HTAA_checkAuthorization ARGS4(CONST char *, url,
- CONST char *, method_name,
- CONST char *, scheme_name,
- char *, scheme_specifics)
-{
- static char *pathname = NULL;
- char *local_copy = NULL;
- HTAAMethod method = HTAAMethod_enum(method_name);
- HTAAScheme scheme = HTAAScheme_enum(scheme_name);
-
- HTAAFailReason = HTAA_OK;
-
- /*
- ** Translate into absolute pathname, and
- ** check for "protect" and "defprot" rules.
- */
- FREE(pathname); /* From previous call */
- StrAllocCopy(local_copy, url);
- {
- char *keywords = strchr(local_copy, '?');
- if (keywords)
- *keywords = '\0'; /* Chop off keywords */
- }
- HTSimplify(local_copy); /* Remove ".." etc. */
-
- /* HTSimplify will leave in a "/../" at the top, which can
- ** be a security hole.
- */
- if (strstr(local_copy, "/../")) {
- CTRACE(tfp, "HTAA_checkAuthorization: %s (`%s')\n",
- "Illegal attempt to use /../", url);
- HTAAFailReason = HTAA_DOTDOT;
- }
- else {
-
-#ifndef NO_RULES
- pathname = HTTranslate(local_copy); /* Translate rules even if */
- /* a /htbin call to set up */
- /* protections. */
- if (0 == strncmp(local_copy, "/htbin/", 7)) {
- if (!HTBinDir)
- HTAAFailReason = HTAA_HTBIN;
- else {
- char *end = strchr(local_copy+7, '/');
- if (end)
- *end = '\0';
- FREE(pathname);
- pathname=(char*)malloc(strlen(HTBinDir)+strlen(local_copy)+1);
- if (pathname == NULL)
- outofmem(__FILE__, "HTAA_checkAuthorization");
- strcpy(pathname, HTBinDir);
- strcat(pathname, local_copy+6);
- }
- }
-
- if (!pathname) { /* Forbidden by rule */
- CTRACE(tfp, "HTAA_checkAuthorization: Forbidden by rule\n");
- HTAAFailReason = HTAA_BY_RULE;
- }
- else if (HTAAFailReason != HTAA_HTBIN) {
-#endif /* NO_RULES */
-
- /* pathname != NULL */
- char *acc_method = HTParse(pathname, "", PARSE_ACCESS);
- if (!*acc_method || 0 == strcmp(acc_method,"file")) { /*Local file, do AA*/
- if (!HTSecure && 0 != strncmp(local_copy, "/htbin/", 7)) {
- char *localname = HTLocalName(pathname);
- FREE(pathname);
- pathname = localname;
- }
- HTAAFailReason = check_authorization(pathname, method,
- scheme, scheme_specifics);
- }
- else { /* Not local access */
- HTAAFailReason = HTAA_OK_GATEWAY;
- CTRACE(tfp, "HTAA_checkAuthorization: %s (%s access)\n",
- "Gatewaying -- skipping authorization check",
- acc_method);
- }
-
-#ifndef NO_RULES
- } /* pathname */
-#endif /* NO_RULES */
-
- }
- FREE(local_copy);
-
- if (htaa_logfile) {
- time(&theTime);
- fprintf(htaa_logfile, "%24.24s %s %s %s %s %s\n",
- ctime(&theTime),
- HTClientHost ? HTClientHost : "local",
- method_name,
- url,
- status_name(HTAAFailReason),
- htaa_user && htaa_user->username
- ? htaa_user->username : "");
- fflush(htaa_logfile); /* Actually update it on disk */
- CTRACE(tfp, "Log: %24.24s %s %s %s %s %s\n",
- ctime(&theTime),
- HTClientHost ? HTClientHost : "local",
- method_name,
- url,
- status_name(HTAAFailReason),
- htaa_user && htaa_user->username
- ? htaa_user->username : "");
- }
-
- switch (HTAAFailReason) {
-
- case HTAA_NO_AUTH:
- case HTAA_NOT_MEMBER:
- return 401;
-
- case HTAA_BY_RULE:
- case HTAA_IP_MASK:
- case HTAA_NO_ACL:
- case HTAA_NO_ENTRY:
- case HTAA_SETUP_ERROR:
- case HTAA_DOTDOT:
- case HTAA_HTBIN:
- return 403;
-
- case HTAA_NOT_FOUND:
- return 404;
-
- case HTAA_OK:
- case HTAA_OK_GATEWAY:
- return 200;
-
- default:
- return 500;
- } /* switch */
-}
-
-
-/* PRIVATE compose_scheme_specifics()
-** COMPOSE SCHEME-SPECIFIC PARAMETERS
-** TO BE SENT ALONG WITH SERVER REPLY
-** IN THE WWW-Authenticate: FIELD.
-** ON ENTRY:
-** scheme is the authentication scheme for which
-** parameters are asked for.
-** prot protection setup structure.
-**
-** ON EXIT:
-** returns scheme specific parameters in an
-** auto-freed string.
-*/
-PRIVATE char *compose_scheme_specifics ARGS2(HTAAScheme, scheme,
- HTAAProt *, prot)
-{
- static char *result = NULL;
-
- FREE(result); /* From previous call */
-
- switch (scheme) {
- case HTAA_BASIC:
- {
- char *realm = HTAssocList_lookup(prot->values, "server");
- HTSprintf0(&result, "realm=\"%s\"",
- (realm ? realm : "UNKNOWN"));
- return result;
- }
-
- case HTAA_PUBKEY:
- {
- char *realm = HTAssocList_lookup(prot->values, "server");
- HTSprintf0(&result, "realm=\"%s\", key=\"%s\"",
- (realm ? realm : "UNKNOWN"),
- "PUBKEY-NOT-IMPLEMENTED");
- return result;
- }
- default:
- return NULL;
- }
-}
-
-
-/* SERVER PUBLIC HTAA_composeAuthHeaders()
-** COMPOSE WWW-Authenticate: HEADER LINES
-** INDICATING VALID AUTHENTICATION SCHEMES
-** FOR THE REQUESTED DOCUMENT
-** ON ENTRY:
-** No parameters, but HTAA_checkAuthorization() must
-** just before have failed because a wrong (or none)
-** authentication scheme was used.
-**
-** ON EXIT:
-** returns a buffer containing all the WWW-Authenticate:
-** fields including CRLFs (this buffer is auto-freed).
-** NULL, if authentication won't help in accessing
-** the requested document.
-**
-*/
-PUBLIC char *HTAA_composeAuthHeaders NOARGS
-{
- static char *result = NULL;
- int n;
- char *scheme_name;
- char *scheme_params;
- HTAAProt *prot = HTAA_getCurrentProtection();
-
- if (!prot) {
- CTRACE(tfp, "%s %s\n",
- "HTAA_composeAuthHeaders: Document not protected",
- "-- why was this function called??");
- return NULL;
- } else {
- CTRACE(tfp, "HTAA_composeAuthHeaders: for file `%s'\n",
- prot->filename);
- }
-
- FREE(result); /* From previous call */
- if (!(result = (char*)malloc(4096))) /* @@ */
- outofmem(__FILE__, "HTAA_composeAuthHeaders");
- *result = '\0';
-
- for (n = 0; n < (int) HTAA_MAX_SCHEMES; n++) {
- HTAAScheme scheme = (HTAAScheme) n;
- if (-1 < HTList_indexOf(prot->valid_schemes, (void*)scheme)) {
- if ((scheme_name = HTAAScheme_name(scheme))) {
- scheme_params = compose_scheme_specifics(scheme,prot);
- strcat(result, "WWW-Authenticate: ");
- strcat(result, scheme_name);
- if (scheme_params) {
- strcat(result, " ");
- strcat(result, scheme_params);
- }
- strcat(result, "\r\n");
- } /* scheme name found */
- else {
- CTRACE(tfp, "HTAA_composeAuthHeaders: %s %d\n",
- "No name found for scheme number", scheme);
- }
- } /* scheme valid for requested document */
- } /* for every scheme */
-
- return result;
-}
-
-
-/* PUBLIC HTAA_startLogging()
-** START UP ACCESS AUTHORIZATION LOGGING
-** ON ENTRY:
-** fp is the open log file.
-**
-*/
-PUBLIC void HTAA_startLogging ARGS1(FILE *, fp)
-{
- htaa_logfile = fp;
-}
-
diff --git a/WWW/Library/Implementation/HTAAServ.h b/WWW/Library/Implementation/HTAAServ.h
deleted file mode 100644
index 2beb6f9a..00000000
--- a/WWW/Library/Implementation/HTAAServ.h
+++ /dev/null
@@ -1,137 +0,0 @@
-/* SERVER SIDE ACCESS AUTHORIZATION MODULE
-
- This module is the server side interface to Access Authorization (AA) package. It
- contains code only for server.
-
- Important to know about memory allocation:
-
- Routines in this module use dynamic allocation, but free automatically all the memory
- reserved by them.
-
- Therefore the caller never has to (and never should) free() any object returned by
- these functions.
-
- Therefore also all the strings returned by this package are only valid until the next
- call to the same function is made. This approach is selected, because of the nature of
- access authorization: no string returned by the package needs to be valid longer than
- until the next call.
-
- This also makes it easy to plug the AA package in: you don't have to ponder whether to
- free()something here or is it done somewhere else (because it is always done somewhere
- else).
-
- The strings that the package needs to store are copied so the original strings given as
- parameters to AA functions may be freed or modified with no side effects.
-
- Also note:The AA package does not free() anything else than what it has itself
- allocated.
-
- */
-
-#ifndef HTAASERV_H
-#define HTAASERV_H
-
-#include <HTRules.h> /* This module interacts with rule system */
-#include <HTAAUtil.h> /* Common parts of AA */
-#include <HTAuth.h> /* Authentication */
-
-
-extern time_t theTime;
-
-/*
-
-Check Access Authorization
-
- HTAA_checkAuthorization() is the main access authorization function.
-
- */
-
-/* PUBLIC HTAA_checkAuthorization()
-** CHECK IF USER IS AUTHORIZED TO ACCESS A FILE
-** ON ENTRY:
-** url is the document to be accessed.
-** method_name name of the method, e.g., "GET"
-** scheme_name authentication scheme name.
-** scheme_specifics authentication string (or other
-** scheme specific parameters, like
-** Kerberos-ticket).
-**
-** ON EXIT:
-** returns status codes uniform with those of HTTP:
-** 200 OK if file access is ok.
-** 401 Unauthorized if user is not authorized to
-** access the file.
-** 403 Forbidden if there is no entry for the
-** requested file in the ACL.
-**
-** NOTE:
-** This function does not check whether the file
-** exists or not -- so the status 404 Not found
-** must be returned from somewhere else (this is
-** to avoid unnecessary overhead of opening the
-** file twice).
-**
-*/
-PUBLIC int HTAA_checkAuthorization PARAMS((CONST char * url,
- CONST char * method_name,
- CONST char * scheme_name,
- char * scheme_specifics));
-/*
-
-Compose Status Line Message
-
- */
-
-/* SERVER PUBLIC HTAA_statusMessage()
-** RETURN A STRING EXPLAINING ACCESS
-** AUTHORIZATION FAILURE
-** (Can be used in server reply status line
-** with 401/403 replies.)
-** ON EXIT:
-** returns a string containing the error message
-** corresponding to internal HTAAFailReason.
-*/
-PUBLIC char *HTAA_statusMessage NOPARAMS;
-/*
-
-Compose "Authenticate:" Header Lines for Server Reply
-
- */
-
-/* SERVER PUBLIC HTAA_composeAuthHeaders()
-** COMPOSE WWW-Authenticate: HEADER LINES
-** INDICATING VALID AUTHENTICATION SCHEMES
-** FOR THE REQUESTED DOCUMENT
-** ON ENTRY:
-** No parameters, but HTAA_checkAuthorization() must
-** just before have failed because a wrong (or none)
-** authentication scheme was used.
-**
-** ON EXIT:
-** returns a buffer containing all the WWW-Authenticate:
-** fields including CRLFs (this buffer is auto-freed).
-** NULL, if authentication won't help in accessing
-** the requested document.
-*/
-PUBLIC char *HTAA_composeAuthHeaders NOPARAMS;
-/*
-
-Start Access Authorization Logging
-
- */
-
-/* PUBLIC HTAA_startLogging()
-** START UP ACCESS AUTHORIZATION LOGGING
-** ON ENTRY:
-** fp is the open log file.
-**
-*/
-PUBLIC void HTAA_startLogging PARAMS((FILE * fp));
-/*
-
- */
-
-#endif /* NOT HTAASERV_H */
-/*
-
- End of file HTAAServ.h. */
diff --git a/WWW/Library/Implementation/HTAAUtil.c b/WWW/Library/Implementation/HTAAUtil.c
index 0212cfeb..30dc677d 100644
--- a/WWW/Library/Implementation/HTAAUtil.c
+++ b/WWW/Library/Implementation/HTAAUtil.c
@@ -61,7 +61,7 @@
** name is a string representing the scheme name.
**
** ON EXIT:
-** returns the enumerated constant for that scheme.
+** returns the enumerated constant for that scheme.
*/
PUBLIC HTAAScheme HTAAScheme_enum ARGS1(CONST char*, name)
{
@@ -102,7 +102,7 @@ PUBLIC HTAAScheme HTAAScheme_enum ARGS1(CONST char*, name)
** HTAA_NONE, HTAA_BASIC, HTAA_PUBKEY, ...
**
** ON EXIT:
-** returns the name of the scheme, i.e.
+** returns the name of the scheme, i.e.
** "None", "Basic", "Pubkey", ...
*/
PUBLIC char *HTAAScheme_name ARGS1(HTAAScheme, scheme)
@@ -132,7 +132,7 @@ PUBLIC char *HTAAScheme_name ARGS1(HTAAScheme, scheme)
** name is the method name to translate.
**
** ON EXIT:
-** returns HTAAMethod enumerated value corresponding
+** returns HTAAMethod enumerated value corresponding
** to the given name.
*/
PUBLIC HTAAMethod HTAAMethod_enum ARGS1(CONST char *, name)
@@ -156,7 +156,7 @@ PUBLIC HTAAMethod HTAAMethod_enum ARGS1(CONST char *, name)
** METHOD_GET, METHOD_PUT, ...
**
** ON EXIT:
-** returns the name of the scheme, i.e.
+** returns the name of the scheme, i.e.
** "GET", "PUT", ...
*/
PUBLIC char *HTAAMethod_name ARGS1(HTAAMethod, method)
@@ -181,7 +181,7 @@ PUBLIC char *HTAAMethod_name ARGS1(HTAAMethod, method)
** list is a list of method names.
**
** ON EXIT:
-** returns YES, if method was found.
+** returns YES, if method was found.
** NO, if not found.
*/
PUBLIC BOOL HTAAMethod_inList ARGS2(HTAAMethod, method,
@@ -219,7 +219,7 @@ PUBLIC BOOL HTAAMethod_inList ARGS2(HTAAMethod, method,
** against the template.
**
** ON EXIT:
-** returns YES, if filename matches the template.
+** returns YES, if filename matches the template.
** NO, otherwise.
*/
PUBLIC BOOL HTAA_templateMatch ARGS2(CONST char *, template,
@@ -270,7 +270,7 @@ PUBLIC BOOL HTAA_templateMatch ARGS2(CONST char *, template,
** against the template.
**
** ON EXIT:
-** returns YES, if filename matches the template.
+** returns YES, if filename matches the template.
** NO, otherwise.
*/
PUBLIC BOOL HTAA_templateCaseMatch ARGS2(CONST char *, template,
@@ -454,6 +454,13 @@ PRIVATE char *start_pointer;
PRIVATE char *end_pointer;
PRIVATE int in_soc = -1;
+#ifdef LY_FIND_LEAKS
+PRIVATE void FreeHTAAUtil NOARGS
+{
+ FREE(buffer);
+}
+#endif /* LY_FIND_LEAKS */
+
/* PUBLIC HTAA_setupReader()
** SET UP HEADER LINE READER, i.e., give
** the already-read-but-not-yet-processed
@@ -468,14 +475,14 @@ PRIVATE int in_soc = -1;
** soc is the socket to use when start_of_headers
** buffer is used up.
** ON EXIT:
-** returns nothing.
+** returns nothing.
** Subsequent calls to HTAA_getUnfoldedLine()
** will use this buffer first and then
** proceed to read from socket.
*/
PUBLIC void HTAA_setupReader ARGS3(char *, start_of_headers,
- int, length,
- int, soc)
+ int, length,
+ int, soc)
{
if (!start_of_headers)
length = 0; /* initialize length (is this reached at all?) */
@@ -491,6 +498,7 @@ PUBLIC void HTAA_setupReader ARGS3(char *, start_of_headers,
(size_t)(sizeof(char)*(buffer_length + 1)));
}
if (buffer == NULL) outofmem(__FILE__, "HTAA_setupReader");
+ atexit(FreeHTAAUtil);
start_pointer = buffer;
if (start_of_headers) {
strncpy(buffer, start_of_headers, length);
@@ -601,5 +609,3 @@ PUBLIC char *HTAA_getUnfoldedLine NOARGS
} /* forever */
}
-
-
diff --git a/WWW/Library/Implementation/HTACL.c b/WWW/Library/Implementation/HTACL.c
deleted file mode 100644
index 64c8a1af..00000000
--- a/WWW/Library/Implementation/HTACL.c
+++ /dev/null
@@ -1,210 +0,0 @@
-
-/* MODULE HTACL.c
-** ACCESS CONTROL LIST ROUTINES
-**
-** AUTHORS:
-** AL Ari Luotonen luotonen@dxcern.cern.ch
-** MD Mark Donszelmann duns@vxdeop.cern.ch
-**
-** HISTORY:
-** 8 Nov 93 MD (VMS only) case insensitive compare reading acl entry, filename
-**
-**
-** BUGS:
-**
-**
-*/
-
-
-#include <HTUtils.h>
-#include <HTAAFile.h> /* File routines */
-#include <HTGroup.h> /* GroupDef */
-#include <HTACL.h> /* Implemented here */
-
-#include <LYLeaks.h>
-
-/* PRIVATE HTAA_getAclFilename()
-** RESOLVE THE FULL PATHNAME OF ACL FILE FOR A GIVEN FILE
-** ON ENTRY:
-** path is the pathname of the file for which to
-** ACL file should be found.
-**
-** ACL filename is computed by replacing
-** the filename by .www_acl in the pathname
-** (this is done to a local copy, of course).
-**
-** ON EXIT:
-** returns the absolute pathname of ACL file
-** (which is automatically freed next time
-** this function is called).
-*/
-PRIVATE char *HTAA_getAclFilename ARGS1(CONST char *, pathname)
-{
- static char * local_copy = NULL;
- static char * acl_path = NULL;
- char * directory = NULL;
- char * filename = NULL;
-
- StrAllocCopy(local_copy, pathname); /* Also frees local_copy */
- /* from previous call. */
-
- directory = local_copy;
- filename = strrchr(directory, '/');
- if (!filename) { /* No path in front of filename */
- directory = "."; /* So use current directory */
- filename = local_copy; /* and the pathname itself is the filename */
- }
- else {
- *filename = '\0'; /* Truncate filename off from directory path */
- filename++; /* and the filename begins from the next character */
- }
-
- StrAllocCopy(acl_path, directory); /* Also frees acl_path */
- /* from previous call. */
- StrAllocCat(acl_path, "/");
- StrAllocCat(acl_path, ACL_FILE_NAME);
-
- return acl_path;
-}
-
-
-/* PUBLIC HTAA_openAcl()
-** OPEN THE ACL FILE FOR THE GIVEN DOCUMENT
-** ON ENTRY:
-** pathname is the absolute pathname of
-** the file to be accessed.
-**
-** ON EXIT:
-** returns the FILE* to open ACL.
-** NULL, if ACL not found.
-*/
-PUBLIC FILE *HTAA_openAcl ARGS1(CONST char *, pathname)
-{
- return fopen(HTAA_getAclFilename(pathname), "r");
-}
-
-
-/* PUBLIC HTAA_closeAcl()
-** CLOSE ACL FILE
-** ON ENTRY:
-** acl_file is Access Control List file to close.
-**
-** ON EXIT:
-** returns nothing.
-*/
-PUBLIC void HTAA_closeAcl ARGS1(FILE *, acl_file)
-{
- if (acl_file) fclose(acl_file);
-}
-
-
-/* PUBLIC HTAA_getAclEntry()
-** CONSULT THE ACCESS CONTROL LIST AND
-** GIVE A LIST OF GROUPS (AND USERS)
-** AUTHORIZED TO ACCESS A GIVEN FILE
-** ON ENTRY:
-** acl_file is an open ACL file.
-** pathname is the absolute pathname of
-** the file to be accessed.
-** method is the method for which access is wanted.
-**
-** ALC FILE FORMAT:
-**
-** template : method, method, ... : group@addr, user, group, ...
-**
-** The last item is in fact in exactly the same format as
-** group definition in group file, i.e., everything that
-** follows the 'groupname:' part,
-** e.g.
-** user, group, user@address, group@address,
-** (user,group,...)@(address, address, ...)
-**
-** ON EXIT:
-** returns NULL, if there is no entry for the file in the ACL,
-** or ACL doesn't exist.
-** If there is, a GroupDef object containing the
-** group and user names allowed to access the file
-** is returned (this is automatically freed
-** next time this function is called).
-** IMPORTANT:
-** Returns the first entry with matching template and
-** method. This function should be called multiple times
-** to process all the valid entries (until it returns NULL).
-** This is because there can be multiple entries like:
-**
-** *.html : get,put : ari,timbl,robert
-** *.html : get : jim,james,jonathan,jojo
-**
-** NOTE:
-** The returned group definition may well contain references
-** to groups defined in group file. Therefore these references
-** must be resolved according to that rule file by function
-** HTAA_resolveGroupReferences() (group file is read in by
-** HTAA_readGroupFile()) and after that access authorization
-** can be checked with function HTAA_userAndInetGroup().
-*/
-PUBLIC GroupDef *HTAA_getAclEntry ARGS3(FILE *, acl_file,
- CONST char *, pathname,
- HTAAMethod, method)
-{
- static GroupDef * group_def = NULL;
- CONST char * filename;
- int len;
- char *buf;
-
- if (!acl_file) return NULL; /* ACL doesn't exist */
-
- if (group_def) {
- GroupDef_delete(group_def); /* From previous call */
- group_def = NULL;
- }
-
- if (!(filename = strrchr(pathname, '/')))
- filename = pathname;
- else filename++; /* Skip slash */
-
- len = strlen(filename);
-
- if (!(buf = (char*)malloc((strlen(filename)+2)*sizeof(char))))
- outofmem(__FILE__, "HTAA_getAuthorizedGroups");
-
- while (EOF != HTAAFile_readField(acl_file, buf, len+1)) {
-#ifdef VMS
- if (HTAA_templateCaseMatch(buf, filename))
-#else /* not VMS */
- if (HTAA_templateMatch(buf, filename))
-#endif /* not VMS */
- {
- HTList *methods = HTList_new();
- HTAAFile_readList(acl_file, methods, MAX_METHODNAME_LEN);
- CTRACE(tfp, "Filename '%s' matched template '%s', allowed methods:",
- filename, buf);
- if (HTAAMethod_inList(method, methods)) { /* right method? */
- CTRACE(tfp, " METHOD OK\n");
- HTList_delete(methods);
- methods = NULL;
- FREE(buf);
- group_def = HTAA_parseGroupDef(acl_file);
- /*
- ** HTAA_parseGroupDef() already reads the record
- ** separator so we don't call HTAAFile_nextRec().
- */
- return group_def;
- } else {
- CTRACE(tfp, " METHOD NOT FOUND\n");
- }
- HTList_delete(methods);
- methods = NULL;
- } /* if template match */
- else {
- CTRACE(tfp, "Filename '%s' didn't match template '%s'\n",
- filename, buf);
- }
-
- HTAAFile_nextRec(acl_file);
- } /* while not eof */
- FREE(buf);
-
- return NULL; /* No entry for requested file */
- /* (or an empty entry). */
-}
diff --git a/WWW/Library/Implementation/HTACL.h b/WWW/Library/Implementation/HTACL.h
deleted file mode 100644
index 1a7147f8..00000000
--- a/WWW/Library/Implementation/HTACL.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/* ACCESS CONTROL LIST ROUTINES
-
- */
-
-#ifndef HTACL_H
-#define HTACL_H
-
-#include <HTAAUtil.h>
-#include <HTGroup.h>
-
-/*
-
-Opening Access Control List File
-
- */
-
-/* PUBLIC HTAA_openAcl()
-** OPEN THE ACL FILE FOR THE GIVEN DOCUMENT
-** ON ENTRY:
-** pathname is the absolute pathname of
-** the file to be accessed.
-**
-** ON EXIT:
-** returns the FILE* to open ACL.
-** NULL, if ACL not found.
-*/
-PUBLIC FILE *HTAA_openAcl PARAMS((CONST char * pathname));
-
-
-/* PUBLIC HTAA_closeAcl()
-** CLOSE ACL FILE
-** ON ENTRY:
-** acl_file is Access Control List file to close.
-**
-** ON EXIT:
-** returns nothing.
-*/
-PUBLIC void HTAA_closeAcl PARAMS((FILE * acl_file));
-/*
-
-Getting ACL Entry
-
- */
-
-/* PUBLIC HTAA_getAclEntry()
-** CONSULT THE ACCESS CONTROL LIST AND
-** GIVE A LIST OF GROUPS (AND USERS)
-** AUTHORIZED TO ACCESS A GIVEN FILE
-** ON ENTRY:
-** acl_file is an open ACL file.
-** pathname is the absolute pathname of
-** the file to be accessed.
-** method is the method for which access is wanted.
-**
-** ALC FILE FORMAT:
-**
-** template : method, method, ... : group@addr, user, group, ...
-**
-** The last item is in fact in exactly the same format as
-** group definition in group file, i.e., everything that
-** follows the 'groupname:' part,
-** e.g.
-** user, group, user@address, group@address,
-** (user,group,...)@(address, address, ...)
-**
-** ON EXIT:
-** returns NULL, if there is no entry for the file in the ACL,
-** or ACL doesn't exist.
-** If there is, a GroupDef object containing the
-** group and user names allowed to access the file
-** is returned (this is automatically freed
-** next time this function is called).
-** IMPORTANT:
-** Returns the first entry with matching template and
-** method. This function should be called multiple times
-** to process all the valid entries (until it returns NULL).
-** This is because there can be multiple entries like:
-**
-** *.html : get,put : ari,timbl,robert
-** *.html : get : jim,james,jonathan,jojo
-**
-** NOTE:
-** The returned group definition may well contain references
-** to groups defined in group file. Therefore these references
-** must be resolved according to that rule file by function
-** HTAA_resolveGroupReferences() (group file is read in by
-** HTAA_readGroupFile()) and after that access authorization
-** can be checked with function HTAA_userAndInetGroup().
-*/
-PUBLIC GroupDef *HTAA_getAclEntry PARAMS((FILE * acl_file,
- CONST char * pathname,
- HTAAMethod method));
-/*
-
- */
-
-#endif /* not HTACL_H */
-/*
-
- End of file HTACL.h. */
diff --git a/WWW/Library/Implementation/HTAccess.c b/WWW/Library/Implementation/HTAccess.c
index 060e5acb..9d49018d 100644
--- a/WWW/Library/Implementation/HTAccess.c
+++ b/WWW/Library/Implementation/HTAccess.c
@@ -88,12 +88,14 @@ PUBLIC char *use_this_url_instead = NULL;
PRIVATE int pushed_assume_LYhndl = -1; /* see LYUC* functions below - kw */
PRIVATE char * pushed_assume_MIMEname = NULL;
+#ifdef LY_FIND_LEAKS
PRIVATE void free_protocols NOARGS
{
HTList_delete(protocols);
protocols = NULL;
FREE(pushed_assume_MIMEname); /* shouldn't happen, just in case - kw */
}
+#endif /* LY_FIND_LEAKS */
/* Register a Protocol. HTRegisterProtocol()
** --------------------
@@ -131,7 +133,9 @@ extern GLOBALREF (HTProtocol, HTTelnet);
extern GLOBALREF (HTProtocol, HTTn3270);
extern GLOBALREF (HTProtocol, HTRlogin);
#ifndef DECNET
+#ifndef DISABLE_FTP
extern GLOBALREF (HTProtocol, HTFTP);
+#endif /* DISABLE_FTP */
#ifndef DISABLE_NEWS
extern GLOBALREF (HTProtocol, HTNews);
extern GLOBALREF (HTProtocol, HTNNTP);
@@ -155,7 +159,9 @@ extern GLOBALREF (HTProtocol, HTWAIS);
#else
GLOBALREF HTProtocol HTTP, HTTPS, HTFile, HTTelnet, HTTn3270, HTRlogin;
#ifndef DECNET
+#ifndef DISABLE_FTP
GLOBALREF HTProtocol HTFTP;
+#endif /* DISABLE_FTP */
#ifndef DISABLE_NEWS
GLOBALREF HTProtocol HTNews, HTNNTP, HTNewsPost, HTNewsReply;
GLOBALREF HTProtocol HTSNews, HTSNewsPost, HTSNewsReply;
@@ -181,8 +187,10 @@ PRIVATE void HTAccessInit NOARGS /* Call me once */
HTRegisterProtocol(&HTTn3270);
HTRegisterProtocol(&HTRlogin);
#ifndef DECNET
-#ifndef DISABLE_NEWS
+#ifndef DISABLE_FTP
HTRegisterProtocol(&HTFTP);
+#endif /* DISABLE_FTP */
+#ifndef DISABLE_NEWS
HTRegisterProtocol(&HTNews);
HTRegisterProtocol(&HTNNTP);
HTRegisterProtocol(&HTNewsPost);
@@ -319,7 +327,7 @@ PUBLIC BOOL override_proxy ARGS1(
int t_len;
while (*no_proxy && (WHITE(*no_proxy) || *no_proxy == ','))
- no_proxy++; /* Skip whitespace and separators */
+ no_proxy++; /* Skip whitespace and separators */
end = no_proxy;
while (*end && !WHITE(*end) && *end != ',') { /* Find separator */
@@ -337,7 +345,7 @@ PUBLIC BOOL override_proxy ARGS1(
if ((!templ_port || templ_port == port) &&
(t_len > 0 && t_len <= h_len &&
- !strncasecomp(Host + h_len - t_len, no_proxy, t_len))) {
+ !strncasecomp(Host + h_len - t_len, no_proxy, t_len))) {
FREE(host);
return YES;
}
@@ -359,7 +367,7 @@ PUBLIC BOOL override_proxy ARGS1(
** anchor a parent anchor with whose address is addr
**
** On exit,
-** returns HT_NO_ACCESS Error has occurred.
+** returns HT_NO_ACCESS Error has occurred.
** HT_OK Success
*/
PRIVATE int get_physical ARGS2(
@@ -387,7 +395,7 @@ PRIVATE int get_physical ARGS2(
StrAllocCat(physical, "?0,0");
CTRACE(tfp, "HTAccess: Appending '?0,0' coordinate pair.\n");
HTAnchor_setPhysical(anchor, physical);
- FREE(physical); /* free our copy */
+ FREE(physical); /* free our copy */
} else {
HTAnchor_setPhysical(anchor, addr);
}
@@ -595,7 +603,7 @@ PRIVATE int LYUCPopAssumed NOARGS
return -1;
}
-/* Load a document HTLoad()
+/* Load a document HTLoad()
** ---------------
**
** This is an internal routine, which has an address AND a matching
@@ -606,7 +614,7 @@ PRIVATE int LYUCPopAssumed NOARGS
** anchor a parent anchor with whose address is addr
**
** On exit,
-** returns <0 Error has occurred.
+** returns <0 Error has occurred.
** HT_LOADED Success
** HT_NO_DATA Success, but no document loaded.
** (telnet session started etc)
@@ -671,7 +679,7 @@ PRIVATE BOOL HTLoadDocument ARGS4(
HTFormat, format_out,
HTStream*, sink)
{
- int status;
+ int status;
HText * text;
CONST char * address_to_load = full_address;
char *cp;
@@ -1148,7 +1156,7 @@ PUBLIC BOOL HTLoadAnchor ARGS1(
} /* HTLoadAnchor */
-/* Search. HTSearch()
+/* Search. HTSearch()
** -------
**
** Performs a keyword search on word given by the user. Adds the
@@ -1236,7 +1244,7 @@ PUBLIC BOOL HTSearch ARGS2(
return result;
}
-/* Search Given Indexname. HTSearchAbsolute()
+/* Search Given Indexname. HTSearchAbsolute()
** -----------------------
**
** Performs a keyword search on word given by the user. Adds the
diff --git a/WWW/Library/Implementation/HTAnchor.c b/WWW/Library/Implementation/HTAnchor.c
index 9bfd8ccf..aa6a8875 100644
--- a/WWW/Library/Implementation/HTAnchor.c
+++ b/WWW/Library/Implementation/HTAnchor.c
@@ -91,6 +91,7 @@ PRIVATE HTParentAnchor * HTParentAnchor_new NOARGS
newAnchor->date = NULL; /* Date. - FM */
newAnchor->expires = NULL; /* Expires. - FM */
newAnchor->last_modified = NULL; /* Last-Modified. - FM */
+ newAnchor->ETag = NULL; /* ETag (HTTP/1.1 cache validator) */
newAnchor->server = NULL; /* Server. - FM */
return(newAnchor);
}
@@ -279,6 +280,7 @@ PUBLIC HTChildAnchor * HTAnchor_findChildAndLink ARGS4(
return(child);
}
+#ifdef LY_FIND_LEAKS
/*
** Function for freeing the adult hash table. - FM
*/
@@ -315,6 +317,7 @@ PRIVATE void free_adult_table NOARGS
}
FREE(adult_table);
}
+#endif /* LY_FIND_LEAKS */
/* Create new or find old named anchor
** -----------------------------------
@@ -706,6 +709,7 @@ PUBLIC BOOL HTAnchor_delete ARGS1(
FREE(me->date);
FREE(me->expires);
FREE(me->last_modified);
+ FREE(me->ETag);
FREE(me->server);
#ifdef USE_HASH
FREE(me->style);
diff --git a/WWW/Library/Implementation/HTAnchor.h b/WWW/Library/Implementation/HTAnchor.h
index 8b72f8ff..cb47e52e 100644
--- a/WWW/Library/Implementation/HTAnchor.h
+++ b/WWW/Library/Implementation/HTAnchor.h
@@ -58,7 +58,7 @@ struct _HTParentAnchor {
char * post_data; /* Posting data */
char * post_content_type; /* Type of post data */
char * bookmark; /* Bookmark filename */
- HTFormat format; /* Pointer to node format descriptor */
+ HTFormat format; /* Pointer to node format descriptor */
char * charset; /* Pointer to character set (kludge, for now */
BOOL isIndex; /* Acceptance of a keyword search */
char * isIndexAction; /* URL of isIndex server */
@@ -75,7 +75,7 @@ struct _HTParentAnchor {
char * physical; /* Physical address */
BOOL underway; /* Document about to be attached to it */
BOOL isISMAPScript; /* Script for clickable image map */
- BOOL isHEAD; /* Document is headers from a HEAD request */
+ BOOL isHEAD; /* Document is headers from a HEAD request */
BOOL safe; /* Safe */
char * FileCache; /* Path to a disk-cached copy */
char * SugFname; /* Suggested filename */
@@ -90,11 +90,12 @@ struct _HTParentAnchor {
char * content_md5; /* Content-MD5 */
char * message_id; /* Message-ID */
char * subject; /* Subject */
- int content_length; /* Content-Length */
+ int content_length; /* Content-Length */
char * date; /* Date */
char * expires; /* Expires */
char * last_modified; /* Last-Modified */
- char * server; /* Server */
+ char * ETag; /* ETag (HTTP1.1 cache validator) */
+ char * server; /* Server */
UCAnchorInfo *UCStages; /* chartrans stages */
HTList * imaps; /* client side image maps */
};
@@ -146,10 +147,10 @@ extern HTChildAnchor * HTAnchor_findChild PARAMS((
** (Code originally in ParseHTML.h)
*/
extern HTChildAnchor * HTAnchor_findChildAndLink PARAMS((
- HTParentAnchor * parent, /* May not be 0 */
- CONST char * tag, /* May be "" or 0 */
- CONST char * href, /* May be "" or 0 */
- HTLinkType * ltype)); /* May be 0 */
+ HTParentAnchor * parent, /* May not be 0 */
+ CONST char * tag, /* May be "" or 0 */
+ CONST char * href, /* May be "" or 0 */
+ HTLinkType * ltype)); /* May be 0 */
/* Create new or find old named anchor
** -----------------------------------
@@ -181,7 +182,7 @@ extern BOOL HTAnchor_delete PARAMS((
** is put in the correct order as we load the document.
*/
extern void HTAnchor_makeLastChild PARAMS((
- HTChildAnchor * me));
+ HTChildAnchor * me));
/* Data access functions
** ---------------------
diff --git a/WWW/Library/Implementation/HTAtom.c b/WWW/Library/Implementation/HTAtom.c
index e4af2962..66e666dd 100644
--- a/WWW/Library/Implementation/HTAtom.c
+++ b/WWW/Library/Implementation/HTAtom.c
@@ -29,7 +29,9 @@ PRIVATE BOOL initialised = NO;
/*
* To free off all atoms.
*/
+#ifdef LY_FIND_LEAKS
PRIVATE void free_atoms NOPARAMS;
+#endif
/*
* Alternate hashing function.
@@ -85,6 +87,7 @@ PUBLIC HTAtom * HTAtom_for ARGS1(CONST char *, string)
return a;
}
+#ifdef LY_FIND_LEAKS
/*
* Purpose: Free off all atoms.
* Arguments: void
@@ -116,6 +119,7 @@ PRIVATE void free_atoms NOARGS
}
}
}
+#endif /* LY_FIND_LEAKS */
PRIVATE BOOL mime_match ARGS2(CONST char *, name,
CONST char *, templ)
diff --git a/WWW/Library/Implementation/HTAuth.c b/WWW/Library/Implementation/HTAuth.c
deleted file mode 100644
index 05ff06c9..00000000
--- a/WWW/Library/Implementation/HTAuth.c
+++ /dev/null
@@ -1,206 +0,0 @@
-
-/* MODULE HTAuth.c
-** USER AUTHENTICATION
-**
-** AUTHORS:
-** AL Ari Luotonen luotonen@dxcern.cern.ch
-**
-** HISTORY:
-** AL 14.10.93 Fixed the colon-not-allowed-in-password-bug.
-**
-** BUGS:
-**
-**
-*/
-
-#include <HTUtils.h>
-#include <HTPasswd.h> /* Password file routines */
-#include <HTAssoc.h>
-#include <HTAuth.h> /* Implemented here */
-#include <HTUU.h> /* Uuencoding and uudecoding */
-
-#include <LYLeaks.h>
-
-/* PRIVATE decompose_auth_string()
-** DECOMPOSE AUTHENTICATION STRING
-** FOR BASIC OR PUBKEY SCHEME
-** ON ENTRY:
-** authstring is the authorization string received
-** from browser.
-**
-** ON EXIT:
-** returns a node representing the user information
-** (as always, this is automatically freed
-** by AA package).
-*/
-PRIVATE HTAAUser *decompose_auth_string ARGS2(char *, authstring,
- HTAAScheme, scheme)
-{
- static HTAAUser *user = NULL;
- static char *cleartext = NULL;
- char *username = NULL;
- char *password = NULL;
- char *i_net_adr = NULL;
- char *timestamp = NULL;
- char *browsers_key = NULL;
-
- if (!user && !(user = (HTAAUser*)malloc(sizeof(HTAAUser)))) /* Allocated */
- outofmem(__FILE__, "decompose_auth_string"); /* only once */
-
- user->scheme = scheme;
- user->username = NULL; /* Not freed, because freeing */
- user->password = NULL; /* cleartext also frees these */
- user->inet_addr = NULL; /* See below: || */
- user->timestamp = NULL; /* || */
- user->secret_key = NULL; /* || */
- /* \/ */
- FREE(cleartext); /* From previous call. */
- /* NOTE: parts of this memory are pointed to by */
- /* pointers in HTAAUser structure. Therefore, */
- /* this also frees all the strings pointed to */
- /* by the static 'user'. */
-
- if (!authstring || !*authstring ||
- scheme != HTAA_BASIC || scheme == HTAA_PUBKEY)
- return NULL;
-
- if (scheme == HTAA_PUBKEY) { /* Decrypt authentication string */
- int bytes_decoded;
- char *ciphertext;
- int len = strlen(authstring) + 1;
-
- if (!(ciphertext = (char*)malloc(len)) ||
- !(cleartext = (char*)malloc(len)))
- outofmem(__FILE__, "decompose_auth_string");
-
- bytes_decoded = HTUU_decode(authstring,
- (unsigned char *)ciphertext, len);
- ciphertext[bytes_decoded] = (char)0;
-#ifdef PUBKEY
- HTPK_decrypt(ciphertext, cleartext, private_key);
-#endif
- FREE(ciphertext);
- }
- else { /* Just uudecode */
- int bytes_decoded;
- int len = strlen(authstring) + 1;
-
- if (!(cleartext = (char*)malloc(len)))
- outofmem(__FILE__, "decompose_auth_string");
- bytes_decoded = HTUU_decode(authstring,
- (unsigned char *)cleartext, len);
- cleartext[bytes_decoded] = (char)0;
- }
-
-
-/*
-** Extract username and password (for both schemes)
-*/
- username = cleartext;
- if (!(password = strchr(cleartext, ':'))) {
- CTRACE(tfp, "%s %s\n",
- "decompose_auth_string: password field",
- "missing in authentication string.\n");
- return NULL;
- }
- *(password++) = '\0';
-
-/*
-** Extract rest of the fields
-*/
- if (scheme == HTAA_PUBKEY) {
- if ( !(i_net_adr =strchr(password, ':')) ||
- (*(i_net_adr++) ='\0'), !(timestamp =strchr(i_net_adr,':')) ||
- (*(timestamp++) ='\0'), !(browsers_key=strchr(timestamp,':')) ||
- (*(browsers_key++)='\0')) {
-
- CTRACE(tfp, "%s %s\n",
- "decompose_auth_string: Pubkey scheme",
- "fields missing in authentication string");
- return NULL;
- }
- }
-
-/*
-** Set the fields into the result
-*/
- user->username = username;
- user->password = password;
- user->inet_addr = i_net_adr;
- user->timestamp = timestamp;
- user->secret_key = browsers_key;
-
- if (scheme == HTAA_BASIC) {
- CTRACE(tfp, "decompose_auth_string: %s (%s,%s)\n",
- "Basic scheme authentication string:",
- username, password);
- } else {
- CTRACE(tfp, "decompose_auth_string: %s (%s,%s,%s,%s,%s)\n",
- "Pubkey scheme authentication string:",
- username, password, i_net_adr, timestamp, browsers_key);
- }
-
- return user;
-}
-
-
-
-PRIVATE BOOL HTAA_checkTimeStamp ARGS1(CONST char *, timestamp GCC_UNUSED)
-{
- return NO; /* This is just a stub */
-}
-
-
-PRIVATE BOOL HTAA_checkInetAddress ARGS1(CONST char *, i_net_adr GCC_UNUSED)
-{
- return NO; /* This is just a stub */
-}
-
-
-/* SERVER PUBLIC HTAA_authenticate()
-** AUTHENTICATE USER
-** ON ENTRY:
-** scheme used authentication scheme.
-** scheme_specifics the scheme specific parameters
-** (authentication string for Basic and
-** Pubkey schemes).
-** prot is the protection information structure
-** for the file.
-**
-** ON EXIT:
-** returns NULL, if authentication failed.
-** Otherwise a pointer to a structure
-** representing authenticated user,
-** which should not be freed.
-*/
-PUBLIC HTAAUser *HTAA_authenticate ARGS3(HTAAScheme, scheme,
- char *, scheme_specifics,
- HTAAProt *, prot)
-{
- if (HTAA_UNKNOWN == scheme || !prot ||
- -1 == HTList_indexOf(prot->valid_schemes, (void*)scheme))
- return NULL;
-
- switch (scheme) {
- case HTAA_BASIC:
- case HTAA_PUBKEY:
- {
- HTAAUser *user = decompose_auth_string(scheme_specifics, scheme);
- /* Remember, user is auto-freed */
- if (user &&
- HTAA_checkPassword(user->username,
- user->password,
- HTAssocList_lookup(prot->values, "passw")) &&
- (HTAA_BASIC == scheme ||
- (HTAA_checkTimeStamp(user->timestamp) &&
- HTAA_checkInetAddress(user->inet_addr))))
- return user;
- else
- return NULL;
- }
- default:
- /* Other authentication routines go here */
- return NULL;
- }
-}
-
diff --git a/WWW/Library/Implementation/HTAuth.h b/WWW/Library/Implementation/HTAuth.h
deleted file mode 100644
index 6d49240d..00000000
--- a/WWW/Library/Implementation/HTAuth.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* AUTHENTICATION MODULE
-
- This is the authentication module. By modifying the function HTAA_authenticate() it can
- be made to support external authentication methods.
-
- */
-
-#ifndef HTAUTH_H
-#define HTAUTH_H
-
-#include <HTAAUtil.h>
-#include <HTAAProt.h>
-
-
-/*
-** Server's representation of a user (fields in authentication string)
-*/
-typedef struct {
- HTAAScheme scheme; /* Scheme used to authenticate this user */
- char * username;
- char * password;
- char * inet_addr;
- char * timestamp;
- char * secret_key;
-} HTAAUser;
-/*
-
-User Authentication
-
- */
-
-/* SERVER PUBLIC HTAA_authenticate()
-** AUTHENTICATE USER
-** ON ENTRY:
-** scheme used authentication scheme.
-** scheme_specifics the scheme specific parameters
-** (authentication string for Basic and
-** Pubkey schemes).
-** prot is the protection information structure
-** for the file.
-**
-** ON EXIT:
-** returns NULL, if authentication failed.
-** Otherwise a pointer to a structure
-** representing authenticated user,
-** which should not be freed.
-*/
-PUBLIC HTAAUser *HTAA_authenticate PARAMS((HTAAScheme scheme,
- char * scheme_specifics,
- HTAAProt * prot));
-/*
-
- */
-
-#endif /* not HTAUTH_H */
-/*
-
- End of file HTAuth.h. */
diff --git a/WWW/Library/Implementation/HTFTP.c b/WWW/Library/Implementation/HTFTP.c
index b8b1c4c2..4ec025ab 100644
--- a/WWW/Library/Implementation/HTFTP.c
+++ b/WWW/Library/Implementation/HTFTP.c
@@ -104,7 +104,6 @@ BUGS: @@@ Limit connection cache size!
#include <HTFile.h> /* For HTFileFormat() */
#include <HTBTree.h>
#include <HTChunk.h>
-#include <HTAlert.h>
#ifndef IPPORT_FTP
#define IPPORT_FTP 21
#endif /* !IPORT_FTP */
@@ -114,9 +113,9 @@ BUGS: @@@ Limit connection cache size!
#include <LYLeaks.h>
typedef struct _connection {
- struct _connection * next; /* Link on list */
+ struct _connection * next; /* Link on list */
u_long addr; /* IP address */
- int socket; /* Socket number for communication */
+ int socket; /* Socket number for communication */
BOOL binary; /* Binary mode? */
} connection;
@@ -143,6 +142,7 @@ struct _HTStructured {
** ---------------------
*/
PUBLIC int HTfileSortMethod = FILE_BY_NAME;
+#ifndef DISABLE_FTP /*This disables everything to end-of-file */
PRIVATE char ThisYear[8];
PRIVATE char LastYear[8];
PRIVATE int TheDate;
@@ -209,6 +209,7 @@ PRIVATE int close_connection PARAMS((
connection * con));
+#ifdef LY_FIND_LEAKS
/*
** This function frees module globals. - FM
*/
@@ -222,6 +223,7 @@ PRIVATE void free_FTPGlobals NOARGS
FREE(control);
}
}
+#endif /* LY_FIND_LEAKS */
/* PUBLIC HTMake_VMS_name()
** CONVERTS WWW name into a VMS name
@@ -230,7 +232,7 @@ PRIVATE void free_FTPGlobals NOARGS
** fn WWW file name
**
** ON EXIT:
-** returns vms file specification
+** returns vms file specification
**
** Bug: Returns pointer to static -- non-reentrant
*/
@@ -250,7 +252,7 @@ PUBLIC char * HTMake_VMS_name ARGS2(
char * filename = (char*)malloc(strlen(fn)+1);
char * nodename = (char*)malloc(strlen(nn)+2+1); /* Copies to hack */
char *second; /* 2nd slash */
- char *last; /* last slash */
+ char *last; /* last slash */
CONST char * hostname = HTHostName();
@@ -269,7 +271,7 @@ PUBLIC char * HTMake_VMS_name ARGS2(
r = strchr(nodename, '.'); /* Mismatch */
if (r)
*r = '\0'; /* Chop domain */
- strcat(nodename, "::"); /* Try decnet anyway */
+ strcat(nodename, "::"); /* Try decnet anyway */
break;
}
}
@@ -281,12 +283,12 @@ PUBLIC char * HTMake_VMS_name ARGS2(
if (!second) { /* Only one slash */
sprintf(vmsname, "%s%s", nodename, filename + 1);
} else if (second == last) { /* Exactly two slashes */
- *second = '\0'; /* Split filename from disk */
+ *second = '\0'; /* Split filename from disk */
sprintf(vmsname, "%s%s:%s", nodename, filename+1, second+1);
*second = '/'; /* restore */
} else { /* More than two slashes */
char * p;
- *second = '\0'; /* Split disk from directories */
+ *second = '\0'; /* Split disk from directories */
*last = '\0'; /* Split dir from filename */
sprintf(vmsname, "%s%s:[%s]%s",
nodename, filename+1, second+1, last+1);
@@ -365,7 +367,7 @@ PRIVATE void init_help_message_cache NOARGS
}
PRIVATE void help_message_cache_add ARGS1(
- char *, string)
+ char *, string)
{
if (help_message_buffer)
StrAllocCat(help_message_buffer, string);
@@ -406,9 +408,9 @@ PRIVATE char *help_message_cache_contents NOARGS
** or negative for communication failure.
*/
PRIVATE int response ARGS1(
- char *, cmd)
+ char *, cmd)
{
- int result; /* Three-digit decimal code */
+ int result; /* Three-digit decimal code */
int continuation_response = -1;
int status;
@@ -670,7 +672,7 @@ PRIVATE int get_connection ARGS2(
if (p2 != NULL) {
username = p1;
- *p2 = '\0'; /* terminate */
+ *p2 = '\0'; /* terminate */
p1 = p2+1; /* point to host */
pw = strchr(username, ':');
if (pw != NULL) {
@@ -966,7 +968,7 @@ PRIVATE int get_connection ARGS2(
CTRACE(tfp, "HTFTP: Port defined.\n");
}
#endif /* NOTREPEAT_PORT */
- return con->socket; /* Good return */
+ return con->socket; /* Good return */
}
@@ -1002,7 +1004,7 @@ PRIVATE int close_master_socket NOARGS
** On entry,
** master_socket Must be negative if not set up already.
** On exit,
-** Returns socket number if good
+** Returns socket number if good
** less than zero if error.
** master_socket is socket number if good, else negative.
** port_number is valid if good.
@@ -1133,7 +1135,7 @@ PRIVATE int get_listen_socket NOARGS
/* Now we must find out who we are to tell the other guy
*/
- (void)HTHostName(); /* Make address valid - doesn't work*/
+ (void)HTHostName(); /* Make address valid - doesn't work*/
sprintf(port_command, "PORT %d,%d,%d,%d,%d,%d%c%c",
(int)*((unsigned char *)(&soc_in->sin_addr)+0),
(int)*((unsigned char *)(&soc_in->sin_addr)+1),
@@ -1241,7 +1243,7 @@ PRIVATE void free_entryinfo_struct_contents ARGS1(
* "FCv 23 1990 " ...
*/
PRIVATE BOOLEAN is_ls_date ARGS1(
- char *, s)
+ char *, s)
{
/* must start with three alpha characters */
if (!isalpha(*s++) || !isalpha(*s++) || !isalpha(*s++))
@@ -1310,7 +1312,7 @@ PRIVATE BOOLEAN is_ls_date ARGS1(
* Extract the name, size, and date from an EPLF line. - 08-06-96 DJB
*/
PRIVATE void parse_eplf_line ARGS2(
- char *, line,
+ char *, line,
EntryInfo *, info)
{
char *cp = line;
@@ -1366,7 +1368,7 @@ PRIVATE void parse_eplf_line ARGS2(
* Extract the name, size, and date from an ls -l line.
*/
PRIVATE void parse_ls_line ARGS2(
- char *, line,
+ char *, line,
EntryInfo *, entry_info)
{
short i, j;
@@ -1405,7 +1407,7 @@ PRIVATE void parse_ls_line ARGS2(
* into the EntryInfo structure - FM
*/
PRIVATE void parse_vms_dir_entry ARGS2(
- char *, line,
+ char *, line,
EntryInfo *, entry_info)
{
int i, j;
@@ -1527,15 +1529,15 @@ PRIVATE void parse_vms_dir_entry ARGS2(
/* We just initialized on the version number */
/* Now let's hunt for a lone, size number */
while ((cps=strtok(NULL, sp)) != NULL) {
- cpd = cps;
- while (isdigit(*cpd))
- cpd++;
- if (*cpd == '\0') {
- /* Assume it's blocks */
- entry_info->size = atoi(cps) * 512;
- break;
- }
- }
+ cpd = cps;
+ while (isdigit(*cpd))
+ cpd++;
+ if (*cpd == '\0') {
+ /* Assume it's blocks */
+ entry_info->size = atoi(cps) * 512;
+ break;
+ }
+ }
}
/** Wrap it up **/
@@ -1552,7 +1554,7 @@ PRIVATE void parse_vms_dir_entry ARGS2(
* the EntryInfo structure (assumes Chameleon NEWT format). - FM
*/
PRIVATE void parse_ms_windows_dir_entry ARGS2(
- char *, line,
+ char *, line,
EntryInfo *, entry_info)
{
char *cp = line;
@@ -1626,7 +1628,7 @@ PRIVATE void parse_ms_windows_dir_entry ARGS2(
*/
#ifdef NOTDEFINED
PRIVATE void parse_windows_nt_dir_entry ARGS2(
- char *, line,
+ char *, line,
EntryInfo *, entry_info)
{
char *cp = line;
@@ -1680,7 +1682,7 @@ PRIVATE void parse_windows_nt_dir_entry ARGS2(
isdigit(*(cp+3)) && isdigit(*(cp+4)) && *(cp+5) == '-') {
*(cp+2) = '\0'; /* Month */
i = atoi(cp) - 1;
- *(cp+5) = '\0'; /* Day */
+ *(cp+5) = '\0'; /* Day */
sprintf(date, "%s %s", months[i], (cp+3));
if (date[4] == '0')
date[4] = ' ';
@@ -1737,7 +1739,7 @@ PRIVATE void parse_windows_nt_dir_entry ARGS2(
* the EntryInfo structure. - FM
*/
PRIVATE void parse_cms_dir_entry ARGS2(
- char *, line,
+ char *, line,
EntryInfo *, entry_info)
{
char *cp = line;
@@ -1837,7 +1839,7 @@ PRIVATE void parse_cms_dir_entry ARGS2(
*(cpd+8) = '\0'; /* Year */
cps -= 5; /* Time */
if (*cpd == ' ')
- *cpd = '0';
+ *cpd = '0';
i = atoi(cpd) - 1;
sprintf(date, "%s %s", months[i], (cpd+3));
if (date[4] == '0')
@@ -1881,7 +1883,7 @@ PRIVATE void parse_cms_dir_entry ARGS2(
*/
PRIVATE EntryInfo * parse_dir_entry ARGS2(
- char *, entry,
+ char *, entry,
BOOLEAN *, first)
{
EntryInfo *entry_info;
@@ -2284,9 +2286,9 @@ PRIVATE int compare_EntryInfo_structs ARGS2(
**
** On entry,
** anchor Parent anchor to link the this node to
-** address Address of the directory
+** address Address of the directory
** On exit,
-** returns HT_LOADED if OK
+** returns HT_LOADED if OK
** <0 if error.
*/
PRIVATE int read_directory ARGS4(
@@ -2378,7 +2380,7 @@ PRIVATE int read_directory ARGS4(
/* read directory entry
*/
- for (;;) { /* Read in one line as filename */
+ for (;;) { /* Read in one line as filename */
ic = NEXT_DATA_CHAR;
AgainForMultiNet:
if (interrupted_in_next_data_char) {
@@ -2420,10 +2422,10 @@ AgainForMultiNet:
break;
}
else
- break; /* finish getting one entry */
+ break; /* finish getting one entry */
}
} else if (ic == EOF) {
- break; /* End of file */
+ break; /* End of file */
} else {
HTChunkPutc(chunk, (char)ic);
}
@@ -2558,7 +2560,7 @@ unload_btree:
** On entry,
** name WWW address of a file: document, including hostname
** On exit,
-** returns Socket number for file if good.
+** returns Socket number for file if good.
** <0 if bad.
*/
PUBLIC int HTFTPLoad ARGS4(
@@ -2613,7 +2615,7 @@ PUBLIC int HTFTPLoad ARGS4(
if (status != 2) { /* Could have timed out */
if (status < 0)
continue; /* try again - net error*/
- return -status; /* bad reply */
+ return -status; /* bad reply */
}
CTRACE(tfp, "HTFTP: Port defined.\n");
}
@@ -2631,7 +2633,7 @@ PUBLIC int HTFTPLoad ARGS4(
if (status != 2) {
if (status < 0)
continue; /* retry or Bad return */
- return -status; /* bad reply */
+ return -status; /* bad reply */
}
for (p = response_text; *p && *p != ','; p++)
; /* null body */
@@ -3122,7 +3124,7 @@ PUBLIC int HTFTPLoad ARGS4(
if (!(type) || (type && *type != 'D')) {
status = send_cmd_2("RETR", filename);
} else {
- status = 5; /* Failed status set as flag. - FM */
+ status = 5; /* Failed status set as flag. - FM */
}
if (status != 1) { /* Failed : try to CWD to it */
/** Clear any login messages if this isn't the login directory **/
@@ -3282,3 +3284,5 @@ PUBLIC void HTClearFTPPassword NOARGS
*/
FREE(user_entered_password);
}
+
+#endif /* ifndef DISABLE_FTP */
diff --git a/WWW/Library/Implementation/HTFile.c b/WWW/Library/Implementation/HTFile.c
index 5991ca7d..3a16e31e 100644
--- a/WWW/Library/Implementation/HTFile.c
+++ b/WWW/Library/Implementation/HTFile.c
@@ -148,7 +148,9 @@ int exists(char *filename)
/* To free up the suffixes at program exit.
** ----------------------------------------
*/
+#ifdef LY_FIND_LEAKS
PRIVATE void free_suffixes NOPARAMS;
+#endif
#ifdef LONG_LIST
PRIVATE char *FormatStr ARGS3(
@@ -183,11 +185,11 @@ PRIVATE char *FormatNum ARGS3(
}
PRIVATE void LYListFmtParse ARGS5(
- char *, fmtstr,
- char *, file,
+ char *, fmtstr,
+ char *, file,
HTStructured *, target,
- char *, entry,
- char *, tail)
+ char *, entry,
+ char *, tail)
{
char c;
char *s;
@@ -246,7 +248,7 @@ PRIVATE void LYListFmtParse ARGS5(
while (isdigit(*s) || *s == '.' || *s == '-' || *s == ' ' ||
*s == '#' || *s == '+' || *s == '\'')
s++;
- c = *s; /* the format char. or \0 */
+ c = *s; /* the format char. or \0 */
*s = '\0';
switch (c) {
@@ -347,7 +349,7 @@ PRIVATE void LYListFmtParse ARGS5(
case S_IFLNK: type = 'l'; break;
#endif
#ifdef S_IFSOCK
-# ifdef S_IFIFO /* some older machines (e.g., apollo) have a conflict */
+# ifdef S_IFIFO /* some older machines (e.g., apollo) have a conflict */
# if S_IFIFO != S_IFSOCK
case S_IFSOCK: type = 's'; break;
# endif
@@ -480,6 +482,7 @@ PUBLIC void HTSetSuffix5 ARGS5(
suff->quality = value;
}
+#ifdef LY_FIND_LEAKS
/*
** Purpose: Free all added suffixes.
** Arguments: void
@@ -511,6 +514,7 @@ PRIVATE void free_suffixes NOARGS
HTList_delete(HTSuffixes);
HTSuffixes = NULL;
}
+#endif /* LY_FIND_LEAKS */
/* Send README file.
** -----------------
@@ -1074,7 +1078,7 @@ PUBLIC float HTFileValue ARGS1(
return suff->quality; /* OK -- found */
}
}
- return 0.3; /* Dunno! */
+ return 0.3; /* Dunno! */
}
/* Determine write access to a file.
@@ -1119,9 +1123,9 @@ PUBLIC BOOL HTEditable ARGS1(
#else
GETGROUPS_T groups[NGROUPS];
uid_t myUid;
- int ngroups; /* The number of groups */
+ int ngroups; /* The number of groups */
struct stat fileStatus;
- int i;
+ int i;
if (stat(filename, &fileStatus)) /* Get details of filename */
return NO; /* Can't even access file! */
@@ -1467,7 +1471,7 @@ PUBLIC BOOL HTDirTitles ARGS3(
** This is the physical address of the file
**
** On exit:
-** returns <0 Error has occurred.
+** returns <0 Error has occurred.
** HTLOADED OK
**
*/
@@ -1516,7 +1520,11 @@ PUBLIC int HTLoadFile ARGS4(
FREE(filename);
FREE(nodename);
FREE(acc_method);
+#ifndef DISABLE_FTP
return HTFTPLoad(addr, anchor, format_out, sink);
+#else
+ return -1;
+#endif /* DISABLE_FTP */
} else {
FREE(newname);
FREE(acc_method);
@@ -1792,7 +1800,7 @@ PUBLIC int HTLoadFile ARGS4(
if (!base || base == localname) {
forget_multi = YES;
} else {
- *base++ = '\0'; /* Just got directory name */
+ *base++ = '\0'; /* Just got directory name */
baselen = strlen(base)- strlen(MULTI_SUFFIX);
base[baselen] = '\0'; /* Chop off suffix */
@@ -1873,7 +1881,7 @@ PUBLIC int HTLoadFile ARGS4(
best_enc = enc;
best = value;
StrAllocCopy(best_name, dirbuf->d_name);
- }
+ }
} /* if best so far */
} /* if match */
@@ -1883,7 +1891,7 @@ PUBLIC int HTLoadFile ARGS4(
if (best_rep) {
format = best_rep;
myEncoding = best_enc;
- base[-1] = '/'; /* Restore directory name */
+ base[-1] = '/'; /* Restore directory name */
base[0] = '\0';
StrAllocCat(localname, best_name);
FREE(best_name);
@@ -1910,7 +1918,7 @@ PUBLIC int HTLoadFile ARGS4(
if (stat(localname,&dir_info) == -1) /* get file information */
#endif
{
- /* if can't read file information */
+ /* if can't read file information */
CTRACE(tfp, "HTLoadFile: can't stat %s\n", localname);
} else { /* Stat was OK */
@@ -2416,7 +2424,11 @@ PUBLIC int HTLoadFile ARGS4(
* is file://localhost
*/
} else {
+#ifndef DISABLE_FTP
return HTFTPLoad(addr, anchor, format_out, sink);
+#else
+ return -1;
+#endif /* DISABLE_FTP */
}
}
FREE(nodename);
diff --git a/WWW/Library/Implementation/HTFormat.c b/WWW/Library/Implementation/HTFormat.c
index 23b16db5..9ca69568 100644
--- a/WWW/Library/Implementation/HTFormat.c
+++ b/WWW/Library/Implementation/HTFormat.c
@@ -75,7 +75,9 @@ PUBLIC HTPresentation * default_presentation = NULL;
/*
* To free off the presentation list.
*/
+#ifdef LY_FIND_LEAKS
PRIVATE void HTFreePresentations NOPARAMS;
+#endif
/* Define a presentation system command for a content-type
** -------------------------------------------------------
@@ -157,6 +159,7 @@ PUBLIC void HTSetConversion ARGS7(
HTList_addObject(HTPresentations, pres);
}
+#ifdef LY_FIND_LEAKS
/*
** Purpose: Free the presentation list.
** Arguments: void
@@ -189,6 +192,7 @@ PRIVATE void HTFreePresentations NOARGS
HTList_delete(HTPresentations);
HTPresentations = NULL;
}
+#endif /* LY_FIND_LEAKS */
/* File buffering
** --------------
diff --git a/WWW/Library/Implementation/HTGopher.c b/WWW/Library/Implementation/HTGopher.c
index 5b4ee335..225d6dfb 100644
--- a/WWW/Library/Implementation/HTGopher.c
+++ b/WWW/Library/Implementation/HTGopher.c
@@ -31,7 +31,7 @@
#define GOPHER_PORT 70 /* See protocol spec */
#define CSO_PORT 105 /* See protocol spec */
#define BIG 1024 /* Bug */
-#define LINE_LENGTH 256 /* Bug */
+#define LINE_LENGTH 256 /* Bug */
/*
** Gopher entity types.
@@ -41,7 +41,7 @@
#define GOPHER_CSO '2'
#define GOPHER_ERROR '3'
#define GOPHER_MACBINHEX '4'
-#define GOPHER_PCBINARY '5'
+#define GOPHER_PCBINARY '5'
#define GOPHER_UUENCODED '6'
#define GOPHER_INDEX '7'
#define GOPHER_TELNET '8'
@@ -58,7 +58,7 @@
#define GOPHER_PLUS_IMAGE ':' /* Addition from Gopher Plus */
#define GOPHER_PLUS_MOVIE ';'
#define GOPHER_PLUS_SOUND '<'
-#define GOPHER_PLUS_PDF 'P'
+#define GOPHER_PLUS_PDF 'P'
#include <HTFormat.h>
@@ -99,20 +99,20 @@ struct _HTStream
HTStreamClass * isa; /* For form-based CSO gateway - FM */
};
-typedef struct _CSOfield_info { /* For form-based CSO gateway - FM */
+typedef struct _CSOfield_info { /* For form-based CSO gateway - FM */
struct _CSOfield_info * next;
char * name;
char * attributes;
char * description;
- int id;
- int lookup;
- int indexed;
- int url;
- int max_size;
- int defreturn;
- int explicit_return;
- int reserved;
- int public;
+ int id;
+ int lookup;
+ int indexed;
+ int url;
+ int max_size;
+ int defreturn;
+ int explicit_return;
+ int reserved;
+ int public;
char name_buf[16]; /* Avoid malloc if we can */
char desc_buf[32]; /* Avoid malloc if we can */
char attr_buf[80]; /* Avoid malloc if we can */
@@ -124,13 +124,13 @@ typedef struct _CSOformgen_context { /* For form-based CSO gateway - FM */
char * host;
char * seek;
CSOfield_info * fld;
- int port;
- int cur_line;
- int cur_off;
- int rep_line;
- int rep_off;
- int public_override;
- int field_select;
+ int port;
+ int cur_line;
+ int cur_off;
+ int rep_line;
+ int rep_off;
+ int public_override;
+ int field_select;
} CSOformgen_context;
/* Matrix of allowed characters in filenames
@@ -744,8 +744,8 @@ PRIVATE void free_CSOfields NOPARAMS
** =========================================
*/
PRIVATE void interpret_cso_key ARGS5(
- char *, key,
- char *, buf,
+ char *, key,
+ char *, buf,
int *, length,
CSOformgen_context *, ctx,
HTStream *, Target)
@@ -921,7 +921,7 @@ PRIVATE int parse_cso_field_info ARGS1(
** ================================================
*/
PRIVATE int parse_cso_fields ARGS2(
- char *, buf,
+ char *, buf,
int, size)
{
int ich;
@@ -1086,9 +1086,9 @@ PRIVATE int parse_cso_fields ARGS2(
** ====================================================
*/
PRIVATE int generate_cso_form ARGS4(
- char *, host,
+ char *, host,
int, port,
- char *, buf,
+ char *, buf,
HTStream *, Target)
{
int i, j, length;
@@ -1442,7 +1442,7 @@ PRIVATE int HTLoadCSO ARGS4(
static CONST char end_form[] = "</BODY>\n</HTML>\n";
char *host, *cp;
int port = CSO_PORT;
- int status; /* tcp return */
+ int status; /* tcp return */
char *command = NULL;
char *content = NULL;
int len, i, j, start, finish, flen, ndx;
@@ -1686,8 +1686,8 @@ PRIVATE int HTLoadGopher ARGS4(
HTStream*, sink)
{
char *command; /* The whole command */
- int status; /* tcp return */
- char gtype; /* Gopher Node type */
+ int status; /* tcp return */
+ char gtype; /* Gopher Node type */
char * selector; /* Selector string */
if (!acceptable_inited)
@@ -1720,8 +1720,13 @@ PRIVATE int HTLoadGopher ARGS4(
** If it's a port 79/0[/...] URL, use the finger gateway. - FM
*/
if (strstr(arg, ":79/0") != NULL) {
+#ifndef DISABLE_FINGER
CTRACE(tfp, "HTGopher: Passing to finger gateway.\n");
return HTLoadFinger(arg, anAnchor, format_out, sink);
+#else /* finger is disabled */
+ HTAlert(gettext("Unable to access document!"));
+ return HT_NOT_LOADED;
+#endif /* DISABLE_FINGER */
}
/*
diff --git a/WWW/Library/Implementation/HTHistory.c b/WWW/Library/Implementation/HTHistory.c
deleted file mode 100644
index d314c0f5..00000000
--- a/WWW/Library/Implementation/HTHistory.c
+++ /dev/null
@@ -1,156 +0,0 @@
-#include <HTUtils.h>
-
-#include <HTHistory.h>
-
-#include <LYLeaks.h>
-
-static HTList * history; /* List of visited anchors */
-
-
-/* Navigation
-** ==========
-*/
-
-/* Record the jump to an anchor
-** ----------------------------
-*/
-
-void HTHistory_record
- ARGS1 (HTAnchor *,destination)
-{
- if (destination) {
- if (! history)
- history = HTList_new();
- HTList_addObject (history, destination);
- }
-}
-
-/* Go back in history (find the last visited node)
-** ------------------
-*/
-
-HTAnchor * HTHistory_backtrack
- NOARGS /* FIXME: Should we add a `sticky' option ? */
-{
- if (HTHistory_canBacktrack())
- HTList_removeLastObject(history);
- return(HTAnchor *)HTList_lastObject(history); /* is Home if can't backtrack */
-}
-
-BOOL HTHistory_canBacktrack
- NOARGS
-{
- return (HTList_objectAt (history, 1) != NULL);
-}
-
-/* Browse through references in the same parent node
-** -------------------------------------------------
-**
-** Take the n-th child's link after or before the one we took to get here.
-** Positive offset means go towards most recently added children.
-*/
-
-HTAnchor * HTHistory_moveBy
- ARGS1 (int,offset)
-{
- HTAnchor * last = (HTAnchor *)HTList_objectAt (history, 1);
- if (! last)
- return NULL; /* No last visited node */
- if (last != (HTAnchor *) last->parent) { /* Was a child */
- HTList * kids = last->parent->children;
- int i = HTList_indexOf (kids, last);
- HTAnchor * nextOne = (HTAnchor *)HTList_objectAt (kids, i - offset);
- if (nextOne) {
- HTAnchor * destination = HTAnchor_followMainLink (nextOne);
- if (destination) {
- HTList_removeLastObject (history);
- HTList_removeLastObject (history);
- HTList_addObject (history, nextOne);
- HTList_addObject (history, destination);
- }
- return destination;
- } else {
- CTRACE(tfp, "HTHistory_moveBy: offset by %+d goes out of list %p.\n",
- offset, (void*)kids);
- return NULL;
- }
- } else { /* Was a parent */
- return NULL; /* FIXME we could possibly follow the next link... */
- }
-}
-
-BOOL HTHistory_canMoveBy
- ARGS1 (int,offset)
-{
- HTAnchor * last = (HTAnchor *)HTList_objectAt (history, 1);
- if (! last)
- return NO; /* No last visited node */
- if (last != (HTAnchor *) last->parent) { /* Was a child */
- HTList * kids = last->parent->children;
- int i = HTList_indexOf (kids, last);
- return (HTList_objectAt (kids, i - offset) != NULL);
- } else { /* Was a parent */
- return NO; /* FIXME we could possibly follow the next link... */
- }
-}
-
-
-/* Retrieval
-** =========
-*/
-
-/* Read numbered visited anchor (1 is the oldest)
-** ----------------------------
-*/
-
-HTAnchor * HTHistory_read
- ARGS1 (int,number)
-{
- return (HTAnchor *)HTList_objectAt(history, HTList_count (history) - number);
-}
-
-
-/* Recall numbered visited anchor (1 is the oldest)
-** ------------------------------
-** This reads the anchor and stores it again in the list, except if last.
-*/
-
-HTAnchor * HTHistory_recall
- ARGS1 (int,number)
-{
- HTAnchor * destination =
- (HTAnchor *)HTList_objectAt (history, HTList_count (history) - number);
- if (destination && destination != (HTAnchor *)HTList_lastObject (history))
- HTList_addObject (history, destination);
- return destination;
-}
-
-/* Number of Anchors stored
-** ------------------------
-**
-** This is needed in order to check the validity of certain commands
-** for menus, etc.
-(not needed for now. Use canBacktrack, etc.)
-int HTHistory_count
- NOARGS
-{
- return HTList_count (history);
-}
-*/
-
-/* Change last history entry
-** -------------------------
-**
-** Sometimes we load a node by one anchor but leave by a different
-** one, and it is the one we left from which we want to remember.
-*/
-
-void HTHistory_leavingFrom
- ARGS1 (HTAnchor *,anchor)
-{
- if (HTList_removeLastObject (history)) {
- HTList_addObject (history, anchor);
- } else {
- CTRACE(tfp, "HTHistory_leavingFrom: empty history !\n");
- }
-}
diff --git a/WWW/Library/Implementation/HTHistory.h b/WWW/Library/Implementation/HTHistory.h
deleted file mode 100644
index a86be500..00000000
--- a/WWW/Library/Implementation/HTHistory.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/* */
-
-#ifndef HTHISTORY_H
-#define HTHISTORY_H
-
-#include <HTAnchor.h>
-
-/* Navigation
-** ==========
-*/
-
-/* Record the jump to an anchor
-** ----------------------------
-*/
-
-extern void HTHistory_record
- PARAMS(
- (HTAnchor * destination)
- );
-
-/* Go back in history (find the last visited node)
-** ------------------
-*/
-
-extern HTAnchor * HTHistory_backtrack
- NOPARAMS; /* FIXME: Should we add a `sticky' option ? */
-
-extern BOOL HTHistory_canBacktrack
- NOPARAMS;
-
-/* Browse through references in the same parent node
-** -------------------------------------------------
-**
-** Take the n-th child's link after or before the one we took to get here.
-** Positive offset means go towards most recently added children.
-*/
-
-extern HTAnchor * HTHistory_moveBy
- PARAMS(
- (int offset)
- );
-
-extern BOOL HTHistory_canMoveBy
- PARAMS(
- (int offset)
- );
-
-#define HTHistory_next (HTHistory_moveBy (+1))
-#define HTHistory_canNext (HTHistory_canMoveBy (+1))
-#define HTHistory_previous (HTHistory_moveBy (-1))
-#define HTHistory_canPrevious (HTHistory_canMoveBy (-1))
-
-
-/* Retrieval
-** =========
-*/
-
-/* Read numbered visited anchor (1 is the oldest)
-** ----------------------------
-*/
-
-extern HTAnchor * HTHistory_read
- PARAMS(
- (int number)
- );
-
-/* Recall numbered visited anchor (1 is the oldest)
-** ------------------------------
-** This reads the anchor and stores it again in the list, except if last.
-*/
-
-extern HTAnchor * HTHistory_recall
- PARAMS(
- (int number)
- );
-
-/* Number of Anchors stored
-** ------------------------
-**
-** This is needed in order to check the validity of certain commands
-** for menus, etc.
-(not needed for now. Use canBacktrack, etc.)
-extern int HTHistory_count NOPARAMS;
-*/
-
-/* Change last history entry
-** -------------------------
-**
-** Sometimes we load a node by one anchor but leave by a different
-** one, and it is the one we left from which we want to remember.
-*/
-extern void HTHistory_leavingFrom
- PARAMS(
- (HTAnchor * anchor)
- );
-
-#endif /* HTHISTORY_H */
-/*
-
- */
diff --git a/WWW/Library/Implementation/HTMIME.c b/WWW/Library/Implementation/HTMIME.c
index c27e1f3b..a688e03a 100644
--- a/WWW/Library/Implementation/HTMIME.c
+++ b/WWW/Library/Implementation/HTMIME.c
@@ -1469,9 +1469,18 @@ PRIVATE void HTMIME_put_character ARGS2(
StrAllocCopy(me->anchor->date, me->value);
break;
case miETAG:
- HTMIME_TrimDoubleQuotes(me->value);
- CTRACE(tfp, "HTMIME: PICKED UP ETag: '%s'\n",
+ /* Do not trim double quotes:
+ * an entity tag consists of an opaque quoted string,
+ * possibly prefixed by a weakness indicator.
+ */
+ CTRACE(tfp, "HTMIME: PICKED UP ETag: %s\n",
me->value);
+ if (!(me->value && *me->value))
+ break;
+ /*
+ ** Indicate in anchor. - FM
+ */
+ StrAllocCopy(me->anchor->ETag, me->value);
break;
case miEXPIRES:
HTMIME_TrimDoubleQuotes(me->value);
@@ -1774,6 +1783,7 @@ PUBLIC HTStream* HTMIMEConvert ARGS3(
FREE(me->anchor->date);
FREE(me->anchor->expires);
FREE(me->anchor->last_modified);
+ FREE(me->anchor->ETag);
FREE(me->anchor->server);
me->target = NULL;
me->state = miBEGINNING_OF_LINE;
diff --git a/WWW/Library/Implementation/HTNews.c b/WWW/Library/Implementation/HTNews.c
index 9f817043..61858d30 100644
--- a/WWW/Library/Implementation/HTNews.c
+++ b/WWW/Library/Implementation/HTNews.c
@@ -108,6 +108,7 @@ typedef struct _NNTPAuth {
char * pass;
} NNTPAuth;
+#ifdef LY_FIND_LEAKS
PRIVATE void free_news_globals NOARGS
{
if (s >= 0) {
@@ -121,6 +122,7 @@ PRIVATE void free_news_globals NOARGS
FREE(address);
FREE(dbuf);
}
+#endif /* LY_FIND_LEAKS */
PRIVATE void free_NNTP_AuthInfo NOARGS
{
diff --git a/WWW/Library/Implementation/HTParse.c b/WWW/Library/Implementation/HTParse.c
index 5f3f3f92..2b13b791 100644
--- a/WWW/Library/Implementation/HTParse.c
+++ b/WWW/Library/Implementation/HTParse.c
@@ -843,9 +843,9 @@ PUBLIC char * HTUnEscapeSome ARGS2(
p[1] && p[2] && /* tests shouldn't be needed, but.. */
isxdigit((unsigned char)p[1]) &&
isxdigit((unsigned char)p[2]) &&
- (testcode = from_hex(p[1])*16 + from_hex(p[2])) && /* %00 no good*/
+ (testcode = FROMASCII(from_hex(p[1])*16 + from_hex(p[2]))) && /* %00 no good*/
strchr(do_trans, testcode)) { /* it's one of the ones we want */
- *q++ = FROMASCII(testcode);
+ *q++ = testcode;
p += 3;
} else {
*q++ = *p++;
diff --git a/WWW/Library/Implementation/HTPasswd.c b/WWW/Library/Implementation/HTPasswd.c
deleted file mode 100644
index f5bc7be4..00000000
--- a/WWW/Library/Implementation/HTPasswd.c
+++ /dev/null
@@ -1,295 +0,0 @@
-
-/* MODULE HTPasswd.c
-** PASSWORD FILE ROUTINES
-**
-** AUTHORS:
-** AL Ari Luotonen luotonen@dxcern.cern.ch
-** MD Mark Donszelmann duns@vxdeop.cern.ch
-**
-** HISTORY:
-** 7 Nov 93 MD free for crypt taken out (static data returned)
-**
-**
-** BUGS:
-**
-**
-*/
-
-#include <HTUtils.h>
-
-#include <HTAAUtil.h> /* Common parts of AA */
-#include <HTAAFile.h> /* File routines */
-#include <HTAAServ.h> /* Server routines */
-#include <HTPasswd.h> /* Implemented here */
-
-#include <LYLeaks.h>
-
-extern char *crypt();
-
-
-PRIVATE char salt_chars [65] =
- "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./";
-
-
-/* PRIVATE next_rec()
-** GO TO THE BEGINNING OF THE NEXT RECORD
-** Otherwise like HTAAFile_nextRec() but
-** does not handle continuation lines
-** (because password file has none).
-** ON ENTRY:
-** fp is the password file from which records are read from.
-**
-** ON EXIT:
-** returns nothing. File read pointer is located at the beginning
-** of the next record.
-*/
-PRIVATE void next_rec ARGS1(FILE *, fp)
-{
- int ch = getc(fp);
-
- while (ch != EOF && ch != CR && ch != LF)
- ch = getc(fp); /* Skip until end-of-line */
-
- while (ch != EOF &&
- (ch == CR || ch == LF)) /*Skip carriage returns and linefeeds*/
- ch = getc(fp);
-
- if (ch != EOF)
- ungetc(ch, fp);
-}
-
-
-/* PUBLIC HTAA_encryptPasswd()
-** ENCRYPT PASSWORD TO THE FORM THAT IT IS SAVED
-** IN THE PASSWORD FILE.
-** ON ENTRY:
-** password is a string of arbitrary lenght.
-**
-** ON EXIT:
-** returns password in one-way encrypted form.
-**
-** NOTE:
-** Uses currently the C library function crypt(), which
-** only accepts at most 8 characters long strings and produces
-** always 13 characters long strings. This function is
-** called repeatedly so that longer strings can be encrypted.
-** This is of course not as safe as encrypting the entire
-** string at once, but then again, we are not that paranoid
-** about the security inside the machine.
-**
-*/
-PUBLIC char *HTAA_encryptPasswd ARGS1(CONST char *, password)
-{
- char salt[3];
- char chunk[9];
- char *result;
- char *tmp;
- CONST char *cur = password;
- int len = strlen(password);
- int randum = (int)theTime; /* This is random enough */
-
- if (!(result = (char*)malloc(13*((strlen(password)+7)/8) + 1)))
- outofmem(__FILE__, "HTAA_encryptPasswd");
-
- *result = (char)0;
- while (len > 0) {
- salt[0] = salt_chars[randum%64];
- salt[1] = salt_chars[(randum/64)%64];
- salt[2] = (char)0;
-
- strncpy(chunk, cur, 8);
- chunk[8] = (char)0;
-
- tmp = crypt((char*)password, salt); /*crypt() doesn't change its args*/
- strcat(result, tmp);
-
- cur += 8;
- len -= 8;
- } /* while */
-
- return result;
-}
-
-
-
-/* PUBLIC HTAA_passwdMatch()
-** VERIFY THE CORRECTNESS OF A GIVEN PASSWORD
-** AGAINST A ONE-WAY ENCRYPTED FORM OF PASSWORD.
-** ON ENTRY:
-** password is cleartext password.
-** encrypted is one-way encrypted password, as returned
-** by function HTAA_encryptPasswd().
-** This is typically read from the password
-** file.
-**
-** ON EXIT:
-** returns YES, if password matches the encrypted one.
-** NO, if not, or if either parameter is NULL.
-** FIX:
-** Only the length of original encrypted password is
-** checked -- longer given passwords are accepted if
-** common length is correct (but not shorter).
-** This is to allow interoperation of servers and clients
-** who have a hard-coded limit of 8 to password.
-*/
-PUBLIC BOOL HTAA_passwdMatch ARGS2(CONST char *, password,
- CONST char *, encrypted)
-{
- char *result;
- size_t len;
- int status;
-
- if (!password || !encrypted)
- return NO;
-
- len = 13*((strlen(password)+7)/8);
- if (len < strlen(encrypted))
- return NO;
-
- if (!(result = (char*)malloc(len + 1)))
- outofmem(__FILE__, "HTAA_encryptPasswd");
-
- *result = (char)0;
- while (len != 0) {
- char salt[3];
- char chunk[9];
- CONST char *cur1 = password;
- CONST char *cur2 = encrypted;
- char *tmp;
-
- salt[0] = *cur2;
- salt[1] = *(cur2+1);
- salt[2] = (char)0;
-
- strncpy(chunk, cur1, 8);
- chunk[8] = (char)0;
-
- tmp = crypt((char*)password, salt);
- strcat(result, tmp);
-
- cur1 += 8;
- cur2 += 13;
- len -= 13;
- } /* while */
-
- status = strncmp(result, encrypted, strlen(encrypted));
-
- CTRACE(tfp, "%s `%s' (encrypted: `%s') with: `%s' => %s\n",
- "HTAA_passwdMatch: Matching password:",
- password, result, encrypted,
- (status==0 ? "OK" : "INCORRECT"));
-
- FREE(result);
-
- if (status==0)
- return YES;
- else
- return NO;
-}
-
-
-/* PUBLIC HTAAFile_readPasswdRec()
-** READ A RECORD FROM THE PASSWORD FILE
-** ON ENTRY:
-** fp open password file
-** out_username buffer to put the read username, must be at
-** least MAX_USERNAME_LEN+1 characters long.
-** out_passwd buffer to put the read password, must be at
-** least MAX_PASSWORD_LEN+1 characters long.
-** ON EXIT:
-** returns EOF on end of file,
-** otherwise the number of read fields
-** (i.e., in a correct case returns 2).
-** out_username contains the null-terminated read username.
-** out_password contains the null-terminated read password.
-**
-** FORMAT OF PASSWORD FILE:
-** username:password:maybe real name or other stuff
-** (may include even colons)
-**
-** There may be whitespace (blanks or tabs) in the beginning and
-** the end of each field. They are ignored.
-*/
-PUBLIC int HTAAFile_readPasswdRec ARGS3(FILE *, fp,
- char *, out_username,
- char *, out_password)
-{
- int terminator;
-
- terminator = HTAAFile_readField(fp, out_username, MAX_USERNAME_LEN);
-
- if (terminator == EOF) { /* End of file */
- return EOF;
- }
- else if (terminator == CR || terminator == LF) { /* End of line */
- next_rec(fp);
- return 1;
- }
- else {
- HTAAFile_readField(fp, out_password, MAX_PASSWORD_LEN);
- next_rec(fp);
- return 2;
- }
-}
-
-
-
-/* PUBLIC HTAA_checkPassword()
-** CHECK A USERNAME-PASSWORD PAIR
-** ON ENTRY:
-** username is a null-terminated string containing
-** the client's username.
-** password is a null-terminated string containing
-** the client's corresponding password.
-** filename is a null-terminated absolute filename
-** for password file.
-** If NULL or empty, the value of
-** PASSWD_FILE is used.
-** ON EXIT:
-** returns YES, if the username-password pair was correct.
-** NO, otherwise; also, if open fails.
-*/
-PUBLIC BOOL HTAA_checkPassword ARGS3(CONST char *, username,
- CONST char *, password,
- CONST char *, filename)
-{
- FILE *fp = NULL;
- char user[MAX_USERNAME_LEN+1];
- char pw[MAX_PASSWORD_LEN+1];
- int status;
-
- if (filename && *filename) fp = fopen(filename,"r");
- else fp = fopen(PASSWD_FILE,"r");
-
- if (!fp) {
- CTRACE(tfp, "%s `%s'\n",
- "HTAA_checkPassword: Unable to open password file",
- (filename && *filename ? filename : PASSWD_FILE));
- return NO;
- }
- do {
- if (2 == (status = HTAAFile_readPasswdRec(fp,user,pw))) {
- CTRACE(tfp, "HTAAFile_validateUser: %s \"%s\" %s \"%s:%s\"\n",
- "Matching username:", username,
- "against passwd record:", user, pw);
- if (username && user && !strcmp(username,user)) {
- /* User's record found */
- if (*pw != '\0') { /* So password is required for this user */
- if (!password ||
- !HTAA_passwdMatch(password,pw)) /* Check the password */
- status = EOF; /* If wrong, indicate it with EOF */
- }
- break; /* exit loop */
- } /* if username found */
- } /* if record is ok */
- } while (status != EOF);
-
- fclose(fp);
-
- CTRACE(tfp, "HTAAFile_checkPassword: (%s,%s) %scorrect\n",
- username, password, ((status != EOF) ? "" : "in"));
-
- if (status == EOF) return NO; /* We traversed to the end without luck */
- else return YES; /* The user was found */
-}
-
diff --git a/WWW/Library/Implementation/HTPasswd.h b/WWW/Library/Implementation/HTPasswd.h
deleted file mode 100644
index 49468723..00000000
--- a/WWW/Library/Implementation/HTPasswd.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/* PASSWORD FILE ROUTINES
-
- */
-
-#ifndef HTPASSWD_H
-#define HTPASSWD_H
-
-#include <HTList.h>
-
-/*
-
-User Authentication
-
- HTAA_checkPassword(username,password,passwdfile)opens the password file, and checks if
- the username-password pair is correct. Return value is YES, if and only if they are
- correct. Otherwise, and also if the open fails, returns NO.
-
- If the given password file name is NULL or an empty string, the default password file
- name is used (macro PASSWD_FILE).
-
- */
-
-/* PUBLIC HTAA_checkPassword()
-** VALIDATE A USERNAME-PASSWORD PAIR
-** ON ENTRY:
-** username is a null-terminated string containing
-** the client's username.
-** password is a null-terminated string containing
-** the client's corresponding password.
-** filename is a null-terminated absolute filename
-** for password file.
-** If NULL or empty, the value of
-** PASSWD_FILE is used.
-** ON EXIT:
-** returns YES, if the username-password pair was correct.
-** NO, otherwise; also, if open fails.
-*/
-PUBLIC BOOL HTAA_checkPassword PARAMS((CONST char * username,
- CONST char * password,
- CONST char * filename));
-/*
-
-Password File Maintenance Routines
-
- */
-
-/* PUBLIC HTAA_encryptPasswd()
-** ENCRYPT PASSWORD TO THE FORM THAT IT IS SAVED
-** IN THE PASSWORD FILE.
-** ON ENTRY:
-** password is a string of arbitrary lenght.
-**
-** ON EXIT:
-** returns password in one-way encrypted form.
-**
-** NOTE:
-** Uses currently the C library function crypt(), which
-** only accepts at most 8 characters long strings and produces
-** always 13 characters long strings. This function is
-** called repeatedly so that longer strings can be encrypted.
-** This is of course not as safe as encrypting the entire
-** string at once, but then again, we are not that paranoid
-** about the security inside the machine.
-**
-*/
-PUBLIC char *HTAA_encryptPasswd PARAMS((CONST char * password));
-
-
-/* PUBLIC HTAA_passwdMatch()
-** VERIFY THE CORRECTNESS OF A GIVEN PASSWORD
-** AGAINST A ONE-WAY ENCRYPTED FORM OF PASSWORD.
-** ON ENTRY:
-** password is cleartext password.
-** encrypted is one-way encrypted password, as returned
-** by function HTAA_encryptPasswd().
-** This is typically read from the password
-** file.
-**
-** ON EXIT:
-** returns YES, if password matches the encrypted one.
-** NO, if not, or if either parameter is NULL.
-*/
-PUBLIC BOOL HTAA_passwdMatch PARAMS((CONST char * password,
- CONST char * encrypted));
-
-
-/* PUBLIC HTAAFile_readPasswdRec()
-** READ A RECORD FROM THE PASSWORD FILE
-** ON ENTRY:
-** fp open password file
-** out_username buffer to put the read username, must be at
-** least MAX_USERNAME_LEN+1 characters long.
-** out_passwd buffer to put the read password, must be at
-** least MAX_PASSWORD_LEN+1 characters long.
-** ON EXIT:
-** returns EOF on end of file,
-** otherwise the number of read fields
-** (i.e., in a correct case returns 2).
-** out_username contains the null-terminated read username.
-** out_password contains the null-terminated read password.
-**
-** FORMAT OF PASSWORD FILE:
-** username:password:maybe real name or other stuff
-** (may include even colons)
-**
-** There may be whitespace (blanks or tabs) in the beginning and
-** the end of each field. They are ignored.
-*/
-PUBLIC int HTAAFile_readPasswdRec PARAMS((FILE * fp,
- char * out_username,
- char * out_password));
-/*
-
- */
-
-#endif /* not HTPASSWD_H */
-/*
-
- End of file HTPasswd.h. */
diff --git a/WWW/Library/Implementation/HTRules.c b/WWW/Library/Implementation/HTRules.c
index 5b3256d0..b97a01aa 100644
--- a/WWW/Library/Implementation/HTRules.c
+++ b/WWW/Library/Implementation/HTRules.c
@@ -24,9 +24,8 @@
#include <HTRules.h>
#include <HTFile.h>
-#include <HTAAServ.h> /* Access Authorization */
-
#include <LYLeaks.h>
+#include <HTAAProt.h>
#define LINE_LENGTH 256
diff --git a/WWW/Library/Implementation/HTTCP.c b/WWW/Library/Implementation/HTTCP.c
index 53cabd0e..99f0b8ff 100644
--- a/WWW/Library/Implementation/HTTCP.c
+++ b/WWW/Library/Implementation/HTTCP.c
@@ -571,6 +571,11 @@ PRIVATE size_t fill_rehostent ARGS3(
#define REHOSTENT_SIZE 128 /* not bigger than pipe buffer! */
+#ifndef HAVE_H_ERRNO
+#define h_errno my_errno
+static int my_errno;
+#endif
+
/* Resolve an internet hostname, like gethostbyname
** ------------------------------------------------
**
@@ -752,8 +757,8 @@ PUBLIC struct hostent * LYGetHostByName ARGS1(
signal(SIGILL, SIG_DFL);
/*
- ** Child won't use read side. -BL
- */
+ ** Child won't use read side. -BL
+ */
close(pfd[0]);
phost = gethostbyname(host);
statuses.child_h_errno = h_errno;
@@ -1223,6 +1228,7 @@ failed:
}
}
+#ifdef LY_FIND_LEAKS
/* Free our name for the host on which we are - FM
** -------------------------------------------
**
@@ -1231,6 +1237,7 @@ PRIVATE void free_HTTCP_hostname NOARGS
{
FREE(hostname);
}
+#endif /* LY_FIND_LEAKS */
/* Derive the name of the host on which we are
** -------------------------------------------
diff --git a/WWW/Library/Implementation/HTTP.c b/WWW/Library/Implementation/HTTP.c
index a6129b5e..be91586e 100644
--- a/WWW/Library/Implementation/HTTP.c
+++ b/WWW/Library/Implementation/HTTP.c
@@ -1687,6 +1687,20 @@ Cookie2_continuation:
} /* scope of fields */
/*
+ ** The user may have pressed the 'z'ap key during the pause caused
+ ** by one of the HTAlerts above if the server reported an error,
+ ** to skip loading of the error response page. Checking here before
+ ** setting up the stream stack and feeding it data avoids doing
+ ** unnecessary work, it also can avoid unnecessarily pushing a
+ ** loaded document out of the cache to make room for the unwanted
+ ** error page. - kw
+ */
+ if (HTCheckForInterrupt()) {
+ HTTP_NETCLOSE(s, handle);
+ status = HT_INTERRUPTED;
+ goto clean_up;
+ }
+ /*
** Set up the stream stack to handle the body of the message.
*/
if (do_head || keep_mime_headers) {
diff --git a/WWW/Library/Implementation/HTTelnet.c b/WWW/Library/Implementation/HTTelnet.c
index 3ef9b2c1..2d7f162b 100644
--- a/WWW/Library/Implementation/HTTelnet.c
+++ b/WWW/Library/Implementation/HTTelnet.c
@@ -38,7 +38,7 @@ PRIVATE void do_system ARGS1(char *, command)
{
CTRACE(tfp, "HTTelnet: Command is: %s\n\n", command);
system(command);
- free(command);
+ FREE(command);
}
/* Telnet or "rlogin" access
@@ -480,7 +480,7 @@ PRIVATE int remote_session ARGS2(char *, acc_method, char *, host)
#define SIMPLE_TELNET
#endif
#ifdef SIMPLE_TELNET
- if (login_protocol == telnet) { /* telnet only */
+ if (login_protocol == telnet) { /* telnet only */
HTSprintf0(&command, "TELNET %s", /* @@ Bug: port ignored */
hostname);
do_system(command);
@@ -521,7 +521,7 @@ PRIVATE int remote_session ARGS2(char *, acc_method, char *, host)
** addr must point to the fully qualified hypertext reference.
**
** On exit,
-** returns <0 Error has occured.
+** returns <0 Error has occured.
** >=0 Value of file descriptor or socket to be used
** to read data.
** *pFormat Set to the format of the file, if known.
diff --git a/WWW/Library/Implementation/HTUtils.h b/WWW/Library/Implementation/HTUtils.h
index 8ce4285f..9065ef01 100644
--- a/WWW/Library/Implementation/HTUtils.h
+++ b/WWW/Library/Implementation/HTUtils.h
@@ -34,6 +34,7 @@
#define NO_KEYPAD
#define NO_UTMP
#define NO_FILIO_H
+#define NOUSERS
#endif
#if defined(__STDC__) || defined(VMS)
diff --git a/WWW/Library/Implementation/LYexit.h b/WWW/Library/Implementation/LYexit.h
index 8e217776..b8e7cd0c 100644
--- a/WWW/Library/Implementation/LYexit.h
+++ b/WWW/Library/Implementation/LYexit.h
@@ -29,8 +29,13 @@
#endif /* _WINDOWS */
#define exit LYexit
+
+#ifdef LY_FIND_LEAKS
#define atexit LYatexit
#define ATEXITSIZE 40
+#else
+#define atexit(func) /*nothing*/
+#endif
/*
* Data structures
diff --git a/WWW/Library/Implementation/SGML.c b/WWW/Library/Implementation/SGML.c
index 01385a16..91e0a0be 100644
--- a/WWW/Library/Implementation/SGML.c
+++ b/WWW/Library/Implementation/SGML.c
@@ -34,7 +34,7 @@
#define INVALID (-1)
-PUBLIC HTCJKlang HTCJK = NOCJK; /* CJK enum value. */
+PUBLIC HTCJKlang HTCJK = NOCJK; /* CJK enum value. */
PUBLIC BOOL HTPassEightBitRaw = FALSE; /* Pass 161-172,174-255 raw. */
PUBLIC BOOL HTPassEightBitNum = FALSE; /* Pass ^ numeric entities raw. */
PUBLIC BOOL HTPassHighCtrlRaw = FALSE; /* Pass 127-160,173,&#127; raw. */
@@ -75,9 +75,9 @@ struct _HTStream {
HTStructured *target; /* target object */
HTTag *current_tag;
- CONST HTTag *unknown_tag;
+ CONST HTTag *unknown_tag;
BOOL inSELECT;
- int current_attribute_number;
+ int current_attribute_number;
HTChunk *string;
HTElement *element_stack;
enum sgml_state { S_text, S_litteral,
@@ -109,23 +109,23 @@ struct _HTStream {
HTParentAnchor * node_anchor;
LYUCcharset * inUCI; /* pointer to anchor UCInfo */
- int inUCLYhndl; /* charset we are fed */
- LYUCcharset * outUCI; /* anchor UCInfo for target */
- int outUCLYhndl; /* charset for target */
+ int inUCLYhndl; /* charset we are fed */
+ LYUCcharset * outUCI; /* anchor UCInfo for target */
+ int outUCLYhndl; /* charset for target */
char utf_count;
UCode_t utf_char;
char utf_buf[8];
char * utf_buf_p;
UCTransParams T;
- int current_tag_charset; /* charset to pass attributes */
+ int current_tag_charset; /* charset to pass attributes */
char * recover;
- int recover_index;
+ int recover_index;
char * include;
- int include_index;
+ int include_index;
char * url;
char * csi;
- int csi_index;
+ int csi_index;
} ;
PRIVATE void set_chartrans_handling ARGS3(
@@ -360,7 +360,7 @@ PRIVATE BOOL put_special_unicodes ARGS2(
/*
** Use Lynx special character for emsp.
*/
- PUTC(HT_EN_SPACE);
+ /* PUTC(HT_EN_SPACE); let's stay with a single space :) */
PUTC(HT_EN_SPACE);
} else {
/*
@@ -642,7 +642,7 @@ PRIVATE void do_close_stacked ARGS1(
{
HTElement * stacked = context->element_stack;
if (!stacked)
- return; /* stack was empty */
+ return; /* stack was empty */
if (context->inSELECT && !strcasecomp(stacked->tag->name, "SELECT")) {
context->inSELECT = FALSE;
}
@@ -766,7 +766,7 @@ PRIVATE void end_element ARGS2(
} else { /* last level */
CTRACE(tfp, "SGML: Found </%s> when expecting </%s>. </%s> ***Ignored.\n",
old_tag->name, t->name, old_tag->name);
- return; /* Ignore */
+ return; /* Ignore */
}
}
@@ -2148,7 +2148,7 @@ top1:
/*
** Tag
*/
- case S_tag: /* new tag */
+ case S_tag: /* new tag */
if (TOASCII(unsign_c) < 127 && (string->size ? /* S/390 -- gil -- 1179 */
isalnum((unsigned char)c) : isalpha((unsigned char)c))) {
/*
@@ -2523,7 +2523,7 @@ top1:
case S_tag_gap: /* Expecting attribute or '>' */
if (WHITE(c))
break; /* Gap between attributes */
- if (c == '>') { /* End of tag */
+ if (c == '>') { /* End of tag */
if (context->current_tag->name)
start_element(context);
context->state = S_text;
@@ -2554,7 +2554,7 @@ top1:
case S_attr_gap: /* Expecting attribute or '=' or '>' */
if (WHITE(c))
break; /* Gap after attribute */
- if (c == '>') { /* End of tag */
+ if (c == '>') { /* End of tag */
if (context->current_tag->name)
start_element(context);
context->state = S_text;
@@ -2570,7 +2570,7 @@ top1:
case S_equals: /* After attr = */
if (WHITE(c))
break; /* Before attribute value */
- if (c == '>') { /* End of tag */
+ if (c == '>') { /* End of tag */
CTRACE(tfp, "SGML: found = but no value\n");
if (context->current_tag->name)
start_element(context);
@@ -2662,7 +2662,7 @@ top1:
break;
case S_dquoted: /* Quoted attribute value */
- if (c == '"' || /* Valid end of attribute value */
+ if (c == '"' || /* Valid end of attribute value */
(soft_dquotes && /* If emulating old Netscape bug, treat '>' */
c == '>')) { /* as a co-terminator of dquoted and tag */
HTChunkTerminate(string) ;
@@ -2702,7 +2702,7 @@ top1:
}
break;
- case S_end: /* </ */
+ case S_end: /* </ */
if (TOASCII(unsign_c) < 127 && isalnum((unsigned char)c)) { /* S/390 -- gil -- 1247 */
HTChunkPutc(string, c);
} else { /* End of end tag name */
@@ -2854,7 +2854,7 @@ top1:
break;
- case S_esc: /* Expecting '$'or '(' following CJK ESC. */
+ case S_esc: /* Expecting '$'or '(' following CJK ESC. */
if (c == '$') {
context->state = S_dollar;
} else if (c == '(') {
@@ -3089,14 +3089,14 @@ PUBLIC CONST HTStreamClass SGMLParser =
**
** On entry,
** dtd represents the DTD, along with
-** actions is the sink for the data as a set of routines.
+** actions is the sink for the data as a set of routines.
**
*/
PUBLIC HTStream* SGML_new ARGS3(
CONST SGML_dtd *, dtd,
HTParentAnchor *, anchor,
- HTStructured *, target)
+ HTStructured *, target)
{
int i;
HTStream* context = (HTStream *) malloc(sizeof(*context));
@@ -3111,7 +3111,7 @@ PUBLIC HTStream* SGML_new ARGS3(
/* Ugh: no OO */
context->unknown_tag = &HTTag_unrecognized;
context->state = S_text;
- context->element_stack = 0; /* empty */
+ context->element_stack = 0; /* empty */
context->inSELECT = FALSE;
#ifdef CALLERDATA
context->callerData = (void*) callerData;
@@ -3179,7 +3179,7 @@ WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
/////////////////////////////////////////////////////////////////////////
Content-Type: program/C; charset=US-ASCII
Program: SJIS.c
-Author: Yutaka Sato <ysato@etl.go.jp>
+Author: Yutaka Sato <ysato@etl.go.jp>
Description:
History:
930923 extracted from codeconv.c of cosmos
@@ -3189,8 +3189,8 @@ History:
PUBLIC int TREAT_SJIS = 1;
PUBLIC void JISx0201TO0208_EUC ARGS4(
- register unsigned char, IHI,
- register unsigned char, ILO,
+ register unsigned char, IHI,
+ register unsigned char, ILO,
register unsigned char *, OHI,
register unsigned char *, OLO)
{
@@ -3270,8 +3270,8 @@ PUBLIC void JISx0201TO0208_EUC ARGS4(
}
PUBLIC unsigned char * SJIS_TO_JIS1 ARGS3(
- register unsigned char, HI,
- register unsigned char, LO,
+ register unsigned char, HI,
+ register unsigned char, LO,
register unsigned char *, JCODE)
{
HI -= (HI <= 0x9F) ? 0x71 : 0xB1;
@@ -3290,8 +3290,8 @@ PUBLIC unsigned char * SJIS_TO_JIS1 ARGS3(
}
PUBLIC unsigned char * JIS_TO_SJIS1 ARGS3(
- register unsigned char, HI,
- register unsigned char, LO,
+ register unsigned char, HI,
+ register unsigned char, LO,
register unsigned char *, SJCODE)
{
if (HI & 1)
@@ -3320,7 +3320,7 @@ PUBLIC unsigned char * EUC_TO_SJIS1 ARGS3(
}
PUBLIC void JISx0201TO0208_SJIS ARGS3(
- register unsigned char, I,
+ register unsigned char, I,
register unsigned char *, OHI,
register unsigned char *, OLO)
{