summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile9
-rw-r--r--config/config.mk6
-rw-r--r--httpd/src/Makefile63
-rw-r--r--httpd/src/ntnsapi.c279
-rw-r--r--httpd/src/unixso.mk16
-rw-r--r--include/base/crit.h6
-rw-r--r--include/base/ereport.h29
-rw-r--r--include/base/pool.h16
-rw-r--r--include/base/util.h123
-rw-r--r--include/libaccess/acl.h1
-rw-r--r--include/libaccess/las.h1
-rw-r--r--include/libadmin/libadmin.h1309
-rw-r--r--include/nt/nsapi.h246
-rw-r--r--include/public/nsapi.h3182
-rw-r--r--ldap/clients/dsgw/config.c2
-rw-r--r--lib/base/Makefile37
-rw-r--r--lib/base/crit.cpp22
-rw-r--r--lib/base/dns.cpp38
-rw-r--r--lib/base/dnsdmain.cpp2
-rw-r--r--lib/base/ereport.cpp227
-rw-r--r--lib/base/eventlog.cpp1
-rw-r--r--lib/base/file.cpp1
-rw-r--r--lib/base/lexer.cpp12
-rw-r--r--lib/base/net.cpp516
-rw-r--r--lib/base/plist_pvt.h3
-rw-r--r--lib/base/pool.cpp34
-rw-r--r--lib/base/system.cpp11
-rw-r--r--lib/base/systhr.cpp1
-rw-r--r--lib/base/util.cpp977
-rw-r--r--lib/libaccess/Makefile16
-rw-r--r--lib/libaccess/aclcache.cpp52
-rw-r--r--lib/libaccess/aclerror.cpp4
-rw-r--r--lib/libaccess/aclflush.cpp38
-rw-r--r--lib/libaccess/acltools.cpp30
-rw-r--r--lib/libaccess/aclutil.cpp2
-rw-r--r--lib/libaccess/avadb.c2
-rw-r--r--lib/libaccess/oneeval.cpp17
-rw-r--r--lib/libaccess/register.cpp20
-rw-r--r--lib/libadmin/Makefile16
-rw-r--r--lib/libadmin/authdb.c2430
-rw-r--r--lib/libadmin/error.c6
-rw-r--r--lib/libadmin/template.c762
-rw-r--r--lib/libadmin/util.c1108
-rw-r--r--lib/libsi18n/Makefile59
-rw-r--r--lib/libsi18n/getlang.c1
-rw-r--r--lib/libsi18n/gsslapd.h9
-rw-r--r--lib/libsi18n/makstrdb.c20
-rw-r--r--nsconfig.mk4
48 files changed, 194 insertions, 11572 deletions
diff --git a/Makefile b/Makefile
index ac9bfe88..b2dfb7f3 100644
--- a/Makefile
+++ b/Makefile
@@ -138,16 +138,9 @@ httpdLib:
@echo
cd lib/base; $(MAKE) $(MFLAGS)
cd lib/ldaputil; $(MAKE) $(MFLAGS)
- cd lib/frame; $(MAKE) $(MFLAGS)
cd lib/libaccess; $(MAKE) $(MFLAGS)
cd lib/libadmin; $(MAKE) $(MFLAGS)
- cd lib/safs; $(MAKE) $(MFLAGS)
- cd lib/libcrypt; $(MAKE) $(MFLAGS)
- cd lib/libmsgdisp; $(MAKE) $(MFLAGS)
cd lib/libsi18n; $(MAKE) $(MFLAGS)
-ifeq ($(ARCH), WINNT)
- cd lib/httpdaemon; $(MAKE) $(MFLAGS)
-endif
@echo ==== Finished Server LIBS for: $(BUILD_MODULE) ==========
@echo
@@ -174,7 +167,7 @@ buildDirectory: buildnum pumpkin $(OBJDIR) $(DIRVER_H) $(SDKVER_H) components
ifeq ($(ARCH), WINNT)
$(PERL) ntversion.pl $(BUILD_ROOT) $(MAJOR_VERSION) $(MINOR_VERSION)
endif
- cd httpd; $(MAKE) $(MFLAGS) LDAP_NO_LIBLCACHE=1 BUILD_MODULE=DIRECTORY httpd-bin
+ cd httpd/src; $(MAKE) $(MFLAGS) LDAP_NO_LIBLCACHE=1 BUILD_MODULE=DIRECTORY all
cd ldap; $(MAKE) $(MFLAGS) LDAP_NO_LIBLCACHE=1 BUILD_MODULE=DIRECTORY all
@echo ==== Finished LDAP Server ==========
@echo
diff --git a/config/config.mk b/config/config.mk
index 2da430db..d9cd0962 100644
--- a/config/config.mk
+++ b/config/config.mk
@@ -376,7 +376,7 @@ DEFINES += -DUNIX_LDAP
endif
#
-# Platform dependent switching off of NSPR, JAVA and MOCHA
+# Platform dependent switching off of NSPR and JAVA
#
ifndef NO_NSPR
DEFINES += -DNSPR -DNSPR20
@@ -390,10 +390,6 @@ ifeq ($(LW_JAVA), 1)
DEFINES += -DJAVA
endif
-ifndef NO_MOCHA
-DEFINES += -DMOCHA
-endif
-
ifdef FORTEZZA
DEFINES += -DFORTEZZA
endif
diff --git a/httpd/src/Makefile b/httpd/src/Makefile
index bdcd81b1..7a8f8e99 100644
--- a/httpd/src/Makefile
+++ b/httpd/src/Makefile
@@ -14,7 +14,7 @@ MODULE=httpdBinary
ifneq ($(ARCH), WINNT)
OLD_BUILD_ROOT := $(BUILD_ROOT)
BUILD_ROOT := $(shell cd $(OLD_BUILD_ROOT); pwd)
-BUILDSO=mocha admin
+BUILDSO=admin
endif
HTTPD_DIR=$(OBJDIR)
@@ -25,12 +25,8 @@ include $(BUILD_ROOT)/nsconfig.mk
MCC_INCLUDE += $(ADMINUTIL_INCLUDE)
ifeq ($(ARCH), WINNT)
-BINS=$(HTTPD_DIR)/httpd.exe
DLLS=$(HTTPD_DIR)/$(HTTPDLL_NAME).dll
HTTPD_LIB=$(HTTPD_DIR)/$(HTTPDLL_NAME).lib
-NSAPI20=$(HTTPD_DIR)/ns-httpd20.dll
-LOCAL_LINK_EXE = link -OUT:"$@" /STACK:0x20000,0x2000 /MAP $(ARCH_LINK_DEBUG) $(LCFLAGS) /NOLOGO /PDB:NONE /INCREMENTAL:NO \
- /SUBSYSTEM:windows $(EXTRA_LIBS)
EXTRA_LIBS+=$(NSPRLINK)
ifeq ($(BSCINFO), yes)
@@ -66,7 +62,7 @@ EXTRA_LIBS=$(GCCLIBS)
endif
ifeq ($(ARCH), WINNT)
-OS_TARGETS= admin libhttpdaemon $(DLLS)
+OS_TARGETS= admin $(DLLS)
endif
all: $(OBJDEST) $(OS_TARGETS) $(BINS) $(BSCS)
@@ -92,29 +88,19 @@ endif
$(OBJDEST):
mkdir -p $(OBJDEST)
-HTTPD_LIBS=$(FRAME) $(HTTPDAEMON)
+HTTPD_LIBS=
ifeq ($(ARCH), WINNT)
-ifeq ($(NO_MOCHA), 1)
-MOCHA =
-MCC_SERVER += -DNO_MOCHA
-else
-MOCHA=$(NSCP_DISTDIR)/lib/mocha.lib
-endif
-OSOBJS = ntmagnus.o ntnsapi.o
-HTTPD_LIBS += $(SAFS) $(LIBCRYPT)
+OSOBJS = ntnsapi.o
FVERSION_FLAGS+=-s$(BUILD_SECURITY)
else
-OSOBJS = main.o
+OSOBJS =
endif
ifneq ($(ARCH), WINNT)
-OBJS=$(addprefix $(OBJDEST)/, $(OSOBJS) index.o shtml.o upload.o \
- cookie.o nsconfig.o)
+OBJS=
else
-EXEOBJS=$(addprefix $(OBJDEST)/, password.res ntmain.o)
-OBJS=$(addprefix $(OBJDEST)/, $(OSOBJS) index.o shtml.o upload.o \
- cookie.o nsconfig.o)
+OBJS=$(addprefix $(OBJDEST)/, $(OSOBJS) )
endif
MODULE_CFLAGS=
@@ -129,31 +115,21 @@ ifeq ($(ARCH), NCR)
#OBJS+=$(HTTPD_DIR)/httpd-lib/nspr20/uxwrap.o
endif
-ifdef PRODUCT_IS_DIRECTORY_SERVER
-# Primitive NT link process for nshttpd.dll requires httpdaemon
- ifeq ($(ARCH), WINNT)
- DAEMONLIB=$(OBJDIR)/lib/libhttpdaemon
- else
- DAEMONLIB=
- endif
-else
- DAEMONLIB=$(OBJDIR)/lib/libhttpdaemon
-endif
+DAEMONLIB=
ifeq ($(ARCH), WINNT)
# Don't define DEPLIBS for NT because standard macros like LINK_EXE
# and LINK_DLL automatically pick up DEPLIBS which we don't always wan't.
# $(LIBDIRMON) (temporily removed)
-DEPLIBS = $(addsuffix .$(LIB_SUFFIX), $(addprefix $(OBJDIR)/lib/lib, $(LIBADMIN) $(LIBLDAPU) $(LIBACCESS) $(HTTPD_LIBS))) \
- $(addsuffix .$(LIB_SUFFIX), $(OBJDIR)/lib/libmsgdisp)
+DEPLIBS = $(addsuffix .$(LIB_SUFFIX), $(addprefix $(OBJDIR)/lib/lib, $(LIBADMIN) $(LIBLDAPU) $(LIBACCESS) $(HTTPD_LIBS)))
DEPLIBS += $(LIBSECURITY) \
$(LIBNSPR) \
$(LIBLDAP) \
$(LIBDBM) \
- $(ADMINUTIL_DEP)
+ $(ADMINUTIL_DEP)
DEPLINK = /LIBPATH:$(OBJDIR)/lib $(addsuffix .$(LIB_SUFFIX), $(addprefix lib, $(LIBADMIN) $(LIBLDAPU) $(LIBACCESS) $(HTTPD_LIBS))) \
- libmsgdisp.$(LIB_SUFFIX) $(ADMINUTIL_LINK) $(LDAPLINK) $(SECURITYLINK) \
+ $(ADMINUTIL_LINK) $(LDAPLINK) $(SECURITYLINK) \
$(NSPRLINK) $(DBMLINK)
else
# unixso.mk may define DEPLIBS
@@ -164,11 +140,10 @@ DEPLIBS = $(addsuffix .$(LIB_SUFFIX), \
$(OBJDIR)/lib/libaccess \
$(OBJDIR)/lib/libbase \
$(OBJDIR)/lib/libsi18n \
- $(OBJDIR)/lib/libmsgdisp) \
$(LIBSSLIO)
DEPLIBS += $(SECURITY_DEP) \
$(NSPR_DEP) \
- $(ADMINUTIL_DEP)
+ $(ADMINUTIL_DEP)
DEPLINK = $(addsuffix .$(LIB_SUFFIX), \
$(addprefix $(OBJDIR)/lib/lib,$(HTTPD_LIBS)) \
@@ -176,11 +151,10 @@ DEPLINK = $(addsuffix .$(LIB_SUFFIX), \
$(OBJDIR)/lib/libaccess \
$(OBJDIR)/lib/libbase \
$(OBJDIR)/lib/libsi18n \
- $(OBJDIR)/lib/libmsgdisp) \
$(SECURITYLINK) \
$(NSPRLINK) \
$(LIBSSLIO) \
- $(ADMINUTILLINK)
+ $(ADMINUTILLINK)
endif
endif
@@ -202,23 +176,16 @@ ifndef PRODUCT_IS_DIRECTORY_SERVER
endif # Netscape Directory Server
else # WINNT
-$(MOCHA):
- cd $(BUILD_ROOT)/mocha; $(MAKE) export $(NSDEFS)
-
-$(DLLS): $(OBJS) $(DEPLIBS) $(OBJDEST)/ns-httpd.res
+$(DLLS): $(OBJS) $(DEPLIBS)
-@echo EXTRA_LIBS = $(EXTRA_LIBS)
- $(PURIFY) $(LINK_DLL) $(DEPLINK) $(OBJDEST)/ns-httpd.res $(OBJS) $(EXTRA_LIBS)
+ $(PURIFY) $(LINK_DLL) $(DEPLINK) $(OBJS) $(EXTRA_LIBS)
cp $(HTTPD_LIB) $(NSCP_DISTDIR)/lib
echo $(DLLS) finished
$(BINS): $(OBJS) $(EXEOBJS) $(HTTPD_LIB)
rm -f $@
- $(PURIFY) $(LOCAL_LINK_EXE) $(EXEOBJS) $(HTTPD_LIB)
echo $(BINS) finished
-$(NSAPI20): $(HTTPD_LIB) $(OBJDIR)/lib/frame/nsapi20.o
- $(PURIFY) $(LINK_DLL) $(LIBNSPR) $(HTTPD_LIB) $(OBJDIR)/lib/frame/nsapi20.o $(EXTRA_LIBS)
-
ifeq ($(BSCINFO), yes)
$(BSCS): $(OBJS)
$(BSCMAKE) $(OBJDEST)/*.sbr
diff --git a/httpd/src/ntnsapi.c b/httpd/src/ntnsapi.c
index 33fa7955..42170d4e 100644
--- a/httpd/src/ntnsapi.c
+++ b/httpd/src/ntnsapi.c
@@ -10,89 +10,33 @@
*/
#include <nt/nsapi.h>
-extern int upload_file(pblock *pb, Session *sn, Request *rq);
#ifdef BUILD_DLL
#include <libadmin/libadmin.h>
-#include <libadmin/dstats.h>
+#include <libaccess/aclproto.h>
#include <libaccess/nsadb.h>
#include <libadminutil/admutil.h>
#include <libadminutil/distadm.h>
-#if 0
-#ifndef NO_MOCHA
-#include <mocha/mo_atom.h>
-#include <mocha/mo_scope.h>
-#include <mocha/mochaapi.h>
-#endif /* NO_MOCHA */
-#endif
#include <base/fsmutex.h>
-
-extern char *system_winerr(void);
-extern char *system_winsockerr(void);
+#include <i18n.h>
+#include <base/ereport.h>
VOID NsapiDummy()
{
int i = 0;
SafTable = (SafFunction **)MALLOC(400 * sizeof(VOID*));
- /* Force references to libadmin */
-
- /* Functions from libadmin:keyconf.c */
- SafTable[i++] = (SafFunction *)get_alias_dir;
- /* Functions from libadmin:objconf.c */
- SafTable[i++] = (SafFunction *)get_mag_init;
- /* Functions from libadmin:form_post.c */
- SafTable[i++] = (SafFunction *)post_begin;
- /* Functions from libadmin:form_get.c */
- SafTable[i++] = (SafFunction *)open_html_file;
- /* Functions from libadmin:userdb.c */
-#if 0
- SafTable[i++] = (SafFunction *)detect_db_type;
-#endif
- /* Functions from libadmin:authdb.c */
- SafTable[i++] = (SafFunction *)list_auth_dbs;
+ /* Force references to libadmin */
+ SafTable[i++] = (SafFunction *)get_userdb_dir;
/* Functions from libadmin:error.c */
SafTable[i++] = (SafFunction *)report_error;
/* Functions from libadmin:template.c */
- SafTable[i++] = (SafFunction *)directive_is;
- /* Functions from libaccess:pcontrol.c */
- SafTable[i++] = (SafFunction *)restart_http;
- /* Functions from libadmin:admserv.c */
- SafTable[i++] = (SafFunction *)read_server_lst;
- /* Functions from libadmin:multconf.c */
- SafTable[i++] = (SafFunction *)make_conflist;
- /* Functions from libadmin:password */
- SafTable[i++] = (SafFunction *)pw_enc;
- /* Functions from libadmin:cron_conf.c */
-#if 0
- SafTable[i++] = (SafFunction *)cron_conf_create_obj;
-#endif
- /* Functions from libadmin:dstats.c */
- SafTable[i++] = (SafFunction *)dstats_open;
- /* Functions from libadmin:distadm.c */
- SafTable[i++] = (SafFunction *)ADM_InitializePermissions;
+ SafTable[i++] = (SafFunction *)helpJavaScriptForTopic;
-#ifndef NO_MOCHA
- /* Force references to mocha */
- /* Functions from mocha:mo_atom.c */
- SafTable[i++] = (SafFunction *)mocha_Atomize;
- /* Functions from mocha:mo_fun.c */
- /* SafTable[i++] = (SafFunction *)mocha_NewFunctionObject; */
- /* Functions from mocha:mo_scope.c */
- SafTable[i++] = (SafFunction *)mocha_DefineSymbol;
- /* Functions from mocha:mochaapi.c */
- SafTable[i++] = (SafFunction *)MOCHA_CanConvertDatum;
-#endif /* NO_MOCHA */
-
- /* Force references to base */
- SafTable[i++] = (SafFunction *)fsmutex_init;
+ /* Force references to base */
+ SafTable[i++] = (SafFunction *)fsmutex_init;
- /* Force references to libmsgdisp */
- SafTable[i++] = (SafFunction *)NSORB_Init;
- SafTable[i++] = (SafFunction *)ConsumerCreatePush;
- SafTable[i++] = (SafFunction *)CMNewBTree;
- SafTable[i++] = (SafFunction *)NSObjArrayNew;
}
#endif /* BUILD_DLL */
@@ -101,30 +45,6 @@ VOID InitializeSafFunctions()
SafTable = (SafFunction **)MALLOC(400 * sizeof(VOID *));
-/* Functions from buffer.c */
-
- SafTable[FILEBUF_OPEN] = (SafFunction *)filebuf_open;
- SafTable[NETBUF_OPEN] = (SafFunction *)netbuf_open;
- SafTable[FILEBUF_OPEN_NOSTAT] = (SafFunction *)filebuf_open_nostat;
- SafTable[PIPEBUF_OPEN] = (SafFunction *)pipebuf_open;
- SafTable[PIPEBUF_CLOSE] = (SafFunction *)pipebuf_close;
- SafTable[FILEBUF_OPEN_NOSTAT] = (SafFunction *)filebuf_open_nostat;
- SafTable[NETBUF_NEXT] = (SafFunction *)netbuf_next;
- SafTable[PIPEBUF_NEXT] = (SafFunction *)pipebuf_next;
- SafTable[FILEBUF_CLOSE] = (SafFunction *)filebuf_close;
- SafTable[NETBUF_CLOSE] = (SafFunction *)netbuf_close;
- SafTable[FILEBUF_GRAB] = (SafFunction *)filebuf_grab;
- SafTable[NETBUF_GRAB] = (SafFunction *)netbuf_grab;
- SafTable[PIPEBUF_GRAB] = (SafFunction *)pipebuf_grab;
- SafTable[NETBUF_BUF2SD] = (SafFunction *)netbuf_buf2sd;
- SafTable[FILEBUF_BUF2SD] = (SafFunction *)filebuf_buf2sd;
- SafTable[PIPEBUF_BUF2SD] = (SafFunction *)pipebuf_buf2sd;
- SafTable[PIPEBUF_NETBUF2SD] = (SafFunction *)pipebuf_netbuf2sd;
-
-/* Functions from daemon.h */
- SafTable[NTDAEMON_RUN] = (SafFunction *)daemon_run;
- SafTable[CHILD_STATUS] = (SafFunction *)child_status;
-
/* Functions from file.h */
SafTable[SYSTEM_STAT] = (SafFunction *)system_stat;
SafTable[SYSTEM_FOPENRO] = (SafFunction *)system_fopenRO;
@@ -137,27 +57,13 @@ VOID InitializeSafFunctions()
SafTable[SYSTEM_WINSOCKERR] = (SafFunction *)system_winsockerr;
SafTable[FILE_NOTFOUND] = (SafFunction *)file_notfound;
- /* Removed from main code- 9-2-96
- *
- SafTable[SYSTEM_INITLOCK] = (SafFunction *)system_initlock;*/
SafTable[FILE_UNIX2LOCAL] = (SafFunction *)file_unix2local;
SafTable[DIR_OPEN] = (SafFunction *)dir_open;
SafTable[DIR_READ] = (SafFunction *)dir_read;
SafTable[DIR_CLOSE] = (SafFunction *)dir_close;
-/* Functions from cinfo.h */
- SafTable[CINFO_INIT] = (SafFunction *)cinfo_init;
- SafTable[CINFO_TERMINATE] = (SafFunction *)cinfo_terminate;
- SafTable[CINFO_MERGE] = (SafFunction *)cinfo_merge;
- SafTable[CINFO_FIND] = (SafFunction *)cinfo_find;
- SafTable[CINFO_LOOKUP] = (SafFunction *)cinfo_lookup;
- SafTable[CINFO_DUMP_DATABASE] = (SafFunction *)cinfo_dump_database;
-
/* Functions from ereport.h */
SafTable[EREPORT] = (SafFunction *)ereport ;
- SafTable[EREPORT_INIT] = (SafFunction *)ereport_init;
- SafTable[EREPORT_TERMINATE] = (SafFunction *)ereport_terminate;
- SafTable[EREPORT_GETFD] = (SafFunction *)ereport_getfd;
#ifdef NET_SSL
/* Functions from minissl.h */
@@ -174,41 +80,6 @@ VOID InitializeSafFunctions()
#endif /* NET_SSL */
-/* Functions from net.h */
-
- SafTable[NET_BIND] = (SafFunction *)net_bind;
- SafTable[NET_READ] = (SafFunction *)net_read;
- SafTable[NET_WRITE] = (SafFunction *)net_write;
- /* SafTable[NET_FIND_FQDN] = (SafFunction *)net_find_fqdn; */
- SafTable[NET_IP2HOST] = (SafFunction *)net_ip2host;
-
-/* Functions from pblock.h */
- SafTable[PARAM_CREATE] = (SafFunction *)param_create;
- SafTable[PARAM_FREE] = (SafFunction *)param_free;
- SafTable[PBLOCK_CREATE] = (SafFunction *)pblock_create;
- SafTable[PBLOCK_FREE] = (SafFunction *)pblock_free;
- SafTable[PBLOCK_FINDVAL] = (SafFunction *)pblock_findval;
- SafTable[PBLOCK_NVINSERT] = (SafFunction *)pblock_nvinsert;
- SafTable[PBLOCK_NNINSERT] = (SafFunction *)pblock_nninsert;
- SafTable[PBLOCK_PINSERT] = (SafFunction *)pblock_pinsert;
- SafTable[PBLOCK_STR2PBLOCK] = (SafFunction *)pblock_str2pblock;
- SafTable[PBLOCK_PBLOCK2STR] = (SafFunction *)pblock_pblock2str;
- SafTable[PBLOCK_COPY] = (SafFunction *)pblock_copy;
- SafTable[PBLOCK_PB2ENV] = (SafFunction *)pblock_pb2env;
- SafTable[PBLOCK_FR] = (SafFunction *)pblock_fr;
-
-/* Functions from sem.h */
- SafTable[SEM_INIT] = (SafFunction *)sem_init;
- SafTable[SEM_TERMINATE] = (SafFunction *)sem_terminate;
- SafTable[SEM_GRAB] = (SafFunction *)sem_grab;
- SafTable[SEM_TGRAB] = (SafFunction *)sem_grab;
- SafTable[SEM_RELEASE] = (SafFunction *)sem_release;
-
-/* Functions from session.h */
- SafTable[SESSION_CREATE] = (SafFunction *)session_create;
- SafTable[SESSION_FREE] = (SafFunction *)session_free;
- SafTable[SESSION_DNS_LOOKUP] = (SafFunction *)session_dns_lookup;
-
/* Functions from shexp.h */
SafTable[SHEXP_VALID] = (SafFunction *)shexp_valid;
SafTable[SHEXP_MATCH] = (SafFunction *)shexp_match;
@@ -225,159 +96,37 @@ VOID InitializeSafFunctions()
SafTable[SYSTHREAD_GETDATA] = (SafFunction *)systhread_getdata;
SafTable[SYSTHREAD_SETDATA] = (SafFunction *)systhread_setdata;
-/* Functions from shmem.h */
- SafTable[SHMEM_ALLOC] = (SafFunction *)shmem_alloc;
- SafTable[SHMEM_FREE] = (SafFunction *)shmem_free;
-
/* Functions from systems.h */
SafTable[UTIL_STRCASECMP] = (SafFunction *)util_strcasecmp;
SafTable[UTIL_STRNCASECMP] = (SafFunction *)util_strncasecmp;
/* Functions from util.h */
- SafTable[UTIL_GETLINE] = (SafFunction *)util_getline;
- SafTable[UTIL_ENV_CREATE] = (SafFunction *)util_env_create;
- SafTable[UTIL_ENV_STR] = (SafFunction *)util_env_str;
-#if 0
- /* Removed from ntcgi.c --- obsolete; MB 1-26-96 */
- SafTable[NTUTIL_ENV_STR] = (SafFunction *)ntutil_env_str;
-#endif
- SafTable[UTIL_ENV_REPLACE] = (SafFunction *)util_env_replace;
- SafTable[UTIL_ENV_FREE] = (SafFunction *)util_env_free;
- SafTable[UTIL_ENV_FIND] = (SafFunction *)util_env_find;
SafTable[UTIL_HOSTNAME] = (SafFunction *)util_hostname;
- SafTable[UTIL_CHDIR2PATH] = (SafFunction *)util_chdir2path;
- SafTable[UTIL_IS_MOZILLA] = (SafFunction *)util_is_mozilla;
- SafTable[UTIL_IS_URL] = (SafFunction *)util_is_url;
- SafTable[UTIL_LATER_THAN] = (SafFunction *)util_later_than;
- SafTable[UTIL_URI_IS_EVIL] = (SafFunction *)util_uri_is_evil;
- SafTable[UTIL_URI_PARSE] = (SafFunction *)util_uri_parse;
- SafTable[UTIL_URI_UNESCAPE] = (SafFunction *)util_uri_unescape;
- SafTable[UTIL_URI_ESCAPE] = (SafFunction *)util_uri_escape;
- SafTable[UTIL_URL_ESCAPE] = (SafFunction *)util_url_escape;
- SafTable[UTIL_SH_ESCAPE] = (SafFunction *)util_sh_escape;
SafTable[UTIL_ITOA] = (SafFunction *)util_itoa;
SafTable[UTIL_VSPRINTF] = (SafFunction *)util_vsprintf;
SafTable[UTIL_SPRINTF] = (SafFunction *)util_sprintf;
SafTable[UTIL_VSNPRINTF] = (SafFunction *)util_vsnprintf;
SafTable[UTIL_SNPRINTF] = (SafFunction *)util_snprintf;
-// SafTable[INITIALIZE_ADMIN_LOGGING] = (SafFunction *)InitializeAdminLogging;
-// SafTable[INITIALIZE_HTTPD_LOGGING] = (SafFunction *)InitializeHttpdLogging;
-// SafTable[TERMINATE_ADMIN_LOGGING] = (SafFunction *)TerminateAdminLogging;
-// SafTable[TERMINATE_HTTPD_LOGGING] = (SafFunction *)TerminateHttpdLogging;
-
SafTable[LOG_ERROR_EVENT] = (SafFunction *)LogErrorEvent;
-/* Functions from conf.h */
- SafTable[CONF_INIT] = (SafFunction *)conf_init;
- SafTable[CONF_TERMINATE] = (SafFunction *)conf_terminate;
- SafTable[CONF_GETGLOBALS] = (SafFunction *)conf_getglobals;
- SafTable[CONF_VARS2DAEMON] = (SafFunction *)conf_vars2daemon;
-
- SafTable[FUNC_INIT] = (SafFunction *)func_init;
- SafTable[FUNC_FIND] = (SafFunction *)func_find;
- SafTable[FUNC_EXEC] = (SafFunction *)func_exec;
- SafTable[FUNC_INSERT] = (SafFunction *)func_insert;
- SafTable[HTTP_SCAN_HEADERS] = (SafFunction *)http_scan_headers;
- SafTable[HTTP_START_RESPONSE] = (SafFunction *)http_start_response;
- SafTable[HTTP_HDRS2_ENV] = (SafFunction *)http_hdrs2env;
- SafTable[HTTP_STATUS] = (SafFunction *)http_status;
- SafTable[HTTP_SET_FINFO] = (SafFunction *)http_set_finfo;
- SafTable[HTTP_DUMP822] = (SafFunction *)http_dump822;
- SafTable[HTTP_FINISH_REQUEST] = (SafFunction *)http_finish_request;
- SafTable[HTTP_HANDLE_SESSION] = (SafFunction *)http_handle_session;
- SafTable[HTTP_URI2URL] = (SafFunction *)http_uri2url;
-
-/* Functions from log.h */
- SafTable[LOG_ERROR] = (SafFunction *)log_error;
- SafTable[DIRECTIVE_NAME2NUM] = (SafFunction *)directive_name2num;
- SafTable[DIRECTIVE_NUM2NAME] = (SafFunction *)directive_num2name;
- SafTable[OBJECT_CREATE] = (SafFunction *)object_create;
- SafTable[OBJECT_FREE] = (SafFunction *)object_free;
- SafTable[OBJECT_ADD_DIRECTIVE] = (SafFunction *)object_add_directive;
- SafTable[OBJECT_EXECUTE] = (SafFunction *)object_execute;
- SafTable[OBJSET_SCAN_BUFFER] = (SafFunction *)objset_scan_buffer;
- SafTable[OBJSET_FREE] = (SafFunction *)objset_free;
- SafTable[OBJSET_FREE_SETONLY] = (SafFunction *)objset_free_setonly;
- SafTable[OBJSET_NEW_OBJECT] = (SafFunction *)objset_new_object;
- SafTable[OBJSET_ADD_OBJECT] = (SafFunction *)objset_add_object;
- SafTable[OBJSET_FINDBYNAME] = (SafFunction *)objset_findbyname;
- SafTable[OBJSET_FINDBYPPATH] = (SafFunction *)objset_findbyppath;
+/* Functions from aclproto.h */
+ SafTable[ACL_LISTCONCAT] = (SafFunction *)ACL_ListConcat;
- SafTable[REQUEST_CREATE] = (SafFunction *)request_create;
- SafTable[REQUEST_FREE] = (SafFunction *)request_free;
- SafTable[REQUEST_RESTART_INTERNAL] = (SafFunction *)request_restart_internal;
- SafTable[REQUEST_TRANSLATE_URI] = (SafFunction *)request_translate_uri;
- SafTable[REQUEST_HEADER] = (SafFunction *)request_header;
- SafTable[REQUEST_STAT_PATH] = (SafFunction *)request_stat_path;
-
- /* temporarily remove definitions till they are added into the header file. */
- SafTable[REQUEST_HANDLE_PROCESSED] = (SafFunction *)request_handle_processed;
-
- SafTable[MAGNUS_ATRESTART] = (SafFunction *)magnus_atrestart;
+/* Functions from i18n.h */
+ SafTable[GETCLIENTLANG] = (SafFunction *)GetClientLanguage;
+/* Functions from file.h */
SafTable[SYSTEM_FOPENWT] = (SafFunction *)system_fopenWT;
SafTable[SYSTEM_MALLOC] = (SafFunction *)system_malloc;
SafTable[SYSTEM_FREE] = (SafFunction *)system_free;
SafTable[SYSTEM_REALLOC] = (SafFunction *)system_realloc;
SafTable[SYSTEM_STRDUP] = (SafFunction *)system_strdup;
- SafTable[UPLOAD_FILE] = (SafFunction *)upload_file;
-
+/* Functions from crit.h */
SafTable[CRIT_INIT] = (SafFunction *)crit_init;
SafTable[CRIT_ENTER] = (SafFunction *)crit_enter;
SafTable[CRIT_EXIT] = (SafFunction *)crit_exit;
SafTable[CRIT_TERMINATE] = (SafFunction *)crit_terminate;
SafTable[SYSTHREAD_CURRENT] = (SafFunction *)systhread_current;
-
- SafTable[NET_ACCEPT] = (SafFunction *)net_accept;
- SafTable[NET_CLOSE] = (SafFunction *)net_close;
- SafTable[NET_CONNECT] = (SafFunction *)net_connect;
- SafTable[NET_IOCTL] = (SafFunction *)net_ioctl;
- SafTable[NET_LISTEN] = (SafFunction *)net_listen;
- SafTable[NET_SETSOCKOPT] = (SafFunction *)net_setsockopt;
- SafTable[NET_SOCKET] = (SafFunction *)net_socket;
-
-
- /* msgdisp functions */
- SafTable[NSORB_INIT] = (SafFunction *)NSORB_Init;
- SafTable[NSORB_INST_ID] = (SafFunction *)NSORB_InstanceID;
- SafTable[NSORB_GET_INST] = (SafFunction *)NSORB_GetInstance;
- SafTable[NSORB_REG_INT] = (SafFunction *)NSORB_RegisterInterface;
- SafTable[NSORB_FIND_OBJ] = (SafFunction *)NSORB_FindObject;
- SafTable[NSORB_GET_INTERFACE] = (SafFunction *)NSORB_GetInterface;
-
- SafTable[ARR_NEW] = (SafFunction *)NSObjArrayNew;
- SafTable[ARR_FREE] = (SafFunction *)NSObjArrayFree;
- SafTable[ARR_GET_OBJ] = (SafFunction *)NSObjArrayGetObj;
- SafTable[ARR_GET_LAST_OBJ] = (SafFunction *)NSObjArrayGetLastObj;
- SafTable[ARR_NEW_OBJ] = (SafFunction *)NSObjArrayNewObj;
- SafTable[ARR_GET_NUM_OBJ] = (SafFunction *)NSObjArrayGetNumObj;
- SafTable[ARR_RESET] = (SafFunction *)NSObjArrayReset;
- SafTable[ARR_REMOVEOBJ] = (SafFunction *)NSObjArrayRemoveObj;
- SafTable[ARR_GET_OBJ_NUM] = (SafFunction *)NSObjArrayGetObjNum;
-
- SafTable[CM_BT_NEW] = (SafFunction *)CMNewBTree;
- SafTable[CM_BT_ADD_NODE] = (SafFunction *)CMBTreeAddNode;
- SafTable[CM_BT_FIND_NODE] = (SafFunction *)CMBTreeFindNode;
- SafTable[CM_BT_DEL_NODE] = (SafFunction *)CMBTreeDeleteNode;
- SafTable[CM_BT_DESTROY] = (SafFunction *)CMBTreeDestroy;
- SafTable[CM_BT_GET_NUM] = (SafFunction *)CMBTreeGetNumNode;
- SafTable[CM_BT_TRAVEL] = (SafFunction *)CMBTreeInorderTravel;
-
- SafTable[CM_STR_NEW] = (SafFunction *)NewCMStrObj;
- SafTable[CM_STR_ADD] = (SafFunction *)CMStrObjAdd;
- SafTable[CM_STR_REL] = (SafFunction *)CMStrObjRelease;
- SafTable[CM_STR_FREE] = (SafFunction *)CMStrObjFree;
- SafTable[CM_STR_GET] = (SafFunction *)CMStrObjGetString;
- SafTable[CM_STR_SIZE] = (SafFunction *)CMStrObjGetSize;
- SafTable[CM_COPY_STR] = (SafFunction *)CMCopyString;
- SafTable[CM_MAKE_UID] = (SafFunction *)MakeUID;
-
- SafTable[MS_NEW] = (SafFunction *)ConsumerNewPush;
- SafTable[MS_CREATE] = (SafFunction *)ConsumerCreatePush;
-
-
-
}
-
diff --git a/httpd/src/unixso.mk b/httpd/src/unixso.mk
index 8d47ffbf..9e9a00cf 100644
--- a/httpd/src/unixso.mk
+++ b/httpd/src/unixso.mk
@@ -112,7 +112,6 @@ ifeq ($(ARCH), HPUX)
endif
mkdir -p $(OBJDIR)/httpd-lib/sslio
mkdir -p $(OBJDIR)/httpd-lib/arlib
- mkdir -p $(OBJDIR)/httpd-lib/mocha
mkdir -p $(OBJDIR)/httpd-lib/libsec
mkdir -p $(OBJDIR)/httpd-lib/libdbm
mkdir -p $(OBJDIR)/httpd-lib/xp
@@ -170,33 +169,24 @@ endif
endif
-SERVLIBS = $(addprefix $(OBJDIR)/lib/, libadmin.a libframe.a libaccess.a \
+SERVLIBS = $(addprefix $(OBJDIR)/lib/, libadmin.a libaccess.a \
libldapu.a libbase.a libsi18n.a)
-SERVLIB_DIRS = $(addprefix $(OBJDIR)/lib/, libadmin frame libaccess base \
+SERVLIB_DIRS = $(addprefix $(OBJDIR)/lib/, libadmin libaccess base \
ldaputil libmsgdisp libsi18n)
SERVLIB_OBJS = $(subst $(OBJDIR)/,$(BUILTDIR)/, \
- $(filter-out $(OBJDIR)/lib/libadmin/nsnews.o, \
- $(wildcard $(addsuffix /*.o, $(SERVLIB_DIRS)))))
-
-MOCHA=$(NSCP_DISTDIR)/lib/mocha.a
+ $(wildcard $(addsuffix /*.o, $(SERVLIB_DIRS))))
# Removed for ns-security integration
#NSLIBS = $(SECLIB) $(LIBSSLIO)
ADMLIB_LIBS = $(SERVLIBS) $(NSLIBS)
-mocha:
- cd $(BUILD_ROOT)/mocha; $(MAKE) export $(NSDEFS)
-
admobjs:
ifeq ($(ARCH), HPUX)
cd $(OBJDIR)/httpd-lib/nspr20; $(AR) x $(LIBNSPR)
endif
cd $(OBJDIR)/httpd-lib/sslio; $(AR) x $(LIBSSLIO)
-ifndef NSPR20
- cd $(OBJDIR)/httpd-lib/mocha; $(AR) x $(MOCHA)
-endif
cd $(OBJDIR)/httpd-lib/libdbm; $(AR) x $(LIBDBM)
cd $(OBJDIR)/httpd-lib/xp; $(AR) x $(LIBXP)
cd $(OBJDIR)/httpd-lib/libdbm; $(AR) x $(LIBDBM)
diff --git a/include/base/crit.h b/include/base/crit.h
index 1ff7e957..e9a3498a 100644
--- a/include/base/crit.h
+++ b/include/base/crit.h
@@ -32,9 +32,7 @@
/* Define C++ interface */
#ifdef __cplusplus
-#ifndef BASE_NSASSERT_H
-#include "nsassert.h"
-#endif /* !BASE_NSASSERT_H */
+#include "prlog.h" /* NSPR */
#ifndef prmon_h___
#include "prmon.h"
@@ -55,7 +53,7 @@ private:
inline CriticalSection::CriticalSection():_crtsec(0)
{
_crtsec = PR_NewMonitor();
- NS_ASSERT(_crtsec);
+ PR_ASSERT(_crtsec);
}
inline CriticalSection::~CriticalSection()
diff --git a/include/base/ereport.h b/include/base/ereport.h
index 0c74e957..16a4bc68 100644
--- a/include/base/ereport.h
+++ b/include/base/ereport.h
@@ -16,10 +16,6 @@
* Rob McCool
*/
-#ifndef BASE_SESSION_H
-#include "session.h"
-#endif /* !BASE_SESSION_H */
-
#ifndef PUBLIC_BASE_EREPORT_H
#include "public/base/ereport.h"
#endif /* !PUBLIC_BASE_EREPORT_H */
@@ -39,37 +35,12 @@ NSPR_BEGIN_EXTERN_C
NSAPI_PUBLIC int INTereport(int degree, char *fmt, ...);
NSAPI_PUBLIC int INTereport_v(int degree, char *fmt, va_list args);
-/*
- * INTereport_init initializes the error logging subsystem and opens the static
- * file descriptors. It returns NULL upon success and an error string upon
- * error. If a userpw is given, the logs will be chowned to that user.
- *
- * email is the address of a person to mail upon catastrophic error. It
- * can be NULL if no e-mail is desired. INTereport_init will not duplicate
- * its own copy of this string; you must make sure it stays around and free
- * it when you shut down the server.
- */
-
-NSAPI_PUBLIC
-char *INTereport_init(char *err_fn, char *email, PASSWD pwuser, char *version);
-
-/*
- * log_terminate closes the error and common log file descriptors.
- */
-NSAPI_PUBLIC void INTereport_terminate(void);
-
-/* For restarts */
-NSAPI_PUBLIC SYS_FILE INTereport_getfd(void);
-
NSPR_END_EXTERN_C
/* --- End function prototypes --- */
#define ereport INTereport
#define ereport_v INTereport_v
-#define ereport_init INTereport_init
-#define ereport_terminate INTereport_terminate
-#define ereport_getfd INTereport_getfd
#endif /* INTNSAPI */
diff --git a/include/base/pool.h b/include/base/pool.h
index bca055c7..a76dc483 100644
--- a/include/base/pool.h
+++ b/include/base/pool.h
@@ -30,18 +30,6 @@
#include "netsite.h"
#endif /* !NETSITE_H */
-#ifndef BASE_PBLOCK_H
-#include "pblock.h"
-#endif /* !BASE_PBLOCK_H */
-
-#ifndef BASE_SESSION_H
-#include "session.h"
-#endif /* !BASE_SESSION_H */
-
-#ifndef FRAME_REQ_H
-#include "frame/req.h"
-#endif /* !FRAME_REQ_H */
-
#ifndef PUBLIC_BASE_POOL_H
#include "public/base/pool.h"
#endif /* !PUBLIC_BASE_POOL_H */
@@ -54,8 +42,6 @@ NSPR_BEGIN_EXTERN_C
int pool_internal_init(void);
-NSAPI_PUBLIC int INTpool_init(pblock *pb, Session *sn, Request *rq);
-
#ifdef DEBUG_CACHES
NSAPI_PUBLIC int INTpool_service_debug(pblock *pb, Session *sn, Request *rq);
#endif
@@ -81,8 +67,6 @@ char *INTpool_strdup(pool_handle_t *pool_handle, const char *orig_str );
NSPR_END_EXTERN_C
-#define pool_init INTpool_init
-
#ifdef DEBUG_CACHES
#define pool_service_debug INTpool_service_debug
#endif /* DEBUG_CACHES */
diff --git a/include/base/util.h b/include/base/util.h
index 7778b924..c33a7c39 100644
--- a/include/base/util.h
+++ b/include/base/util.h
@@ -17,15 +17,6 @@
* Rob McCool
*/
-/* Needed for various reentrant functions */
-#define DEF_CTIMEBUF 26
-#define DEF_ERRBUF 256
-#define DEF_PWBUF 256
-
-#ifndef BASE_BUFFER_H
-#include "buffer.h" /* filebuf for getline */
-#endif /* !BASE_BUFFER_H */
-
#ifndef PUBLIC_BASE_UTIL_H
#include "public/base/util.h"
#endif /* !PUBLIC_BASE_UTIL_H */
@@ -36,49 +27,8 @@
NSPR_BEGIN_EXTERN_C
-NSAPI_PUBLIC
-int INTutil_getline(filebuffer *buf, int lineno, int maxlen, char *l);
-
-NSAPI_PUBLIC char **INTutil_env_create(char **env, int n, int *pos);
-
-NSAPI_PUBLIC char *INTutil_env_str(char *name, char *value);
-
-NSAPI_PUBLIC void INTutil_env_replace(char **env, char *name, char *value);
-
-NSAPI_PUBLIC void INTutil_env_free(char **env);
-
-NSAPI_PUBLIC char **INTutil_env_copy(char **src, char **dst);
-
-NSAPI_PUBLIC char *INTutil_env_find(char **env, char *name);
-
NSAPI_PUBLIC char *INTutil_hostname(void);
-NSAPI_PUBLIC int INTutil_chdir2path(char *path);
-
-NSAPI_PUBLIC int INTutil_is_mozilla(char *ua, char *major, char *minor);
-
-NSAPI_PUBLIC int INTutil_is_url(char *url);
-
-NSAPI_PUBLIC int INTutil_later_than(struct tm *lms, char *ims);
-
-NSAPI_PUBLIC int INTutil_time_equal(struct tm *lms, char *ims);
-
-NSAPI_PUBLIC int INTutil_str_time_equal(char *t1, char *t2);
-
-NSAPI_PUBLIC int INTutil_uri_is_evil(char *t);
-
-NSAPI_PUBLIC void INTutil_uri_parse(char *uri);
-
-NSAPI_PUBLIC void INTutil_uri_unescape(char *s);
-
-NSAPI_PUBLIC char *INTutil_uri_escape(char *d, char *s);
-
-NSAPI_PUBLIC char *INTutil_url_escape(char *d, char *s);
-
-NSAPI_PUBLIC char *INTutil_sh_escape(char *s);
-
-NSAPI_PUBLIC int INTutil_mime_separator(char *sep);
-
NSAPI_PUBLIC int INTutil_itoa(int i, char *a);
NSAPI_PUBLIC
@@ -93,18 +43,8 @@ NSAPI_PUBLIC int INTutil_snprintf(char *s, int n, const char *fmt, ...);
NSAPI_PUBLIC int INTutil_strftime(char *s, const char *format, const struct tm *t);
-NSAPI_PUBLIC char *INTutil_strtok(char *s1, const char *s2, char **lasts);
-
NSAPI_PUBLIC struct tm *INTutil_localtime(const time_t *clock, struct tm *res);
-NSAPI_PUBLIC char *INTutil_ctime(const time_t *clock, char *buf, int buflen);
-
-NSAPI_PUBLIC char *INTutil_strerror(int errnum, char *msg, int buflen);
-
-NSAPI_PUBLIC struct tm *INTutil_gmtime(const time_t *clock, struct tm *res);
-
-NSAPI_PUBLIC char *INTutil_asctime(const struct tm *tm,char *buf, int buflen);
-
#ifdef NEED_STRCASECMP
NSAPI_PUBLIC int INTutil_strcasecmp(CASECMPARG_T char *one, CASECMPARG_T char *two);
#endif /* NEED_STRCASECMP */
@@ -115,56 +55,9 @@ NSAPI_PUBLIC int INTutil_strncasecmp(CASECMPARG_T char *one, CASECMPARG_T char *
/* --- End common function prototypes --- */
-/* --- Begin Unix-only function prototypes --- */
-
-#ifdef XP_UNIX
-
-NSAPI_PUBLIC int INTutil_can_exec(struct stat *finfo, uid_t uid, gid_t gid);
-
-NSAPI_PUBLIC
-struct passwd *INTutil_getpwnam(const char *name, struct passwd *result,
- char *buffer, int buflen);
-
-NSAPI_PUBLIC pid_t INTutil_waitpid(pid_t pid, int *statptr, int options);
-
-#endif /* XP_UNIX */
-
-/* --- End Unix-only function prototypes --- */
-
-/* --- Begin Windows-only function prototypes --- */
-
-#ifdef XP_WIN32
-
-NSAPI_PUBLIC
-VOID INTutil_delete_directory(char *FileName, BOOL delete_directory);
-
-#endif /* XP_WIN32 */
-
-/* --- End Windows-only function prototypes --- */
-
NSPR_END_EXTERN_C
-#define util_getline INTutil_getline
-#define util_env_create INTutil_env_create
-#define util_env_str INTutil_env_str
-#define util_env_replace INTutil_env_replace
-#define util_env_free INTutil_env_free
-#define util_env_copy INTutil_env_copy
-#define util_env_find INTutil_env_find
#define util_hostname INTutil_hostname
-#define util_chdir2path INTutil_chdir2path
-#define util_is_mozilla INTutil_is_mozilla
-#define util_is_url INTutil_is_url
-#define util_later_than INTutil_later_than
-#define util_time_equal INTutil_time_equal
-#define util_str_time_equal INTutil_str_time_equal
-#define util_uri_is_evil INTutil_uri_is_evil
-#define util_uri_parse INTutil_uri_parse
-#define util_uri_unescape INTutil_uri_unescape
-#define util_uri_escape INTutil_uri_escape
-#define util_url_escape INTutil_url_escape
-#define util_sh_escape INTutil_sh_escape
-#define util_mime_separator INTutil_mime_separator
#define util_itoa INTutil_itoa
#define util_vsprintf INTutil_vsprintf
#define util_sprintf INTutil_sprintf
@@ -173,22 +66,7 @@ NSPR_END_EXTERN_C
#define util_strftime INTutil_strftime
#define util_strcasecmp INTutil_strcasecmp
#define util_strncasecmp INTutil_strncasecmp
-#define util_strtok INTutil_strtok
#define util_localtime INTutil_localtime
-#define util_ctime INTutil_ctime
-#define util_strerror INTutil_strerror
-#define util_gmtime INTutil_gmtime
-#define util_asctime INTutil_asctime
-
-#ifdef XP_UNIX
-#define util_can_exec INTutil_can_exec
-#define util_getpwnam INTutil_getpwnam
-#define util_waitpid INTutil_waitpid
-#endif /* XP_UNIX */
-
-#ifdef XP_WIN32
-#define util_delete_directory INTutil_delete_directory
-#endif /* XP_WIN32 */
#ifdef NEED_STRCASECMP
#define util_strcasecmp INTutil_strcasecmp
@@ -207,4 +85,3 @@ NSPR_END_EXTERN_C
#endif /* INTNSAPI */
#endif /* !BASE_UTIL_H */
-
diff --git a/include/libaccess/acl.h b/include/libaccess/acl.h
index 88ac07f4..2429a426 100644
--- a/include/libaccess/acl.h
+++ b/include/libaccess/acl.h
@@ -12,7 +12,6 @@
#include <netsite.h>
#include <base/pool.h>
-#include <base/pblock.h>
#include <base/plist.h>
#include <libaccess/nserror.h>
diff --git a/include/libaccess/las.h b/include/libaccess/las.h
index 252e3619..c678486f 100644
--- a/include/libaccess/las.h
+++ b/include/libaccess/las.h
@@ -15,7 +15,6 @@
#include <plhash.h>
#include <prclist.h>
-#include <base/pblock.h>
#include <base/plist.h>
#include <libaccess/nserror.h>
#include <libaccess/acl.h>
diff --git a/include/libadmin/libadmin.h b/include/libadmin/libadmin.h
index 8fdd4fa2..713fa663 100644
--- a/include/libadmin/libadmin.h
+++ b/include/libadmin/libadmin.h
@@ -19,9 +19,6 @@
#include "base/systhr.h"
#include "base/util.h"
-#include "frame/objset.h"
-#include "frame/req.h"
-
#ifdef XP_UNIX
#include <unistd.h>
#else /* XP_WIN32 */
@@ -34,151 +31,8 @@
#define NSPR_INIT(Program) (PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 8))
-#undef howmany
-
-#define ADM_CONF "admin.conf"
-#define MAGNUS_CONF "magnus.conf"
-#define OBJ_DATABASE "obj.conf"
-#define MIME_TYPES "mime.types"
-#define NSADMIN_CONF "ns-admin.conf"
-#define CERT_LOG "cert.log"
-
-#define SERVER_KEY_NAME "Server-Key"
-#define SERVER_CERT_NAME "Server-Cert"
-
-#define DBPW_USER "admin"
-#define DB_BAD_INPUT_CHARS "<>\""
-#define AUTHDB_ACL_FAIL -1
-#define AUTHDB_ACL_ODD_ACL -2
-#define AUTHDB_ACL_NOT_FOUND -3
-
-#define ACLNAME_READ_COOKIE "formgen-READ-ACL"
-#define ACLNAME_WRITE_COOKIE "formgen-WRITE-ACL"
-
-#define USERNAME_KEYWORD "USERNAME"
-
-typedef struct authInfo_s authInfo_t;
-struct authInfo_s {
- char *type;
- char *db_path;
- char *prompt;
-};
-
-/* Not defined in any nspr header file, why? */
-PRNetAddr *PR_CreateNetAddr(int PR_IpAddrNull, PRUint16 port);
-
NSPR_BEGIN_EXTERN_C
-NSAPI_PUBLIC char *get_ip_and_mask(char *candidate);
-NSAPI_PUBLIC int groupOrUser(char *dbname, char *name,
- int *is_user, int *is_group);
-NSAPI_PUBLIC int is_readacl(char *name);
-NSAPI_PUBLIC int is_writeacl(char *name);
-NSAPI_PUBLIC char *get_acl_file(void); /* Full path to file used by server. */
-NSAPI_PUBLIC char *get_workacl_file(void); /* Full path to file updated by ACL forms. */
-NSAPI_PUBLIC int get_acl_names(char **readaclname,
- char **writeaclname, char *dir);
-NSAPI_PUBLIC int get_acl_info(char *acl_file, char *acl_name,
- void **acl_context, char ***hosts,
- authInfo_t **authinfo,
- char ***users, char ***userhosts,
- int *fdefaultallow);
-NSAPI_PUBLIC int set_acl_info(char *acl_file, char *acl_name, int prefix,
- void **pacl, char **rights,
- char **hosts, authInfo_t *authinfo,
- char **users, char **userhosts,
- int fdefaultallow);
-NSAPI_PUBLIC int delete_acl_by_name(char *acl_file, char *acl_name);
-
-NSAPI_PUBLIC int str_flag_to_int(char *str_flag);
-NSAPI_PUBLIC int admin_is_ipaddr(char *p);
-NSAPI_PUBLIC void get_hostnames_and_ipaddrs(char **hosts,
- char **hostnames, char **ipaddrs);
-NSAPI_PUBLIC void load_host_array(char ***hosts,
- char *hostnames, char *ipaddrs);
-NSAPI_PUBLIC void load_users_array(char ***users,
- char *usernames, char *groups);
-NSAPI_PUBLIC void get_users_and_groups(char **users, char **usernames,
- char **groups, char *dbname);
-NSAPI_PUBLIC char * str_unquote(char * str);
-
-extern NSAPI_PUBLIC char *acl_read_rights[];
-extern NSAPI_PUBLIC char *acl_write_rights[];
-
-#ifdef USE_ADMSERV
-#define CONFDIR(x) get_conf_dir(x)
-#define ACLDIR(x) get_acl_dir(x)
-#define COMMDEST(x) get_commit_dest(x)
-#define SERVER_NAMES getenv("SERVER_NAMES")
-#define ADMCONFDIR getenv("ADMSERV_ROOT")
-#else
-#define ACLDIR(x) "../../httpacl/"
-#define CONFDIR(x) "../config/"
-#define ADMCONFDIR "../config/"
-#endif
-
-#ifdef XP_UNIX
-#define FILE_PATHSEP '/'
-#define OPEN_MODE "r"
-#define QUOTE ""
-#define CONVERT_TO_NATIVE_FS(Filename)
-#define CONVERT_TO_HTTP_FORMAT(Filename)
-#define WSACleanup()
-
-#undef GET_QUERY_STRING
-#define GET_QUERY_STRING() (getenv("QUERY_STRING"))
-#define NOT_ABSOLUTE_PATH(str) (str[0] != '/')
-#define CREATE_DIRECTORY(Directory)
-#define FILE_LOCK_PATH (get_flock_path())
-
-#else /* XP_WIN32 */
-#define verify_adm_dbm
-#define add_user_dbm
-#define find_user_dbm
-#define list_users_dbm
-#define modify_user_dbm
-#define remove_user_dbm
-#define dbm_open
-#define dbm_close
-#define dbm_store
-#define lstat stat
-#define popen _popen
-#define pclose _pclose
-
-#define CONVERT_TO_NATIVE_FS(Filename) \
-{ \
- register char *s; \
- if (Filename) \
- for (s = Filename; *s; s++) \
- if ( *s == '/') \
- *s = '\\'; \
-}
-#define CONVERT_TO_HTTP_FORMAT(Filename) \
-{ \
- register char *s; \
- if (Filename) \
- for (s = Filename; *s; s++) \
- if ( *s == '\\') \
- *s = '/'; \
-}
-#define FILE_PATHSEP '/'
-#define OPEN_MODE "r+b"
-#define QUOTE "\""
-
-
-#undef GET_QUERY_STRING
-#define GET_QUERY_STRING() (GetQueryNT())
-/* Defined in util.c */
-NSAPI_PUBLIC char *GetQueryNT(void);
-#define NOT_ABSOLUTE_PATH(str) \
- ((str[0] != '/') && (str[0] != '\\') && (str[2] != '/') && (str[2] != '\\'))
-
-#define CREATE_DIRECTORY(Directory) CreateDirectory(Directory, NULL)
-#define FILE_LOCK_PATH (get_flock_path())
-
-#endif /* XP_WIN32 */
-
-
/* error types */
#define FILE_ERROR 0
#define MEMORY_ERROR 1
@@ -196,220 +50,19 @@ NSAPI_PUBLIC char *GetQueryNT(void);
/* The default error type (in case something goes wrong */
#define DEFAULT_ERROR 3
-/* The change types for admin logging */
-#define TO_MAGNUS "magnus.conf"
-#define TO_OBJCONF "obj.conf"
-#define TO_ACLFILE "generated.acl"
-#define TO_STATUS "status"
-#define TO_ADMIN "admserv"
-#define TO_USERDB "userdb"
-#define TO_SEC "security"
-#define TO_BACKUP "backup"
-#define TO_CACHE "cache"
-#define TO_BUCONF "bu.conf"
-#define TO_LDAP "ldap"
-
-/* The indexes for conf file backup purposes */
-#define BK_MAGNUS 0
-#define BK_OBJ 1
-#define BK_MIMETYPES 2
-#define BK_BU 3
-#define BK_ACLFILE 4
-
-/* The extension for backup files to use. Emacs weenies like "%s.~%d~" */
-/* But real vi men like this one */
-#define BACKUP_EXT "%s.v%d"
-/* Need also a way to identify the backup files when we're doing an ls */
-#define BACKUP_SHORT ".v"
-
-/* User database defines */
-#define IS_A_DBM 1
-#define IS_A_NCSA 2
-
-#define REMOVE_FROM_DB "-REMOVE_THIS_USER"
-#define DB_INC "inc"
-#define NCSA_EXT "pwf"
-
-/* We now use the client DB libs, so they're all '.db' with no second file. */
-#define DBM_EXT_1 "db"
-#define DBM_EXT_2 NULL
-
-/* Define the functions in a central place so that obj.conf viewer can get
- * to them */
-#ifdef MCC_PROXY
-#define BASIC_NCSA_FN "proxy-auth"
-#define REQUIRE_AUTH_FN "require-proxy-auth"
-#define CHECK_ACL_FN "check-acl"
-#else
-#define BASIC_NCSA_FN "basic-ncsa"
-#define REQUIRE_AUTH_FN "require-auth"
-#define CHECK_ACL_FN "check-acl"
-#endif
-
-
-/* Frame window names. */
-#define INDEX_NAME "index"
-#define MESSAGE_NAME "msgs"
-#define TOP_NAME "tabs"
-#define BOTTOM_NAME "category"
-#define OPTIONS_NAME "options"
-#define CONTENT_NAME "content"
-#define COPY_NAME "copy"
-
#define INFO_IDX_NAME "infowin"
#define INFO_TOPIC_NAME "infotopic"
#define HELP_WIN_OPTIONS "'resizable=1,width=500,height=500'"
-
-/* pblock types, either it's a ppath, or it's a name. */
-#define PB_NAME 1
-#define PB_PATH 2
-
-/* Resource types */
-#define NAME "name"
-#define FILE_OR_DIR "path"
-#define TEMPLATE "tmpl"
-#define WILDCARD "wild"
-
-/* A really big form line */
-#define BIG_LINE 1024
-
-/* Max size for a pathname */
-#ifndef PATH_MAX
-#define PATH_MAX 256
-#endif
-
-
-/* Boundary string for uploading / downloading config files. */
-#define CF_BOUNDARY "--Config_File_Boundary--"
-#define CF_NEWCONFIG "--NewConfigFile:"
-#define CF_MTIME "--LastMod:"
-#define CF_ERRSTR "--Error: "
-#define CFTRANS_BIN "bin/cftrans"
-#define CF_REMOTE_URL "#RemoteUrl "
-
-#define HTML_ERRCOLOR "#AA0000"
-
-#define MOCHA_NAME "JavaScript"
-
-/* Internationalization stuffs. If we define MSG_RETURN, then create a
- * function which will return a string of the given identifier. If we
- * define MSG_DBM, it creates a function you can call to create the DBM
- * properly. Finally, if nothing else, it will create a mapping from
- * the string's name to its proper ID number. */
-/* store_msg is in mkdbm.c, in the admin stuff */
-/* get_msg.c */
-NSAPI_PUBLIC char *get_msg(int msgid);
-NSAPI_PUBLIC void store_msg(int msgid, char *msg);
-
-#if defined(MSG_RETURN)
-#define BGN_MSG(arg) static char *(arg)(int i) { switch(i) {
-#define STR(name, id, msg) case (id): return(msg);
-#define END_MSG(arg) } return 0; }
-
-#elif defined(MSG_DBM)
-#define BGN_MSG(arg) void (arg)() {
-#define STR(name, id, msg) store_msg(id, msg);
-#define END_MSG(arg) }
-
-#else
-#define BGN_MSG(arg) enum {
-#define STR(name, id, msg) name=id,
-#define END_MSG(arg) arg=0 };
-#endif
-
-/* The files where the messages are kept. */
-#define LA_BASE 1000
-#define LA_BASE_END 1999
-#define LA_DBM_LOC "./la_msgs"
-
-#define HADM_BASE 2000
-#define HADM_BASE_END 5999
-#define HADM_DBM_LOC "./hadm_msgs"
-
-#include "la_msgs.i"
-#include "hadm_msgs.i"
-
/* Initialize libadmin. Should be called by EVERY CGI. */
/* util.c */
NSAPI_PUBLIC int ADM_Init(void);
-/* Open a .html file to parse it. Returns a file ptr (simple fn, really) */
-/* error one doesn't call report_error so we lose the infinite loop prob */
-/* form_get.c */
-NSAPI_PUBLIC FILE *open_html_file(char *filename);
-NSAPI_PUBLIC FILE *open_error_file(char *filename);
-
-/* Same as open_html_file, but opens the html file from the specified */
-/* language subdirectory, if available, else from the default language */
-/* subdirectory. */
-/* form_get.c */
-NSAPI_PUBLIC FILE* open_html_file_lang(char* filename,char* language);
-
-/* Parse an HTML file and return it to the client. */
-/* form_get.c */
-NSAPI_PUBLIC void return_html_file(char *filename);
-
-/* Parse an HTML file, return it to the client, but don't set the referer */
-/* form_get.c */
-NSAPI_PUBLIC void return_html_noref(char *filename);
-
-/* Output an input of an arbitrary type. Not really that flexible. */
-/* form_get.c */
-NSAPI_PUBLIC void output_input(char *type, char *name, char *value, char *other);
-
-/* Get the next line from the file. Returns 0 when EOF is encountered. */
-/* form_get.c */
-NSAPI_PUBLIC int next_html_line(FILE *f, char *line);
-
-
-
-/* Get the referer from the config file */
-/* referer.c */
-NSAPI_PUBLIC char *get_referer(char **config);
-
-/* Set the referer and write out the config file */
-/* referer.c */
-NSAPI_PUBLIC void set_referer(char **config);
-
-/* Sets the referer to a script that's not you. If new_ref is an absolute ref,
- * it will cat that with SERVER_URL; if it's not, it will replace the
- * current script name with new_ref. */
-/* referer.c */
-NSAPI_PUBLIC void set_fake_referer(char *new_ref);
-
-/* Redirect the person to the Referer, or give a short error message */
-/* referer.c */
-NSAPI_PUBLIC void redirect_to_referer(char *addition);
-
-/* Opens the referer in the content window using JavaScript */
-/* referer.c */
-NSAPI_PUBLIC void js_open_referer(void);
-
-/* Redirect to the given script. Assumes that SCRIPT_NAME is set to a script */
-/* referer.c */
-NSAPI_PUBLIC void redirect_to_script(char *script);
-
-
-/* Filter a line using templates, and spit the results to stdout */
-/* template.c */
-NSAPI_PUBLIC int parse_line(char *line, char **input);
-
/* Since everyone seems to be doing this independently, at least centralize
the code. Useful for onClicks and automatic help */
NSAPI_PUBLIC char *helpJavaScript();
NSAPI_PUBLIC char *helpJavaScriptForTopic( char *topic );
-/* Check to see if a directive the parser didn't know about is a given
- * directive */
-/* template.c */
-NSAPI_PUBLIC int directive_is(char *target, char *directive);
-
-/* Export the pageheader because sec-icrt uses it --MLM */
-/* template.c */
-NSAPI_PUBLIC void pageheader(char **vars, char **config);
-
-
/* Report an error. Takes 3 args: 1. Category of error
* 2. Some more specific category info (opt)
* 3. A short explanation of the error.
@@ -421,701 +74,6 @@ NSAPI_PUBLIC void output_alert(int type, char *info, char *details, int wait);
NSAPI_PUBLIC void report_error(int type, char *info, char *details);
NSAPI_PUBLIC void report_warning(int type, char *info, char *details);
-/* Read the administrative config from the server admin root */
-/* Mult adm gets a particular adm config (for multiple server config) */
-/* admconf.c */
-NSAPI_PUBLIC char **get_adm_config(void);
-NSAPI_PUBLIC char **get_mult_adm_config(int whichone);
-
-/* Write the administrative config back to the file */
-/* Mult adm saves a particular adm config (for multiple server config) */
-/* admconf.c */
-NSAPI_PUBLIC int write_adm_config(char **config);
-NSAPI_PUBLIC int write_mult_adm_config(int whichone, char **config);
-
-/* An additional level of abstraction for resource grabbing. Gets the current
- * resource from the config set. */
-/* admconf.c */
-NSAPI_PUBLIC char *get_current_resource(char **config);
-
-/* Gets the string of the current resource type */
-/* admconf.c */
-NSAPI_PUBLIC char *get_current_typestr(char **config);
-
-/* Gets the pblock type of the current resource from the config set. */
-/* admconf.c */
-NSAPI_PUBLIC int get_current_restype(char **config);
-
-/* Sets the current resource given its type and its data. */
-/* admconf.c */
-NSAPI_PUBLIC void set_current_resource(char **config, char *nrestype, char *nres);
-
-
-/* Get the value of a particular variable in magnus.conf */
-/* get_num_mag_var: get only a particular server's value for it */
-/* magconf.c */
-NSAPI_PUBLIC char *get_mag_var(char *var);
-NSAPI_PUBLIC char *get_num_mag_var(int whichsrv, char *var);
-
-/* Set the value of a particular variable in magnus.conf */
-/* magconf.c */
-NSAPI_PUBLIC void set_mag_var(char *name, char *value);
-
-/* Get the value of a particular variable in cert.log */
-NSAPI_PUBLIC char *get_cert_var(char *var);
-NSAPI_PUBLIC char *get_num_cert_var(int whichsrv, char *var);
-
-/* Set the value of a particular variable in cert.log */
-NSAPI_PUBLIC void set_cert_var(char *name, char *value);
-
-/* Get the value of a particular variable in ns-admin.conf */
-/* admserv.c */
-NSAPI_PUBLIC char *get_nsadm_var(char *var);
-NSAPI_PUBLIC char **scan_server_instance(char *, char **);
-
-
-/* Set the value of a particular variable in ns-admin.conf */
-/* admserv.c */
-NSAPI_PUBLIC void set_nsadm_var(char *name, char *value);
-
-/* List all of the installed servers on the admin server. */
-/* Takes 1 arg (string list of identifiers for servers, such as */
-/* httpd, https, proxy, news) */
-/* admserv.c */
-NSAPI_PUBLIC char **list_installed_servers(char **namelist);
-
-/* Reads in the list of servers installed on this machine. Fills in
- * two string lists (one of names, one of descriptions.) *servlist and
- * *desclist will be allocated for you. */
-NSAPI_PUBLIC void read_server_lst(char ***namelist, char ***desclist);
-NSAPI_PUBLIC void read_keyalias_lst(char ***namelist);
-NSAPI_PUBLIC void read_certalias_lst(char ***namelist);
-NSAPI_PUBLIC void get_key_cert_files(char *alias, char **keyfile, char **certfile);
-NSAPI_PUBLIC void display_aliases(char *keyfile, char **aliaslist);
-
-/* Create a new object (i.e. empty "<Object name=foo></Object>" in the
- * config files. */
-/* objconf.c */
-NSAPI_PUBLIC void add_object(int objtype, char *id);
-
-/* Destroy a given object and all its contents. */
-/* objconf.c */
-NSAPI_PUBLIC void delete_object(int objtype, char *id);
-
-/* Grab a given object */
-/* objconf.c */
-NSAPI_PUBLIC httpd_object *grab_object(int objtype, char *id);
-
-/* List all objects of the given type. */
-/* objconf.c */
-NSAPI_PUBLIC char **list_objects(int objtype);
-
-/* Count how many objects there are of the given type. */
-/* objconf.c */
-NSAPI_PUBLIC int count_objects(int objtype);
-
-/* Return the total number of objects in the configuration. */
-/* objconf.c */
-NSAPI_PUBLIC int total_object_count(void);
-
-/* Find a particular instance of a parameter in a particular object and a
- * particular directive. id_type and id_value are optional parameter
- * specifiers if you want not just the first instance of a function.
- */
-/* objconf.c */
-NSAPI_PUBLIC pblock *grab_pblock(int objtype, char *object, char *directive,
- char *function, char *id_type, char *id_value);
-
-/* Grab a pblock, but don't use the "fn" parameter. Instead of "fn",
- * use the string "fname" to identify the block. */
-/* objconf.c */
-NSAPI_PUBLIC pblock *grab_pblock_byid(int objtype, char *object, char *directive,
- char *fname, char *function, char *id_type,
- char *id_value);
-
-/* Add a new parameter block into the given object, of the given directive
- * type, using the given function, and with the list of parameters given
- * (should be called like this:)
- *
- * add_pblock(PB_NAME, "default", "NameTrans", "pfx2dir",
- * 4, "from", "/foo", "dir", "/bar");
- * Returns the new pblock for posterity
- */
-/* objconf.c */
-NSAPI_PUBLIC pblock *add_pblock(int objtype, char *object, char *directive, char *function,
- int nargs, ...);
-
-/* Create a new pblock, but don't save it or anything. */
-/* objconf.c */
-NSAPI_PUBLIC pblock *new_pblock(char *function, int nargs, ...);
-
-/* Destroy a paramter block. Same call patterns as grab_pblock. */
-/* objconf.c */
-NSAPI_PUBLIC void delete_pblock(int objtype, char *object, char *directive, char *function,
- char *id_type, char *id_value);
-
-/* Set the values of a given pblock to these new values. Arg passing is same
- * as for add_pblock()
- */
-/* objconf.c */
-NSAPI_PUBLIC void set_pblock_vals(pblock *pb, int nargs, ...);
-
-/* List all the pblocks you can find with the given object, directive, and
- * function. Returns a pointer to a list of pblock *'s just like a strlist.
- */
-/* objconf.c */
-NSAPI_PUBLIC pblock **list_pblocks(int objtype, char *object, char *direct, char *function);
-
-/* Get the client pblock from a given directive, specified as above in
- * grab_pblock.
- */
-/* objconf.c */
-NSAPI_PUBLIC pblock *grab_client(int objtype, char *object, char *directive,
- char *function, char *id_type, char *id_value);
-
-/* Add a client pblock to a given object. If you have a pblock, send it
- * in oldpb, if not, send NULL and it will create one with a
- * "PathCheck fn=deny-existence" directive for you.
- *
- * Send the nargs just like above; assumedly there's only two: client and ip.
- */
-/* objconf.c */
-NSAPI_PUBLIC void add_client(int objtype, char *object, char *direct,
- pblock *oldpb, int nargs, ...);
-
-/* List all the clients you can find with the given object, directive, and
- * function. Returns a pointer to a list of directive *'s (struct with
- * two pblock ptrs: param and client)
- */
-/* objconf.c */
-NSAPI_PUBLIC directive **list_clients(int objtype, char *object, char *direct,
- char *function);
-
-/* Delete a client, as identified by directive, path=blah in param part,
- * dns=blah in client part, and ip=blah in client part. */
-/* objconf.c */
-NSAPI_PUBLIC void delete_client(int objtype, char *object, char *direct, char *path,
- char *dns, char *ip);
-
-/* Gets the directive associated with a given pblock. */
-/* objconf.c */
-NSAPI_PUBLIC directive *get_pb_directive(int objtype, char *object,
- char *directive, pblock *pb);
-NSAPI_PUBLIC directive *get_cl_directive(int objtype, char *object,
- char *directive, pblock *cl);
-
-/* Delete a pblock by its pointer. (Note: I should have done this function
- * long ago. Grr. */
-/* objconf.c */
-NSAPI_PUBLIC void delete_pblock_byptr(int objtype, char *object,
- char *directive, pblock *pb);
-
-/* Init directives are now in obj.conf, deal with them there. */
-/* ---------------------------------------------------------- */
-
-/* Get the value of an init variable in pblock form. */
-/* objconf.c */
-NSAPI_PUBLIC pblock *get_mag_init(char *fn);
-
-/* Get only a particular mag init */
-/* objconf.c */
-NSAPI_PUBLIC pblock *get_specific_mag_init(char *fn, char *name, char *value);
-
-/* Get all instances of the same Init function as an array of pblock ptrs */
-/* objconf.c */
-NSAPI_PUBLIC pblock **get_all_mag_inits(char *fn);
-
-/* Set the value of an init variable. If it exists, modify existing, if not,
- * create it.
- * If the key_nam and key_val are set, also the parameter named key_val
- * will be used when matching against the specific directive. This will
- * allow multiple calls to the same Init function, with a specific parameter
- * value together with the function name uniquely identifying the specific
- * Init function call.
- */
-/* objconf.c */
-NSAPI_PUBLIC void set_mag_init(char *fn, char *key_nam, char *key_val, int nargs, ...);
-
-/* Delete an instance of an Init variable. */
-/* objconf.c */
-NSAPI_PUBLIC void delete_mag_init(char *fn);
-NSAPI_PUBLIC void delete_specific_mag_init(char *fn, char *key_nam, char *key_val);
-
-
-/* Commit all outstanding config stuff from admin directory to the actual
- * server. Does not restart the server. */
-/* Argument authlist is a string list of authorization strings
- * (username:password) to send to remote servers (or NULL if it is a
- * local machine.) */
-/* commit.c */
-NSAPI_PUBLIC int do_commit(char **authlist);
-
-/* Back out from outstanding changes. Authlist same as above. */
-/* commit.c */
-NSAPI_PUBLIC int do_undo(char **authlist);
-
-/* Prints outstanding changes to server to stdout. */
-/* commit.c */
-NSAPI_PUBLIC void output_uncommitted(void);
-
-/* Returns a flag saying whether there are outstanding changes that need to
- * be committed. If you've already read in admin.conf, send a pointer to
- * it here. Or else send NULL, and it'll read it in. */
-/* commit.c */
-NSAPI_PUBLIC int needs_commit(char **config);
-
-/* Sets the flag to say whether we need to commit or not. 1 means "yes,
- * we need to commit." 0 means "No, I just committed the changes."
- * whichsrv is which server to set the bit in (if you're configuring
- * multiple servers.) */
-/* commit.c */
-NSAPI_PUBLIC void set_commit(int whichsrv, int needscommit);
-
-/* Returns an int for which backup number to use. 0=magnus, 1=obj*/
-/* index is which server among the list you want to use (mult config) */
-/* commit.c */
-NSAPI_PUBLIC int get_bknum(int which, int index);
-
-/* Sets the current backup number. */
-/* index is which server among the list you want to use. */
-/* commit.c */
-NSAPI_PUBLIC void set_bknum(int num, int which, int index);
-
-/* Backs up given file, using number in admconf. */
-/* commit.c */
-NSAPI_PUBLIC void conf_backup(char *whichfile, int index, int whichsrv);
-
-/* Gets the last known modification time for a config file.
- * When you do a commit, this is set to the mod time after you do
- * the commit. Later, when you want to see if the file you're about
- * to upload has changed, you check this value. */
-/* commit.c */
-NSAPI_PUBLIC time_t get_org_mtime(int whichsrv, int whichfile);
-
-/* Gets and sets the three modification times as they were stored in
- * admin.conf. */
-/* Useful in remote transactions. */
-/* commit.c */
-NSAPI_PUBLIC char *get_mtime_str(int whichsrv);
-NSAPI_PUBLIC void set_mtime_str(int whichsrv, char *str);
-
-/* Sets that same value (see above) */
-/* commit.c */
-NSAPI_PUBLIC void set_org_mtime(int whichsrv, int whichfile, time_t mtime);
-
-/* Set the modification times for *all* of the files needing this check,
- * assuming admin.conf got lost or hasn't been created yet. */
-/* When it doubt, set to zero. */
-NSAPI_PUBLIC void set_all_org_mtimes(void);
-
-
-/* Create an internal list of the servers which are being changed. */
-/* Returns the total number of servers in the list. */
-/* multconf.c */
-NSAPI_PUBLIC int make_conflist(void);
-
-/* Don't use this function. It's a grotesque hack. It's used by the admin
- * page to fake the on/off buttons for the servers. */
-/* multconf.c */
-NSAPI_PUBLIC int fake_conflist(char *fakename);
-
-/* Get the current admin config directory. Takes an int to say which one
- * (of the list of servers to configure) you're interested in, so you can
- * for loop through them. Always use 0 if you want the first one. */
-/* multconf.c */
-NSAPI_PUBLIC char *get_conf_dir(int whichone);
-NSAPI_PUBLIC char *get_alias_dir(void);
-NSAPI_PUBLIC void read_alias_files(char ***aliasfiles);
-NSAPI_PUBLIC void read_aliases(char ***aliaslist);
-
-/* Return 1 if this server number whichone is a not on the local machine. */
-/* multconf.c */
-NSAPI_PUBLIC int is_remote_server(int whichone);
-
-/* Return 1 if we are configuring the admin server. */
-/* multconf.c */
-NSAPI_PUBLIC int is_admserv(void);
-
-/* Return 1 if there is a remote server in the list of servers to config. */
-/* Return 0 if not. */
-/* multconf.c */
-NSAPI_PUBLIC int remote_server_inlist(void);
-
-/* Get the ultimate destination for a particular config file set. Same
- * arg as above function. */
-/* multconf.c */
-NSAPI_PUBLIC char *get_commit_dest(int whichone);
-
-/* Get the name of the indicated server (for logging purposes etc.) */
-/* Send -1 for a string with all of them. */
-/* multconf.c */
-NSAPI_PUBLIC char *get_srvname(int whichsrv);
-
-
-/* Some simple buffering tools */
-/* Keeps a buffer for network info, and a buffer for returning lines */
-/* httpcon.c */
-typedef struct bufstruct {
- char *buf;
- int bufsize;
- int curpos;
- int inbuf;
- char *hbuf;
- int hbufsize;
- int hbufpos;
-} bufstruct;
-
-/* Make a new buffer. Flush the rest of a buffer (leaving the contents
- * unread. Delete a buffer structure. */
-/* httpcon.c */
-NSAPI_PUBLIC bufstruct *new_buffer(int bufsize);
-NSAPI_PUBLIC void flush_buffer(bufstruct *buf);
-NSAPI_PUBLIC void delete_buffer(bufstruct *buf);
-
-/* stdio replacement for a network connection (so shoot me) */
-/* httpcon.c */
-NSAPI_PUBLIC char *get_line_from_fd(PRFileDesc *fd, bufstruct *buf);
-
-/* send a line to a remote server (equivalent to write()) */
-/* httpcon.c */
-NSAPI_PUBLIC int send_line_to_fd(PRFileDesc *fd, char *line, int linesize);
-
-/* Decompose a URL into protocol, server, port, and URI. You needn't allocate
- * the strings you're passing, will be done for you. */
-/* httpcon.c */
-NSAPI_PUBLIC int decompose_url(char *url, char **protocol, char **server, unsigned int *port, char **uri);
-
-/* Take a status line "HTTP/1.0 200 OK" or some such and produce a protocol
- * status number. */
-/* httpcon.c */
-NSAPI_PUBLIC int parse_status_line(char *statusline);
-
-/* Returns whether the headers have now ended (with the line you give it) */
-/* httpcon.c */
-NSAPI_PUBLIC int is_end_of_headers(char *hline);
-
-/* Make an HTTP request to a given server, running on a given port,
- * with the given initial request. Returns a FD that can be used
- * to read / write to the connection. */
-/* Note: Reports status to stdout in HTML form. Bad? Perhaps... */
-/* httpcon.c */
-NSAPI_PUBLIC PRFileDesc *make_http_request(char *protocol, char *server, unsigned int port, char *request, int *errcode);
-
-/* Terminate an HTTP request session (see above) */
-/* httpcon.c */
-NSAPI_PUBLIC void end_http_request(PRFileDesc *req_socket);
-
-/* Verify that given server is an admin server. */
-NSAPI_PUBLIC int verify_is_admin(char *protocol, char *server, int port);
-
-
-/* Log a change in the verbose admin log. kind is a string representing
- * what kind of change it was (see #defines at top of file, such as MAGNUS_LOG)
- * Change is the text of the change, in printf format (so you can give args). */
-/* admlog.c */
-NSAPI_PUBLIC void log_change(char *kind, char *change, ...);
-
-/* Get a pretty string for the current resource for logging. */
-/* admlog.c */
-NSAPI_PUBLIC char *log_curres(char **config);
-
-
-/* List all the user databases (actually, all files) in a given path into a
- * strlist. */
-/* userdb.c */
-NSAPI_PUBLIC char **list_user_dbs(char *fullpath);
-
-NSAPI_PUBLIC char **list_auth_dbs(char *fullpath);
-
-/* Output the 1.x database selector. Path is the path to the DB's, element is
- * the desired SELECT name, current is the one that should currently be
- * selected. */
-/* userdb.c */
-NSAPI_PUBLIC void output_db_selector(char *path, char *element, char *current);
-
-/* Output the 2.x database selector. Path is the path to the DB's, element is
- * the desired SELECT name, current is the one that should currently be
- * selected. */
-NSAPI_PUBLIC void output_authdb_selector(char *path, char *element, char *current);
-
-/* Sets which DB is considered current. */
-/* userdb.c */
-NSAPI_PUBLIC void set_current_db(char *current); /* obsolete 1.x */
-
-/* Sets which DB is considered current (2.x version). */
-NSAPI_PUBLIC void set_current_authdb(char *current);
-NSAPI_PUBLIC char *get_current_authdb(void);
-
-/* Detect the type of the given database. */
-/* WARNING: REMOVES THE EXTENSION!!! */
-/* userdb.c */
-NSAPI_PUBLIC int detect_db_type(char *db_name);
-
-/* Find a user within an NCSA database, and return */
-/* userdb.c */
-NSAPI_PUBLIC char *find_user_ncsa(char *db, char *user);
-
-/* Add a user to an NCSA style database */
-/* userdb.c */
-NSAPI_PUBLIC void add_user_ncsa(char *db, char *user, char *password, int enc);
-
-/* List all the users in an NCSA style database */
-/* userdb.c */
-NSAPI_PUBLIC char **list_users_ncsa(char *db);
-
-/* Modify a user in an NCSA style database */
-/* userdb.c */
-NSAPI_PUBLIC int modify_user_ncsa(char *db, char *user, char *pw);
-
-/* Verify the admin password, or die. Returns 1 if there is one, 0 if not */
-/* userdb.c */
-NSAPI_PUBLIC int verify_adm_ncsa(char *db, char *pw);
-
-/* Remove a user from an NCSA style database */
-/* userdb.c */
-NSAPI_PUBLIC int remove_user_ncsa(char *db, char *user);
-
-#ifdef XP_UNIX /* WIN32 has no DBM */
-/* Find a user within a DBM database, and return */
-/* userdb.c */
-char *find_user_dbm(char *db, char *user);
-
-/* Add a user to a DBM database */
-/* userdb.c */
-void add_user_dbm(char *db, char *user, char *password, int enc);
-
-/* List all the users in a DBM */
-/* userdb.c */
-char **list_users_dbm(char *db);
-
-/* Modify a user in a DBM database */
-/* userdb.c */
-int modify_user_dbm(char *db, char *user, char *pw);
-
-/* Verify the admin password, or die. Returns 1 if there is one, 0 if not */
-/* userdb.c */
-int verify_adm_dbm(char *db, char *pw);
-
-/* Remove a user from a DBM */
-/* userdb.c */
-int remove_user_dbm(char *db, char *user);
-
-#endif /* WIN32 */
-
-
-/* Checks to see if server is running. Doesn't work over network. Returns 0
- * if it's down, 1 if it's up, -1 if an error occurred. */
-/* pcontrol.c */
-NSAPI_PUBLIC int is_server_running(int whichsrv);
-
-/* Starts up the HTTP server. Puts the errors into /tmp/startup.[pid] */
-/* Returns 0 on success, 1 on failure */
-/* Restart restarts it, shutdown shuts it down */
-/* pcontrol.c */
-NSAPI_PUBLIC int startup_http(int, char*, char *);
-NSAPI_PUBLIC int restart_http(int, char*, char *);
-NSAPI_PUBLIC int shutdown_http(int, char*);
-
-/* As above, but for SNMP HTTP subagent */
-/* pcontrol.c */
-NSAPI_PUBLIC int startup_snmp();
-NSAPI_PUBLIC int restart_snmp();
-NSAPI_PUBLIC int shutdown_snmp();
-
-/* Performs the request rq, for server (in list) whichsrv, using auth as
- * auth info.
- *
- * successmsg is the prefix on lines that are returned from the remote
- * server that indicate success. */
-/* pcontrol.c */
-NSAPI_PUBLIC int perform_request(char *req, int whichsrv, char *auth, char *successmsg);
-
-/* Escapes a shell command for system() calls. NOTE: This string should
- * be large enough to handle expansion!!!! */
-/* util.c */
-NSAPI_PUBLIC void escape_for_shell(char *cmd);
-
-/* Lists all files in a directory. If dashA list .files except . and .. */
-/* util.c */
-NSAPI_PUBLIC char **list_directory(char *path, int dashA);
-
-/* Does a given file exist? */
-/* util.c */
-NSAPI_PUBLIC int file_exists(char *filename);
-
-/* What's the size of a given file? */
-/* util.c */
-NSAPI_PUBLIC int get_file_size(char *path);
-
-/* Create a directory path if it does not exist (mkdir -p) */
-/* util.c */
-NSAPI_PUBLIC int ADM_mkdir_p(char *dir, int mode);
-
-/* Copy a directory recursively. */
-/* util.c */
-NSAPI_PUBLIC int ADM_copy_directory(char *src_dir, char *dest_dir);
-
-/* Remove a directory recursively. Same as remove_directory except that
- filenames arent printed on stdout */
-/* util.c */
-NSAPI_PUBLIC void ADM_remove_directory(char *path);
-
-#ifdef XP_UNIX
-/* Obtain Unix SuiteSpot user/group information */
-/* util.c */
-NSAPI_PUBLIC int ADM_GetUXSSid(char *, char **, char **);
-#endif
-
-/* Return: LastModificationTime(f1) < LastModificationTime(f2) ? */
-/* util.c */
-NSAPI_PUBLIC int mtime_is_earlier(char *file1, char *file2);
-
-/* Return: the last mod time of fn */
-/* util.c */
-NSAPI_PUBLIC time_t get_mtime(char *fn);
-
-/* Does this string have all numbers? */
-/* util.c */
-NSAPI_PUBLIC int all_numbers(char *target);
-/* Valid floating point number? */
-NSAPI_PUBLIC int all_numbers_float(char *target);
-
-/* Get the [ServerRoot]/config directory. */
-/* whichone is which server you're interested in. */
-/* 0 if you want the first one.*/
-/* util.c */
-NSAPI_PUBLIC char *get_admcf_dir(int whichone);
-
-/* Get the admin server's [ServerRoot]/config directory */
-NSAPI_PUBLIC char *get_admservcf_dir(void);
-
-/* Get the admin/userdb directory. */
-/* util.c */
-NSAPI_PUBLIC char *get_userdb_dir(void);
-/* Get the V2.x admin/userdb directory. */
-/* util.c */
-NSAPI_PUBLIC char *get_authdb_dir(void);
-NSAPI_PUBLIC char *get_httpacl_dir(void);
-
-
-/* V2.x User admin functions. They take a full path of
- the directory where the databases live, and perform
- various operations on the databases. They open and
- close the DBM, so they can not be called when the
- database is already open. The output_xxx ones spit
- out various HTMLized admin data.
-*/
-NSAPI_PUBLIC int getfullname(char *dbname, char *user, char **fullname);
-NSAPI_PUBLIC int setfullname(char *dbname, char *user, char *fullname);
-NSAPI_PUBLIC int setpw(char *dbname, char *user, char *pwd);
-NSAPI_PUBLIC int setdbpw(char *dbname, char *pwd);
-NSAPI_PUBLIC int checkdbpw(char *dbname, char *pwd);
-NSAPI_PUBLIC int addusertogroup(char *dbname, char *user, char *group);
-NSAPI_PUBLIC int remuserfromgroup(char *dbname, char *user, char *group);
-NSAPI_PUBLIC int addgrouptogroup(char *dbname, char *memgroup, char *group);
-NSAPI_PUBLIC int remgroupfromgroup(char *dbname, char *memgroup, char *group);
-NSAPI_PUBLIC int output_users_list(char *line, char *userfilter);
-NSAPI_PUBLIC int output_groups_list(char *dbname, char *groupfilter);
-NSAPI_PUBLIC void output_group_membership(char *dbname, char *user);
-NSAPI_PUBLIC void output_nonmembership(char *dbname, char *user);
-NSAPI_PUBLIC void output_grpgroup_membership(char *dbname, char *group, char *filter);
-NSAPI_PUBLIC void output_user_membership(char *dbname, char *group, char *filter);
-NSAPI_PUBLIC void output_nongrpgroup_membership(char *dbname, char *group, char *filter);
-NSAPI_PUBLIC void output_nonuser_membership(char *dbname, char *group, char *filter);
-
-/* Set a user's login name */
-NSAPI_PUBLIC int setusername(char *db_path, char *user, char *newname);
-
-/* Output a selector box with name "name", an option "NONE" if none=1,
- * and make it a multiple selector box if multiple=1. If multiple != 1,
- * then make it a pulldown list if the number of groups is less than
- * SELECT_OVERFLOW. */
-/* If highlight is non-null, specifically highlight that entry. */
-/* If user is non-null, and it's a multiple box, correctly set the group
- * membership in the multiple list (Groups they're in are on, groups they're
- * not in are off. */
-/* If group_user is one, then the variable "user" refers to *group* members,
- * not *user* members. */
-/* If except is non-null, output all entries except the "except" item. */
-/* (note: this methodology is known as the "Garbage pail method", just
- * keep adding parameters till it does everything you want) MLM */
-#define SELECT_OVERFLOW 25
-NSAPI_PUBLIC void output_group_selector(char *db_path,
- int group_user, char *user,
- char *highlight, char *except,
- char *name, int none, int multiple);
-
-/* Same as above, except output a list of users, highlighting those in a
- * particular group. MLM */
-NSAPI_PUBLIC void output_user_selector(char *db_path, char *group,
- char *highlight, char *except,
- char *name, int none, int multiple);
-
-/* Take a char ** null terminated list of group names, and change a user's
- * memberships so those are the only groups he's in. MLM */
-NSAPI_PUBLIC void change_user_membership(char *db_path, char *user,
- char **new_groups);
-
-/* Take a char ** null terminated list of group names, and change a user's
- * memberships so those are the only groups he's in. MLM */
-/* If group_users is 1, then new_users are assumed to be groups. */
-NSAPI_PUBLIC void change_group_membership(char *db_path, char *group,
- int group_users, char **new_users);
-
-
-/* Get the server's URL. */
-/* util.c */
-NSAPI_PUBLIC char *get_serv_url(void);
-
-/* Run a command and check the output */
-struct runcmd_s {
- char *title;
- char *msg;
- char *arg;
- int sysmsg;
-};
-/* util.c */
-NSAPI_PUBLIC int run_cmd(char *cmd, FILE *closeme, struct runcmd_s *rm);
-
-/* This is basically copy_file from the install section, with the error
- * reporting changed to match the admin stuff. Since some stuff depends
- * on copy_file being the install version, I'll cheat and call this one
- * cp_file. */
-/* util.c */
-NSAPI_PUBLIC void cp_file(char *sfile, char *dfile, int mode);
-
-/* Delete the file with the given path. Returns positive value on failure.*/
-/* util.c */
-NSAPI_PUBLIC int delete_file(char *path);
-
-/* Delete the directory with the given path. Returns positive value on failure.*/
-/* BEWARE! Be sure to verify you're not deleting things you */
-/* shouldn't. Testing the directory with "util_uri_is_evil" */
-/* is often a good idea. */
-/* util.c */
-NSAPI_PUBLIC void remove_directory(char *path);
-
-/* Simply creates a directory that you give it. Checks for errors and
- * all that. (Not to be confused with create_subdirs in install, since
- * it relies on some installation stuff.) */
-/* util.c */
-NSAPI_PUBLIC void create_dir(char *dir, int mode);
-
-/* Open a file, with file locking. Close a file, releasing the lock. */
-/* util.c */
-NSAPI_PUBLIC FILE *fopen_l(char *pathname, char *mode);
-NSAPI_PUBLIC void fclose_l(FILE *f);
-
-/* helper function to figure out where to put the lock */
-/* util.c */
-NSAPI_PUBLIC char *get_flock_path(void);
-
-/* uuencode a given buffer. both src and dst need to be allocated. dst
- * should be 1 1/4 as big as src (i saved some math and just made it twice
- * as big when I called it) */
-/* util.c */
-NSAPI_PUBLIC int do_uuencode(unsigned char *src, unsigned char *dst, int srclen);
-
/* Word wrap a string to fit into a JavaScript alert box. */
/* str is the string, width is the width to wrap to, linefeed is the string
* to use as a linefeed. */
@@ -1123,63 +81,9 @@ NSAPI_PUBLIC int do_uuencode(unsigned char *src, unsigned char *dst, int srclen)
#define WORD_WRAP_WIDTH 80
NSAPI_PUBLIC char *alert_word_wrap(char *str, int width, char *linefeed);
-
-/* Writes the given object set as the current database */
-/* Takes an argument for which server in the list to dump to */
-/* ns-util.c */
-NSAPI_PUBLIC void dump_database(int whichsrv, httpd_objset *os);
-NSAPI_PUBLIC void dump_database_tofile(int whichsrv, char *fn, httpd_objset *os);
-
-/* Scans the given database and returns its object set. */
-/* ns-util.c */
-NSAPI_PUBLIC httpd_objset *read_config_from_file(char *objconf);
-
-/* Scans the current database and returns its object set. */
-/* Takes a number for which server in multiple list to read */
-/* ns-util.c */
-NSAPI_PUBLIC httpd_objset *read_config(int x);
-
-/* Inserts a new pfx2dir name translation into the object, making sure there
- * are no name conflicts. Name conflict resolution is simple: Keep the longest
- * from fields first in the file. */
-/* ns-util.c */
-NSAPI_PUBLIC void insert_ntrans(pblock *p, pblock *c, httpd_object *obj);
-
-/* Inserts a new assign-name and mkssi-version into the object, making sure
- * that they come first and are sorted. */
-NSAPI_PUBLIC void insert_ntrans_an(pblock *p, pblock *c, httpd_object *obj);
-
-/* Inserts a new mkssi-pcheck into the object, making sure that they come
- * first and are sorted. */
-NSAPI_PUBLIC void insert_pcheck_mp(pblock *p, pblock *c, httpd_object *obj);
-
-/* Inserts a new alias in the database (before all other entries) */
-/* ns-util.c */
-NSAPI_PUBLIC void insert_alias(pblock *p, pblock *c, httpd_object *obj);
-
-/* Scans a file and puts all of its lines into a char * array. Strips
- * trailing whitespace */
-/* ns-util.c */
-NSAPI_PUBLIC char **scan_tech(char *fn);
-
-/* Writes the lines to the given file */
-/* ns-util.c */
-NSAPI_PUBLIC int write_tech(char *fn, char **lines);
-
-/* Finds an object by its ppath */
-/* ns-util.c */
-NSAPI_PUBLIC httpd_object *findliteralppath(char *qs, httpd_objset *os);
-
-
-/* Compares two passwords, one plaintext and one encrypted. Returns strcmp()
- * like integer (0 good, anything else bad) */
-/* password.c */
-NSAPI_PUBLIC int pw_cmp(char *pw, char *enc);
-
-/* Encrypts a plaintext password. */
-/* password.c */
-NSAPI_PUBLIC char *pw_enc(char *pw);
-
+/* Get the admin/userdb directory. */
+/* util.c */
+NSAPI_PUBLIC char *get_userdb_dir(void);
/* Maintain what amounts to a handle to a list of strings */
/* strlist.c */
@@ -1189,215 +93,8 @@ NSAPI_PUBLIC char **grow_strlist(char **strlist, int newsize);
NSAPI_PUBLIC void free_strlist(char **strlist);
*/
-/* Handle INN config.data which are now called nsnews.conf files */
-/* nsnews.c */
-char *find_nsnews_var(char *var, char **lines);
-void set_nsnews_var(char *name, char *val, char **lines);
-int find_nsnews_line(char *var, char **lines);
-void remove_nsnews_var(char *name, char **lines);
-void replace_nsnews_prefix(char *opfx, char *npfx, char **lines);
-
-char **scan_nsnews_admin(char *filename);
-char **scan_nsnews_install(char *filename);
-void nsnews_file2path_admin(char *filename, char *path);
-void nsnews_file2path_install(char *filename, char *path);
-void write_nsnews_admin(char *filename, char **lines);
-void write_nsnews_install(char *filename, char **lines);
-
-void run_ctlinnd(char *cmd);
-char **nsnews_status(void);
-void set_moderator(char *group, char *email);
-char *find_moderator(char *group, char **lines);
-char **scan_active(char **nscnf);
-int find_active_group(char *grp, char **active);
-char *active_flags(char *line);
-int active_groupmatch(char *grppat, char *line);
-char **scan_expirectl(char *fn);
-void write_expirectl(char *fn, char **lines);
-void set_expire_remember(char *days, char **lines);
-void set_expire_default(char *def, char *keep, char *purge, char **lines);
-
-#define EXPREM_STRING "/remember/:"
-#define EXPREM_LEN 11
-#define EXPDEF_STRING "*:A:"
-#define EXPDEF_LEN 4
-
-#define find_expire_remember(lines) (find_expire_string(EXPREM_STRING, lines))
-#define find_expire_default(lines) (find_expire_string(EXPDEF_STRING, lines))
-char *find_expire_string(char *find, char **lines);
-
-typedef struct {
- char *patterns;
- char flag;
- char *keep;
- char *def;
- char *purge;
-} expire_s;
-int expire_entry(char *line, expire_s *ret);
-expire_s *expire_entry_default(char **lines);
-expire_s *find_expire_entry(char *find, char **lines);
-void new_expire_entry(expire_s *ex, char **lines);
-void change_expire_entry(char *find, expire_s *ex, char **lines);
-void remove_expire_entry(char *find, char **lines);
-
-typedef struct {
- char *grp;
- char *hostpats;
- char *flags;
- char *userpat;
-} permission_s;
-char **scan_nsaccess(char *fn);
-void write_nsaccess(char *fn, char **lines);
-permission_s *find_nsaccess_default(char **lines);
-permission_s *find_nsaccess_entry(char *find, char **lines);
-void new_nsaccess_entry(permission_s *ps, char **lines);
-void change_nsaccess_entry(char *find, permission_s *ps, char **lines);
-void remove_nsaccess_entry(char *find, char **lines);
-
-/* Handle newsfeeds files */
-void feed_read_file();
-void feed_write_file();
-char *feed_get_ind_var(int *x);
-char *feed_get_host_var(char *host);
-char *feed_get_newsgroups(char *feedline);
-char *feed_get_param(char *feedline);
-void feed_split_newsgroups(char *ngroups, char **allow, char **deny);
-char *add_bangs(char *string);
-void compress_whitespace(char *source);
-char *feed_merge_newsgroups(char *allow_in, char *deny_in);
-void feed_set_groups(char *host, char *groups);
-void feed_set_entry(char *id, char *ngroups, char *feedtype, char *params);
-void feed_delete_host(char *host);
-void feed_dump_vars(char *feedtype, char *dest);
-
-void nnhost_add(char *hostname);
-void nnhost_delete(char *hostname);
-
-void nnctl_add(char *hostname);
-void nnctl_delete(char *hostname);
-
-int nsnews_running(char **nscnf);
-
-
-#ifdef MCC_PROXY
-
-extern long inst_cache_size_tbl[];
-extern long inst_cache_capacity_tbl[];
-extern long cache_size_tbl[];
-extern long cache_capacity_tbl[];
-extern float lm_factor_tbl[];
-extern long time_interval_tbl[];
-extern long timeout_tbl[];
-extern int percent_tbl[];
-
-char *mb_str(long mb);
-char *lm_str(float f);
-
-void output_interval_select(char *name, char *other, long selected, long *tbl);
-void output_mb_select(char *name, char *other, long selected, long *tbl);
-void output_lm_select(char *name, char *other, float selected, float *tbl);
-void output_percentage_select(char *name, char *other, int selected, int *tbl);
-
-#endif /* MCC_PROXY */
-
-#ifdef MCC_NEWS
-
-char * get_active_news_authdb(char **nscnf);
-void set_active_news_authdb(char *name, char **nscnf);
-void output_active_news_authdb(char **nscnf);
-
-#endif /* MCC_NEWS */
-
-#if 0 /* move cron_conf to libadminutil */
-
-/* read and write to cron.conf, cron_conf.c */
-/* Alex Feygin, 3/22/96 */
-typedef struct cron_conf_obj
-{
- char *name;
- char *command;
- char *dir;
- char *user;
- char *start_time;
- char *days;
-}
-cron_conf_obj;
-
-typedef struct cron_conf_list
-{
- char *name;
- cron_conf_obj *obj;
- struct cron_conf_list *next;
-}
-cron_conf_list;
-
-/* Reads cron.conf to a null terminated list of cron_conf_objects; returns
- 0 if unable to do a read; 1 otherwise */
-NSAPI_PUBLIC int cron_conf_read();
-
-/* gets a cron object, NULL if it doesnt exist */
-NSAPI_PUBLIC cron_conf_obj *cron_conf_get(char *name);
-
-/* returns a NULL-terminated cron_conf_list of all the cron conf objects */
-NSAPI_PUBLIC cron_conf_list *cron_conf_get_list();
-
-/* Creates a cron conf object; all these args get STRDUP'd in the function
- so make sure to free up the space later if need be */
-NSAPI_PUBLIC cron_conf_obj *cron_conf_create_obj(char *name, char *command,
- char *dir, char *user,
- char *start_time, char *days);
-
-/* Puts a cron conf object into list or updates it if it already in there.
- Returns either the object passed or the object in there already;
- cco may be FREE'd during this operation so if you need the object
- back, call it like so:
-
- cco = cron_conf_set(cco->name, cco);
-
- calling cron_conf_set with a NULL cco will cause the 'name' object
- to be deleted.
-*/
-NSAPI_PUBLIC cron_conf_obj *cron_conf_set(char *name, cron_conf_obj *cco);
-
-/* write out current list of cron_conf_objects to cron.conf file */
-NSAPI_PUBLIC void cron_conf_write();
-
-/* free all cron conf data structures */
-NSAPI_PUBLIC void cron_conf_free();
-
-
-#endif /* move cron_conf to libadminutil */
-
-
-/**************************************************************************
- * This is should really be in base/file.h, but we don't want to tread on
- * toes.
- * Implement fgets without the error complaints the util_getline has. The
- * calling function is smart enough to deal with partial lines.
- * Also include a sleep that has the same functionality as Unix for NT.
- *************************************************************************/
-
-NSAPI_PUBLIC char *system_gets( char *, int, filebuffer * );
-
-#ifdef XP_UNIX
-NSAPI_PUBLIC int system_zero( SYS_FILE );
-#else /* XP_WIN32 */
-#define system_zero( f ) \
- SetFilePointer( PR_FileDesc2NativeHandle( f ), 0, NULL, FILE_BEGIN );\
- SetEndOfFile( PR_FileDesc2NativeHandle( f ) )
-#define sleep( t ) Sleep( (t) * 1000 )
-#endif /* XP_WIN32 */
-
NSAPI_PUBLIC char *cookieValue( char *, char * );
-NSAPI_PUBLIC void jsPWDialogSrc( int inScript, char *otherJS );
-
-NSAPI_PUBLIC int IsCurrentTemplateNSPlugin(char* templateName);
-
-/************************** Miscellaneous *************************/
-NSAPI_PUBLIC char * jsEscape(char *src);
-NSAPI_PUBLIC int read_AbbrDescType_file(char *path, char ***namelist, char ***desclist);
-
NSPR_END_EXTERN_C
#endif /* libadmin_h */
diff --git a/include/nt/nsapi.h b/include/nt/nsapi.h
index f286dc1f..82c46bb7 100644
--- a/include/nt/nsapi.h
+++ b/include/nt/nsapi.h
@@ -10,78 +10,20 @@
#include <windows.h>
#include <stdio.h>
-#include <base/buffer.h>
#include <base/file.h>
-#include <base/daemon.h>
#include <base/eventlog.h>
#include <base/util.h>
#include <base/shexp.h>
-#include <base/session.h>
-#include <base/sem.h>
-#include <base/pblock.h>
-#include <base/net.h>
-#include <base/ereport.h>
-#include <base/cinfo.h>
#include <base/systhr.h>
-#include <base/shmem.h>
#include <base/crit.h>
#include <base/systhr.h>
-#include <frame/objset.h>
-#include <frame/conf.h>
-#include <frame/func.h>
-#include <frame/http.h>
-#include <frame/log.h>
-#include <frame/object.h>
-#include <frame/protocol.h>
-#include <frame/req.h>
-#include <frame/httpact.h>
-#include <frame/servact.h>
-
-#include <libmsgdisp/orb.h>
-#include <libmsgdisp/nsarray.h>
-#include <libmsgdisp/msgchnel.h>
-#include <libmsgdisp/mdbtree.h>
-#include <libmsgdisp/mdutil.h>
-
#include <ssl.h>
-#include <nt/magnus.h>
-
typedef void * (SafFunction)();
SafFunction **SafTable;
__declspec(dllexport) int InitSafTable(SafFunction *Table);
-/* Functions from ntbuffer.c */
-
-#define FILEBUF_OPEN 1
-#define NETBUF_OPEN 2
-#define FILEBUF_OPEN_NOSTAT 3
-
-#define PIPEBUF_OPEN 4
-#define PIPEBUF_CLOSE 5
-#define FILEBUF_NEXT 6
-#define NETBUF_NEXT 7
-
-#define PIPEBUF_NEXT 8
-#define FILEBUF_CLOSE 9
-#define NETBUF_CLOSE 10
-#define FILEBUF_GRAB 11
-#define NETBUF_GRAB 12
-#define PIPEBUF_GRAB 13
-#define NETBUF_BUF2SD 14
-#define FILEBUF_BUF2SD 15
-
-#define PIPEBUF_BUF2SD 16
-#define PIPEBUF_NETBUF2SD 17
-
-/* Functions from daemon.h */
-
-#define NTDAEMON_RUN 18
-#define CHILD_STATUS 19
-
/* Functions from file.h */
-#define SYSTEM_FREAD 20
-#define SYSTEM_PREAD 21
#define SYSTEM_FOPENRO 22
#define SYSTEM_FOPENWA 23
#define SYSTEM_FOPENRW 24
@@ -93,38 +35,14 @@ __declspec(dllexport) int InitSafTable(SafFunction *Table);
#define SYSTEM_WINSOCKERR 30
#define FILE_NOTFOUND 31
#define SYSTEM_STAT 32
-#define SYSTEM_INITLOCK 33
#define FILE_UNIX2LOCAL 34
#define DIR_OPEN 35
#define DIR_READ 36
#define DIR_CLOSE 37
-/* Functions from sem.h */
-#define SEM_INIT 40
-#define SEM_TERMINATE 41
-#define SEM_GRAB 42
-#define SEM_TGRAB 43
-#define SEM_RELEASE 44
-
-/* Functions from session.h */
-#define SESSION_CREATE 45
-#define SESSION_FREE 46
-#define SESSION_DNS_LOOKUP 47
-
-/* Functions from cinfo.h */
-#define CINFO_INIT 70
-#define CINFO_TERMINATE 71
-#define CINFO_MERGE 72
-#define CINFO_FIND 73
-#define CINFO_LOOKUP 74
-#define CINFO_DUMP_DATABASE 75
-
/* Functions from ereport.h */
#define EREPORT 80
-#define EREPORT_INIT 81
-#define EREPORT_TERMINATE 82
-#define EREPORT_GETFD 83
/* Functions from minissl.h */
#define SSL_CLOSE 90
@@ -138,30 +56,6 @@ __declspec(dllexport) int InitSafTable(SafFunction *Table);
#define SSL_WRITE 98
#define SSL_GETPEERNAME 99
-/* Functions from net.h */
-#define NET_BIND 110
-#define NET_READ 111
-#define NET_WRITE 112
-
-#define NET_FIND_FQDN 113
-#define NET_IP2HOST 114
-#define NET_SENDMAIL 115
-
-/* Functions from pblock.h */
-#define PARAM_CREATE 120
-#define PARAM_FREE 121
-#define PBLOCK_CREATE 122
-#define PBLOCK_FREE 123
-#define PBLOCK_FINDVAL 124
-#define PBLOCK_NVINSERT 125
-#define PBLOCK_NNINSERT 126
-#define PBLOCK_PINSERT 127
-#define PBLOCK_STR2PBLOCK 128
-#define PBLOCK_PBLOCK2STR 129
-#define PBLOCK_COPY 130
-#define PBLOCK_PB2ENV 131
-#define PBLOCK_FR 132
-
/* Functions from systhr.h */
#define SYSTHREAD_START 133
#define SYSTHREAD_ATTACH 134
@@ -172,19 +66,6 @@ __declspec(dllexport) int InitSafTable(SafFunction *Table);
#define SYSTHREAD_GETDATA 139
#define SYSTHREAD_SETDATA 140
-/* Functions from shmem.h */
-#define SHMEM_ALLOC 141
-#define SHMEM_FREE 142
-
-/* Functions from eventlog.h */
-#define INITIALIZE_ADMIN_LOGGING 143
-#define INITIALIZE_HTTPD_LOGGING 144
-#define INITIALIZE_HTTPS_LOGGING 145
-
-#define TERMINATE_ADMIN_LOGGING 146
-#define TERMINATE_HTTPD_LOGGING 147
-#define TERMINATE_HTTPS_LOGGING 148
-
#define LOG_ERROR_EVENT 149
/* Functions from shexp.h */
@@ -198,91 +79,15 @@ __declspec(dllexport) int InitSafTable(SafFunction *Table);
#define UTIL_STRNCASECMP 171
/* Functions from util.h */
-#define UTIL_GETLINE 180
-#define UTIL_ENV_CREATE 181
-#define UTIL_ENV_STR 182
-#define NTUTIL_ENV_STR 183
-#define UTIL_ENV_REPLACE 184
-#define UTIL_ENV_FREE 185
-#define UTIL_ENV_FIND 186
#define UTIL_HOSTNAME 187
-#define UTIL_CHDIR2PATH 188
-#define UTIL_IS_MOZILLA 189
-#define UTIL_IS_URL 190
-#define UTIL_LATER_THAN 191
-#define UTIL_URI_IS_EVIL 192
-#define UTIL_URI_PARSE 193
-#define UTIL_URI_UNESCAPE 194
-#define UTIL_URI_ESCAPE 195
-#define UTIL_URL_ESCAPE 196
-#define UTIL_SH_ESCAPE 197
#define UTIL_ITOA 198
#define UTIL_VSPRINTF 199
#define UTIL_SPRINTF 200
#define UTIL_VSNPRINTF 201
#define UTIL_SNPRINTF 202
-/* Functions from magnus.h */
-#define MAGNUS_ATRESTART 203
-
/* Functions from conf.h */
#define CONF_INIT 207
-#define CONF_TERMINATE 208
-#define CONF_GETGLOBALS 209
-#define CONF_VARS2DAEMON 210
-
-/* Functions from req.h */
-#define REQUEST_CREATE 211
-#define REQUEST_FREE 212
-#define REQUEST_RESTART_INTERNAL 213
-#define REQUEST_TRANSLATE_URI 214
-#define REQUEST_HEADER 215
-#define REQUEST_STAT_PATH 216
-#define REQUEST_URI2PATH 217
-#define REQUEST_PATHCHECKS 218
-#define REQUEST_FILEINFO 219
-#define REQUEST_HANDLE_PROCESSED 220
-#define REQUEST_SERVICE 221
-#define REQUEST_HANDLE 222
-
-/* Functions from object.h */
-#define DIRECTIVE_NAME2NUM 223
-#define DIRECTIVE_NUM2NAME 224
-#define OBJECT_CREATE 225
-#define OBJECT_FREE 226
-#define OBJECT_ADD_DIRECTIVE 227
-#define OBJECT_EXECUTE 228
-
-/* Functions from objset.h */
-#define OBJSET_SCAN_BUFFER 230
-#define OBJSET_CREATE 231
-#define OBJSET_FREE 232
-#define OBJSET_FREE_SETONLY 233
-#define OBJSET_NEW_OBJECT 234
-#define OBJSET_ADD_OBJECT 235
-#define OBJSET_FINDBYNAME 236
-#define OBJSET_FINDBYPPATH 237
-
-/* Functions from http.h */
-#define HTTP_PARSE_REQUEST 240
-#define HTTP_SCAN_HEADERS 241
-#define HTTP_START_RESPONSE 242
-#define HTTP_HDRS2_ENV 243
-#define HTTP_STATUS 244
-#define HTTP_SET_FINFO 245
-#define HTTP_DUMP822 246
-#define HTTP_FINISH_REQUEST 247
-#define HTTP_HANDLE_SESSION 248
-#define HTTP_URI2URL 249
-
-/* Functions from func.h */
-#define FUNC_INIT 251
-#define FUNC_FIND 252
-#define FUNC_EXEC 253
-#define FUNC_INSERT 254
-
-/* Functions from log.h */
-#define LOG_ERROR 260
/* robm Functions added in 2.0 */
#define SYSTEM_FOPENWT 261
@@ -291,56 +96,11 @@ __declspec(dllexport) int InitSafTable(SafFunction *Table);
#define SYSTEM_REALLOC 264
#define SYSTEM_STRDUP 265
-#define UPLOAD_FILE 266
-
#define CRIT_INIT 267
#define CRIT_ENTER 268
#define CRIT_EXIT 269
#define CRIT_TERMINATE 270
#define SYSTHREAD_CURRENT 271
-
-#define NET_ACCEPT 272
-#define NET_CLOSE 273
-#define NET_CONNECT 274
-#define NET_IOCTL 275
-#define NET_LISTEN 276
-#define NET_SETSOCKOPT 277
-#define NET_SOCKET 278
-
-/* Daryoush Functions added in 3.0 */
-#define NSORB_INIT 279
-#define NSORB_INST_ID 280
-#define NSORB_GET_INST 281
-#define NSORB_REG_INT 282
-#define NSORB_FIND_OBJ 283
-#define NSORB_GET_INTERFACE 284
-
-#define ARR_NEW 285
-#define ARR_FREE 286
-#define ARR_GET_OBJ 288
-#define ARR_GET_LAST_OBJ 289
-#define ARR_NEW_OBJ 290
-#define ARR_GET_NUM_OBJ 291
-#define ARR_RESET 292
-#define ARR_REMOVEOBJ 293
-#define ARR_GET_OBJ_NUM 294
-
-#define CM_BT_NEW 295
-#define CM_BT_ADD_NODE 296
-#define CM_BT_FIND_NODE 297
-#define CM_BT_DEL_NODE 298
-#define CM_BT_DESTROY 299
-#define CM_BT_GET_NUM 300
-#define CM_BT_TRAVEL 301
-
-#define CM_STR_NEW 302
-#define CM_STR_ADD 303
-#define CM_STR_REL 304
-#define CM_STR_FREE 305
-#define CM_STR_GET 306
-#define CM_STR_SIZE 307
-#define CM_COPY_STR 308
-#define CM_MAKE_UID 309
-
-#define MS_NEW 310
-#define MS_CREATE 311
+
+#define ACL_LISTCONCAT 312
+#define GETCLIENTLANG 313
diff --git a/include/public/nsapi.h b/include/public/nsapi.h
index 3544fd20..ef01aaad 100644
--- a/include/public/nsapi.h
+++ b/include/public/nsapi.h
@@ -26,29 +26,12 @@
/* Used in some places as a length limit on error messages */
#define MAGNUS_ERROR_LEN 1024
-/* Carriage return and line feed */
-#define CR 13
-#define LF 10
#ifdef XP_WIN32
#define ENDLINE "\r\n"
#else
#define ENDLINE "\n"
#endif
-/* mime.types file identification line */
-#define NCC_MT_MAGIC "#--Netscape Communications Corporation MIME Information"
-#define NCC_MT_MAGIC_LEN 55
-
-/* Deprecated */
-#define MCC_MT_MAGIC "#--Mosaic Communications Corporation MIME Information"
-#define MCC_MT_MAGIC_LEN 53
-
-/* The character which separates extensions with cinfo_find */
-#define CINFO_SEPARATOR '.'
-
-/* The maximum length of a line in a mime.types file */
-#define CINFO_MAX_LEN 1024
-
/*
* The maximum length of an error message. NOT RUN-TIME CHECKED
*/
@@ -110,8 +93,6 @@
#define IO_OKAY 1
#define IO_ERROR -1
#define IO_EOF 0
-#define NETBUF_EOF -1
-#define NETBUF_ERROR -2
/* The disk page size on this machine. */
#define FILE_BUFFERSIZE 4096
@@ -128,36 +109,6 @@
#endif /* XP_WIN32 */
-#define NET_INFINITE_TIMEOUT 0
-#define NET_ZERO_TIMEOUT -1
-
-
-/*
- * The following macros allow code to be written to use either the
- * shell expression API defined here, or the regular expression
- * pattern matching API defined in regexp.h. Regular expressions
- * have a more complicated syntax, but also are more powerful.
- * Define the symbol, USE_REGEX to use regular expressions. You
- * can include either or both of shexp.h and regexp.h, regardless
- * of whether USE_REGEX is defined or not, and the WILDPAT macros
- * will be defined appropriately.
- */
-
-#ifdef USE_REGEX
-
-#define WILDPAT_VALID(exp) regexp_valid(exp)
-#define WILDPAT_MATCH(str, exp) regexp_match(str, exp)
-#define WILDPAT_CMP(str, exp) regexp_cmp(str, exp)
-#define WILDPAT_CASECMP(str, exp) regexp_casecmp(str, exp)
-#define WILDPAT_USES_REGEXP 1
-
-/* Define return codes from WILDPAT_VALID */
-#define NON_WILDPAT -1 /* exp is ordinary string */
-#define INVALID_WILDPAT -2 /* exp is an invalid pattern */
-#define VALID_WILDPAT 1 /* exp is a valid pattern */
-
-#else
-
/* WILDPAT uses shell expressions */
#define WILDPAT_VALID(exp) shexp_valid(exp)
#define WILDPAT_MATCH(str, exp) shexp_match(str, exp)
@@ -170,89 +121,15 @@
#define INVALID_WILDPAT -2 /* exp is an invalid pattern */
#define VALID_WILDPAT 1 /* exp is a valid pattern */
-#endif /* USE_REGEX */
+//#endif /* USE_REGEX */
/* Define return codes from regexp_valid and shexp_valid */
#define NON_SXP NON_WILDPAT /* exp is an ordinary string */
#define INVALID_SXP INVALID_WILDPAT /* exp is an invalid shell exp */
#define VALID_SXP VALID_WILDPAT /* exp is a valid shell exp */
-#ifdef USE_REGEX
-/* and regexp versions */
-#define NON_REGEXP NON_SXP
-#define INVALID_REGEXP INVALID_SXP
-#define VALID_REGEXP VALID_SXP
-#endif
-
#define SYSTHREAD_DEFAULT_PRIORITY 16
-/* The longest line in the configuration file */
-#define CONF_MAXLEN 16384
-
-#define HTTP_DATE_LEN 128
-#ifdef XP_UNIX
-#define HTTP_DATE_FMT "%A, %d-%b-%y %T GMT"
-#else /* XP_WIN32 */
-#define HTTP_DATE_FMT "%A, %d-%b-%y %H:%M:%S GMT"
-#endif /* XP_WIN32 */
-
-/* HTTP status codes */
-#define PROTOCOL_CONTINUE 100 /* HTTP/1.1 */
-#define PROTOCOL_SWITCHING 101 /* HTTP/1.1 */
-#define PROTOCOL_OK 200
-#define PROTOCOL_CREATED 201
-#define PROTOCOL_NO_RESPONSE 204
-#define PROTOCOL_PARTIAL_CONTENT 206
-#define PROTOCOL_REDIRECT 302
-#define PROTOCOL_NOT_MODIFIED 304
-#define PROTOCOL_BAD_REQUEST 400
-#define PROTOCOL_UNAUTHORIZED 401
-#define PROTOCOL_FORBIDDEN 403
-#define PROTOCOL_NOT_FOUND 404
-#define PROTOCOL_METHOD_NOT_ALLOWED 405 /*HTTP/1.1 */
-#define PROTOCOL_PROXY_UNAUTHORIZED 407
-#define PROTOCOL_CONFLICT 409 /* HTTP/1.1 */
-#define PROTOCOL_LENGTH_REQUIRED 411 /*HTTP/1.1 */
-#define PROTOCOL_PRECONDITION_FAIL 412 /*HTTP/1.1 */
-#define PROTOCOL_ENTITY_TOO_LARGE 413 /*HTTP/1.1 */
-#define PROTOCOL_URI_TOO_LARGE 414 /*HTTP/1.1 */
-#define PROTOCOL_SERVER_ERROR 500
-#define PROTOCOL_NOT_IMPLEMENTED 501
-#define PROTOCOL_VERSION_NOT_SUPPORTED 505 /*HTTP/1.1 */
-
-#define CURRENT_PROTOCOL_VERSION 101
-
-/* Definitions for HTTP over SSL */
-#define HTTPS_PORT 443
-#define HTTPS_URL "https"
-
-/* Definitions for HTTP over TCP */
-#define HTTP_PORT 80
-#define HTTP_URL "http"
-
-
-#define REQ_MAX_LINE 4096
-
-/*
- * The REQ_ return codes. These codes are used to determine what the server
- * should do after a particular module completes its task.
- *
- * Func type functions return these as do many internal functions.
- */
-
-/* The function performed its task, proceed with the request */
-#define REQ_PROCEED 0
-/* The entire request should be aborted: An error occurred */
-#define REQ_ABORTED -1
-/* The function performed no task, but proceed anyway. */
-#define REQ_NOACTION -2
-/* Tear down the session and exit */
-#define REQ_EXIT -3
-/* Restart the entire request-response process */
-#define REQ_RESTART -4
-
-/* --- End miscellaneous definitions --- */
-
/* --- Begin native platform includes --- */
#if defined(FILE_UNIX) || defined(FILE_UNIX_MMAP)
@@ -309,180 +186,11 @@ typedef void *SYS_FILE;
#define SYS_ERROR_FD ((SYS_FILE)-1)
-#ifndef SYS_NETFD_T
-typedef void *SYS_NETFD;
-#define SYS_NETFD_T void *
-#endif /* !SYS_NETFD_T */
-
-/* Error value for a SYS_NETFD */
-#ifndef SYS_NET_ERRORFD
-#define SYS_NET_ERRORFD ((SYS_NETFD)-1)
-#endif /* !SYS_NET_ERRORFD */
-
-/*
- * Type: filebuffer, filebuf_t
- *
- * Description:
- *
- * This structure is used to represent a buffered file. On some
- * systems the file may be memory-mapped. A filebuffer is created
- * by filebuf_open(), and destroyed by filebuf_close().
- *
- * Notes:
- *
- * Direct access to the members of this structure, not using
- * macros defined here, is discouraged.
- *
- * The filebuf alias that used to be defined for this type was
- * found to conflict with a C++ class of the same name, so it
- * has been renamed to filebuf_t.
- *
- * The inbuf field used to be (char *), but is now (unsigned char *)
- * to simplify handling of 8-bit data. The value returned by the
- * filebuf_getc() macro is the (unsigned char) casted to (int), or
- * an error code. Unfortunately, IO_EOF cannot be distinguished
- * from a zero byte, but a new function, filebuf_iseof(), is
- * provided that will indicate definitively whether EOF has been
- * reached.
- */
-
-#ifdef FILE_MMAP
-
-/* Version of filebuffer when memory-mapped files are supported */
-typedef struct {
- SYS_FILE fd;
-#ifdef FILE_UNIX_MMAP
- caddr_t fp;
-#else /* FILE_WIN32_MMAP */
- HANDLE fdmap;
- char *fp;
-#endif /* FILE_UNIX_MMAP */
- int len;
-
- unsigned char *inbuf; /* for buffer_grab */
- int cursize;
-
- int pos;
- char *errmsg;
-} filebuffer;
-
-/* Return next character or IO_EOF */
-#define filebuf_getc(b) ((b)->pos == (b)->len ? IO_EOF : (int)((unsigned char *)(b)->fp)[(b)->pos++])
-
-#define filebuf_iseof(b) ((b)->pos == (b)->len)
-
-#else
-
-/* Version of filebuffer with no memory-mapped file support */
-typedef struct {
- SYS_FILE fd;
-
- int pos, cursize, maxsize;
- unsigned char *inbuf;
- char *errmsg;
-} filebuffer;
-
-/* Return next character, IO_EOF, or IO_ERROR */
-#define filebuf_getc(b) \
- ((b)->pos != (b)->cursize ? (int)((b)->inbuf[(b)->pos++]) : filebuf_next(b,1))
-
-#endif /* FILE_MMAP */
-
-/* C++ streamio defines a filebuf class. */
-typedef filebuffer filebuf_t;
-
-#ifdef XP_WIN32
-/* Use a filebuffer to read data from a pipe */
-#define pipebuf_getc(b) \
- ((b)->pos != (b)->cursize ? (int)((b)->inbuf[(b)->pos++]) : pipebuf_next(b,1))
-#endif /* XP_WIN32 */
-
-/*
- * Type: netbuf
- *
- * Description:
- *
- * This structure is used to represent a buffered network socket.
- * It is created by netbuf_open(), and destroyed by netbuf_close().
- *
- * Notes:
- *
- * Direct access to the members of this structure, not using
- * macros defined here, is discouraged.
- *
- * The inbuf field used to be (unsigned char *), but is now
- * simply (char *). The value returned by the netbuf_getc()
- * macro is (int).
- */
-
-typedef struct {
- SYS_NETFD sd;
-
- int pos, cursize, maxsize, rdtimeout;
-#ifdef XP_WIN32
- CHAR address[64];
-#endif /* XP_WIN32 */
- unsigned char *inbuf;
- char *errmsg;
-#ifndef XP_WIN32
- char address[64];
-#endif /* !XP_WIN32 */
-} netbuf;
-
-/*
- * netbuf_getc gets a character from the given network buffer and returns
- * it. (as an integer).
- *
- * It will return (int) IO_ERROR for an error and (int) IO_EOF for
- * an error condition or EOF respectively.
- */
-
-#define netbuf_getc(b) \
- ((b)->pos != (b)->cursize ? (int)((b)->inbuf[(b)->pos++]) : netbuf_next(b,1))
-
-/*
- * buffer_error returns the last error that occurred with buffer. Don't use
- * this unless you know an error occurred. Independent of network/file type.
- */
-
-#define buffer_error(b) ((b)->errmsg)
-
-/*
- * Type: cinfo
- *
- * Description:
- *
- * This is a structure that captures the information in the name/value
- * pairs on one line of a mime.types file. A cinfo structure is
- * stored in the memory-resident database, indexed by each of the
- * file extensions specified in the "exts" name/value pair. It
- * defines various attributes of resources with names containing
- * the specified file extensions.
- *
- * Notes:
- *
- * Pointers to cinfo structures returned by this API may or may not
- * need to freed by the caller. See the individual function
- * descriptions.
- *
- * The strings referenced by the fields of cinfo structures returned
- * by this API should be considered read-only, and do not need to be
- * freed by the caller, even when the cinfo structure does.
- */
-
-typedef struct {
- char *type;
- char *encoding;
- char *language;
-} cinfo;
-
-
typedef void* CONDVAR;
typedef void *COUNTING_SEMAPHORE;
typedef void* CRITICAL;
#ifdef XP_UNIX
-typedef struct passwd *PASSWD;
typedef DIR* SYS_DIR;
typedef struct dirent SYS_DIRENT;
#endif /* XP_UNIX */
@@ -523,56 +231,9 @@ typedef struct {
typedef void *pool_handle_t;
#endif
-#ifndef SEMAPHORE_T
-typedef void *SEMAPHORE;
-#define SEMAPHORE_T void *
-#endif /* !SEMAPHORE_T */
-
-#define SESSION_HASHSIZE 5
-
typedef struct PListStruct_s PListStruct_s;
typedef struct ACLListHandle ACLListHandle;
-typedef struct Session {
- /* Client-specific information */
- pblock *client;
-
- SYS_NETFD csd;
- netbuf *inbuf;
- int csd_open;
-
- struct in_addr iaddr;
-
-#ifdef MCC_PROXY
- int req_cnt;
-#endif
-
-#ifdef MALLOC_POOLS
- pool_handle_t *pool;
-#endif /* MALLOC_POOLS */
-
- void *clauth; /* ACL client authentication information */
- struct Session *next;
- int fill;
- struct sockaddr_in local_addr; /* local addr for this session*/
-
- PListStruct_s *subject;
-} Session;
-
-#if defined (SHMEM_UNIX_MMAP) || defined (SHMEM_WIN32_MMAP)
-typedef struct {
- void *data; /* the data */
-#ifdef SHMEM_WIN32_MMAP
- HANDLE fdmap;
-#endif /* SHMEM_WIN32_MMAP */
- int size; /* the maximum length of the data */
-
- char *name; /* internal use: filename to unlink if exposed */
- SYS_FILE fd; /* internal use: file descriptor for region */
-} shmem_s;
-#endif /* SHMEM_UNIX_MMAP || SHMEM_WIN32_MMAP */
-
-
/* Define a handle for a thread */
typedef void* SYS_THREAD;
@@ -608,2760 +269,17 @@ typedef struct {
pblock *client;
} directive;
-/*
- * dtable is a structure for creating tables of directives
- */
-
-typedef struct {
- int ni;
- directive *inst;
-} dtable;
-
-/*
- * The httpd_object structure.
- *
- * The name pblock array contains the names for this object, such as its
- * virtual location, its physical location, or its identifier.
- *
- * tmpl contains any templates allocated to this object.
- */
-
-typedef struct {
- pblock *name;
-
- int nd;
- dtable *dt;
-} httpd_object;
-
-/*
- * httpd_objset is a container for a bunch of objects. obj is a
- * NULL-terminated array of objects. pos points to the entry after the last
- * one in the array. You should not mess with pos, but can read it to find
- * the last entry.
- *
- * The initfns array is a NULL-terminated array of the Init functions
- * associated with this object set. If there are no Init functions associated
- * with this object set, initfns can be NULL. Each pblock specifies the
- * parameters which are passed to the function when it's executed.
- */
-
-typedef struct {
- int pos;
- httpd_object **obj;
-
- pblock **initfns;
-} httpd_objset;
-
-
-typedef struct {
-
- /* What port we listen to */
- int Vport;
-#define server_portnum conf_getglobals()->Vport
-
- /* What address to bind to */
- char *Vaddr;
-
- /* User to run as */
-#define user_pw conf_getglobals()->Vuserpw
- struct passwd *Vuserpw;
-
- /* Directory to chroot to */
- char *Vchr;
-
- /* Where to log our pid to */
- char *Vpidfn;
-
-#define pool_max conf_getglobals()->Vpool_max
- int Vpool_max; /* OBSOLETE */
-#define pool_min conf_getglobals()->Vpool_min
- int Vpool_min; /* OBSOLETE */
-#define pool_life conf_getglobals()->Vpool_life
- int Vpool_life; /* OBSOLETE */
-
- /* For multiprocess UNIX servers, the maximum threads per process */
-#define pool_maxthreads conf_getglobals()->Vpool_maxthreads
- int Vpool_maxthreads;
-
-#define pool_minthreads conf_getglobals()->Vpool_minthreads
- int Vpool_minthreads; /* OBSOLETE */
-
- char *Vsecure_keyfn;
- char *Vsecure_certfn;
-
-#define security_active conf_getglobals()->Vsecurity_active
- int Vsecurity_active;
-#define ssl3_active conf_getglobals()->Vssl3_active
- int Vssl3_active;
-#define ssl2_active conf_getglobals()->Vssl2_active
- int Vssl2_active;
- int Vsecure_auth;
-#define security_session_timeout conf_getglobals()->Vsecurity_session_timeout
- int Vsecurity_session_timeout;
-#define ssl3_session_timeout conf_getglobals()->Vssl3_session_timeout
- long Vssl3_session_timeout;
-
- /* The server's hostname as should be reported in self-ref URLs */
-#define server_hostname conf_getglobals()->Vserver_hostname
- char *Vserver_hostname;
-
- /* The main object from which all are derived */
-#define root_object conf_getglobals()->Vroot_object
- char *Vroot_object;
-
- /* The object set the administrator has asked us to load */
-#define std_os conf_getglobals()->Vstd_os
- httpd_objset *Vstd_os;
-
- /* The root of ACL data structures */
- void *Vacl_root;
-#define acl_root conf_getglobals()->Vacl_root
-
- /* The main error log, where all errors are logged */
-#define master_error_log conf_getglobals()->Vmaster_error_log
- char *Vmaster_error_log;
-
- /* The server root ( in which the server sits while executing ) */
-#define server_root conf_getglobals()->Vserver_root
- char *Vserver_root;
-
- /* This server's id */
-#define server_id conf_getglobals()->Vserver_id
- char *Vserver_id;
-
- int single_accept; /* daemon mode Internal use only */
- int num_keep_alives; /* number of KA threads Internal use only */
- int log_verbose; /* Flag to log LOG_VERBOSE messages */
- int mmap_flags; /* mmap flags for file cache mmaping - internal use only */
- int mmap_prots; /* mmap prots for file cache mmaping - internal use only */
- int unused1;
- int unused2;
-
- /* Begin Enterprise 3.0 fields */
- int accept_language; /* turn accept-language on/off */
-
- char *mtahost; /* Hostname of the Mail Transport Agent :
- * typically "localhost" for the Unix boxes,
- * or the hostname of a POP server otherwise.
- * Needed by the Agents subsystem.
- */
- char *nntphost; /* NNTP server -> for Agents */
-
- /* The root of ACL data structures */
- void *Vacl_root_30;
-#define acl_root_30 conf_getglobals()->Vacl_root_30
-
- /* This is for the agent subsystem */
- /* The name of tha configuration parameter is: "AgentsFilePath" */
- char* agentFilePath; /* path to agent.conf */
-#define AgentFilePath (conf_getglobals()->agentFilePath)
-
- /* Default allowed methods - */
- int Allowed;
-#define AllowedMethods (conf_getglobals()->Allowed)
-
- pblock *genericGlobals; /* See conf_api.h for details on accessing
- * these
- */
-
- /*Agents ACL file */
- char* agentsACLFile;
- int wait_for_cgi;
- int cgiwatch_timeout;
-
-#ifdef FORTEZZA
- uint32 fortezza_card_mask;
- char *fortezza_personality;
- char *krlname;
-#endif
-} conf_global_vars_s;
-
-typedef struct {
- /* Server working variables */
- pblock *vars;
-
- /* The method, URI, and protocol revision of this request */
- pblock *reqpb;
- /* Protocol specific headers */
- int loadhdrs;
- pblock *headers;
-
- /* Server's response headers */
- int senthdrs;
- pblock *srvhdrs;
-
- /* The object set constructed to fulfill this request */
- httpd_objset *os;
- /* Array of objects that were created from .nsconfig files */
- httpd_objset *tmpos;
-
- /* The stat last returned by request_stat_path */
- char *statpath;
- char *staterr;
- struct stat *finfo;
-
- /* access control state */
- int aclstate; /* ACL decision state */
- int acldirno; /* deciding ACL directive number */
- char * aclname; /* name of deciding ACL */
- pblock * aclpb; /* parameter block for ACL PathCheck */
- /* 3.0 ACL list pointer */
- ACLListHandle *acllist;
-
-#ifdef MCC_PROXY
- struct hostent *hp; /* proxy NSAPI: DNS resolution result */
- char * host; /* proxy NSAPI: host to resolve/connect to */
- int port; /* proxy NSAPI: port to connect to */
-
- void * socks_rq; /* SOCKS request data */
-#endif
-
- int request_is_cacheable; /* default TRUE */
- int directive_is_cacheable; /* default FALSE */
-
- char *cached_headers;
- int cached_headers_len; /* length of the valid headers */
- char *unused;
-
- /* HTTP/1.1 features */
- time_t req_start; /* Time request arrived - used for determining weak or*/
- /* strong cache validation */
-#define REQ_TIME(x) (x)->req_start
- short protv_num; /* Protocol Version number */
- short method_num; /* Method number */
- struct rq_attr {
-#ifdef AIX
- unsigned abs_uri:1; /* 1=Absolute URI was used */
- unsigned chunked:1; /* chunked transfer-coding */
- unsigned keep_alive:1; /* connection keek-alive */
- unsigned pipelined:1; /* request packet is pipelined */
- unsigned reserved:28; /* If you add a bit flag, make */
- /* sure to subtract one from this */
-#else
- unsigned long abs_uri:1; /* 1=Absolute URI was used */
- unsigned long chunked:1; /* chunked transfer-coding */
- unsigned long keep_alive:1; /* connection keek-alive */
- unsigned pipelined:1; /* request packet is pipelined */
- unsigned long reserved:28; /* If you add a bit flag, make */
- /* sure to subtract one from this */
-#endif
- }rq_attr;
- char * hostname; /* Not NULL if abs_uri */
- int allowed; /* Allowed METHODs for this server */
- int byterange; /* number of byte ranges */
- short status_num; /* Status code */
-
- int staterrno; /* used for rqstat */
-} Request;
-
-/* Request attribute macros */
-#define ABS_URI(x) (x)->rq_attr.abs_uri
-#define CHUNKED(x) (x)->rq_attr.chunked
-#define KEEP_ALIVE(x) (x)->rq_attr.keep_alive
-#define PIPELINED(x) (x)->rq_attr.pipelined
-
-/* Define METHODS for HTTP/1.1 */
-#define METHOD_HEAD 0
-#define METHOD_GET 1
-#define METHOD_PUT 2
-#define METHOD_POST 3
-#define METHOD_DELETE 4
-#define METHOD_TRACE 5
-#define METHOD_OPTIONS 6
-/* The following methods are Netscape method extensions */
-#define METHOD_MOVE 7
-#define METHOD_INDEX 8
-#define METHOD_MKDIR 9
-#define METHOD_RMDIR 10
-#define METHOD_COPY 11
-#define METHOD_MAX 12 /* Number of methods available on this server */
-
-#define ISMGET(r) ((r)->method_num == METHOD_GET)
-#define ISMHEAD(r) ((r)->method_num == METHOD_HEAD)
-#define ISMPUT(r) ((r)->method_num == METHOD_PUT)
-#define ISMPOST(r) ((r)->method_num == METHOD_POST)
-#define ISMDELETE(r) ((r)->method_num == METHOD_DELETE)
-#define ISMMOVE(r) ((r)->method_num == METHOD_MOVE)
-#define ISMINDEX(r) ((r)->method_num == METHOD_INDEX)
-#define ISMMKDIR(r) ((r)->method_num == METHOD_MKDIR)
-#define ISMRMDIR(r) ((r)->method_num == METHOD_RMDIR)
-#define ISMCOPY(r) ((r)->method_num == METHOD_COPY)
-#define ISMTRACE(r) ((r)->method_num == METHOD_TRACE)
-#define ISMOPTIONS(r) ((r)->method_num == METHOD_OPTIONS)
-
-/*
- * FuncPtr is a pointer to our kind of functions
- */
-
-#ifdef XP_UNIX
-typedef int Func(pblock *, Session *, Request *);
-#else /* XP_WIN32 */
-typedef int _cdecl Func(pblock *, Session *, Request *);
-#endif /* XP_WIN32 */
-
-typedef Func *FuncPtr;
-
-/*
- * FuncStruct is a structure used in the static declaration of the
- * functions. This static declaration is parsed into a hash table at
- * startup. You should initialize the next entry to NULL.
- */
-
-struct FuncStruct {
- char *name;
- FuncPtr func;
- struct FuncStruct *next;
- int flags;
-};
-
/* --- End type definitions --- */
-/* --- Begin dispatch vector table definition --- */
-
-typedef struct nsapi_dispatch_s nsapi_dispatch_t;
-struct nsapi_dispatch_s {
- char *(*f_system_version)();
- void *(*f_system_malloc)(int size);
- void *(*f_system_calloc)(int size);
- void *(*f_system_realloc)(void *ptr, int size);
- void (*f_system_free)(void *ptr);
- char *(*f_system_strdup)(const char *ptr);
- void *(*f_system_malloc_perm)(int size);
- void *(*f_system_calloc_perm)(int size);
- void *(*f_system_realloc_perm)(void *ptr, int size);
- void (*f_system_free_perm)(void *ptr);
- char *(*f_system_strdup_perm)(const char *ptr);
- int (*f_getThreadMallocKey)(void);
- void (*f_magnus_atrestart)(void (*fn)(void *), void *data);
- filebuf_t *(*f_filebuf_open)(SYS_FILE fd, int sz);
- netbuf *(*f_netbuf_open)(SYS_NETFD sd, int sz);
- filebuf_t *(*f_filebuf_create)(SYS_FILE fd, caddr_t mmap_ptr,
- int mmap_len, int bufsz);
- void (*f_filebuf_close_buffer)(filebuf_t *buf, int clean_mmap);
-#ifdef FILE_MMAP
- filebuf_t *(*f_filebuf_open_nostat)(SYS_FILE fd, int sz,
- struct stat *finfo);
-#else
- void *(*f_filebuf_open_nostat)(void);
-#endif
-#ifdef XP_WIN32
- filebuf_t *(*f_pipebuf_open)(SYS_FILE fd, int sz, struct stat *finfo);
-#else
- void *(*f_pipebuf_open)(void);
-#endif /* XP_WIN32 */
-#ifndef FILE_MMAP
- int (*f_filebuf_next)(filebuf_t *buf, int advance);
-#else
- int (*f_filebuf_next)(void);
-#endif /* !FILE_MMAP */
- int (*f_netbuf_next)(netbuf *buf, int advance);
-#ifdef XP_WIN32
- int (*f_pipebuf_next)(filebuf_t *buf, int advance);
-#else
- int (*f_pipebuf_next)(void);
-#endif /* XP_WIN32 */
- void (*f_filebuf_close)(filebuf_t *buf);
- void (*f_netbuf_close)(netbuf *buf);
-#ifdef XP_WIN32
- void (*f_pipebuf_close)(filebuf_t *buf);
-#else
- void (*f_pipebuf_close)(void);
-#endif /* XP_WIN32 */
- int (*f_filebuf_grab)(filebuf_t *buf, int sz);
- int (*f_netbuf_grab)(netbuf *buf, int sz);
-#ifdef XP_WIN32
- int (*f_pipebuf_grab)(filebuf_t *buf, int sz);
-#else
- int (*f_pipebuf_grab)(void);
-#endif /* XP_WIN32 */
- int (*f_netbuf_buf2sd)(netbuf *buf, SYS_NETFD sd, int len);
- int (*f_filebuf_buf2sd)(filebuf_t *buf, SYS_NETFD sd);
-#ifdef XP_WIN32
- int (*f_pipebuf_buf2sd)(filebuf_t *buf, SYS_NETFD sd, int len);
- int (*f_pipebuf_netbuf2sd)(netbuf *buf, SYS_FILE sd, int len);
- int (*f_pipebuf_netbuf2pipe)(netbuf *buf, SYS_NETFD sd, int len);
-#else
- int (*f_pipebuf_buf2sd)(void);
- int (*f_pipebuf_netbuf2sd)(void);
- int (*f_pipebuf_netbuf2pipe)(void);
-#endif /* XP_WIN32 */
- void (*f_cinfo_init)(void);
- void (*f_cinfo_terminate)(void);
- char *(*f_cinfo_merge)(char *fn);
- cinfo *(*f_cinfo_find)(char *uri);
- cinfo *(*f_cinfo_lookup)(char *type);
- void (*f_cinfo_dump_database)(FILE *dump);
- CRITICAL (*f_crit_init)(void);
- void (*f_crit_enter)(CRITICAL id);
- void (*f_crit_exit)(CRITICAL id);
- void (*f_crit_terminate)(CRITICAL id);
- CONDVAR (*f_condvar_init)(CRITICAL id);
- void (*f_condvar_wait)(CONDVAR cv);
- void (*f_condvar_notify)(CONDVAR cv);
- void (*f_condvar_notifyAll)(CONDVAR cv);
- void (*f_condvar_terminate)(CONDVAR cv);
- COUNTING_SEMAPHORE (*f_cs_init)(int initial_count);
- void (*f_cs_terminate)(COUNTING_SEMAPHORE csp);
- int (*f_cs_wait)(COUNTING_SEMAPHORE csp);
- int (*f_cs_trywait)(COUNTING_SEMAPHORE csp);
- int (*f_cs_release)(COUNTING_SEMAPHORE csp);
- void (*f_daemon_atrestart)(void (*fn)(void *), void *data);
-#ifdef FORTEZZA
- /* THIS IS BOGUS... WHO Decided to export servssl_init!!! It should not
- * be a public function.
- */
- void (*f_servssl_init)(void);
-#else
- void (*f_servssl_init)(PsetHndl pset, PRFileDesc *fd, char *admRoot);
-#endif
- int (*f_ereport)(int degree, char *fmt, ...);
- int (*f_ereport_v)(int degree, char *fmt, va_list args);
- char *(*f_ereport_init)(char *err_fn, char *email,
- PASSWD pwuser, char *version);
- void (*f_ereport_terminate)(void);
- SYS_FILE (*f_ereport_getfd)(void);
- SYS_FILE (*f_system_fopenRO)(char *path);
- SYS_FILE (*f_system_fopenWA)(char *path);
- SYS_FILE (*f_system_fopenRW)(char *path);
- SYS_FILE (*f_system_fopenWT)(char *path);
- int (*f_system_fread)(SYS_FILE fd, char *buf, int sz);
- int (*f_system_fwrite)(SYS_FILE fd,char *buf,int sz);
- int (*f_system_fwrite_atomic)(SYS_FILE fd, char *buf, int sz);
- int (*f_system_lseek)(SYS_FILE fd, int off, int wh);
- int (*f_system_fclose)(SYS_FILE fd);
- int (*f_system_stat)(char *name, struct stat *finfo);
- int (*f_system_rename)(char *oldpath, char *newpath);
- int (*f_system_unlink)(char *path);
- int (*f_system_tlock)(SYS_FILE fd);
- int (*f_system_flock)(SYS_FILE fd);
- int (*f_system_ulock)(SYS_FILE fd);
-#ifdef XP_WIN32
- SYS_DIR (*f_dir_open)(char *path);
- SYS_DIRENT *(*f_dir_read)(SYS_DIR ds);
- void (*f_dir_close)(SYS_DIR ds);
-#else
- void *(*f_dir_open)(void);
- void *(*f_dir_read)(void);
- void (*f_dir_close)(void);
-#endif /* XP_WIN32 */
- int (*f_dir_create_all)(char *dir);
-#ifdef XP_WIN32
- char *(*f_system_winsockerr)(void);
- char *(*f_system_winerr)(void);
- int (*f_system_pread)(SYS_FILE fd, char *buf, int sz);
- int (*f_system_pwrite)(SYS_FILE fd, char *buf, int sz);
- void (*f_file_unix2local)(char *path, char *p2);
-#else
- void *(*f_system_winsockerr)(void);
- void *(*f_system_winerr)(void);
- int (*f_system_pread)(void);
- int (*f_system_pwrite)(void);
- void (*f_file_unix2local)(void);
-#endif /* XP_WIN32 */
- int (*f_system_nocoredumps)(void);
- int (*f_file_setinherit)(SYS_FILE fd, int value);
- int (*f_file_notfound)(void);
- char *(*f_system_errmsg)(void);
- int (*f_system_errmsg_fn)(char **buff, size_t maxlen);
- SYS_NETFD (*f_net_socket)(int domain, int type, int protocol);
- int (*f_net_listen)(SYS_NETFD s, int backlog);
- SYS_NETFD (*f_net_create_listener)(char *ipaddr, int port);
- int (*f_net_connect)(SYS_NETFD s, const void *sockaddr, int namelen);
- int (*f_net_getpeername)(SYS_NETFD s, struct sockaddr *name, int *namelen);
- int (*f_net_close)(SYS_NETFD s);
- int (*f_net_bind)(SYS_NETFD s, const struct sockaddr *name, int namelen);
- SYS_NETFD (*f_net_accept)(SYS_NETFD s, struct sockaddr *addr, int *addrlen);
- int (*f_net_read)(SYS_NETFD sd, char *buf, int sz, int timeout);
- int (*f_net_write)(SYS_NETFD sd, char *buf, int sz);
- int (*f_net_writev)(SYS_NETFD sd, struct iovec *iov, int iovlen);
- int (*f_net_isalive)(SYS_NETFD sd);
- char *(*f_net_ip2host)(char *ip, int verify);
- int (*f_net_getsockopt)(SYS_NETFD s, int level, int optname,
- void *optval, int *optlen);
- int (*f_net_setsockopt)(SYS_NETFD s, int level, int optname,
- const void *optval, int optlen);
- int (*f_net_select)(int nfds, fd_set *r, fd_set *w, fd_set *e,
- struct timeval *timeout);
- int (*f_net_ioctl)(SYS_NETFD s, int tag, void *result);
- pb_param *(*f_param_create)(char *name, char *value);
- int (*f_param_free)(pb_param *pp);
- pblock *(*f_pblock_create)(int n);
- void (*f_pblock_free)(pblock *pb);
- char *(*f_pblock_findval)(const char *name, pblock *pb);
- pb_param *(*f_pblock_nvinsert)(const char *name, const char *value, pblock *pb);
- pb_param *(*f_pblock_nninsert)(const char *name, int value, pblock *pb);
- void (*f_pblock_pinsert)(pb_param *pp, pblock *pb);
- int (*f_pblock_str2pblock)(const char *str, pblock *pb);
- char *(*f_pblock_pblock2str)(pblock *pb, char *str);
- void (*f_pblock_copy)(pblock *src, pblock *dst);
- pblock *(*f_pblock_dup)(pblock *src);
- char **(*f_pblock_pb2env)(pblock *pb, char **env);
- pb_param *(*f_pblock_fr)(const char *name, pblock *pb, int remove);
- char * (*f_pblock_replace)(const char *name,char * new_value,pblock *pb);
- pool_handle_t *(*f_pool_create)(void);
- void (*f_pool_destroy)(pool_handle_t *pool_handle);
- int (*f_pool_enabled)(void);
- void *(*f_pool_malloc)(pool_handle_t *pool_handle, size_t size );
- void (*f_pool_free)(pool_handle_t *pool_handle, void *ptr );
- void *(*f_pool_calloc)(pool_handle_t *pool_handle, size_t nelem, size_t elsize);
- void *(*f_pool_realloc)(pool_handle_t *pool_handle, void *ptr, size_t size );
- char *(*f_pool_strdup)(pool_handle_t *pool_handle, const char *orig_str );
-#if defined(MCC_PROXY) && defined(USE_REGEX)
- int (*f_regexp_valid)(char *exp);
- int (*f_regexp_match)(char *str, char *exp);
- int (*f_regexp_cmp)(char *str, char *exp);
- int (*f_regexp_casecmp)(char *str, char *exp);
-#else
- int (*f_regexp_valid)(void);
- int (*f_regexp_match)(void);
- int (*f_regexp_cmp)(void);
- int (*f_regexp_casecmp)(void);
-#endif
- SEMAPHORE (*f_sem_init)(char *name, int number);
- void (*f_sem_terminate)(SEMAPHORE id);
- int (*f_sem_grab)(SEMAPHORE id);
- int (*f_sem_tgrab)(SEMAPHORE id);
- int (*f_sem_release)(SEMAPHORE id);
- Session *(*f_session_alloc)(SYS_NETFD csd, struct sockaddr_in *sac); /* internal */
- Session *(*f_session_fill)(Session *sn); /* internal */
- Session *(*f_session_create)(SYS_NETFD csd, struct sockaddr_in *sac);
- void (*f_session_free)(Session *sn);
- char *(*f_session_dns_lookup)(Session *sn, int verify);
- int (*f_shexp_valid)(char *exp);
- int (*f_shexp_match)(char *str, char *exp);
- int (*f_shexp_cmp)(char *str, char *exp);
- int (*f_shexp_casecmp)(char *str, char *exp);
-#if defined (SHMEM_UNIX_MMAP) || defined (SHMEM_WIN32_MMAP)
- shmem_s *(*f_shmem_alloc)(char *name, int size, int expose);
- void (*f_shmem_free)(shmem_s *region);
-#else
- void *(*f_shmem_alloc)(void);
- void (*f_shmem_free)(void);
-#endif /* SHMEM_UNIX_MMAP || SHMEM_WIN32_MMAP */
- SYS_THREAD (*f_systhread_start)(int prio, int stksz, void (*fn)(void *), void *arg);
- SYS_THREAD (*f_systhread_current)(void);
- void (*f_systhread_yield)(void);
- SYS_THREAD (*f_systhread_attach)(void);
- void (*f_systhread_detach)(SYS_THREAD thr);
- void (*f_systhread_terminate)(SYS_THREAD thr);
- void (*f_systhread_sleep)(int milliseconds);
- void (*f_systhread_init)(char *name);
- void (*f_systhread_timerset)(int usec);
- int (*f_systhread_newkey)(void);
- void *(*f_systhread_getdata)(int key);
- void (*f_systhread_setdata)(int key, void *data);
- void (*f_systhread_set_default_stacksize)(unsigned long size);
- int (*f_util_getline)(filebuffer *buf, int lineno, int maxlen, char *l);
- char **(*f_util_env_create)(char **env, int n, int *pos);
- char *(*f_util_env_str)(char *name, char *value);
- void (*f_util_env_replace)(char **env, char *name, char *value);
- void (*f_util_env_free)(char **env);
- char **(*f_util_env_copy)(char **src, char **dst);
- char *(*f_util_env_find)(char **env, char *name);
- char *(*f_util_hostname)(void);
- int (*f_util_chdir2path)(char *path);
- int (*f_util_is_mozilla)(char *ua, char *major, char *minor);
- int (*f_util_is_url)(char *url);
- int (*f_util_later_than)(struct tm *lms, char *ims);
- int (*f_util_time_equal)(struct tm *lms, char *ims);
- int (*f_util_str_time_equal)(char *t1, char *t2);
- int (*f_util_uri_is_evil)(char *t);
- void (*f_util_uri_parse)(char *uri);
- void (*f_util_uri_unescape)(char *s);
- char *(*f_util_uri_escape)(char *d, char *s);
- char *(*f_util_url_escape)(char *d, char *s);
- char *(*f_util_sh_escape)(char *s);
- int (*f_util_mime_separator)(char *sep);
- int (*f_util_itoa)(int i, char *a);
- int (*f_util_vsprintf)(char *s, register const char *fmt, va_list args);
- int (*f_util_sprintf)(char *s, const char *fmt, ...);
- int (*f_util_vsnprintf)(char *s, int n, register const char *fmt,
- va_list args);
- int (*f_util_snprintf)(char *s, int n, const char *fmt, ...);
- int (*f_util_strftime)(char *s, const char *format, const struct tm *t);
- char *(*f_util_strtok)(char *s1, const char *s2, char **lasts);
- struct tm *(*f_util_localtime)(const time_t *clock, struct tm *res);
- char *(*f_util_ctime)(const time_t *clock, char *buf, int buflen);
- char *(*f_util_strerror)(int errnum, char *msg, int buflen);
- struct tm *(*f_util_gmtime)(const time_t *clock, struct tm *res);
- char *(*f_util_asctime)(const struct tm *tm,char *buf, int buflen);
-#ifdef NEED_STRCASECMP
- int (*f_util_strcasecmp)(CASECMPARG_T char *one, CASECMPARG_T char *two);
-#else
- int (*f_util_strcasecmp)(void);
-#endif /* NEED_STRCASECMP */
-#ifdef NEED_STRNCASECMP
- int (*f_util_strncasecmp)(CASECMPARG_T char *one, CASECMPARG_T char *two, int n);
-#else
- int (*f_util_strncasecmp)(void);
-#endif /* NEED_STRNCASECMP */
-#ifdef XP_UNIX
- int (*f_util_can_exec)(struct stat *finfo, uid_t uid, gid_t gid);
- struct passwd *(*f_util_getpwnam)(const char *name, struct passwd
- *result, char *buffer, int buflen);
- pid_t (*f_util_waitpid)(pid_t pid, int *statptr, int options);
-#else
- int (*f_util_can_exec)(void);
- void *(*f_util_getpwnam)(void);
- int (*f_util_waitpid)(void);
-#endif /* XP_UNIX */
-#ifdef XP_WIN32
- VOID (*f_util_delete_directory)(char *FileName, BOOL delete_directory);
-#else
- void (*f_util_delete_directory)(void);
-#endif /* XP_WIN32 */
- char *(*f_conf_init)(char *cfn);
- char *(*f_conf_run_init_functions)(void);
- void (*f_conf_terminate)(void);
- conf_global_vars_s *(*f_conf_getglobals)(void);
- void (*f_func_init)(struct FuncStruct *func_standard);
- FuncPtr (*f_func_find)(char *name);
- int (*f_func_exec)(pblock *pb, Session *sn, Request *rq);
- struct FuncStruct *(*f_func_insert)(char *name, FuncPtr fn);
- int (*f_object_execute)(directive *inst, Session *sn, void *rq);
- Request *(*f_http_find_request)(netbuf *buf, Session *sn, int *reply);
- int (*f_http_parse_request)(char *t, Request *rq, Session *sn);
- int (*f_http_scan_headers)(Session *sn, netbuf *buf, char *t,
- pblock *headers);
- int (*f_http_start_response)(Session *sn, Request *rq);
- char **(*f_http_hdrs2env)(pblock *pb);
- void (*f_http_status)(Session *sn, Request *rq, int n, char *r);
- int (*f_http_set_finfo)(Session *sn, Request *rq, struct stat *finfo);
- char *(*f_http_dump822)(pblock *pb, char *t, int *pos, int tsz);
- void (*f_http_finish_request)(Session *sn, Request *rq);
- void (*f_http_handle_session)(Session *sn);
- char *(*f_http_uri2url)(const char *prefix, const char *suffix);
- char *(*f_http_uri2url_dynamic)(const char *prefix, const char *suffix,
- Session *sn, Request *rq);
- void (*f_http_set_keepalive_timeout)(int secs);
- int (*f_log_error_v)(int degree, char *func, Session *sn, Request *rq,
- char *fmt, va_list args);
- int (*f_log_error)(int degree, char *func, Session *sn, Request *rq,
- char *fmt, ...);
- int (*f_log_ereport_v)(int degree, char *fmt, va_list args);
- int (*f_log_ereport)(int degree, char *fmt, ...);
- httpd_object *(*f_object_create)(int nd, pblock *name);
- void (*f_object_free)(httpd_object *obj);
- void (*f_object_add_directive)(int dc, pblock *p, pblock *c,
- httpd_object *obj);
- httpd_objset *(*f_objset_scan_buffer)(filebuffer *buf, char *errstr,
- httpd_objset *os);
- httpd_objset *(*f_objset_create)(void);
- void (*f_objset_free)(httpd_objset *os);
- void (*f_objset_free_setonly)(httpd_objset *os);
- httpd_object *(*f_objset_new_object)(pblock *name, httpd_objset *os);
- void (*f_objset_add_object)(httpd_object *obj, httpd_objset *os);
- void (*f_objset_add_init)(pblock *initfn, httpd_objset *os);
- httpd_object *(*f_objset_findbyname)(char *name, httpd_objset *ign,
- httpd_objset *os);
- httpd_object *(*f_objset_findbyppath)(char *ppath, httpd_objset *ign,
- httpd_objset *os);
- Request *(*f_request_create)(void);
- void (*f_request_free)(Request *req);
- Request *(*f_request_restart_internal)(char *uri, Request *rq);
- int (*f_request_header)(char *name, char **value, Session *sn,
- Request *rq);
- struct stat *(*f_request_stat_path)(char *path, Request *rq);
- char *(*f_conf_getServerString)(void);
- FuncPtr (*f_func_replace)(char *funcname, FuncPtr fn);
- int (*f_net_socketpair)(SYS_NETFD *pair);
-#ifdef XP_UNIX
- SYS_NETFD (*f_net_dup2)(SYS_NETFD prfd, int osfd);
- int (*f_net_is_STDOUT)(SYS_NETFD prfd);
- int (*f_net_is_STDIN)(SYS_NETFD prfd);
-#else
- void *(*f_net_dup2)(void);
- int (*f_net_is_STDOUT)(void);
- int (*f_net_is_STDIN)(void);
-#endif /* XP_UNIX */
- int (*f_func_set_native_thread_flag)(char *name, int flags);
- void *(*f_random_create)(void);
- void (*f_random_update)(void *rctx, unsigned char *inbuf, int length);
- void (*f_random_generate)(void *rctx, unsigned char *outbuf, int length);
- void (*f_random_destroy)(void *rctx);
- void *(*f_md5hash_create)(void);
- void *(*f_md5hash_copy)(void *hctx);
- void (*f_md5hash_begin)(void *hctx);
- void (*f_md5hash_update)(void *hctx, unsigned char *inbuf, int length);
- void (*f_md5hash_end)(void *hctx, unsigned char *outbuf);
- void (*f_md5hash_destroy)(void *hctx);
- void (*f_md5hash_data)(unsigned char *outbuf, unsigned char *src, int length);
- int (*f_ACL_SetupEval)(struct ACLListHandle *acllist, Session *sn, Request *rq, char **rights, char **map_generic, const char *user);
- int (*f_netbuf_getbytes)(netbuf *buf, char *buffer, int size);
- char *(*f_servact_translate_uri)(char *uri, Session *sn);
-
-};
-
-/* --- End dispatch vector table definition --- */
-
-/* --- Begin API macro definitions --- */
-
-#ifndef INTNSAPI
-
-#define system_version (*__nsapi30_table->f_system_version)
-
-/*
- Depending on the system, memory allocated via these macros may come from
- an arena. If these functions are called from within an Init function, they
- will be allocated from permanent storage. Otherwise, they will be freed
- when the current request is finished.
- */
-
-#define MALLOC (*__nsapi30_table->f_system_malloc)
-#define system_malloc (*__nsapi30_table->f_system_malloc)
-
-#define CALLOC (*__nsapi30_table->f_system_calloc)
-#define system_calloc (*__nsapi30_table->f_system_calloc)
-
-#define REALLOC (*__nsapi30_table->f_system_realloc)
-#define system_realloc (*__nsapi30_table->f_system_realloc)
-
-#define FREE (*__nsapi30_table->f_system_free)
-#define system_free (*__nsapi30_table->f_system_free)
-
-#define STRDUP (*__nsapi30_table->f_system_strdup)
-#define system_strdup (*__nsapi30_table->f_system_strdup)
-
-#ifndef NS_MALLOC_DEBUG
-
-/*
- These macros always provide permanent storage, for use in global variables
- and such. They are checked at runtime to prevent them from returning NULL.
- */
-
-#define PERM_MALLOC (*__nsapi30_table->f_system_malloc_perm)
-#define system_malloc_perm (*__nsapi30_table->f_system_malloc_perm)
-
-#define PERM_CALLOC (*__nsapi30_table->f_system_calloc_perm)
-#define system_calloc_perm (*__nsapi30_table->f_system_calloc_perm)
-
-#define PERM_REALLOC (*__nsapi30_table->f_system_realloc_perm)
-#define system_realloc_perm (*__nsapi30_table->f_system_realloc_perm)
-
-#define PERM_FREE (*__nsapi30_table->f_system_free_perm)
-#define system_free_perm (*__nsapi30_table->f_system_free_perm)
-
-#define PERM_STRDUP (*__nsapi30_table->f_system_strdup_perm)
-#define system_strdup_perm (*__nsapi30_table->f_system_strdup_perm)
-
-#endif /* !NS_MALLOC_DEBUG */
-
-/* Thread-Private data key index for accessing the thread-private memory pool.
- * Each thread creates its own pool for allocating data. The MALLOC/FREE/etc
- * macros have been defined to check the thread private data area with the
- * thread_malloc_key index to find the address for the pool currently in use.
- *
- * If a thread wants to use a different pool, it must change the thread-local-
- * storage[thread_malloc_key].
- */
-
-#define getThreadMallocKey (*__nsapi30_table->f_getThreadMallocKey)
-
-#define magnus_atrestart (*__nsapi30_table->f_magnus_atrestart)
-
-/*
- * buffer_open opens a new buffer reading the specified file, with an I/O
- * buffer of size sz, and returns a new buffer structure which will hold
- * the data.
- *
- * If FILE_UNIX_MMAP is defined, this may return NULL. If it does, check
- * system_errmsg to get a message about the error.
- */
-
-#define filebuf_open (*__nsapi30_table->f_filebuf_open)
-#define netbuf_open (*__nsapi30_table->f_netbuf_open)
-
-/*
- * filebuf_open_nostat is a convenience function for mmap() buffer opens,
- * if you happen to have the stat structure already.
- */
-
-#ifdef FILE_MMAP
-#define filebuf_open_nostat (*__nsapi30_table->f_filebuf_open_nostat)
-#endif /* FILE_MMAP */
-
-/*
- * filebuf_create is a convenience function if the file is already open
- * or mmap'd. It creates a new filebuf for use with the mmap'd file.
- * If mmap_ptr is NULL, or MMAP is not supported on this system, it
- * creates a buffer with buffer size bufsz.
- */
-
-#define filebuf_create (*__nsapi30_table->f_filebuf_create)
-
-/*
- * filebuf_close_buffer is provided to cleanup a filebuf without closing
- * the underlying file. If clean_mmap is 1, and the file is memory mapped,
- * the file will be unmapped. If clean_mmap is 0, the file will not
- * be unmapped.
- */
-#define filebuf_close_buffer (*__nsapi30_table->f_filebuf_close_buffer)
-
-#ifdef FILE_MMAP
-#define filebuf_open_nostat (*__nsapi30_table->f_filebuf_open_nostat)
-#endif
-
-#ifdef XP_WIN32
-#define pipebuf_open (*__nsapi30_table->f_pipebuf_open)
-#endif /* XP_WIN32 */
-
-/*
- * buffer_next loads size more bytes into the given buffer and returns the
- * first one, or BUFFER_EOF on EOF and BUFFER_ERROR on error.
- */
-
-#ifndef FILE_MMAP
-#define filebuf_next (*__nsapi30_table->f_filebuf_next)
-#endif /* !FILE_MMAP */
-#define netbuf_next (*__nsapi30_table->f_netbuf_next)
-#ifdef XP_WIN32
-#define pipebuf_next (*__nsapi30_table->f_pipebuf_next)
-#endif /* XP_WIN32 */
-
-/*
- * buffer_close deallocates a buffer and closes its associated files
- * (does not close a network socket).
- */
-
-#define filebuf_close (*__nsapi30_table->f_filebuf_close)
-#define netbuf_close (*__nsapi30_table->f_netbuf_close)
-#ifdef XP_WIN32
-#define pipebuf_close (*__nsapi30_table->f_pipebuf_close)
-#endif /* XP_WIN32 */
-
-/*
- * buffer_grab will set the buffer's inbuf array to an array of sz bytes
- * from the buffer's associated object. It returns the number of bytes
- * actually read (between 1 and sz). It returns IO_EOF upon EOF or IO_ERROR
- * upon error. The cursize entry of the structure will reflect the size
- * of the iobuf array.
- *
- * The buffer will take care of allocation and deallocation of this array.
- */
-
-#define filebuf_grab (*__nsapi30_table->f_filebuf_grab)
-#define netbuf_grab (*__nsapi30_table->f_netbuf_grab)
-#ifdef XP_WIN32
-#define pipebuf_grab (*__nsapi30_table->f_pipebuf_grab)
-#endif /* XP_WIN32 */
-
-/*
- * netbuf_getbytes will read bytes from the netbuf into the user
- * supplied buffer. Up to size bytes will be read.
- * If the call is successful, the number of bytes read is returned.
- * NETBUF_EOF is returned when no more data will arrive on the socket,
- * and NETBUF_ERROR is returned in the event of an error.
- *
- */
-#define netbuf_getbytes (*__nsapi30_table->f_netbuf_getbytes)
-
-
-/*
- * netbuf_buf2sd will send n bytes from the (probably previously read)
- * buffer and send them to sd. If sd is -1, they are discarded. If n is
- * -1, it will continue until EOF is recieved. Returns IO_ERROR on error
- * and the number of bytes sent any other time.
- */
-
-#define netbuf_buf2sd (*__nsapi30_table->f_netbuf_buf2sd)
-
-/*
- * filebuf_buf2sd assumes that nothing has been read from the filebuf,
- * and just sends the file out to the given socket. Returns IO_ERROR on error
- * and the number of bytes sent otherwise.
- *
- * Does not currently support you having read from the buffer previously. This
- * can be changed transparently.
- */
-
-#define filebuf_buf2sd (*__nsapi30_table->f_filebuf_buf2sd)
-
-#ifdef XP_WIN32
-
-/*
- * NT pipe version of filebuf_buf2sd.
- */
-#define pipebuf_buf2sd (*__nsapi30_table->f_pipebuf_buf2sd)
-
-/*
- * NT pipe version of netbuf_buf2sd.
- */
-
-#define pipebuf_netbuf2sd (*__nsapi30_table->f_pipebuf_netbuf2sd)
-#define pipebuf_netbuf2pipe (*__nsapi30_table->f_pipebuf_netbuf2pipe)
-#endif /* XP_WIN32 */
-
-/*
- * Notes:
- *
- * Format of a mime.types file
- *
- * A mime.types file passed to cinfo_merge() should begin with
- * a line containing NCC_MT_MAGIC as defined below (MCC_MT_MAGIC
- * is also still supported). Lines containing only whitespace
- * and lines beginning with "#" are ignored. Other lines contain
- * one or more name/value pairs, separated by whitespace. The
- * format of each of these is NAME=VALUE, where NAME is one of:
- *
- * type - VALUE is a mime type, e.g. text/html
- * exts - VALUE is a list of file extensions, e.g. htm,html
- * enc - VALUE specifies a content encoding, e.g. x-gzip
- * lang - VALUE specifies a content language, e.g. en-US
- * (see RFC1766)
- *
- * The VALUE may be enclosed in quotes (" "), and should be if it
- * contains whitespace.
- *
- * Each line in the file that contains at least one name/value
- * pair causes a cinfo structure to be created, containing the
- * specified information. These structures are kept in memory
- * and can be queried using cinfo_find().
- *
- * Related information
- *
- * See the NSAPI "load-types" function.
- */
-
-/*
- * Function: cinfo_init
- *
- * Description:
- *
- * This function initializes the memory resident content information
- * database to be empty.
- *
- * Notes:
- *
- * This function is called by the NSAPI "load-types" function,
- * which also sets up a call to cinfo_terminate() on server restart.
- * If "load-types" is used, it should be unnecessary to call this
- * function.
- */
-
-#define cinfo_init (*__nsapi30_table->f_cinfo_init)
-
-/*
- * Function: cinfo_terminate
- *
- * Description:
- *
- * This function frees all dynamic memory associated with the
- * memory resident content information database, and leaves the
- * database empty. cinfo_init() should be called before using
- * the database again.
- */
-
-#define cinfo_terminate (*__nsapi30_table->f_cinfo_terminate)
-
-/*
- * Function: cinfo_merge
- *
- * Description:
- *
- * This function reads a mime.types formatted file of the specified
- * name. Content information in the file is merged into the
- * memory resident content information database.
- *
- * Arguments:
- *
- * fn - name of mime.types formatted file
- *
- * Returns:
- *
- * If successful, NULL is returned. If an error occurs, the return
- * value is a pointer to a descriptive error string, which should
- * be freed by the caller (using FREE()). Information processed
- * prior to the error will still be added to the database.
- */
-
-#define cinfo_merge (*__nsapi30_table->f_cinfo_merge)
-
-
-/*
- * Function: cinfo_find
- *
- * Description:
- *
- * This function is used to retrieve content information based on
- * a file extension contained in the argument string, which might
- * be either a URI or a file name. It ignores any text up to and
- * including the last FILE_PATHSEP character in the argument
- * string. It looks for one or more file extensions in the
- * remaining string, each one starting with a CINFO_SEPARATOR
- * character. Each file extension is looked up in the database
- * and any information found there is used to build a composite
- * cinfo structure, containing information derived from each of
- * the file extensions. If more than one file extensions present
- * have a particular piece of information associated with them
- * in the database (e.g. type or language), the value returned in
- * the composite cinfo structure is taken from the data for the
- * last file extension to provide that attribute.
- *
- * Arguments:
- *
- * uri - pointer to the argument string
- *
- * Returns:
- *
- * If successful, a pointer to the composite cinfo structure is
- * returned. The fields of this structure reference values of
- * those fields in one or more cinfo structures in the database,
- * so these values should be copied if they are going to be
- * modified. The cinfo structure itself should be freed by the
- * caller using FREE(). If an error occurs, a null pointer is
- * returned. If no information is found for any of the extensions,
- * a null pointer is returned, although this is not necessarily
- * an error.
- *
- * Notes:
- *
- * The matching of extensions in the argument string to extensions
- * in the database is case-insensitive.
- *
- * The argument string is modified during parsing, but only
- * temporarily. It should be intact on return.
- */
-
-#define cinfo_find (*__nsapi30_table->f_cinfo_find)
-
-/*
- * Function: cinfo_lookup
- *
- * Description:
- *
- * This function returns a pointer to the last cinfo structure
- * added to the database for a specified mime type. Unlike
- * cinfo_find(), the returned pointer references a cinfo structure
- * that is part of the database, and corresponds to a single line
- * in a mime.types file. This structure should be considered
- * read-only, and should not be freed by the caller.
- *
- * Arguments:
- *
- * type - a pointer to a mime type string
- *
- * Returns:
- *
- * If the specified type is found, a pointer to the cinfo structure
- * returned. Otherwise a null pointer is returned.
- *
- * Notes:
- *
- * The search for the type is case-insensitive.
- */
-
-#define cinfo_lookup (*__nsapi30_table->f_cinfo_lookup)
-
-/*
- * Function: cinfo_dump_database
- *
- * Description:
- *
- * This function outputs, to a specified file, formatted text
- * describing the contents of the content information database.
- * This is intended for debugging purposes. It is not in mime.types
- * format.
- *
- * Arguments:
- *
- * dump - handle for already open output file
- */
-
-#define cinfo_dump_database (*__nsapi30_table->f_cinfo_dump_database)
-
-/*
- * Critical section abstraction. Used in threaded servers to protect
- * areas where two threads can interfere with each other.
- *
- * Condvars are condition variables that are used for thread-thread
- * synchronization.
- */
-
-/*
- * crit_init creates and returns a new critical section variable. At the
- * time of creation no one has entered it.
- */
-#define crit_init (*__nsapi30_table->f_crit_init)
-
-/*
- * crit_enter enters a critical section. If someone is already in the
- * section, the calling thread is blocked until that thread exits.
- */
-#define crit_enter (*__nsapi30_table->f_crit_enter)
-
-/*
- * crit_exit exits a critical section. If another thread is blocked waiting
- * to enter, it will be unblocked and given ownership of the section.
- */
-#define crit_exit (*__nsapi30_table->f_crit_exit)
-
-/*
- * crit_terminate removes a previously allocated critical section variable.
- */
-#define crit_terminate (*__nsapi30_table->f_crit_terminate)
-
-/*
- * condvar_init initializes and returns a new condition variable. You
- * must provide a critical section to be associated with this condition
- * variable.
- */
-#define condvar_init (*__nsapi30_table->f_condvar_init)
-
-/*
- * condvar_wait blocks on the given condition variable. The calling thread
- * will be blocked until another thread calls condvar_notify on this variable.
- * The caller must have entered the critical section associated with this
- * condition variable prior to waiting for it.
- */
-#define condvar_wait (*__nsapi30_table->f_condvar_wait)
-
-/*
- * condvar_notify awakens any threads blocked on the given condition
- * variable. The caller must have entered the critical section associated
- * with this variable first.
- */
-#define condvar_notify (*__nsapi30_table->f_condvar_notify)
-
-/*
- * condvar_notify awakens all threads blocked on the given condition
- * variable. The caller must have entered the critical section associated
- * with this variable first.
- */
-#define condvar_notifyAll (*__nsapi30_table->f_condvar_notifyAll)
-
-/*
- * condvar_terminate frees the given previously allocated condition variable
- */
-#define condvar_terminate (*__nsapi30_table->f_condvar_terminate)
-
-/*
- * Create a counting semaphore.
- * Return non-zero on success, 0 on failure.
- */
-#define cs_init (*__nsapi30_table->f_cs_init)
-
-/*
- * Destroy a counting semaphore
- */
-#define cs_terminate (*__nsapi30_table->f_cs_terminate)
-
-/*
- * Wait to "enter" the semaphore.
- * Return 0 on success, -1 on failure.
- */
-#define cs_wait (*__nsapi30_table->f_cs_wait)
-
-/*
- * Enter the semaphore if the count is > 0. Otherwise return -1.
- *
- */
-#define cs_trywait (*__nsapi30_table->f_cs_trywait)
-
-/*
- * Release the semaphore- allowing a thread to enter.
- * Return 0 on success, -1 on failure.
- */
-#define cs_release (*__nsapi30_table->f_cs_release)
-
-/*
- * daemon_atrestart registers a function to be called fn, with the given
- * void pointer as an argument, when the server is restarted.
- */
-#define daemon_atrestart (*__nsapi30_table->f_daemon_atrestart)
-
-#define servssl_init (*__nsapi30_table->f_servssl_init)
-
-/*
- * ereport logs an error of the given degree and formats the arguments with
- * the printf() style fmt. Returns whether the log was successful. Records
- * the current date.
- */
-
-#define ereport (*__nsapi30_table->f_ereport)
-#define ereport_v (*__nsapi30_table->f_ereport_v)
-
-/*
- * ereport_init initializes the error logging subsystem and opens the static
- * file descriptors. It returns NULL upon success and an error string upon
- * error. If a userpw is given, the logs will be chowned to that user.
- *
- * email is the address of a person to mail upon catastrophic error. It
- * can be NULL if no e-mail is desired. ereport_init will not duplicate
- * its own copy of this string; you must make sure it stays around and free
- * it when you shut down the server.
- */
-
-#define ereport_init (*__nsapi30_table->f_ereport_init)
-
-/*
- * log_terminate closes the error and common log file descriptors.
- */
-#define ereport_terminate (*__nsapi30_table->f_ereport_terminate)
-
-/* For restarts */
-#define ereport_getfd (*__nsapi30_table->f_ereport_getfd)
-
-/* FUNCTION: system_fopenXX
- * DESCRIPTION:
- * system_fopenRO - Open a disk file for read-only access.
- * system_fopenWA - Open a disk file for write and append access.
- * system_fopenRW - Open a disk file for read-write access.
- * system_fopenWT - Open a disk file for write and truncate access.
- * INPUTS:
- * path- the name of the file
- * OUTPUTS:
- * none
- * RETURNS:
- * SYS_ERRORFD on failure
- * A opaque file handle on success
- * RESTRICTIONS:
- * The return from this function should not be interpreted as a native
- * file handle. It may only be used in other calls to system_xxx().
- *
- * Note for unix programmers: Although this routine is called
- * "system_fopen" do not consider it to be equivalent to the unix
- * "fopen" call, which opens a buffered-IO file.
- */
-#define system_fopenRO (*__nsapi30_table->f_system_fopenRO)
-#define system_fopenWA (*__nsapi30_table->f_system_fopenWA)
-#define system_fopenRW (*__nsapi30_table->f_system_fopenRW)
-#define system_fopenWT (*__nsapi30_table->f_system_fopenWT)
-
-/* FUNCTION: system_fread
- * DESCRIPTION:
- * Read from a file
- * INPUTS:
- * fd- an open file handle to read from
- * buf- a buffer to receive data
- * sz- the number of bytes to read from the file
- * OUTPUTS:
- * none
- * RETURNS:
- * less-than-zero on failure
- * 0 for end-of-file
- * positive for number of bytes read
- * RESTRICTIONS:
- */
-#define system_fread (*__nsapi30_table->f_system_fread)
-
-/* FUNCTION: system_write
- * DESCRIPTION:
- * Writes sz bytes from buf to file fd.
- * INPUTS:
- * fd- the file to write to
- * buf- the buffer containing data to be written
- * sz- the size of data to write.
- * OUTPUTS:
- * none
- * RETURNS:
- * IO_OKAY on success
- * IO_ERROR on failure
- * RESTRICTIONS:
- * There is no way to determine if bytes were written when this call fails.
- * For more specific information, use PR_WRITE().
- */
-#define system_fwrite (*__nsapi30_table->f_system_fwrite)
-
-/* FUNCTION: system_fwrite_atomic
- * DESCRIPTION:
- * system_fwrite_atomic locks the given fd before writing to it. This
- * avoids interference between simultaneous writes.
- * INPUTS:
- * fd- the file to write to
- * buf- the buffer containing data to be written
- * sz- the size of data to write.
- * OUTPUTS:
- * none
- * RETURNS:
- * IO_OKAY on success
- * IO_ERROR on failure
- * RESTRICTIONS:
- */
-#define system_fwrite_atomic (*__nsapi30_table->f_system_fwrite_atomic)
-
-/* FUNCTION: system_lseek
- * DESCRIPTION:
- * Seek to a position in a file
- * INPUTS:
- * fd- an open file handle
- * off
- * wh
- * OUTPUTS:
- * RETURNS:
- * RESTRICTIONS:
- */
-#define system_lseek (*__nsapi30_table->f_system_lseek)
-
-/* FUNCTION: system_fclose
- * DESCRIPTION:
- * Close a file.
- * INPUTS:
- * fd- an open file handle from a previous system_fopenXX call.
- * OUTPUTS:
- * none
- * RETURNS:
- * IO_OKAY on success
- * IO_ERROR on failure
- * RESTRICTIONS:
- */
-#define system_fclose (*__nsapi30_table->f_system_fclose)
-
-/* FUNCTION: system_stat
- * DESCRIPTION:
- * Get information about a file on disk
- * INPUTS:
- * name- the name of the file to be queried
- * OUTPUTS:
- * finfo- a buffer to receive the file information.
- * RETURN:
- * less-than-zero on failure.
- * 0 on success.
- * RESTRICTIONS:
- * Within the stat structure, this routine is only guaranteed to return
- * st_mode, st_size, st_ctime, and st_mtime. Other stat fields are
- * undefined.
- */
-#define system_stat (*__nsapi30_table->f_system_stat)
-
-/* --- File manipulation --------------------------------------------- */
-
-/* FUNCTION: system_rename
- * DESCRIPTION:
- * Rename a file on disk.
- * INPUTS:
- * oldpath- old file name
- * newpath- new file name
- * OUTPUTS:
- * none
- * RETURNS:
- * less-than-zero on failure
- * 0 on success
- * RESTRICTIONS:
- * Not guaranteed to work portably on files which are in use.
- */
-#define system_rename (*__nsapi30_table->f_system_rename)
-
-/* FUNCTION: system_unlink
- * DESCRIPTION:
- * Remove a file from disk.
- * INPUTS:
- * path- the file to delete
- * OUTPUTS:
- * none
- * RETURNS:
- * less-than-zero on failure
- * 0 on success
- * RESTRICTIONS:
- * Not guaranteed to work portably on files which are in use.
- */
-#define system_unlink (*__nsapi30_table->f_system_unlink)
-
-/* --- File locking -------------------------------------------------- */
-
-#define system_initlock(fd) (0)
-
-/* FUNCTION: system_tlock
- * DESCRIPTION:
- * Test for a file lock and grab it if it is available
- * INPUTS:
- * fd- the file to lock
- * OUTPUTS:
- * none
- * RETURNS:
- * 0 - if we now hold the lock
- * less-than-zero if the lock is held by someone else
- * RESTRICTIONS:
- * 1. file locking is process based. Two threads in the same process
- * requesting exclusive access will both be allowed to access the file
- * at the same time.
- */
-#define system_tlock (*__nsapi30_table->f_system_tlock)
-
-/* FUNCTION: system_flock
- * DESCRIPTION:
- * Wait for exclusive access to a file
- * INPUTS:
- * fd- the file to lock
- * OUTPUTS:
- * none
- * RETURNS:
- * 0 - if we now hold the lock
- * less-than-zero if an error occurred
- * RESTRICTIONS:
- * 1. file locking is process based. Two threads in the same process
- * requesting exclusive access will both be allowed to access the file
- * at the same time.
- */
-#define system_flock (*__nsapi30_table->f_system_flock)
-
-/* FUNCTION: system_ulock
- * DESCRIPTION:
- * Release exclusive access to a file
- * INPUTS:
- * fd- the file to lock
- * OUTPUTS:
- * none
- * RETURNS:
- * 0 - if we released the lock
- * less-than-zero if an error occurred
- * RESTRICTIONS:
- * 1. file locking is process based. Two threads in the same process
- * requesting exclusive access will both be allowed to access the file
- * at the same time.
- */
-#define system_ulock (*__nsapi30_table->f_system_ulock)
-
-/* --- Directory manipulation routines ---------------------------------- */
-
-#ifdef XP_WIN32
-#define dir_open (*__nsapi30_table->f_dir_open)
-#define dir_read (*__nsapi30_table->f_dir_read)
-#define dir_close (*__nsapi30_table->f_dir_close)
-#endif /* XP_WIN32 */
-
-/*
- * create a directory and any of its parents
- */
-#define dir_create_all (*__nsapi30_table->f_dir_create_all)
-
-#ifdef XP_WIN32
-#define system_winsockerr (*__nsapi30_table->f_system_winsockerr)
-#define system_winerr (*__nsapi30_table->f_system_winerr)
-#define system_pread (*__nsapi30_table->f_system_pread)
-#define system_pwrite (*__nsapi30_table->f_system_pwrite)
-#define file_unix2local (*__nsapi30_table->f_file_unix2local)
-#endif /* XP_WIN32 */
-
-#define system_nocoredumps (*__nsapi30_table->f_system_nocoredumps)
-#define file_setinherit (*__nsapi30_table->f_file_setinherit)
-#define file_notfound (*__nsapi30_table->f_file_notfound)
-#define system_errmsg (*__nsapi30_table->f_system_errmsg)
-#define system_errmsg_fn (*__nsapi30_table->f_system_errmsg_fn)
-
-/* FUNCTION: net_socket
- * DESCRIPTION:
- * Create a new socket.
- * INPUTS:
- * domain- only supported type is AF_INET
- * type- only supported type is SOCK_STREAM
- * protocol- only supported value is 0
- * OUTPUTS:
- * none
- * RETURNS:
- * SYS_NET_ERRORFD on errro
- * a valid SYS_NETFD on success
- * RESTRICTIONS:
- */
-#define net_socket (*__nsapi30_table->f_net_socket)
-
-/* FUNCTION: net_listen
- * DESCRIPTION:
- * Set listen backlog for a socket.
- * INPUTS:
- * s- the socket
- * backlog- value of backlog to set
- * OUTPUTS:
- * RETURNS:
- * 0 on success
- * less-than-zero on failure
- * RESTRICTIONS:
- * Some systems do not return errors even when the requested backlog
- * cannot be set (it is too high). Consult your system manual for
- * details on the maximum value of the backlog.
- */
-#define net_listen (*__nsapi30_table->f_net_listen)
-
-/* FUNCTION: net_create_listener
- * DESCRIPTION:
- * Creates a socket for accepting new connection.
- * INPUTS:
- * OUTPUTS:
- * RETURNS:
- * SYS_NET_ERRORFD on error.
- * RESTRICTIONS:
- * This is a convenience routine which creates a socket, binds to
- * an IP address and port, and sets the listen backlog to
- * net_listenqsize.
- */
-#define net_create_listener (*__nsapi30_table->f_net_create_listener)
-
-/* FUNCTION: net_connect
- * DESCRIPTION:
- * Connect a socket to a remote listener
- * INPUTS:
- * OUTPUTS:
- * RETURNS:
- * 0 on success
- * less-than-zero on error
- * RESTRICTIONS:
- */
-#define net_connect (*__nsapi30_table->f_net_connect)
-
-/* FUNCTION: net_getpeername
- * DESCRIPTION:
- * Get the socket address (IP address/port) of the remote host.
- * INPUTS:
- * s- the socket
- * name - the socket address of the remote
- * OUTPUTS:
- * RETURNS:
- * RESTRICTIONS:
- */
-#define net_getpeername (*__nsapi30_table->f_net_getpeername)
-
-/* FUNCTION: net_close
- * DESCRIPTION:
- * Close an open socket
- * INPUTS:
- * s- the socket to close
- * OUTPUTS:
- * none
- * RETURNS:
- * 0 on success
- * less-than-zero on failure
- * RESTRICTIONS:
- */
-#define net_close (*__nsapi30_table->f_net_close)
-
-/* FUNCTION: net_bind
- * DESCRIPTION:
- * Bind to a socket address
- * INPUTS:
- * s-
- * name-
- * namelen-
- * OUTPUTS:
- * RETURNS:
- * RESTRICTIONS:
- */
-#define net_bind (*__nsapi30_table->f_net_bind)
-
-/* FUNCTION: net_accept
- * DESCRIPTION:
- * Accept a connection on a listener socket.
- * INPUTS:
- * s
- * addr
- * OUTPUTS:
- * addrlen
- * RETURNS:
- * RESTRICTIONS:
- */
-#define net_accept (*__nsapi30_table->f_net_accept)
-
-/* FUNCTION: net_read
- * DESCRIPTION:
- * sd
- * buf
- * sz
- * timeout
- * INPUTS:
- * OUTPUTS:
- * RETURNS:
- * IO_ERROR on error
- * 0 if the remote closes the socket
- * positive representing the number of bytes successfully read
- * RESTRICTIONS:
- * timeout must be NET_ZERO_TIMEOUT, NET_INFINITE_TIMEOUT, or a positive
- * value in seconds
- */
-#define net_read (*__nsapi30_table->f_net_read)
-
-/* FUNCTION: net_write
- * DESCRIPTION:
- * Write data to a socket.
- * INPUTS:
- * sd
- * buf
- * sz
- * OUTPUTS:
- * RETURNS:
- * RESTRICTIONS:
- * net_write() is unbuffered. Specifying many calls to net_write() for
- * small amounts of data is inefficient.
- */
-#define net_write (*__nsapi30_table->f_net_write)
-
-/* FUNCTION: net_writev
- * DESCRIPTION:
- * Write vectored data to the socket.
- * INPUTS:
- * OUTPUTS:
- * RETURNS:
- * RESTRICTIONS:
- * net_writev() is unbuffered. Specifying many calls to net_writev() for
- * small amounts of data is inefficient.
- */
-#define net_writev (*__nsapi30_table->f_net_writev)
-
-/* FUNCTION: net_isalive
- * DESCRIPTION:
- * Checks to see if the given socket is still connected to a remote
- * host. The remote host does not see any side effects from this call.
- * INPUTS:
- * sd - the socket
- * OUTPUTS:
- * none
- * RETURNS:
- * 0 if the socket is no longer connected
- * 1 if the socket is still connected.
- * RESTRICTIONS:
- */
-#define net_isalive (*__nsapi30_table->f_net_isalive)
-
-/* FUNCTION: net_ip2host
- * DESCRIPTION:
- * Transforms the given textual IP number into a fully qualified domain
- * name (FQDN). This is similar to calling gethostbyaddr().
- * INPUTS:
- * verify- If 1, specifies that the function should verify the hostname
- * returned from the lookup. This is similar to calling
- * gethostbyname() on the result of the call to gethostbyaddr().
- * OUTPUTS:
- * RETURNS:
- * The fully qualified domain name, or whatever it can find.
- * If it cannot resolve the name at all, returns NULL.
- * RESTRICTIONS:
- * This function is governed by the use of the Server DNS cache. If caching
- * is enabled it can take as long as 20 minutes before this function
- * does the lookup again.
- */
-#define net_ip2host (*__nsapi30_table->f_net_ip2host)
-
-
-/* --- OBSOLETE ----------------------------------------------------------
- * The following macros/functions are obsolete and are only maintained for
- * compatibility. Do not use them.
- * -----------------------------------------------------------------------
- */
-
-/* FUNCTION: net_getsockopt
- * DESCRIPTION:
- * Get socket options
- * INPUTS:
- * OUTPUTS:
- * RETURNS:
- * RESTRICTIONS:
- * Because this function is not portable (not all systems support the
- * same options), it should be used with caution.
- */
-#define net_getsockopt (*__nsapi30_table->f_net_getsockopt)
-
-/* FUNCTION: net_setsockopt
- * DESCRIPTION:
- * Set socket options
- * INPUTS:
- * OUTPUTS:
- * RETURNS:
- * RESTRICTIONS:
- * Because this function is not portable (not all systems support the
- * same options), it should be used with caution.
- */
-#define net_setsockopt (*__nsapi30_table->f_net_setsockopt)
-
-/* FUNCTION: net_select
- * DESCRIPTION:
- * Wait for IO on a set of sockets.
- * INPUTS:
- * OUTPUTS:
- * RETURNS:
- * -1 on error
- * 0 on timeout
- * positive value representing the number of IOs ready
- * RESTRICTIONS:
- * Because this function is not portable (not all systems support the
- * same options), it should be used with caution.
- */
-#define net_select (*__nsapi30_table->f_net_select)
-
-/* FUNCTION: net_ioctl
- * DESCRIPTION:
- * Set socket options.
- * INPUTS:
- * OUTPUTS:
- * RETURNS:
- * RESTRICTIONS:
- * Because this function is not portable (not all systems support the
- * same options), it should be used with caution.
- */
-#define net_ioctl (*__nsapi30_table->f_net_ioctl)
-
-/* FUNCTION: net_socketpair
- * DESCRIPTION:
- * Creates a TCP socketpair.
- * INPUTS:
- * OUTPUTS:
- * RETURNS:
- * 0 on success
- * -1 on failure
- * RESTRICTIONS:
- * Because this function is not portable (not all systems support the
- * same options), it should be used with caution.
- */
-#define net_socketpair (*__nsapi30_table->f_net_socketpair)
-
-#ifdef XP_UNIX
-/* FUNCTION: net_dup2
- * DESCRIPTION:
- * Duplicates a socket to a specific file descriptor
- * INPUTS:
- * OUTPUTS:
- * RETURNS:
- * RESTRICTIONS:
- * Because this function is not portable (not all systems support the
- * same options), it should be used with caution.
- */
-#define net_dup2 (*__nsapi30_table->f_net_dup2)
-
-/* FUNCTION: net_is_STDOUT
- * DESCRIPTION:
- * Checks if the underlying OS file descriptor for the given
- * SYS_NETFD is the STDOUT filedescriptor
- * INPUTS:
- * OUTPUTS:
- * RETURNS:
- * 1 if it is STDOUT (1)
- * 0 otherwise
- * RESTRICTIONS:
- * Because this function is not portable (not all systems support the
- * same options), it should be used with caution.
- */
-#define net_is_STDOUT (*__nsapi30_table->f_net_is_STDOUT)
-
-/* FUNCTION: net_is_STDIN
- * DESCRIPTION:
- * Checks if the underlying OS file descriptor for the given
- * SYS_NETFD is the STDIN filedescriptor
- * INPUTS:
- * OUTPUTS:
- * RETURNS:
- * 1 if it is STDIN (0)
- * 0 otherwise
- * RESTRICTIONS:
- * Because this function is not portable (not all systems support the
- * same options), it should be used with caution.
- */
-#define net_is_STDIN (*__nsapi30_table->f_net_is_STDIN)
-#endif /* XP_UNIX */
-
-/*
- * A parameter block is a set of name=value pairs which are generally used
- * as parameters, but can be anything. They are kept in a hash table for
- * reasonable speed, but if you are doing any intensive modification or
- * access of them you should probably make a local copy of each parameter
- * while working.
- *
- * When creating a pblock, you specify the hash table size for that pblock.
- * You should set this size larger if you know that many items will be in
- * that pblock, and smaller if only a few will be used or if speed is not
- * a concern.
- */
-
-/*
- * param_create creates a parameter with the given name and value. If name
- * and value are non-NULL, they are copied and placed into the new pb_param
- * struct.
- */
-
-#define param_create (*__nsapi30_table->f_param_create)
-
-/*
- * param_free frees a given parameter if it's non-NULL, and returns 1 if
- * p was non-NULL, and 0 if p was NULL.
- *
- * Useful for error checking pblock_remove.
- */
-
-#define param_free (*__nsapi30_table->f_param_free)
-
-/*
- * pblock_create creates a new pblock with hash table size n.
- *
- * It returns the newly allocated pblock.
- */
-
-#define pblock_create (*__nsapi30_table->f_pblock_create)
-
-/*
- * pblock_free frees the given pblock and any entries inside it.
- *
- * If you want to save anything in a pblock, remove its entities with
- * pblock_remove first and save the pointers you get.
- */
-
-#define pblock_free (*__nsapi30_table->f_pblock_free)
-
-/*
- * pblock_findval finds the entry with the given name in pblock pb, and
- * returns its value, otherwise returns NULL.
- */
-
-#define pblock_findval (*__nsapi30_table->f_pblock_findval)
-
-/*
- * pblock_nvinsert creates a new parameter with the given name and value
- * and inserts it into pblock pb. The name and value in the parameter are
- * also newly allocated. Returns the pb_param it allocated (in case you
- * need it).
- *
- * pblock_nninsert inserts a numerical value.
- */
-
-#define pblock_nvinsert (*__nsapi30_table->f_pblock_nvinsert)
-#define pblock_nninsert (*__nsapi30_table->f_pblock_nninsert)
-
-/*
- * pblock_pinsert inserts a pb_param into a pblock.
- */
-
-#define pblock_pinsert (*__nsapi30_table->f_pblock_pinsert)
-
-/*
- * pblock_str2pblock scans the given string str for parameter pairs
- * name=value, or name="value". Any \ must be followed by a literal
- * character. If a string value is found, with no unescaped = signs, it
- * will be added with the name 1, 2, 3, etc. depending on whether it was
- * first, second, third, etc. in the stream (zero doesn't count).
- *
- * Returns the number of parameters added to the table, or -1 upon error.
- */
-
-#define pblock_str2pblock (*__nsapi30_table->f_pblock_str2pblock)
-
-/*
- * pblock_pblock2str places all of the parameters in the given pblock
- * into the given string (NULL if it needs creation). It will re-allocate
- * more space for the string. Each parameter is separated by a space and of
- * the form name="value"
- */
-
-#define pblock_pblock2str (*__nsapi30_table->f_pblock_pblock2str)
-
-/*
- * pblock_copy copies the entries in the given source pblock to the
- * destination one. The entries are newly allocated so that the original
- * pblock may be freed or the new one changed without affecting the other.
- */
-
-#define pblock_copy (*__nsapi30_table->f_pblock_copy)
-
-/*
- * pblock_dup creates a new pblock and copies the given source pblock
- * into it. The entries are newly allocated so that the original pblock
- * may be freed or the new one changed without affecting the other.
- */
-
-#define pblock_dup (*__nsapi30_table->f_pblock_dup)
-
-/*
- * pblock_pb2env copies the given pblock into the given environment, with
- * one new env entry for each name/value pair in the pblock.
- */
-
-#define pblock_pb2env (*__nsapi30_table->f_pblock_pb2env)
-
-/* --------------------------- Internal things ---------------------------- */
-#define pblock_fr (*__nsapi30_table->f_pblock_fr)
-#define pblock_replace (*__nsapi30_table->f_pblock_replace)
-
-/* pool_create()
- * Function to create a new pool.
- * Returns non-NULL on success, NULL on failure.
- */
-#define pool_create (*__nsapi30_table->f_pool_create)
-
-/* pool_destroy()
- * Frees all memory associated with a pool and destroys the pool.
- */
-#define pool_destroy (*__nsapi30_table->f_pool_destroy)
-
-/* pool_enabled()
- * Check if the pools are enabled and a pool is currently set
- * for this thread. Return 1 if enabled, 0 if not enabled.
- */
-#define pool_enabled (*__nsapi30_table->f_pool_enabled)
-
-#define pool_malloc (*__nsapi30_table->f_pool_malloc)
-#define pool_free (*__nsapi30_table->f_pool_free)
-#define pool_calloc (*__nsapi30_table->f_pool_calloc)
-#define pool_realloc (*__nsapi30_table->f_pool_realloc)
-#define pool_strdup (*__nsapi30_table->f_pool_strdup)
-
-/*
- * regexp_valid takes a regular expression exp as input. It returns:
- *
- * NON_REGEXP if exp is a standard string
- * (above not used -- always returns VALID_REGEXP!!)
- * INVALID_REGEXP if exp is a regular expression, but invalid
- * VALID_REGEXP if exp is a valid regular expression
- */
-
-#define regexp_valid (*__nsapi30_table->f_regexp_valid)
-
-/*
- * regexp_match
- *
- * Takes a prevalidated shell expression exp, and a string str.
- *
- * Returns 0 on match and 1 on non-match.
- */
-
-#define regexp_match (*__nsapi30_table->f_regexp_match)
-
-/*
- * regexp_cmp
- *
- * Same as above, but validates the exp first. 0 on match, 1 on non-match,
- * -1 on invalid exp. regexp_casecmp does the same thing but is case
- * insensitive.
- */
-
-#define regexp_cmp (*__nsapi30_table->f_regexp_cmp)
-#define regexp_casecmp (*__nsapi30_table->f_regexp_casecmp)
-
-/*
- * sem_init creates a semaphore using the given name and unique
- * identification number. filename should be a file accessible to the
- * process. Returns SEM_ERROR on error.
- */
-
-#define sem_init (*__nsapi30_table->f_sem_init)
-
-/*
- * sem_terminate de-allocates the given semaphore.
- */
-
-#define sem_terminate (*__nsapi30_table->f_sem_terminate)
-
-/*
- * sem_grab attempts to gain exclusive access to the given semaphore. If
- * it can't get it, the caller will block. Returns -1 on error.
- */
-
-#define sem_grab (*__nsapi30_table->f_sem_grab)
-#define sem_tgrab (*__nsapi30_table->f_sem_tgrab)
-
-/*
- * sem_release releases this process's exclusive control over the given
- * semaphore. Returns -1 on error.
- */
-
-#define sem_release (*__nsapi30_table->f_sem_release)
-
-/*
- * session_create creates a new request structure for the client with the
- * given socket descriptor and sockaddr.
- */
-
-#define session_alloc (*__nsapi30_table->f_session_alloc)
-#define session_fill (*__nsapi30_table->f_session_fill)
-#define session_create (*__nsapi30_table->f_session_create)
-
-/*
- * session_free frees the given session
- */
-
-#define session_free (*__nsapi30_table->f_session_free)
-
-#define session_dns_lookup (*__nsapi30_table->f_session_dns_lookup)
-
-/*
- * This describes the API for matching a string with a "shell expression".
- * The expressions accepted are based loosely on the expressions accepted
- * by zsh. A shell expression is a string pattern made up of ordinary
- * characters and any of the types of pattern sequences listed below.
- *
- * Pattern Matches
- * * zero or more characters
- * ? exactly one character
- * $ matches the end of string
- * [abc] matches one instance of any of the characters
- * enclosed in []
- * [a-z] matches one instance of any character in the
- * specified range of characters
- * [^abc] matches one instance of any character not
- * in the enclosed set
- *
- * Backslash (\) is used to quote a character that would otherwise be
- * considered part of a pattern sequence, e.g. "2\*2=4".
- *
- * The following composite shell expression structures are also
- * recognized:
- *
- * shexp1~shexp2 matches any string that matches shexp1,
- * unless the string also matches shexp2
- *
- * Example: "*~*.netscape.com" matches any string that does
- * not end with ".netscape.com"
- *
- * (shexp1|...|shexpN) matches any string that matches any one of
- * the ()-enclosed, |-separated shell
- * expressions.
- */
-
-/* Determine whether exp is a valid shell expression */
-#define shexp_valid (*__nsapi30_table->f_shexp_valid)
-
-/*
- * shexp_match
- *
- * Takes a prevalidated shell expression exp, and a string str.
- *
- * Returns 0 on match and 1 on non-match.
- */
-
-#define shexp_match (*__nsapi30_table->f_shexp_match)
-
-
-/*
- * shexp_cmp
- *
- * Same as above, but validates the exp first. 0 on match, 1 on non-match,
- * -1 on invalid exp. shexp_casecmp does the same thing but is case
- * insensitive.
- */
-
-#define shexp_cmp (*__nsapi30_table->f_shexp_cmp)
-#define shexp_casecmp (*__nsapi30_table->f_shexp_casecmp)
-
-/*
- * Regular expression API - Analogous to shell expression API
- */
-
-#define regexp_valid (*__nsapi30_table->f_regexp_valid)
-#define regexp_match (*__nsapi30_table->f_regexp_match)
-#define regexp_cmp (*__nsapi30_table->f_regexp_cmp)
-#define regexp_casecmp (*__nsapi30_table->f_regexp_casecmp)
-
-
-#if defined (SHMEM_UNIX_MMAP) || defined (SHMEM_WIN32_MMAP)
-
-/*
- * shmem_alloc allocates a region of shared memory of the given size, using
- * the given name to avoid conflicts between multiple regions within the
- * program. The region will not be automatically grown if its boundaries
- * are over-run, use shmem_realloc for that.
- *
- * If expose is non-zero and the underlying system supports it, the
- * file used to create the shared region will be visible to other processes
- * running on the system.
- *
- * name should be unique to the program which calls this routine, otherwise
- * conflicts will arise.
- *
- * Returns a new shared memory region, with the data element being a
- * pointer to the shared memory. This function must be called before any
- * daemon workers are spawned, in order for the handle to the shared region
- * to be inherited by the children.
- *
- * Because of the requirement that the region must be inherited by the
- * children, the region cannot be re-allocated with a larger size when
- * necessary.
- */
-#define shmem_alloc (*__nsapi30_table->f_shmem_alloc)
-
-/*
- * shmem_free de-allocates the specified region of shared memory.
- */
-#define shmem_free (*__nsapi30_table->f_shmem_free)
-
-#endif /* SHMEM_UNIX_MMAP || SHMEM_WIN32_MMAP */
-
-/*
- * systhread_start creates a thread with the given priority, will allocate
- * a stack of stksz bytes, and calls fn with arg as its argument. stksz
- * of zero will allocate a default stack size.
- *
- * Returns a new SYS_THREAD pointer on success, SYS_THREAD_ERROR on failure.
- * XXX Priorities are system dependent
- */
-
-#define systhread_start (*__nsapi30_table->f_systhread_start)
-
-/*
- * systhread_current returns a handle for the current thread.
- */
-
-#define systhread_current (*__nsapi30_table->f_systhread_current)
-
-/*
- * systhread_yield yields the processor to another thread
- */
-
-#define systhread_yield (*__nsapi30_table->f_systhread_yield)
-
-/*
- * systhread_attach makes an existing thread an NSPR thread.
- */
-#define systhread_attach (*__nsapi30_table->f_systhread_attach)
-
-/*
- * Detaches a thread that was attached.
- */
-
-#define systhread_detach (*__nsapi30_table->f_systhread_detach)
-
-/*
- * systhread_terminate terminates the thread that is passed in.
- */
-#define systhread_terminate (*__nsapi30_table->f_systhread_terminate)
-
-/*
- * systhread_sleep puts the calling thread to sleep for the given number
- * of milliseconds.
- */
-#define systhread_sleep (*__nsapi30_table->f_systhread_sleep)
-
-/*
- * systhread_init initializes the threading system. name is a name for the
- * program for debugging.
- */
-
-#define systhread_init (*__nsapi30_table->f_systhread_init)
-
-/*
- * systhread_timerset starts or re-sets the interrupt timer for a thread
- * system. This should be considered a suggestion as most systems don't allow
- * the timer interval to be changed.
- */
-
-#define systhread_timerset (*__nsapi30_table->f_systhread_timerset)
-
-/*
- * newkey allocates a new integer id for thread-private data. Use this
- * key to identify a variable which you want to appear differently
- * between threads, and then use setdata to associate a value with this
- * key for each thread.
- */
-#define systhread_newkey (*__nsapi30_table->f_systhread_newkey)
-
-/*
- * Get data that has been previously associated with key in this thread.
- * Returns NULL if setkey has not been called with this key by this
- * thread previously, or the data that was previously used with setkey
- * by this thread with this key.
- */
-#define systhread_getdata (*__nsapi30_table->f_systhread_getdata)
-
-/*
- * Associate data with the given key number in this thread.
- */
-#define systhread_setdata (*__nsapi30_table->f_systhread_setdata)
-
-/*
- * Set the default stack size for threads created via systhr_start
- */
-#define systhread_set_default_stacksize (*__nsapi30_table->f_systhread_set_default_stacksize)
-
-/*
- * A hodge podge of utility functions and standard functions which
- * are unavailable on certain systems
- */
-
-/*
- * getline scans in buf until it finds a LF or CRLF, storing the string in
- * l. It will terminate the string and return:
- *
- * 0 when done, with the scanned line (minus CR or LF) in l
- * 1 upon EOF, with the scanned line (minus CR or LF) in l
- * -1 on error with the error description in l (uses lineno for information)
- */
-
-#define util_getline (*__nsapi30_table->f_util_getline)
-
-/*
- * env_create creates a new environment with the given env, with n new
- * entries, and places the current position that you should add your
- * entries with at pos.
- *
- * If env is NULL, it will allocate a new one. If not, it will reallocate
- * that one.
- */
-
-#define util_env_create (*__nsapi30_table->f_util_env_create)
-
-/*
- * util_env_str allocates a string from the given name and value and
- * returns it. It does not check for things like = signs in name.
- */
-
-#define util_env_str (*__nsapi30_table->f_util_env_str)
-
-/*
- * env_replace replaces the occurrence of the given variable with the
- * value you give.
- */
-
-#define util_env_replace (*__nsapi30_table->f_util_env_replace)
-
-/*
- * util_env_free frees an environment.
- */
-
-#define util_env_free (*__nsapi30_table->f_util_env_free)
-
-/*
- * util_env_copy copies an env
- */
-#define util_env_copy (*__nsapi30_table->f_util_env_copy)
-
-/*
- * util_env_find looks through env for the named string. Returns the
- * corresponding value if the named string is found, or NULL if not.
- */
-#define util_env_find (*__nsapi30_table->f_util_env_find)
-
-/*
- * hostname gets the local hostname. Returns NULL if it can't find a FQDN.
- * You are free to realloc or free this string.
- */
-
-#define util_hostname (*__nsapi30_table->f_util_hostname)
-
-/*
- * chdir2path changes the current directory to the one that the file
- * path is in. path should point to a file. Caveat: path must be a writable
- * string. It won't get modified permanently.
- */
-
-#define util_chdir2path (*__nsapi30_table->f_util_chdir2path)
-
-/*
- * is_mozilla checks if the given user-agent is mozilla, of at least
- * the given major and minor revisions. These are strings to avoid
- * ambiguities like 1.56 > 1.5
- */
-
-#define util_is_mozilla (*__nsapi30_table->f_util_is_mozilla)
-
-/*
- * is_url will return 1 if the given string seems to be a URL, or will
- * return 0 otherwise.
- *
- * Because of stupid news URLs, this will return 1 if the string has
- * all alphabetic characters up to the first colon and will not check for
- * the double slash.
- */
-
-#define util_is_url (*__nsapi30_table->f_util_is_url)
-
-/*
- * util_later_than checks the date in the string ims, and if that date is
- * later than or equal to the one in the tm struct lms, then it returns 1.
- *
- * util_time_equal is above, but checks for exact equality.
- *
- * Handles RFC 822, 850, and ctime formats.
- */
-
-#define util_later_than (*__nsapi30_table->f_util_later_than)
-#define util_time_equal (*__nsapi30_table->f_util_time_equal)
-
-/*
- * util_str_time_equal checks the character-string dates are equal.
- * Supports rfc1123 and rfc850 formats. t1 must be rfc1123
- * Returns 0 if equal, -1 otherwise
- */
-#define util_str_time_equal (*__nsapi30_table->f_util_str_time_equal)
-
-/*
- * util_uri_is_evil returns 1 if a URL has ../ or // in it.
- */
-#define util_uri_is_evil (*__nsapi30_table->f_util_uri_is_evil)
-
-/*
- * util_uri_parse gets rid of /../, /./, and //.
- *
- * Assumes that either the string starts with a /, or the string will
- * not .. right off of its beginning. As such, ../foo.gif will
- * not be changed, although /../foo.gif will become /foo.gif.
- */
-
-#define util_uri_parse (*__nsapi30_table->f_util_uri_parse)
-
-/*
- * util_uri_unescape unescapes the given URI in place (% conversions only).
- */
-
-#define util_uri_unescape (*__nsapi30_table->f_util_uri_unescape)
-
-/*
- * util_uri_escape escapes any nasty chars in s and copies the string into d.
- * If d is NULL, it will allocate and return a properly sized string.
- * Warning: does not check bounds on a given d.
- *
- * util_url_escape does the same thing but does it for a url, i.e. ?:+ is
- * not escaped.
- */
-
-#define util_uri_escape (*__nsapi30_table->f_util_uri_escape)
-#define util_url_escape (*__nsapi30_table->f_util_url_escape)
-
-/*
- * util_sh_escape places a \ in front of any shell-special characters.
- * Returns a newly-allocated copy of the string.
- */
-
-#define util_sh_escape (*__nsapi30_table->f_util_sh_escape)
-
-/*
- * util_mime_separator generates a new MIME separator into the given buffer.
- * The buffer should be more than 4 + 3*10 + 1 bytes long. A CRLF is prepended
- * to the beginning of the string, along with two dashes. The string is null
- * terminated, with no CRLF. The intent is that you create your content-type
- * header by accessing &sep[4], and afterwards print sep followed by CRLF
- * for message boundaries.
- *
- * Returns the length of the string.
- */
-#define util_mime_separator (*__nsapi30_table->f_util_mime_separator)
-
-/*
- * util_itoa converts the given integer to a string into a.
- */
-
-#define util_itoa (*__nsapi30_table->f_util_itoa)
-
-/*
- * util_vsprintf and util_sprintf are simplified clones of the System V
- * vsprintf and sprintf routines.
- *
- * Returns the number of characters printed. Only handles %d and %s,
- * does not handle any width or precision.
- */
-
-#define util_vsprintf (*__nsapi30_table->f_util_vsprintf)
-#define util_sprintf (*__nsapi30_table->f_util_sprintf)
-
-/* These routines perform bounds checks. */
-#define util_vsnprintf (*__nsapi30_table->f_util_vsnprintf)
-#define util_snprintf (*__nsapi30_table->f_util_snprintf)
-
-/* util_strftime()
- * Thread safe version of strftime.
- * No bounds checking is done s. t must be a valid tm structure.
- */
-#define util_strftime (*__nsapi30_table->f_util_strftime)
-
-/* Various thread safe routines. */
-
-#define util_strtok (*__nsapi30_table->f_util_strtok)
-#define util_localtime (*__nsapi30_table->f_util_localtime)
-#define util_ctime (*__nsapi30_table->f_util_ctime)
-#define util_strerror (*__nsapi30_table->f_util_strerror)
-#define util_gmtime (*__nsapi30_table->f_util_gmtime)
-#define util_asctime (*__nsapi30_table->f_util_asctime)
-
#ifdef NEED_STRCASECMP
-#define util_strcasecmp (*__nsapi30_table->f_util_strcasecmp)
#define strcasecmp(s1, s2) util_strcasecmp(s1, s2)
#endif /* NEED_STRCASECMP */
#ifdef NEED_STRNCASECMP
-#define util_strncasecmp (*__nsapi30_table->f_util_strncasecmp)
#define strncasecmp(s1, s2, n) util_strncasecmp(s1, s2, n)
#endif /* NEED_STRNCASECMP */
#ifdef XP_UNIX
-
-/*
- * can_exec returns 1 if you can execute the file described by finfo, and
- * 0 if you can't.
- */
-
-#define util_can_exec (*__nsapi30_table->f_util_can_exec)
-
-/*
- * Thread safe getpwnam
- */
-#define util_getpwnam (*__nsapi30_table->f_util_getpwnam)
-
-#define util_waitpid (*__nsapi30_table->f_util_waitpid)
-
-#endif /* XP_UNIX */
-
-#ifdef XP_WIN32
-
-/* util_delete_directory()
- * This routine deletes all the files in a directory. If delete_directory is
- * TRUE it will also delete the directory itself.
- */
-#define util_delete_directory (*__nsapi30_table->f_util_delete_directory)
-
-#endif /* XP_WIN32 */
-
-/*
- * conf_init reads the given configuration file and sets any non-default
- * parameters to their given setting.
- */
-#define conf_init (*__nsapi30_table->f_conf_init)
-#define conf_run_init_functions (*__nsapi30_table->f_conf_run_init_functions)
-
-/*
- * conf_terminate frees any data the conf routines may be holding.
- */
-#define conf_terminate (*__nsapi30_table->f_conf_terminate)
-
-/*
- * conf_getServerString returns the Server ID string
- */
-#define conf_getServerString (*__nsapi30_table->f_conf_getServerString)
-
-/*
- * Get a structure with the global variables for this server.
- */
-#define conf_getglobals (*__nsapi30_table->f_conf_getglobals)
-
-/*
- * func_init reads the static FuncStruct arrays and creates the global
- * function table from them.
- *
- * func_init will only read from the static arrays defined in func.c.
- */
-#define func_init (*__nsapi30_table->f_func_init)
-
-/*
- * func_find returns a pointer to the function named name, or NULL if none
- * exists.
- */
-#define func_find (*__nsapi30_table->f_func_find)
-
-/* DO NOT USE this function.
- */
-#define func_set_native_thread_flag (*__nsapi30_table->f_func_set_native_thread_flag)
-
-/*
- * func_exec will try to execute the function whose name is the "fn" entry
- * in the given pblock. If name is not found, it will log a misconfig of
- * missing fn parameter. If it can't find it, it will log that. In these
- * cases it will return REQ_ABORTED. Otherwise, it will return what the
- * function being executed returns.
- */
-#define func_exec (*__nsapi30_table->f_func_exec)
-
-/*
- * func_replace will replace a function in the server's function table with
- * another. Returns the FuncPtr to the old function if it replaces the
- * function, otherwise it returns 0.
- */
-#define func_replace (*__nsapi30_table->f_func_replace)
-
-/*
- * func_insert dynamically inserts a named function into the server's
- * table of functions. Returns the FuncStruct it keeps in internal
- * databases, because on server restart you are responsible for freeing
- * (or not) its contents.
- */
-#define func_insert (*__nsapi30_table->f_func_insert)
-#define object_execute (*__nsapi30_table->f_object_execute)
-
-/*
- * gets the first line of an HTTP request
- */
-#define http_find_request (*__nsapi30_table->f_http_find_request)
-
-/*
- * parses the first line of an HTTP request
- */
-#define http_parse_request (*__nsapi30_table->f_http_parse_request)
-
-/*
- * Scans HTTP headers from the given netbuf, and places them in headers.
- * If netbuf is NULL, the session's inbuf is used.
- *
- * Folded lines are joined and the linefeed removed (but not the whitespace).
- * If there are any repeat headers they are joined and the two field bodies
- * separated by a comma and space.
- *
- * t should be a string of length REQ_MAX_LINE. This is a convenience to
- * req.c so that we don't use too much runtime stack.
- *
- * Session is an optional parameter. Use NULL if you wish. It's used for
- * error logs.
- */
-#define http_scan_headers (*__nsapi30_table->f_http_scan_headers)
-
-/*
- * Starts the HTTP response. If HTTP/0.9, does nothing. If 1.0, sends header.
- * If this returns REQ_NOACTION, the method was head and no body should be
- * sent. Otherwise, it will return REQ_PROCEED.
- */
-#define http_start_response (*__nsapi30_table->f_http_start_response)
-
-/*
- * http_hdrs2env takes the entries from the given pblock and converts them
- * to an environment.
- *
- * Each name entry will be made uppercase, prefixed with HTTP_ and any
- * occurrence of - will be converted to _.
- */
-#define http_hdrs2env (*__nsapi30_table->f_http_hdrs2env)
-
-/*
- * http_status sets status to the code n, with reason string r. If r is
- * NULL, the server will attempt to find one for the given status code.
- * If it finds none, it will give "Because I felt like it."
- */
-#define http_status (*__nsapi30_table->f_http_status)
-
-/*
- * http_set_finfo sets content-length and last-modified
- */
-
-#define http_set_finfo (*__nsapi30_table->f_http_set_finfo)
-
-/*
- * Takes the given pblock and prints headers into the given buffer at
- * position pos. Returns the buffer, reallocated if needed. Modifies pos.
- */
-#define http_dump822 (*__nsapi30_table->f_http_dump822)
-
-/*
- * Finishes a request. For HTTP, this just closes the socket.
- */
-#define http_finish_request (*__nsapi30_table->f_http_finish_request)
-
-/*
- * http_handle_session processes each request generated by Session
- */
-#define http_handle_session (*__nsapi30_table->f_http_handle_session)
-
-/*
- * http_uri2url takes the give URI prefix and URI suffix and creates a
- * newly-allocated full URL from them of the form
- * http://(server):(port)(prefix)(suffix)
- *
- * If you want either prefix or suffix to be skipped, use "" instead of NULL.
- *
- * Normally, the server hostname is taken from the ServerName parameter in
- * magnus.conf. The newer function http_uri2url_dynamic should be used when
- * a Session and Request structure are available, to ensure that the browser
- * gets redirected to the exact host they were originally referencing.
- */
-
-#define http_uri2url (*__nsapi30_table->f_http_uri2url)
-#define http_uri2url_dynamic (*__nsapi30_table->f_http_uri2url_dynamic)
-
-/*
- * http_set_keepalive_timeout sets the number of seconds to wait for a new
- * request to come from a persistent connection. Returns nothing. Intended
- * to be called at server startup only.
- *
- * Specifying a timeout of zero will disable persistent connections and allow
- * browsers to request only one file per connection.
- */
-#define http_set_keepalive_timeout (*__nsapi30_table->f_http_set_keepalive_timeout)
-
-/*
- * log_error logs an error of the given degree from the function func
- * and formats the arguments with the printf() style fmt. Returns whether the
- * log was successful. Records the current date.
- *
- * sn and rq are optional parameters. If given, information about the client
- * will be reported.
- */
-#define log_error_v (*__nsapi30_table->f_log_error_v)
-#define log_error (*__nsapi30_table->f_log_error)
-
-/*
- * Internal use only
- */
-#define log_ereport_v (*__nsapi30_table->f_log_ereport_v)
-#define log_ereport (*__nsapi30_table->f_log_ereport)
-
-/*
- * object_create will create a new object and return a pointer to it.
- * It will allocate space for nd directive types and set name accordingly.
- */
-#define object_create (*__nsapi30_table->f_object_create)
-
-/*
- * object_free will free an object and any data associated with it.
- */
-#define object_free (*__nsapi30_table->f_object_free)
-
-/*
- * object_add_directive will add a new directive to the dtable for
- * the directive class at position dc.
- */
-#define object_add_directive (*__nsapi30_table->f_object_add_directive)
-
-/*
- * Executes the directive specified by inst within the context of the
- * given session and request structures. Returns what the executed function
- * returned (one of the REQ_* codes defined in req.h).
- *
- * This prototype uses void * for Request * in order to avoid including
- * all of req.h.
- *
- */
-
-/*
- * objset_scan_buffer will scan through buffer, looking for object
- * configuration information, and adding them to the object set os if it
- * finds any. If os is NULL it will allocate a new object set.
- *
- * If any error occurs (syntax error, premature EOF) this function will
- * free os, print an error message into errstr, and return NULL.
- * This is because a config. file error is viewed as a catastrophic error
- * from which httpd should not try to recover. If httpd were to continue
- * after an error, it would not behave as the admin. expected and he/she
- * may not notice until it's too late.
- *
- * Upon EOF the file will not be closed.
- */
-#define objset_scan_buffer (*__nsapi30_table->f_objset_scan_buffer)
-
-/*
- * objset_create creates a new object set and returns a pointer to it.
- */
-#define objset_create (*__nsapi30_table->f_objset_create)
-
-/*
- * objset_free will free an object set, any associated objects, and any
- * associated Init functions.
- */
-#define objset_free (*__nsapi30_table->f_objset_free)
-
-/*
- * objset_free_setonly frees only the object set, and not the associated
- * objects or init functions.
- */
-#define objset_free_setonly (*__nsapi30_table->f_objset_free_setonly)
-
-/*
- * objset_new_object will add a new object to objset with the specified
- * name. It returns a pointer to the new object (which may be anywhere in
- * the objset).
- */
-#define objset_new_object (*__nsapi30_table->f_objset_new_object)
-
-/*
- * objset_add_object will add the existing object to os.
- */
-#define objset_add_object (*__nsapi30_table->f_objset_add_object)
-
-/*
- * objset_add_init will add the initialization function specified by
- * initfn to the given object set. Modifies os->initfns.
- */
-#define objset_add_init (*__nsapi30_table->f_objset_add_init)
-
-/*
- * objset_findbyname will find the object in objset having the given name,
- * and return the object if found, and NULL otherwise.
- * ign is a set of objects to ignore.
- */
-#define objset_findbyname (*__nsapi30_table->f_objset_findbyname)
-
-/*
- * objset_findbyppath will find the object in objset having the given
- * partial path entry. Returns object if found, NULL otherwise.
- * ign is a set of objects to ignore.
- */
-#define objset_findbyppath (*__nsapi30_table->f_objset_findbyppath)
-
-/*
- * request_create creates a new request structure.
- */
-#define request_create (*__nsapi30_table->f_request_create)
-
-/*
- * request_free destroys a request structure.
- */
-#define request_free (*__nsapi30_table->f_request_free)
-
-/*
- * Restarts a request for a given URI internally. If rq is non-NULL, the
- * function will keep the old request's headers and protocol, but with a new
- * URI and method of GET. If the previous method was HEAD, this is preserved.
- * Any other method becomes GET. You may assume that if you give it a request
- * structure that it will use the same structure.
- *
- * Once you have this new Request, you must then do what you want with
- * it (e.g. send the object back, perform uri2path translation, etc.)
- */
-#define request_restart_internal (*__nsapi30_table->f_request_restart_internal)
-
-/*
- * request_header finds the named header depending on the requesting
- * protocol. If possible, it will not load headers until the first is
- * requested. You have to watch out because this can return REQ_ABORTED.
- */
-#define request_header (*__nsapi30_table->f_request_header)
-
-/*
- * request_loadheaders just makes sure the headers have been loaded.
- */
-#define request_loadheaders (*__nsapi30_table->f_request_loadheaders)
-
-/*
- * request_stat_path tries to stat path. If path is NULL, it will look in
- * the vars pblock for "path". If the stat is successful, it returns the stat
- * structure. If not, returns NULL and leaves a message in rq->staterr. If a
- * previous call to this function was successful, and path is the same, the
- * function will simply return the previously found value.
- *
- * User functions should not free this structure.
- */
-
-#define request_stat_path (*__nsapi30_table->f_request_stat_path)
-
-/*
- * Random number generation
- *
- * random_create - create a new random number context
- * random_update - update a context with random data
- * random_generate - generate random bytes
- * random_destroy - destroy a random number context
- */
-
-#define random_create (*__nsapi30_table->f_random_create)
-#define random_update (*__nsapi30_table->f_random_update)
-#define random_generate (*__nsapi30_table->f_random_generate)
-#define random_destroy (*__nsapi30_table->f_random_destroy)
-
-/*
- * MD5 hash routines
- *
- * md5hash_create - create an MD5 hash context
- * md5hash_copy - make a copy of an MD5 hash context
- * md5hash_begin - initialize an MD5 hash context
- * md5hash_update - update MD5 hash with more input data
- * md5hash_end - finalize MD5 hash and get result
- * md5hash_destroy - destroy an MD5 hash context
- * md5hash_data - compute MD5 hash of data in one step
- */
-
-#define md5hash_create (*__nsapi30_table->f_md5hash_create)
-#define md5hash_copy (*__nsapi30_table->f_md5hash_copy)
-#define md5hash_begin (*__nsapi30_table->f_md5hash_begin)
-#define md5hash_update (*__nsapi30_table->f_md5hash_update)
-#define md5hash_end (*__nsapi30_table->f_md5hash_end)
-#define md5hash_destroy (*__nsapi30_table->f_md5hash_destroy)
-#define md5hash_data (*__nsapi30_table->f_md5hash_data)
-
-/*
- * ACL_SetupEval -
- * Setup environment and call ACL_EvalTestRights.
- */
-#define ACL_SetupEval (*__nsapi30_table->f_ACL_SetupEval)
-
-/*
- * servact_translate_uri
- * Returns the translated path (filename) for the given uri, NULL otherwise.
- * If authentication is required for the given uri, nothing is returned even
- * if the current user has authenticated to that area.
- */
-#define servact_translate_uri (*__nsapi30_table->f_servact_translate_uri)
-
-#endif /* !INTNSAPI */
-
-#ifndef FILE_MMAP
-#define filebuf_open_nostat(fd,sz,finfo) filebuf_open(fd,sz)
-#endif
-
-#ifdef XP_UNIX
#define dir_open opendir
#define dir_read readdir
#define dir_close closedir
@@ -3378,104 +296,8 @@ struct nsapi_dispatch_s {
#endif /* XP_WIN32 */
/*
- * Thread-safe variants of localtime and gmtime
+ * Thread-safe variant of localtime
*/
#define system_localtime(curtime, ret) util_localtime(curtime, ret)
-#define system_gmtime(curtime, ret) util_gmtime(curtime, ret)
-
-/*
- * pblock_find finds the entry with the given name in pblock pb.
- *
- * If it is successful, it returns the param block. If not, it returns NULL.
- */
-
-#define pblock_find(name, pb) (pblock_fr(name,pb,0))
-
-/*
- * pblock_remove behaves exactly like pblock_find, but removes the given
- * entry from pb.
- */
-
-#define pblock_remove(name, pb) (pblock_fr(name,pb,1))
-
-/*
- * session_dns returns the DNS hostname of the client of this session,
- * and inserts it into the client pblock. Returns NULL if unavailable.
- */
-
-#define session_dns(sn) session_dns_lookup(sn, 0)
-
-/*
- * session_maxdns looks up a hostname from an IP address, and then verifies
- * that the host is really who they claim to be.
- */
-
-#define session_maxdns(sn) session_dns_lookup(sn, 1)
-
-#define protocol_find_request http_find_request
-#define protocol_parse_request http_parse_request
-#define protocol_scan_headers http_scan_headers
-#define protocol_start_response http_start_response
-#define protocol_status http_status
-#define protocol_set_finfo http_set_finfo
-#define protocol_finish_request http_finish_request
-#define protocol_handle_session http_handle_session
-#define protocol_uri2url http_uri2url
-#define protocol_uri2url_dynamic http_uri2url_dynamic
-#define protocol_set_keepalive_timeout http_set_keepalive_timeout
-
-/* XXXrobm temporary compatibility */
-#define request_uri2path servact_uri2path
-#define request_pathchecks servact_pathchecks
-#define request_fileinfo servact_fileinfo
-#define request_service servact_service
-
-#define request_handle_processed servact_handle_processed
-#define request_translate_uri servact_translate_uri
-#define request_finderror servact_finderror
-
-/* --- OBSOLETE ----------------------------------------------------------
- * The following macros/functions are obsolete and are only maintained for
- * compatibility. Do not use them. 11-19-96
- * -----------------------------------------------------------------------
- */
-
-#define SYS_STDERR STDERR_FILENO
-
-#ifdef XP_WIN32
-
-typedef HANDLE pid_t;
-
-#define ERROR_PIPE \
- (ERROR_BROKEN_PIPE | ERROR_BAD_PIPE |\
- ERROR_PIPE_BUSY | ERROR_PIPE_LISTENING | ERROR_PIPE_NOT_CONNECTED)
-#define CONVERT_TO_PRINTABLE_FORMAT(Filename) \
-{ \
- register char *s; \
- if (Filename) \
- for (s = Filename; *s; s++) \
- if ( *s == '\\') \
- *s = '/'; \
-}
-#define CONVERT_TO_NATIVE_FS(Filename) \
-{ \
- register char *s; \
- if (Filename) \
- for (s = Filename; *s; s++) \
- if ( *s == '/') \
- *s = '\\'; \
-}
-
-#ifdef INTNSAPI
-NSAPI_PUBLIC extern nsapi_dispatch_t *__nsapi30_table;
-#else
-__declspec(dllimport) nsapi_dispatch_t *__nsapi30_table;
-#endif /* INTNSAPI */
-
-#else /* !XP_WIN32 */
-
-NSAPI_PUBLIC extern nsapi_dispatch_t *__nsapi30_table;
-
-#endif /* XP_WIN32 */
#endif /* !PUBLIC_NSAPI_H */
diff --git a/ldap/clients/dsgw/config.c b/ldap/clients/dsgw/config.c
index 954da599..07e84830 100644
--- a/ldap/clients/dsgw/config.c
+++ b/ldap/clients/dsgw/config.c
@@ -270,6 +270,7 @@ dsgw_read_config()
read_dsgwconfig( fname, NULL, gc->gc_admserv, 0 );
free( fname );
+#if 0
/* if necessary, try to set path to certificate database */
#ifndef DSGW_NO_SSL
if ( gc->gc_ldapssl && gc->gc_securitypath == NULL ) {
@@ -283,6 +284,7 @@ dsgw_read_config()
}
}
#endif
+#endif
if ( browser_ignores_acceptcharset() ) {
set_dsgwcharset();
diff --git a/lib/base/Makefile b/lib/base/Makefile
index d646be03..6676436a 100644
--- a/lib/base/Makefile
+++ b/lib/base/Makefile
@@ -38,62 +38,33 @@ $(OBJDEST):
mkdir -p $(OBJDEST)
ifeq ($(ARCH), WINNT)
-OSOBJS = nterrors.o eventlog.o eventhandler.o ntpipe.o pathnames.o
+OSOBJS = nterrors.o eventlog.o
else
OSOBJS =
endif
OBJS = $(addprefix $(OBJDEST)/, \
- dstats.o \
- daemon.o \
shexp.o \
- regexp.o \
- pblock.o \
plist.o \
- buffer.o \
- netbuf.o \
file.o \
- net.o \
- session.o \
- cinfo.o \
util.o \
- ereport.o \
- sem.o \
+ net.o \
fsmutex.o \
systhr.o \
crit.o \
rwlock.o \
dns.o \
dnsdmain.o \
- shmem.o \
- dll.o \
- servssl.o \
lexer.o \
- restart.o \
- objndx.o \
- cache.o \
pool.o \
- time_cache.o \
- dns_cache.o \
system.o \
- xp.o \
nscperror.o \
- language.o \
- fasttime.o \
- secpwd.o \
+ ereport.o \
$(OSOBJS) \
)
-MODULE_CFLAGS=-I$(BUILD_ROOT)/include/base
-
-ifeq ($(PRODUCT),"Netscape Catalog Server")
-ifeq ($(ARCH), WINNT)
-MCC_INCLUDE := $(subst -I$(BUILD_ROOT)/lib/libnet,,$(MCC_INCLUDE))
-endif
-endif
-#$(OBJDEST)/fasttime.o : $(OBJDIR)/fasttime.o
-# cp $< $@
+MODULE_CFLAGS=-I$(BUILD_ROOT)/include/base -I$(BUILD_ROOT)/ldap/servers/slapd
$(LIBS): $(OBJS)
rm -f $@
diff --git a/lib/base/crit.cpp b/lib/base/crit.cpp
index 06f5fba4..ceb9a634 100644
--- a/lib/base/crit.cpp
+++ b/lib/base/crit.cpp
@@ -18,7 +18,6 @@
#include "netsite.h"
#include "crit.h"
#include "pool.h"
-#include "ereport.h"
#include "base/dbtbase.h"
@@ -29,13 +28,6 @@
*/
#include "nspr.h"
-/* private/primpl.h is gone fromnspr21 19971028 */
-#if 0
-#ifdef XP_WIN32
-#include "private/primpl.h"
-#endif /* XP_WIN32 */
-#endif
-
#include "prthread.h"
#include "prlock.h"
#include "prcvar.h"
@@ -97,12 +89,12 @@ NSAPI_PUBLIC void crit_enter(CRITICAL id)
PRThread *me = PR_GetCurrentThread();
if ( crit->owner == me) {
- NS_ASSERT(crit->count > 0);
+ PR_ASSERT(crit->count > 0);
crit->count++;
}
else {
PR_Lock(crit->lock);
- NS_ASSERT(crit->count == 0);
+ PR_ASSERT(crit->count == 0);
crit->count = 1;
crit->owner = me;
}
@@ -121,7 +113,7 @@ NSAPI_PUBLIC void crit_exit(CRITICAL id)
crit->owner = 0;
PR_Unlock(crit->lock);
}
- NS_ASSERT(crit->count >= 0);
+ PR_ASSERT(crit->count >= 0);
#endif
}
@@ -165,7 +157,7 @@ NSAPI_PUBLIC void condvar_wait(CONDVAR _cv)
int saveCount = cv->lock->count;
PRThread *saveOwner = cv->lock->owner;
- NS_ASSERT(cv->lock->owner == PR_GetCurrentThread());
+ PR_ASSERT(cv->lock->owner == PR_GetCurrentThread());
cv->lock->count = 0;
cv->lock->owner = 0;
@@ -185,7 +177,7 @@ NSAPI_PUBLIC void condvar_timed_wait(CONDVAR _cv, long secs)
int saveCount = cv->lock->count;
PRThread *saveOwner = cv->lock->owner;
- NS_ASSERT(cv->lock->owner == PR_GetCurrentThread());
+ PR_ASSERT(cv->lock->owner == PR_GetCurrentThread());
cv->lock->count = 0;
cv->lock->owner = 0;
@@ -205,7 +197,7 @@ NSAPI_PUBLIC void condvar_notify(CONDVAR _cv)
{
#ifdef USE_NSPR
condvar_t *cv = (condvar_t *)_cv;
- NS_ASSERT(cv->lock->owner == PR_GetCurrentThread());
+ PR_ASSERT(cv->lock->owner == PR_GetCurrentThread());
PR_NotifyCondVar(cv->cvar);
#endif
}
@@ -214,7 +206,7 @@ NSAPI_PUBLIC void condvar_notifyAll(CONDVAR _cv)
{
#ifdef USE_NSPR
condvar_t *cv = (condvar_t *)_cv;
- NS_ASSERT(cv->lock->owner == PR_GetCurrentThread());
+ PR_ASSERT(cv->lock->owner == PR_GetCurrentThread());
PR_NotifyAllCondVar(cv->cvar);
#endif
}
diff --git a/lib/base/dns.cpp b/lib/base/dns.cpp
index f9e38886..3760cac5 100644
--- a/lib/base/dns.cpp
+++ b/lib/base/dns.cpp
@@ -17,8 +17,6 @@
#include "base/systems.h"
#endif /* XP_WIN32 */
-#include "net.h" /* SYS_NETFD, various headers to do DNS */
-
/* Under NT, these are taken care of by net.h including winsock.h */
#ifdef XP_UNIX
#include <arpa/inet.h> /* inet_ntoa */
@@ -27,13 +25,8 @@
extern "C" int gethostname (char *name, size_t namelen);
#endif
#endif
-#ifdef DNS_CACHE
-#include "base/dns_cache.h"
-#include "base/ereport.h"
-#endif /* DNS_CACHE */
#include <stdio.h>
#include <nspr.h>
-#include "frame/conf.h"
/* ---------------------------- dns_find_fqdn ----------------------------- */
@@ -75,9 +68,6 @@ char *dns_ip2host(char *ip, int verify)
/* struct in_addr iaddr; */
PRNetAddr iaddr;
char *hn;
-#ifdef DNS_CACHE
- dns_cache_entry_t *dns_entry;
-#endif
static unsigned long laddr = 0;
static char myhostname[256];
PRHostEnt hent;
@@ -90,23 +80,6 @@ char *dns_ip2host(char *ip, int verify)
if((iaddr.inet.ip = inet_addr(ip)) == -1)
goto bong;
-#ifdef DNS_CACHE
- if ( (dns_entry = dns_cache_lookup_ip((unsigned int)iaddr.inet.ip)) ) {
- hn = NULL;
- if ( dns_entry->host &&
- /* Only use entry if the cache entry has been verified or if
- * verify is off...
- */
- (dns_entry->verified || !verify) ) {
- hn = STRDUP( dns_entry->host );
- (void)dns_cache_use_decrement(dns_entry);
- return hn;
- }
- dns_cache_delete(dns_entry);
- dns_entry = 0;
- }
-#endif
-
/*
* See if it happens to be the localhost IP address, and try
* the local host name if so.
@@ -159,18 +132,7 @@ char *dns_ip2host(char *ip, int verify)
goto bong;
}
-#ifdef DNS_CACHE
- if ( (dns_entry = dns_cache_insert(hn, (unsigned int)iaddr.inet.ip, verify)) ) {
- (void) dns_cache_use_decrement(dns_entry);
- }
-#endif /* DNS_CACHE */
return hn;
bong:
-#ifdef DNS_CACHE
- /* Insert the lookup failure */
- if ( (dns_entry = dns_cache_insert(NULL, (unsigned int)iaddr.inet.ip, verify)) ) {
- (void) dns_cache_use_decrement(dns_entry);
- }
-#endif /* DNS_CACHE */
return NULL;
}
diff --git a/lib/base/dnsdmain.cpp b/lib/base/dnsdmain.cpp
index f37e475c..6972dcb5 100644
--- a/lib/base/dnsdmain.cpp
+++ b/lib/base/dnsdmain.cpp
@@ -10,7 +10,6 @@
#include "netsite.h"
-#include "base/net.h"
#include <string.h>
#include <stdio.h>
#ifdef XP_UNIX
@@ -26,7 +25,6 @@
extern "C" {
#include <nspr.h>
}
-#include "frame/conf.h"
diff --git a/lib/base/ereport.cpp b/lib/base/ereport.cpp
index 3454d01f..e7acad19 100644
--- a/lib/base/ereport.cpp
+++ b/lib/base/ereport.cpp
@@ -13,10 +13,9 @@
#include "private/pprio.h" /* for nspr20 binary release */
#include "netsite.h"
#include "file.h" /* system_fopenWA, system_write_atomic */
-#include "pblock.h"
-#include "session.h"
#include "util.h" /* util_vsprintf */
#include "ereport.h"
+#include "slapi-plugin.h"
#include "base/dbtbase.h"
@@ -25,217 +24,33 @@
#include <string.h> /* strcpy */
#include <time.h> /* localtime */
-#ifdef XP_UNIX
-#include <syslog.h> /* error logging to syslog */
-
-static SYS_FILE _error_fd;
-#else /* WIN32 */
-#include <nt/regparms.h>
-#include <nt/messages.h>
-#include "eventlog.h"
-
-static SYS_FILE _error_fd;
-#endif /* XP_UNIX */
-
-static PRBool _ereport_initialized = PR_FALSE;
-
-
-NSAPI_PUBLIC SYS_FILE ereport_getfd(void) { return _error_fd; }
-
-
-
-/* ----------------------------- ereport_init ----------------------------- */
-
-
-NSAPI_PUBLIC char *ereport_init(char *err_fn, char *email,
- PASSWD pwuser, char *version)
-{
- char err[MAGNUS_ERROR_LEN];
- SYS_FILE new_fd;
-
-#ifdef XP_UNIX
- if(!strcmp(err_fn, "SYSLOG")) {
-#ifdef NET_SSL
- openlog("secure-httpd", LOG_PID, LOG_DAEMON);
-#else
- openlog("httpd", LOG_PID, LOG_DAEMON);
-#endif
- _error_fd = PR_ImportFile(ERRORS_TO_SYSLOG);
-
- _ereport_initialized = PR_TRUE;
- return NULL;
- }
-#endif /* XP_UNIX */
- if( (new_fd = system_fopenWA(err_fn)) == SYS_ERROR_FD) {
- util_snprintf(err, MAGNUS_ERROR_LEN, "can't open error log %s (%s)", err_fn,
- system_errmsg());
-#ifdef XP_UNIX
- _error_fd = PR_ImportFile(STDERR_FILENO);
-#else
- _error_fd = PR_ImportFile(NULL);
-#endif
- return STRDUP(err);
- }
- _error_fd = new_fd;
-
-#ifdef XP_UNIX
- if(pwuser)
- chown(err_fn, pwuser->pw_uid, pwuser->pw_gid);
-#endif /* XP_UNIX */
-
- _ereport_initialized = PR_TRUE;
-
- ereport(LOG_INFORM, XP_GetAdminStr(DBT_successfulServerStartup_));
- ereport(LOG_INFORM, XP_GetAdminStr(DBT_SBS_), MAGNUS_VERSION_STRING, BUILD_NUM);
- if (strcasecmp(BUILD_NUM, version)) {
- ereport(LOG_WARN, XP_GetAdminStr(DBT_netscapeExecutableAndSharedLibra_));
- ereport(LOG_WARN, XP_GetAdminStr(DBT_executableVersionIsS_), version);
- ereport(LOG_WARN, XP_GetAdminStr(DBT_sharedLibraryVersionIsS_), BUILD_NUM);
-
- }
-
- /* Initialize thread-specific error handling */
- system_errmsg_init();
-
- return NULL;
-}
-
-
-
-/* -------------------------- ereport_terminate --------------------------- */
-
-
-NSAPI_PUBLIC void ereport_terminate(void)
-{
- if (!_ereport_initialized)
- return;
-
-#ifdef XP_UNIX
- ereport(LOG_INFORM, XP_GetAdminStr(DBT_errorReportingShuttingDown_));
- if(PR_FileDesc2NativeHandle(_error_fd) != ERRORS_TO_SYSLOG)
- system_fclose(_error_fd);
- else
- closelog();
-#else /* WIN32 */
- if(PR_FileDesc2NativeHandle(_error_fd) != NULL)
- system_fclose(_error_fd);
-#endif /* XP_UNIX */
-
-}
-
-
-/* ------------------------------- ereport -------------------------------- */
-
-
-static int degree_msg[] = {
- DBT_warning_,
- DBT_config_,
- DBT_security_,
- DBT_failure_,
- DBT_catastrophe_,
- DBT_info_,
- DBT_verbose_
- };
-
-#ifdef XP_UNIX
-static int degree_syslog[] = {
- LOG_WARNING, LOG_ERR, LOG_NOTICE, LOG_ALERT, LOG_CRIT, LOG_INFO, LOG_INFO
-};
-#endif/* XP_UNIX */
-
+/* taken from ACL plugin acl.h */
+#define ACL_PLUGIN_NAME "NSACLPlugin"
NSAPI_PUBLIC int ereport_v(int degree, char *fmt, va_list args)
{
char errstr[MAX_ERROR_LEN];
- int pos = 0;
- struct tm *tms, tmss;
- time_t t;
-#ifdef MCC_PROXY
- char *p;
- int i;
-#endif /* MCC_PROXY */
- if (!_ereport_initialized)
- return IO_OKAY;
-
-#ifdef XP_UNIX
- if(PR_FileDesc2NativeHandle(_error_fd) != ERRORS_TO_SYSLOG) {
-#endif /* XP_UNIX */
- t = time(NULL);
- tms = system_localtime(&t, &tmss);
- util_strftime(errstr, ERR_TIMEFMT, tms);
- pos = strlen(errstr);
-
- pos += util_snprintf(&errstr[pos], MAX_ERROR_LEN - pos, " %s: ",
- XP_GetAdminStr(degree_msg[degree]));
-#ifdef XP_UNIX
+ util_vsnprintf(errstr, MAX_ERROR_LEN, fmt, args);
+ switch (degree)
+ {
+ case LOG_WARN:
+ case LOG_FAILURE:
+ case LOG_INFORM:
+ case LOG_VERBOSE:
+ case LOG_MISCONFIG:
+// slapi_log_error(SLAPI_LOG_PLUGIN, ACL_PLUGIN_NAME, errstr);
+ break;
+ case LOG_SECURITY:
+// slapi_log_error(SLAPI_LOG_ACL, ACL_PLUGIN_NAME, errstr);
+ break;
+ case LOG_CATASTROPHE:
+// slapi_log_error(SLAPI_LOG_FATAL, ACL_PLUGIN_NAME, errstr);
+ break;
+ default:
+ break;
}
-#endif /* XP_UNIX */
-
- pos += util_vsnprintf(&errstr[pos], sizeof(errstr) - pos, fmt, args);
-
- pos += util_snprintf(&errstr[pos], sizeof(errstr) - pos, ENDLINE);
-
-#ifdef MCC_PROXY
- /* Thanx to netlib, the proxy sometimes generates multiline err msgs */
- for(p=errstr, i=pos-1; i>0; i--, p++) {
- if (*p == '\n' || *p == '\r') *p = ' ';
- }
-#endif /* MCC_PROXY */
-
-#if defined XP_UNIX
- if(PR_FileDesc2NativeHandle(_error_fd) != ERRORS_TO_SYSLOG)
- return system_fwrite_atomic(_error_fd, errstr, pos);
- syslog(degree_syslog[degree], errstr);
return IO_OKAY;
-#elif defined XP_WIN32 /* XP_WIN32 */
- if(PR_FileDesc2NativeHandle(_error_fd) != NULL)
- {
-#ifdef MCC_HTTPD
- /* also write to NT Event Log if error is serious */
- switch (degree)
- {
- case LOG_MISCONFIG:
- case LOG_SECURITY:
- case LOG_CATASTROPHE:
- LogErrorEvent(NULL, EVENTLOG_ERROR_TYPE,
- 0, MSG_BAD_PARAMETER,
- errstr, NULL);
- break;
- default:
- break;
- }
-#endif
- return system_fwrite_atomic(_error_fd, errstr, pos);
- }
- else { /* log to the EventLogger */
- /* Write to the event logger... */
- switch (degree) {
- case LOG_WARN:
- LogErrorEvent(NULL, EVENTLOG_WARNING_TYPE,
- 0, MSG_BAD_PARAMETER,
- errstr, NULL);
- break;
- case LOG_MISCONFIG:
- case LOG_SECURITY:
- case LOG_FAILURE:
- case LOG_CATASTROPHE:
- LogErrorEvent(NULL, EVENTLOG_ERROR_TYPE,
- 0, MSG_BAD_PARAMETER,
- errstr, NULL);
- break;
-
- case LOG_INFORM:
- default:
- LogErrorEvent(NULL, EVENTLOG_INFORMATION_TYPE,
- 0, MSG_BAD_PARAMETER,
- errstr, NULL);
- break;
- }
- return (IO_OKAY);
- }
-#endif /* XP_WIN32 */
-
}
NSAPI_PUBLIC int ereport(int degree, char *fmt, ...)
diff --git a/lib/base/eventlog.cpp b/lib/base/eventlog.cpp
index b8762842..26149c1a 100644
--- a/lib/base/eventlog.cpp
+++ b/lib/base/eventlog.cpp
@@ -22,7 +22,6 @@
#include <stdlib.h>
#include "netsite.h"
#include "base/eventlog.h"
-#include "frame/conf.h"
#include <nt/regparms.h>
#include <nt/messages.h>
diff --git a/lib/base/file.cpp b/lib/base/file.cpp
index 7382be46..0833cde5 100644
--- a/lib/base/file.cpp
+++ b/lib/base/file.cpp
@@ -13,7 +13,6 @@
#include "base/file.h"
-#include "ereport.h"
#ifdef BSD_RLIMIT
#include <sys/time.h>
#include <sys/resource.h>
diff --git a/lib/base/lexer.cpp b/lib/base/lexer.cpp
index e521c51f..18327d0a 100644
--- a/lib/base/lexer.cpp
+++ b/lib/base/lexer.cpp
@@ -13,7 +13,7 @@
*/
#include "netsite.h"
-#include "base/nsassert.h"
+#include "prlog.h"
#include "lexer_pvt.h"
#include "base/lexer.h"
@@ -104,7 +104,7 @@ int lex_class_create(int classc, char * classv[], void **pchtab)
int i; /* class index */
/* Get number of bytes per bit vector */
- NS_ASSERT(classc > 0);
+ PR_ASSERT(classc > 0);
bvbytes = (classc + 7) >> 3;
/* Allocate the character class table */
@@ -137,7 +137,7 @@ int lex_class_create(int classc, char * classv[], void **pchtab)
}
/* Return pointer to table */
- NS_ASSERT(pchtab != NULL);
+ PR_ASSERT(pchtab != NULL);
*pchtab = (void *)ct;
return classc;
@@ -273,7 +273,7 @@ int lex_token_new(pool_handle_t * pool, int initlen, int growlen, void **token)
if (growlen > 0) lt->lt_inclen = growlen;
- NS_ASSERT(token != NULL);
+ PR_ASSERT(token != NULL);
*token = (void *)lt;
return 0;
@@ -533,8 +533,8 @@ int lex_token_append(void * token, int nbytes, char * src)
int bufsize;
int length;
- NS_ASSERT(nbytes >= 0);
- NS_ASSERT((src != NULL) || (nbytes == 0));
+ PR_ASSERT(nbytes >= 0);
+ PR_ASSERT((src != NULL) || (nbytes == 0));
if (nbytes > 0) {
diff --git a/lib/base/net.cpp b/lib/base/net.cpp
index 0d15b121..1ccfdbd7 100644
--- a/lib/base/net.cpp
+++ b/lib/base/net.cpp
@@ -14,19 +14,9 @@
#include "netsite.h"
-#include "prio.h"
-#include "private/pprio.h"
#include <nspr.h>
-#include <frame/conf.h>
-/* Removed for ns security integration
-#include "sslio/sslio.h"
-*/
-
-#include "net.h"
#include "util.h"
-#include "daemon.h" /* child_exit */
-#include "ereport.h" /* error reporting */
#include <string.h>
#ifdef XP_UNIX
#include <arpa/inet.h> /* inet_ntoa */
@@ -39,521 +29,18 @@ extern "C" int gethostname (char *name, size_t namelen);
#include <sys/ioctl.h> /* ioctl */
#endif
-extern "C" {
-#include "ssl.h"
-}
-
-#if defined(OSF1)
-#include <stropts.h>
-#endif
-#include "base/systems.h"
-#include "base/dbtbase.h"
-
-#if defined(OSF1)
-#include <stropts.h>
-#endif
-
-#ifdef IRIX
-#include <bstring.h> /* fd_zero uses bzero */
-#endif
-#include "netio.h"
-
-net_io_t net_io_functions;
-/* removed for ns security integration
-#include "xp_error.h"
-*/
-
#include "libadmin/libadmin.h"
-int net_enabledns = 1;
-int net_enableAsyncDNS = 0;
-int net_listenqsize = DAEMON_LISTEN_SIZE;
-unsigned int NET_BUFFERSIZE = NET_DEFAULT_BUFFERSIZE;
-unsigned int NET_READ_TIMEOUT = NET_DEFAULT_READ_TIMEOUT;
-unsigned int NET_WRITE_TIMEOUT = NET_DEFAULT_WRITE_TIMEOUT;
-unsigned int SSL_HANDSHAKE_TIMEOUT = SSL_DEFAULT_HANDSHAKE_TIMEOUT;
-
-
-/* ------------------------------ net_init -------------------------------- */
-NSAPI_PUBLIC int net_init(int security_on)
-{
- return 0;
-}
-
-/* ------------------------------ net_socket ------------------------------ */
-NSAPI_PUBLIC SYS_NETFD net_socket(int domain, int type, int protocol)
-{
- SYS_NETFD sock;
- SYS_NETFD prsock;
-
- if (security_active) {
- if (protocol == IPPROTO_TCP)
- prsock = PR_NewTCPSocket();
- else
- prsock = PR_NewUDPSocket();
- if(prsock)
- sock = SSL_ImportFD(NULL, prsock);
- else sock = NULL;
- }
- else {
- if (protocol == IPPROTO_TCP) sock = PR_NewTCPSocket();
- else sock = PR_NewUDPSocket();
- }
-
- if (sock == NULL)
- return (SYS_NETFD)SYS_NET_ERRORFD;
- return sock;
-}
-
-
-/* ---------------------------- net_getsockopt ---------------------------- */
-NSAPI_PUBLIC int net_getsockopt(SYS_NETFD s, int level, int optname,
- void *optval, int *optlen)
-{
- return getsockopt(PR_FileDesc2NativeHandle(s), level, optname,
- (char *)optval, (TCPLEN_T *)optlen);
-}
-
-
-/* ---------------------------- net_setsockopt ---------------------------- */
-
-
-NSAPI_PUBLIC int net_setsockopt(SYS_NETFD s, int level, int optname,
- const void *optval, int optlen)
-{
- return setsockopt(PR_FileDesc2NativeHandle(s), level, optname,
- (const char *)optval, optlen);
-}
-/* ------------------------------ net_listen ------------------------------ */
-
-
-NSAPI_PUBLIC int net_listen(SYS_NETFD s, int backlog)
-{
- return PR_Listen(s, backlog)==PR_FAILURE?IO_ERROR:0;
-}
-
-
-/* ------------------------- net_create_listener -------------------------- */
-
-
-NSAPI_PUBLIC SYS_NETFD net_create_listener(char *ipstr, int port)
-{
- SYS_NETFD sd;
- /*
- struct sockaddr_in sa_server;
- */
- PRNetAddr sa_server;
- PRStatus status;
- PRInt32 flags;
-
- if ((sd = net_socket(AF_INET,SOCK_STREAM,IPPROTO_TCP)) == SYS_NET_ERRORFD) {
- return SYS_NET_ERRORFD;
- }
-
-#ifdef SOLARIS
- /*
- * unset NONBLOCK flag;
- */
- /* Have no idea why Solaris want to unset NONBLOCK flag when it should
- be in NON-BLOCK mode, and new NSPR20 does not give file descriptor
- back, so the code are removed --- yjh
- flags = fcntl(sd->osfd, F_GETFL, 0);
- fcntl(sd->osfd, F_SETFL, flags & ~O_NONBLOCK);
- */
-#endif
- /* Convert to NSPR21 for ns security integration
- ZERO((char *) &sa_server, sizeof(sa_server));
- sa_server.sin_family=AF_INET;
- sa_server.sin_addr.s_addr = (ipstr ? inet_addr(ipstr) : htonl(INADDR_ANY));
- sa_server.sin_port=htons(port);
- if(net_bind(sd, (struct sockaddr *) &sa_server,sizeof(sa_server)) < 0) {
- return SYS_NET_ERRORFD;
- }
- net_listen(sd, net_listenqsize);
- */
-
- if (ipstr) {
- status = PR_InitializeNetAddr(PR_IpAddrNull, port, &sa_server);
- if (status == PR_SUCCESS) sa_server.inet.ip = inet_addr(ipstr);
- else return SYS_NET_ERRORFD;
- }
- else {
- status = PR_InitializeNetAddr(PR_IpAddrAny, port, &sa_server);
- if (status == PR_FAILURE) return SYS_NET_ERRORFD;
- }
-
- status = PR_Bind(sd, &sa_server);
- if (status == PR_FAILURE) return SYS_NET_ERRORFD;
-
-
- status = PR_Listen(sd, net_listenqsize);
- if (status == PR_FAILURE) return SYS_NET_ERRORFD;
-
- return sd;
-}
-/* ------------------------------ net_select ------------------------------ */
-
-/*
-NSAPI_PUBLIC int net_select(int nfds, fd_set *r, fd_set *w, fd_set *e,
- struct timeval *timeout)
-{
- PR_fd_set rd, wr, ex;
- int index;
- int rv;
-
- if (nfds > (64*1024))
- return -1;
-
- PR_FD_ZERO(&rd);
- PR_FD_ZERO(&wr);
- PR_FD_ZERO(&ex);
-
- for (index=0; index<nfds; index++) {
- if (FD_ISSET(index, r))
- PR_FD_NSET(index, &rd);
- if (FD_ISSET(index, w))
- PR_FD_NSET(index, &wr);
- if (FD_ISSET(index, e))
- PR_FD_NSET(index, &ex);
- }
-
- rv = PR_Select(0, &rd, &wr, &ex, PR_SecondsToInterval(timeout->tv_sec));
- if (rv > 0) {
- FD_ZERO(r);
- FD_ZERO(w);
- FD_ZERO(e);
- for (index=0; index<nfds; index++) {
- if (PR_FD_NISSET(index, &rd))
- FD_SET(index, r);
- if (PR_FD_NISSET(index, &wr))
- FD_SET(index, w);
- if (PR_FD_NISSET(index, &ex))
- FD_SET(index, e);
- }
- }
-
- return rv;
-}
-*/
-
-NSAPI_PUBLIC int net_select(int nfds, fd_set *r, fd_set *w, fd_set *e,
- struct timeval *timeout)
-{
- return 1;
-}
-
-
-/* ----------------------------- net_isalive ------------------------------ */
-
-
-/*
- * XXXmikep As suggested by shaver@ingenia.com. If everyone was POSIX
- * compilent, a write() of 0 bytes would work as well
- */
-NSAPI_PUBLIC int net_isalive(SYS_NETFD sd)
-{
- char c;
- if (PR_RecvFrom(sd, &c, 1, MSG_PEEK, NULL, 0) == -1 ) {
- return 0;
- }
- return 1;
-}
-
-
-/* ------------------------------ net_connect ------------------------------ */
-
-NSAPI_PUBLIC int net_connect(SYS_NETFD s, const void *sockaddr, int namelen)
-{
- int rv;
-
- child_status(CHILD_WRITING);
- rv = PR_Connect(s, (PRNetAddr *)sockaddr, PR_INTERVAL_NO_TIMEOUT);
- child_status(CHILD_PROCESSING);
-
- return rv==PR_FAILURE?IO_ERROR:0;
-}
-
-
-/* ------------------------------ net_ioctl ------------------------------ */
-
-
-NSAPI_PUBLIC int net_ioctl(SYS_NETFD s, int tag, void *result)
-{
-#if defined(NET_WINSOCK)
- return ioctlsocket(PR_FileDesc2NativeHandle(s),tag,(unsigned long *)result);
-#elif defined(XP_UNIX)
- return ioctl(PR_FileDesc2NativeHandle(s), tag, result);
-#else
- write me;
-#endif
-
-}
-/* --------------------------- net_getpeername ---------------------------- */
-
-
-NSAPI_PUBLIC int net_getpeername(SYS_NETFD s, struct sockaddr *name,
- int *namelen)
-{
-#if defined (SNI) || defined (UnixWare)
- return getpeername(PR_FileDesc2NativeHandle(s), name, (size_t *)namelen);
-#else /* defined (SNI) || defined (UnixWare) */
- return getpeername(PR_FileDesc2NativeHandle(s), name, (TCPLEN_T *)namelen);
-#endif /* defined (SNI) || defined (UnixWare) */
-}
-
-
-/* ------------------------------ net_close ------------------------------- */
-
-
-NSAPI_PUBLIC int net_close(SYS_NETFD s)
-{
- return PR_Close(s)==PR_FAILURE?IO_ERROR:0;
-}
-
-NSAPI_PUBLIC int net_shutdown(SYS_NETFD s, int how)
-{
- switch (how) {
- case 0:
- return PR_Shutdown(s, PR_SHUTDOWN_RCV);
- break;
- case 1:
- return PR_Shutdown(s, PR_SHUTDOWN_SEND);
- break;
- case 2:
- return PR_Shutdown(s, PR_SHUTDOWN_BOTH);
- break;
- default:
- return -1;
- }
-
- return 0;
-}
-
-
-
-/* ------------------------------- net_bind ------------------------------- */
-
-NSAPI_PUBLIC int net_bind(SYS_NETFD s, const struct sockaddr *name,
- int namelen)
-{
- return PR_Bind(s, (const PRNetAddr *)name)==PR_FAILURE?IO_ERROR:0;
-}
-
-
-/* ------------------------------ net_accept ------------------------------ */
-
-
-NSAPI_PUBLIC SYS_NETFD net_accept(SYS_NETFD sd, struct sockaddr *addr,
- int *addrlen)
-{
- SYS_NETFD sock = PR_Accept(sd, (PRNetAddr *)addr, PR_INTERVAL_NO_TIMEOUT);
-
- if (sock == NULL)
- return SYS_NET_ERRORFD;
- return sock;
-}
-
-/* ------------------------------- net_read ------------------------------- */
-
-NSAPI_PUBLIC int net_read(SYS_NETFD fd, char *buf, int sz, int timeout)
-{
- int rv;
-
- if (timeout == NET_ZERO_TIMEOUT)
- timeout = PR_INTERVAL_NO_WAIT;
- else if (timeout == NET_INFINITE_TIMEOUT)
- timeout = PR_INTERVAL_NO_TIMEOUT;
- else
- timeout = PR_SecondsToInterval(timeout);
-
- child_status(CHILD_READING);
- rv = PR_Recv(fd, buf, sz, 0, timeout);
-
- child_status(CHILD_PROCESSING);
- return rv;
-}
-
-
-/* ------------------------------ net_write ------------------------------- */
-
-#ifndef NEEDS_WRITEV
-int net_writev(SYS_NETFD fd, struct iovec *iov, int iov_size)
-{
- int rv;
-
- child_status(CHILD_WRITING);
- rv = PR_Writev(fd, (PRIOVec *)iov, iov_size, PR_INTERVAL_NO_TIMEOUT);
- child_status(CHILD_PROCESSING);
- return rv;
-}
-
-#else /* NEEDS_WRITEV */
-
-/* Since SSL and NT do not support writev(), we just emulate it.
- * This does not lead to the optimal number of packets going out...
- */
-int net_writev(SYS_NETFD fd, struct iovec *iov, int iov_size)
-{
- int index;
-
- child_status(CHILD_WRITING);
-
- for (index=0; index<iov_size; index++) {
-
- /* net_write already does the buffer for nonblocked IO */
- if ( net_write(fd, iov[index].iov_base, iov[index].iov_len) ==IO_ERROR){
- child_status(CHILD_PROCESSING);
- return IO_ERROR;
- }
- }
-
- child_status(CHILD_PROCESSING);
- return IO_OKAY;
-}
-#endif /* NEEDS_WRITEV */
-
-
-NSAPI_PUBLIC int net_write(SYS_NETFD fd, char *buf, int sz)
-{
- int rv;
-
- child_status(CHILD_WRITING);
- rv = PR_Send(fd, buf, sz, 0, PR_INTERVAL_NO_TIMEOUT);
- child_status(CHILD_PROCESSING);
- if(rv < 0) {
- return IO_ERROR;
- }
- return rv;
-}
-
-NSAPI_PUBLIC int net_socketpair(SYS_NETFD *pair)
-{
- return PR_NewTCPSocketPair(pair);
-}
-
-#ifdef XP_UNIX
-NSAPI_PUBLIC SYS_NETFD net_dup2(SYS_NETFD prfd, int osfd)
-{
- SYS_NETFD newfd = NULL;
-
- if (prfd && PR_FileDesc2NativeHandle(prfd) != osfd) {
- if (dup2(PR_FileDesc2NativeHandle(prfd), osfd) != -1) {
- newfd = PR_ImportFile(osfd);
- if (!newfd)
- close(osfd);
- }
- }
-
- return newfd;
-}
-
-NSAPI_PUBLIC int net_is_STDOUT(SYS_NETFD prfd)
-{
- int fd = PR_FileDesc2NativeHandle(prfd);
- if (fd == STDOUT_FILENO) return 1;
- return 0;
-}
-
-NSAPI_PUBLIC int net_is_STDIN(SYS_NETFD prfd)
-{
- int fd = PR_FileDesc2NativeHandle(prfd);
- if (fd == STDIN_FILENO) return 1;
- return 0;
-}
-
-#endif /* XP_UNIX */
-
-/* -------------------------- Accept mutex crap --------------------------- */
-
-
-#ifndef NET_WINSOCK
-
-
-#include "sem.h"
-static SEMAPHORE mob_sem;
-static int have_mob_sem;
-
-
-void net_accept_enter(void)
-{
- if(sem_grab(mob_sem) == -1)
- ereport(LOG_CATASTROPHE, "sem_grab failed (%s)", system_errmsg());
- have_mob_sem = 1;
-}
-
-int net_accept_tenter(void)
-{
- int ret = sem_tgrab(mob_sem);
- if(ret != -1)
- have_mob_sem = 1;
- return ret;
-}
-
-void net_accept_exit(void)
-{
- if(sem_release(mob_sem) == -1)
- ereport(LOG_CATASTROPHE, "sem_release failed (%s)", system_errmsg());
- have_mob_sem = 0;
-}
-
-#ifdef AIX
-#undef accept
-#define accept naccept
-#endif
-
-void net_accept_texit(void)
-{
- if(have_mob_sem && (sem_release(mob_sem) == -1))
- ereport(LOG_CATASTROPHE, "sem_release failed (%s)", system_errmsg());
- have_mob_sem = 0;
-}
-
-int net_accept_init(int port)
-{
- /* XXXMB how to translate this to nspr? */
- /* since SSL_AcceptHook is no longer in ns security (HCL_1_5),
- so this is gone! (It does exist in HCL_101)
- SSL_AcceptHook((SSLAcceptFunc)PR_Accept);
- */
- have_mob_sem = 0;
- mob_sem = sem_init("netsite", port);
- return (mob_sem == SEM_ERROR ? -1 : 0);
-}
-
-void net_accept_terminate(void)
-{
- sem_terminate(mob_sem);
-}
-
-#endif /* !NET_WINSOCK */
-
-
-/* ----------------------------- net_ip2host ------------------------------ */
-
-
-char *dns_ip2host(char *ip, int verify);
-
-NSAPI_PUBLIC char *net_ip2host(char *ip, int verify)
-{
- if(!net_enabledns)
- return NULL;
-
- return dns_ip2host(ip, verify);
-}
-
-
-
/* ---------------------------- util_hostname ----------------------------- */
-
#ifdef XP_UNIX
#include <sys/param.h>
#else /* WIN32 */
#define MAXHOSTNAMELEN 255
#endif /* XP_UNIX */
-/* Defined in dns.c */
+/* Defined in dns.cpp */
char *net_find_fqdn(PRHostEnt *p);
NSAPI_PUBLIC char *util_hostname(void)
@@ -575,4 +62,3 @@ NSAPI_PUBLIC char *util_hostname(void)
return net_find_fqdn(&hent);
}
-
diff --git a/lib/base/plist_pvt.h b/lib/base/plist_pvt.h
index e4b861c5..3f18b4af 100644
--- a/lib/base/plist_pvt.h
+++ b/lib/base/plist_pvt.h
@@ -35,9 +35,6 @@ typedef struct PListStruct_s PListStruct_t;
* the property value data.
*/
-#ifndef PBLOCK_H
-#include "base/pblock.h"
-#endif /* PBLOCK_H */
#include <stddef.h>
struct PLValueStruct_s {
diff --git a/lib/base/pool.cpp b/lib/base/pool.cpp
index 56232e3f..e33acd44 100644
--- a/lib/base/pool.cpp
+++ b/lib/base/pool.cpp
@@ -27,9 +27,6 @@
#ifdef MALLOC_POOLS
#include "base/pool.h"
#include "base/ereport.h"
-#include "base/session.h"
-#include "frame/req.h"
-#include "frame/http.h"
#include "base/util.h"
#include "base/crit.h"
@@ -107,40 +104,11 @@ pool_internal_init()
known_pools_lock = crit_init();
freelist_lock = crit_init();
}
- } else
- ereport(LOG_INFORM, XP_GetAdminStr(DBT_poolInitMemoryPoolsDisabled_));
-
- return 0;
-}
-
-NSAPI_PUBLIC int
-pool_init(pblock *pb, Session *sn, Request *rq)
-{
- char *str_free_size = pblock_findval("free-size", pb);
- char *str_pool_disable = pblock_findval("disable", pb);
-
- if (str_free_size != NULL) {
- if ( (freelist_max = atoi(str_free_size)) <= 0) {
- ereport(LOG_WARN, XP_GetAdminStr(DBT_poolInitFreeSize0UsingD_),
- MAX_FREELIST_SIZE);
- freelist_max = MAX_FREELIST_SIZE;
- }
}
- if (str_pool_disable && strcasecmp(str_pool_disable, "false") )
- pool_disable = 1;
- else
- pool_disable = 0;
-
- if (known_pools_lock == NULL) {
- known_pools_lock = crit_init();
- freelist_lock = crit_init();
- }
-
- return REQ_PROCEED;
+ return 0;
}
-
static block_t *
_create_block(int size)
{
diff --git a/lib/base/system.cpp b/lib/base/system.cpp
index e58538b4..d138b400 100644
--- a/lib/base/system.cpp
+++ b/lib/base/system.cpp
@@ -10,7 +10,7 @@
*/
#include "netsite.h"
-#include "base/nsassert.h"
+#include "prlog.h"
#include "base/ereport.h"
#ifdef XP_WIN32
@@ -52,6 +52,7 @@ static int thread_malloc_key = -1;
#define DEBUG_FREE_CHAR 'X'
#endif /* DEBUG_MALLOC */
+
/* On NT, the server version string is not statically encoded based
* upon a product compile define but dynamically set by the server
* exe at startup.
@@ -113,14 +114,14 @@ NSAPI_PUBLIC void system_free(void *ptr)
#if defined(MALLOC_POOLS) && defined(MCC_HTTPD) && defined(THREAD_ANY)
pool_free(MALLOC_KEY, ptr);
#else
- NS_ASSERT(ptr);
+ PR_ASSERT(ptr);
free(ptr);
#endif
}
NSAPI_PUBLIC char *system_strdup(const char *ptr)
{
- NS_ASSERT(ptr);
+ PR_ASSERT(ptr);
#if defined(MALLOC_POOLS) && defined(MCC_HTTPD) && defined(THREAD_ANY)
return pool_strdup(MALLOC_KEY, ptr);
#else
@@ -202,7 +203,7 @@ NSAPI_PUBLIC void system_free_perm(void *ptr)
char *baseptr, *cptr;
int index;
- NS_ASSERT(ptr);
+ PR_ASSERT(ptr);
cptr = baseptr = ((char *)ptr) - DEBUG_MARGIN - 2*sizeof(int);
@@ -239,7 +240,7 @@ NSAPI_PUBLIC void system_free_perm(void *ptr)
NSAPI_PUBLIC char *system_strdup_perm(const char *ptr)
{
#ifndef DEBUG_MALLOC
- NS_ASSERT(ptr);
+ PR_ASSERT(ptr);
return strdup(ptr);
#else
int len = strlen(ptr);
diff --git a/lib/base/systhr.cpp b/lib/base/systhr.cpp
index ac29121a..169405d6 100644
--- a/lib/base/systhr.cpp
+++ b/lib/base/systhr.cpp
@@ -10,7 +10,6 @@
*/
#include "systhr.h"
-#include "ereport.h"
#define USE_NSPR
#ifdef USE_NSPR
diff --git a/lib/base/util.cpp b/lib/base/util.cpp
index 55d6ca56..d775e00f 100644
--- a/lib/base/util.cpp
+++ b/lib/base/util.cpp
@@ -20,625 +20,12 @@
#include "base/util.h"
#include "base/dbtbase.h"
-#include "base/ereport.h"
#ifdef XP_UNIX
#include <sys/types.h>
#endif /* WIN32 */
-/* ----------------------------- util_getline ----------------------------- */
-
-#define LF 10
-#define CR 13
-
-NSAPI_PUBLIC int util_getline(filebuf_t *buf, int lineno, int maxlen, char *l) {
- int i, x;
-
- x = 0;
- while(1) {
- i = filebuf_getc(buf);
- switch(i) {
- case IO_EOF:
- l[x] = '\0';
- return 1;
- case LF:
- if(x && (l[x-1] == '\\')) {
- --x;
- continue;
- }
- l[x] = '\0';
- return 0;
- case IO_ERROR:
- util_sprintf(l, "I/O error reading file at line %d", lineno);
- return -1;
- case CR:
- continue;
- default:
- l[x] = (char) i;
- if(++x == maxlen) {
- util_sprintf(l, "line %d is too long", lineno);
- return -1;
- }
- break;
- }
- }
-}
-
-
-/* ---------------------------- util_can_exec ----------------------------- */
-
-#ifdef XP_UNIX
-NSAPI_PUBLIC int util_can_exec(struct stat *fi, uid_t uid, gid_t gid)
-{
- if(!uid)
- return 1;
- if((fi->st_mode & S_IXOTH) ||
- ((gid == fi->st_gid) && (fi->st_mode & S_IXGRP)) ||
- ((uid == fi->st_uid) && (fi->st_mode & S_IXUSR)))
- return 1;
- return 0;
-}
-#endif /* XP_UNIX */
-
-
-/* --------------------------- util_env_create ---------------------------- */
-
-
-NSAPI_PUBLIC char **util_env_create(char **env, int n, int *pos)
-{
- int x;
-
- if(!env) {
- *pos = 0;
- return (char **) MALLOC((n + 1)*sizeof(char *));
- }
- else {
- for(x = 0; (env[x]); x++);
- env = (char **) REALLOC(env, (n + x + 1)*(sizeof(char *)));
- *pos = x;
- return env;
- }
-}
-
-
-/* ---------------------------- util_env_free ----------------------------- */
-
-
-NSAPI_PUBLIC void util_env_free(char **env)
-{
- register char **ep = env;
-
- for(ep = env; *ep; ep++)
- FREE(*ep);
- FREE(env);
-}
-
-/* ----------------------------- util_env_str ----------------------------- */
-
-
-NSAPI_PUBLIC char *util_env_str(char *name, char *value) {
- char *t,*tp;
-
- t = (char *) MALLOC(strlen(name)+strlen(value)+2); /* 2: '=' and '\0' */
-
- for(tp=t; (*tp = *name); tp++,name++);
- for(*tp++ = '='; (*tp = *value); tp++,value++);
- return t;
-}
-
-
-/* --------------------------- util_env_replace --------------------------- */
-
-
-NSAPI_PUBLIC void util_env_replace(char **env, char *name, char *value)
-{
- int x, y, z;
- char *i;
-
- for(x = 0; env[x]; x++) {
- i = strchr(env[x], '=');
- *i = '\0';
- if(!strcmp(env[x], name)) {
- y = strlen(env[x]);
- z = strlen(value);
-
- env[x] = (char *) REALLOC(env[x], y + z + 2);
- util_sprintf(&env[x][y], "=%s", value);
- return;
- }
- *i = '=';
- }
-}
-
-
-/* ---------------------------- util_env_find ----------------------------- */
-
-
-NSAPI_PUBLIC char *util_env_find(char **env, char *name)
-{
- char *i;
- int x, r;
-
- for(x = 0; env[x]; x++) {
- i = strchr(env[x], '=');
- *i = '\0';
- r = !strcmp(env[x], name);
- *i = '=';
- if(r)
- return i + 1;
- }
- return NULL;
-}
-
-
-/* ---------------------------- util_env_copy ----------------------------- */
-
-
-NSAPI_PUBLIC char **util_env_copy(char **src, char **dst)
-{
- char **src_ptr;
- int src_cnt;
- int index;
-
- if (!src)
- return NULL;
-
- for (src_cnt = 0, src_ptr = src; *src_ptr; src_ptr++, src_cnt++);
-
- if (!src_cnt)
- return NULL;
-
- dst = util_env_create(dst, src_cnt, &index);
-
- for (src_ptr = src, index=0; *src_ptr; index++, src_ptr++)
- dst[index] = STRDUP(*src_ptr);
- dst[index] = NULL;
-
- return dst;
-}
-
-/* ---------------------------- util_hostname ----------------------------- */
-
-
-/*
- * MOVED TO NET.C TO AVOID INTERDEPENDENCIES
- */
-
-
-/* --------------------------- util_chdir2path ---------------------------- */
-
-
-NSAPI_PUBLIC int util_chdir2path(char *path)
-{
- /* use FILE_PATHSEP to accomodate WIN32 */
- char *t = strrchr(path, FILE_PATHSEP);
- int ret;
-
- if(!t)
- return -1;
-
- *t = '\0';
-#ifdef XP_UNIX
- ret = chdir(path);
-#else /* WIN32 */
- ret = SetCurrentDirectory(path);
-#endif /* XP_UNIX */
-
- /* use FILE_PATHSEP instead of chdir to accomodate WIN32 */
- *t = FILE_PATHSEP;
-
- return ret;
-}
-
-
-/* --------------------------- util_is_mozilla ---------------------------- */
-
-
-NSAPI_PUBLIC int util_is_mozilla(char *ua, char *major, char *minor)
-{
- if((!ua) || strncasecmp(ua, "Mozilla/", 8))
- return 0;
-
- /* Major version. I punted on supporting versions like 10.0 */
- if(ua[8] > major[0])
- return 1;
- else if((ua[8] < major[0]) || (ua[9] != '.'))
- return 0;
-
- /* Minor version. Support version numbers like 0.96 */
- if(ua[10] < minor[0])
- return 0;
- else if((ua[10] > minor[0]) || (!minor[1]))
- return 1;
-
- if((!isdigit(ua[11])) || (ua[11] < minor[1]))
- return 0;
- else
- return 1;
-}
-
-
-/* ----------------------------- util_is_url ------------------------------ */
-
-
-#include <ctype.h> /* isalpha */
-
-NSAPI_PUBLIC int util_is_url(char *url)
-{
- char *t = url;
-
- while(*t) {
- if(*t == ':')
- return 1;
- if(!isalpha(*t))
- return 0;
- ++t;
- }
- return 0;
-}
-
-
-/* --------------------------- util_later_than ---------------------------- */
-
-
-int _mstr2num(char *str) {
- if(!strcasecmp(str, "Jan")) return 0;
- if(!strcasecmp(str, "Feb")) return 1;
- if(!strcasecmp(str, "Mar")) return 2;
- if(!strcasecmp(str, "Apr")) return 3;
- if(!strcasecmp(str, "May")) return 4;
- if(!strcasecmp(str, "Jun")) return 5;
- if(!strcasecmp(str, "Jul")) return 6;
- if(!strcasecmp(str, "Aug")) return 7;
- if(!strcasecmp(str, "Sep")) return 8;
- if(!strcasecmp(str, "Oct")) return 9;
- if(!strcasecmp(str, "Nov")) return 10;
- if(!strcasecmp(str, "Dec")) return 11;
- return -1;
-}
-
-int _time_compare(struct tm *lms, char *ims, int later_than_op)
-{
- int y = 0, mnum = 0, d = 0, h = 0, m = 0, s = 0, x;
- char t[128];
-
- /* Supported formats start with weekday (which we don't care about) */
- /* The sizeof(t) is to avoid buffer overflow with t */
- if((!(ims = strchr(ims,' '))) || (strlen(ims) > (sizeof(t) - 2)))
- return 0;
-
- while(*ims && isspace(*ims)) ++ims;
- if((!(*ims)) || (strlen(ims) < 2))
- return 0;
-
- /* Standard HTTP (RFC 850) starts with dd-mon-yy */
- if(ims[2] == '-') {
- sscanf(ims, "%s %d:%d:%d", t, &h, &m, &s);
- if(strlen(t) < 6)
- return 0;
- t[2] = '\0';
- t[6] = '\0';
- d = atoi(t);
- mnum = _mstr2num(&t[3]);
- x = atoi(&t[7]);
- /* Postpone wraparound until 2070 */
- y = x + (x < 70 ? 2000 : 1900);
- }
- /* The ctime format starts with a month name */
- else if(isalpha(*ims)) {
- sscanf(ims,"%s %d %d:%d:%d %*s %d", t, &d, &h, &m, &s, &y);
- mnum = _mstr2num(t);
- }
- /* RFC 822 */
- else {
- sscanf(ims, "%d %s %d %d:%d:%d", &d, t, &y, &h, &m, &s);
- mnum = _mstr2num(t);
- }
-
- if (later_than_op) {
- if( (x = (1900 + lms->tm_year) - y) )
- return x < 0;
-
- if(mnum == -1)
- return 0;
-
- /* XXXMB - this will fail if you check if december 31 1996 is later
- * than january 1 1997
- */
- if((x = lms->tm_mon - mnum) || (x = lms->tm_mday - d) ||
- (x = lms->tm_hour - h) || (x = lms->tm_min - m) ||
- (x = lms->tm_sec - s))
- return x < 0;
-
- return 1;
- }
- else {
- return (mnum != -1 &&
- 1900 + lms->tm_year == y &&
- lms->tm_mon == mnum &&
- lms->tm_mday == d &&
- lms->tm_hour == h &&
- lms->tm_min == m &&
- lms->tm_sec == s);
- }
-}
-
-
-/* Returns 0 if lms later than ims
- * Returns 1 if equal
- * Returns 1 if ims later than lms
- */
-NSAPI_PUBLIC int util_later_than(struct tm *lms, char *ims)
-{
- return _time_compare(lms, ims, 1);
-}
-
-
-NSAPI_PUBLIC int util_time_equal(struct tm *lms, char *ims)
-{
- return _time_compare(lms, ims, 0);
-}
-
-/* util_str_time_equal()
- *
- * Function to compare if two time strings are equal
- *
- * Acceptible date formats:
- * Saturday, 17-Feb-96 19:41:34 GMT <RFC850>
- * Sat, 17 Mar 1996 19:41:34 GMT <RFC1123>
- *
- * Argument t1 MUST be RFC1123 format.
- *
- * Note- it is not the intention of this routine to *always* match
- * There are cases where we would return != when the strings might
- * be equal (especially with case). The converse should not be true.
- *
- * Return 0 if equal, -1 if not equal.
- */
-#define MINIMUM_LENGTH 18
-#define RFC1123_DAY 5
-#define RFC1123_MONTH 8
-#define RFC1123_YEAR 12
-#define RFC1123_HOUR 17
-#define RFC1123_MINUTE 20
-#define RFC1123_SECOND 23
-NSAPI_PUBLIC int util_str_time_equal(char *t1, char *t2)
-{
- int index;
-
- /* skip over leading whitespace... */
- while(*t1 && isspace(*t1)) ++t1;
- while(*t2 && isspace(*t2)) ++t2;
-
- /* Check weekday */
- if ( (t1[0] != t2[0]) || (t1[1] != t2[1]) )
- return -1;
-
- /* Skip to date */
- while(*t2 && !isspace(*t2)) ++t2;
- t2++;
-
- /* skip if not strings not long enough */
- if ( (strlen(t1) < MINIMUM_LENGTH) || (strlen(t2) < MINIMUM_LENGTH) )
- return -1;
-
- if ( (t1[RFC1123_DAY] != t2[0]) || (t1[RFC1123_DAY+1] != t2[1]) )
- return -1;
-
- /* Skip to the month */
- t2 += 3;
-
- if ( (t1[RFC1123_MONTH] != t2[0]) || (t1[RFC1123_MONTH+1] != t2[1]) ||
- (t1[RFC1123_MONTH+2] != t2[2]) )
- return -1;
-
- /* Skip to year */
- t2 += 4;
-
- if ( (t1[RFC1123_YEAR] != t2[0]) ) {
- /* Assume t2 is RFC 850 format */
- if ( (t1[RFC1123_YEAR+2] != t2[0]) || (t1[RFC1123_YEAR+3] != t2[1]) )
- return -1;
-
- /* skip to hour */
- t2 += 3;
- } else {
- /* Assume t2 is RFC 1123 format */
- if ( (t1[RFC1123_YEAR+1] != t2[1]) || (t1[RFC1123_YEAR+2] != t2[2]) ||
- (t1[RFC1123_YEAR+3] != t2[3]) )
- return -1;
-
- /* skip to hour */
- t2 += 5;
- }
-
- /* check date */
- for (index=0; index<8; index++) {
- if ( t1[RFC1123_HOUR+index] != t2[index] )
- return -1;
- }
-
- /* Ignore timezone */
-
- return 0;
-}
-
-
-/* --------------------------- util_uri_is_evil --------------------------- */
-
-
-NSAPI_PUBLIC int util_uri_is_evil(char *t)
-{
- register int x;
-
- for(x = 0; t[x]; ++x) {
- if(t[x] == '/') {
- if(t[x+1] == '/')
- return 1;
- if(t[x+1] == '.') {
- switch(t[x+2]) {
- case '.':
- if((!t[x+3]) || (t[x+3] == '/'))
- return 1;
- case '/':
- case '\0':
- return 1;
- }
- }
- }
-#ifdef XP_WIN32
- /* On NT, the directory "abc...." is the same as "abc"
- * The only cheap way to catch this globally is to disallow
- * names with the trailing "."s. Hopefully this is not over
- * restrictive
- */
- if ((t[x] == '.') && ( (t[x+1] == '/') || (t[x+1] == '\0') )) {
- return 1;
- }
-#endif
- }
- return 0;
-}
-
-/* ---------------------------- util_uri_parse ---------------------------- */
-
-NSAPI_PUBLIC void util_uri_parse(char *uri)
-{
- int spos = 0, tpos = 0;
- int l = strlen(uri);
-
- while(uri[spos]) {
- if(uri[spos] == '/') {
- if((spos != l) && (uri[spos+1] == '.')) {
- if(uri[spos+2] == '/')
- spos += 2;
- else
- if((spos <= (l-3)) &&
- (uri[spos+2] == '.') && (uri[spos+3] == '/')) {
- spos += 3;
- while((tpos > 0) && (uri[--tpos] != '/'))
- uri[tpos] = '\0';
- } else
- uri[tpos++] = uri[spos++];
- } else {
- if(uri[spos+1] != '/')
- uri[tpos++] = uri[spos++];
- else
- spos++;
- }
- } else
- uri[tpos++] = uri[spos++];
- }
- uri[tpos] = '\0';
-}
-
-
-/* -------------------- util_uri_unescape_and_normalize -------------------- */
-
-#ifdef XP_WIN32
-/* The server calls this function to unescape the URI and also normalize
- * the uri. Normalizing the uri converts all "\" characters in the URI
- * and pathinfo portion to "/". Does not touch "\" in query strings.
- */
-void util_uri_unescape_and_normalize(char *s)
-{
- char *t, *u;
-
- for(t = s, u = s; *t; ++t, ++u) {
- if((*t == '%') && t[1] && t[2]) {
- *u = ((t[1] >= 'A' ? ((t[1] & 0xdf) - 'A')+10 : (t[1] - '0'))*16) +
- (t[2] >= 'A' ? ((t[2] & 0xdf) - 'A')+10 : (t[2] - '0'));
- t += 2;
- }
- else
- if(u != t)
- *u = *t;
- if (*u == '\\') /* normalize */
- *u = '/';
- }
- *u = *t;
-}
-#endif /* XP_WIN32 */
-
-/* -------------------------- util_uri_unescape --------------------------- */
-
-NSAPI_PUBLIC void util_uri_unescape(char *s)
-{
- char *t, *u;
-
- for(t = s, u = s; *t; ++t, ++u) {
- if((*t == '%') && t[1] && t[2]) {
- *u = ((t[1] >= 'A' ? ((t[1] & 0xdf) - 'A')+10 : (t[1] - '0'))*16) +
- (t[2] >= 'A' ? ((t[2] & 0xdf) - 'A')+10 : (t[2] - '0'));
- t += 2;
- }
- else
- if(u != t)
- *u = *t;
- }
- *u = *t;
-}
-
-
-/* --------------------------- util_uri_escape ---------------------------- */
-
-
-NSAPI_PUBLIC char *util_uri_escape(char *od, char *s)
-{
- char *d;
-
- if(!od)
- od = (char *) MALLOC((strlen(s)*3) + 1);
- d = od;
-
- while(*s) {
- if(strchr("% ?#:+&*\"<>\r\n", *s)) {
- sprintf(d, "%%%2x", *s);
- ++s; d += 3;
- }
- else
- *d++ = *s++;
- }
- *d = '\0';
- return od;
-}
-
-
-/* --------------------------- util_url_escape ---------------------------- */
-
-
-NSAPI_PUBLIC char *util_url_escape(char *od, char *s)
-{
- char *d;
-
- if(!od)
- od = (char *) MALLOC((strlen(s)*3) + 1);
- d = od;
-
- while(*s) {
- if(strchr("% +*\"<>\r\n", *s)) {
- sprintf(d, "%%%.2x", *s);
- ++s; d += 3;
- }
- else
- *d++ = *s++;
- }
- *d = '\0';
- return od;
-}
-
-
-/* ------------------------- util_mime_separator -------------------------- */
-
-
-NSAPI_PUBLIC int util_mime_separator(char *sep)
-{
- srand(time(NULL));
- return util_sprintf(sep, "%c%c--%d%d%d", CR, LF, rand(), rand(), rand());
-}
-
-
/* ------------------------------ util_itoa ------------------------------- */
@@ -714,23 +101,6 @@ NSAPI_PUBLIC int util_sprintf(char *s, const char *fmt, ...)
return PR_vsnprintf(s, UTIL_PRF_MAXSIZE, fmt, args);
}
-/* ---------------------------- util_sh_escape ---------------------------- */
-
-
-NSAPI_PUBLIC char *util_sh_escape(char *s)
-{
- char *ns = (char *) MALLOC(strlen(s) * 2 + 1); /* worst case */
- register char *t, *u;
-
- for(t = s, u = ns; *t; ++t, ++u) {
- if(strchr("&;`'\"|*?~<>^()[]{}$\\ #!", *t))
- *u++ = '\\';
- *u = *t;
- }
- *u = '\0';
- return ns;
-}
-
/* --------------------------- util_strcasecmp ---------------------------- */
@@ -777,67 +147,6 @@ int util_strncasecmp(CASECMPARG_T char *one, CASECMPARG_T char *two, int n)
}
#endif /* NEED_STRNCASECMP */
-#ifdef XP_WIN32
-
-
-/* util_delete_directory()
- * This routine deletes all the files in a directory. If delete_directory is
- * TRUE it will also delete the directory itself.
- */
-VOID
-util_delete_directory(char *FileName, BOOL delete_directory)
-{
- HANDLE firstFile;
- WIN32_FIND_DATA findData;
- char *TmpFile, *NewFile;
-
- if (FileName == NULL)
- return;
-
- TmpFile = (char *)MALLOC(strlen(FileName) + 5);
- sprintf(TmpFile, "%s\\*.*", FileName);
- firstFile = FindFirstFile(TmpFile, &findData);
- FREE(TmpFile);
-
- if (firstFile == INVALID_HANDLE_VALUE)
- return;
-
- if(strcmp(findData.cFileName, ".") &&
- strcmp(findData.cFileName, "..")) {
- NewFile = (char *)MALLOC(strlen(FileName) + 1 +
- strlen(findData.cFileName) + 1);
- sprintf(NewFile, "%s\\%s",FileName, findData.cFileName);
- DeleteFile(NewFile);
- FREE(NewFile);
- }
- while (TRUE) {
- if(!(FindNextFile(firstFile, &findData))) {
- if (GetLastError() != ERROR_NO_MORE_FILES) {
- ereport(LOG_WARN, XP_GetAdminStr(DBT_couldNotRemoveTemporaryDirectory_), FileName, GetLastError());
- } else {
- FindClose(firstFile);
- if (delete_directory)
- if(!RemoveDirectory(FileName)) {
- ereport(LOG_WARN,
- XP_GetAdminStr(DBT_couldNotRemoveTemporaryDirectory_1),
- FileName, GetLastError());
- }
- return;
- }
- } else {
- if(strcmp(findData.cFileName, ".") &&
- strcmp(findData.cFileName, "..")) {
- NewFile = (char *)MALLOC(strlen(FileName) + 5 +
- strlen(findData.cFileName) + 1);
- sprintf(NewFile,"%s\\%s", FileName, findData.cFileName);
- DeleteFile(NewFile);
- FREE(NewFile);
- }
- }
- }
-}
-#endif
-
/* ------------------------------ util_strftime --------------------------- */
/*
* Copyright (c) 1989 The Regents of the University of California.
@@ -1118,30 +427,6 @@ _util_strftime_conv(char *pt, int n, int digits, char pad)
return;
}
-
-#ifdef XP_UNIX
-/*
- * Local Thread Safe version of waitpid. This prevents the process
- * from blocking in the system call.
- */
-NSAPI_PUBLIC pid_t
-util_waitpid(pid_t pid, int *statptr, int options)
-{
- pid_t rv;
-
- for(rv = 0; !rv; PR_Sleep(500)) {
- rv = waitpid(pid, statptr, options | WNOHANG);
- if (rv == -1) {
- if (errno == EINTR)
- rv = 0; /* sleep and try again */
- else
- ereport(LOG_WARN, "waitpid failed for pid %d:%s", pid, system_errmsg());
- }
- }
- return rv;
-}
-#endif
-
/*
* Various reentrant routines by mikep. See util.h and systems.h
*/
@@ -1164,111 +449,6 @@ util_waitpid(pid_t pid, int *statptr, int options)
#endif
-NSAPI_PUBLIC char *
-util_strtok(register char *s,
- register const char *delim,
- register char **lasts)
-{
-#ifdef HAVE_STRTOK_R
- return strtok_r(s, delim, lasts);
-#else
- /*
- * THIS IS THE THREAD SAFE VERSION OF strtok captured from
- * public NetBSD. Note that no locks are needed
- */
- register char *spanp;
- register int c, sc;
- char *tok;
-
- if (s == NULL && (s = *lasts) == NULL)
- return (NULL);
-
- /*
- * Skip (span) leading delimiters (s += strspn(s, delim),
- * sort of).
- */
-
-cont:
- c = *s++;
- for (spanp = (char *)delim; (sc = *spanp++) != 0;) {
- if (c == sc)
- goto cont;
- }
-
- if (c == 0) { /* no non-delimiter characters */
- *lasts = NULL;
- return (NULL);
- }
- tok = s - 1;
-
- /*
- * Scan token (scan for delimiters: s += strcspn(s, delim),
- * sort of).
- * Note that delim must have one NUL; we stop if we see that, too.
- */
- for (;;) {
- c = *s++;
- spanp = (char *)delim;
- do {
- if ((sc = *spanp++) == c) {
- if (c == 0)
- s = NULL;
- else
- s[-1] = 0;
- *lasts = s;
- return (tok);
- }
- } while (sc != 0);
- }
- /* NOTREACHED */
-#endif /* no strtok_r */
-}
-
-#ifndef XP_WIN32
-NSAPI_PUBLIC struct passwd *
-util_getpwnam(const char *name, struct passwd *result, char *buffer,
- int buflen)
-{
-#ifdef HAVE_PW_R
-
-#ifdef AIX
-#if OSVERSION >= 4320
- return ((int)getpwnam_r(name, result, buffer, buflen, 0) == 0 ? result : NULL);
-#else
- return ((int)getpwnam_r(name, result, buffer, buflen) == 0 ? result : NULL);
-#endif
-#else
- return getpwnam_r(name, result, buffer, buflen);
-#endif /* AIX */
-
-#else
- char *lastp;
- struct passwd *r;
- RE_LOCK(pw);
- r = getpwnam(name);
- if (!r)
- return r;
-
- result->pw_gid = r->pw_gid;
- result->pw_uid = r->pw_uid;
- /* Hope this buffer is long enough */
- if (buffer)
- util_snprintf(buffer, buflen, "%s:%s:%d:%d:%s:%s:%s", r->pw_name, r->pw_passwd,
- r->pw_uid, r->pw_gid, r->pw_gecos, r->pw_dir, r->pw_shell);
- RE_UNLOCK(pw);
-
- result->pw_name = util_strtok(buffer, ":", &lastp);
- result->pw_passwd = util_strtok(NULL, ":", &lastp);
- (void) util_strtok(NULL, ":", &lastp);
- (void) util_strtok(NULL, ":", &lastp);
- result->pw_gecos = util_strtok(NULL, ":", &lastp);
- result->pw_dir = util_strtok(NULL, ":", &lastp);
- result->pw_shell = util_strtok(NULL, ":", &lastp);
- return result;
-#endif
-}
-#endif
-
NSAPI_PUBLIC struct tm *
util_localtime(const time_t *clock, struct tm *res)
{
@@ -1290,160 +470,3 @@ util_localtime(const time_t *clock, struct tm *res)
return res;
#endif
}
-
-
-NSAPI_PUBLIC char *
-util_ctime(const time_t *clock, char *buf, int buflen)
-{
-/*
- * From cgi-src/restore.c refering to XP_WIN32:
- * MLM - gross, but it works, better now FLC
- */
-#if !defined(HAVE_TIME_R) || defined(XP_WIN32)
- RE_LOCK(ctime);
- strncpy(buf, ctime(clock), buflen);
- buf[buflen - 1] = '\0';
- RE_UNLOCK(ctime);
- return buf;
-#elif HAVE_TIME_R == 2
- return ctime_r(clock, buf);
-#else /* HAVE_TIME_R == 3 */
- return ctime_r(clock, buf, buflen);
-#endif
-}
-
-NSAPI_PUBLIC struct tm *
-util_gmtime(const time_t *clock, struct tm *res)
-{
-#ifdef HAVE_TIME_R
- return gmtime_r(clock, res);
-#else
- struct tm *rv;
- time_t zero = 0x7fffffff;
-
- RE_LOCK(gmtime);
- rv = gmtime(clock);
- RE_UNLOCK(gmtime);
- if (!rv)
- rv = gmtime(&zero);
- if (rv)
- *res = *rv;
- else
- return NULL;
-
- return res;
-#endif
-}
-
-NSAPI_PUBLIC char *
-util_asctime(const struct tm *tm, char *buf, int buflen)
-{
-#if HAVE_TIME_R == 2
- return asctime_r(tm, buf);
-#elif HAVE_TIME_R == 3
- return asctime_r(tm, buf, buflen);
-#else
- RE_LOCK(asctime);
- strncpy(buf, asctime(tm), buflen);
- buf[buflen - 1] = '\0';
- RE_UNLOCK(asctime);
- return buf;
-#endif
-}
-
-NSAPI_PUBLIC char *
-util_strerror(int errnum, char *msg, int buflen)
-{
-#ifdef HAVE_STRERROR_R
- /* More IBM real-genius */
- return ((int)strerror_r(errnum, msg, buflen) > 0) ? msg : NULL;
-#else
- /* RE_LOCK(strerror); I don't think this is worth the trouble */
- (void)strncpy(msg, strerror(errnum), buflen);
- msg[buflen - 1] = '\0';
- return msg;
- /* RE_UNLOCK(strerror); */
-#endif
-}
-
-
-
-/* ------------------------------- OLD CODE ------------------------------- */
-
-
-#if 0
-
-NSAPI_PUBLIC int util_vsnprintf(char *s, int n, register char *fmt,
- va_list args)
-{
- register int pos = 0, max = (n > 2 ? n-2 : -1), boundson;
- register char c, *t;
-
- if((max == -1) && (n != -1))
- goto punt;
-
- boundson = (n != -1);
- while(*fmt) {
- if(boundson && (pos > max))
- break;
- c = *fmt++;
- switch(c) {
- case '%':
- switch(*fmt++) {
- case 'd':
- if(boundson && ((pos + 10) > max))
- goto punt;
- pos += util_itoa(va_arg(args, int), &s[pos]);
- break;
- case 's':
- t = va_arg(args, char *);
- while(*t) {
- s[pos++] = *t++;
- if(boundson && (pos > max))
- goto punt;
- }
- break;
- case 'c':
- s[pos++] = (char) va_arg(args, int);
- break;
- case '%':
- s[pos++] = '%';
- break;
- }
- break;
- case '\\':
- if( (s[pos++] = *fmt) )
- ++fmt;
- break;
- default:
- s[pos++] = c;
- }
- }
- punt:
- s[pos] = '\0';
-
- va_end(args);
- return pos;
-}
-
-NSAPI_PUBLIC int util_snprintf(char *s, int n, char *fmt, ...)
-{
- va_list args;
-
- va_start(args, fmt);
- return util_vsnprintf(s, n, fmt, args);
-}
-
-NSAPI_PUBLIC int util_vsprintf(char *s, register char *fmt, va_list args)
-{
- return util_vsnprintf(s, -1, fmt, args);
-}
-
-NSAPI_PUBLIC int util_sprintf(char *s, char *fmt, ...)
-{
- va_list args;
-
- va_start(args, fmt);
- return util_vsnprintf(s, -1, fmt, args);
-}
-#endif
diff --git a/lib/libaccess/Makefile b/lib/libaccess/Makefile
index 2acb484b..c5433f7f 100644
--- a/lib/libaccess/Makefile
+++ b/lib/libaccess/Makefile
@@ -43,14 +43,8 @@ OBJS=$(addprefix $(OBJDEST)/, usi.o \
attrec.o \
nseframe.o \
nsdb.o \
- nsdbmgmt.o \
nsuser.o \
- nsumgmt.o \
nsgroup.o \
- nsgmgmt.o \
- nsadb.o \
- nscert.o \
- nsamgmt.o \
nsautherr.o \
symbols.o \
acltools.o \
@@ -67,7 +61,6 @@ OBJS=$(addprefix $(OBJDEST)/, usi.o \
usrcache.o \
lasgroup.o \
lasuser.o \
- lasprogram.o \
aclspace.o \
acl.tab.o \
acl.yy.o \
@@ -77,10 +70,15 @@ OBJS=$(addprefix $(OBJDEST)/, usi.o \
aclparse.o \
aclbuild.o \
aclerror.o \
- acladmin.o \
- aclcgi.o \
+ nsadb.o \
+ nscert.o \
+ nsamgmt.o \
+ nsgmgmt.o \
+ nsdbmgmt.o \
+ nsumgmt.o \
$(OSOBJS) \
)
+
#
# AVA Mapping files. Currently not compiled in (FORTEZZA for reference only).
diff --git a/lib/libaccess/aclcache.cpp b/lib/libaccess/aclcache.cpp
index 34d2ecfb..acb1fc1d 100644
--- a/lib/libaccess/aclcache.cpp
+++ b/lib/libaccess/aclcache.cpp
@@ -4,7 +4,7 @@
* All rights reserved.
* END COPYRIGHT BLOCK **/
-#include <base/nsassert.h>
+#include <prlog.h>
#include <base/crit.h>
#include <base/ereport.h>
#include <plhash.h>
@@ -125,20 +125,20 @@ ACL_ListHashUpdate(ACLListHandle_t **acllistp)
NSErr_t *errp = 0;
ACLListHandle_t *tmp_acllist;
- NS_ASSERT(ACL_AssertAcllist(*acllistp));
+ PR_ASSERT(ACL_AssertAcllist(*acllistp));
tmp_acllist = (ACLListHandle_t *)PR_HashTableLookup(ACLListHash, *acllistp);
if (tmp_acllist && tmp_acllist != *acllistp) {
- NS_ASSERT(*acllistp && *acllistp != ACL_LIST_NO_ACLS);
+ PR_ASSERT(*acllistp && *acllistp != ACL_LIST_NO_ACLS);
ACL_ListDestroy(errp, *acllistp);
*acllistp = tmp_acllist;
- NS_ASSERT(ACL_CritHeld());
+ PR_ASSERT(ACL_CritHeld());
tmp_acllist->ref_count++; /* we're gonna use it */
} else { /* Wasn't in the list */
PR_HashTableAdd(ACLListHash, *acllistp, *acllistp);
}
- NS_ASSERT(ACL_AssertAcllist(*acllistp));
+ PR_ASSERT(ACL_AssertAcllist(*acllistp));
return;
}
@@ -156,15 +156,15 @@ ACL_ListHashEnter(ACLListHandle_t **acllistp)
/* Look for a matching ACL List and use it if we find one. */
if (*acllistp) {
- NS_ASSERT(*acllistp != ACL_LIST_NO_ACLS);
- NS_ASSERT(ACL_AssertAcllist(*acllistp));
+ PR_ASSERT(*acllistp != ACL_LIST_NO_ACLS);
+ PR_ASSERT(ACL_AssertAcllist(*acllistp));
ACL_ListHashUpdate(acllistp);
} else {
*acllistp = ACL_LIST_NO_ACLS;
}
ACL_CritExit();
- NS_ASSERT(ACL_AssertAcllist(*acllistp));
+ PR_ASSERT(ACL_AssertAcllist(*acllistp));
return;
}
@@ -184,12 +184,12 @@ ACL_ListHashCheck(ACLListHandle_t **acllistp)
tmp_acllist = (ACLListHandle_t *)PR_HashTableLookup(ACLListHash, *acllistp);
if (tmp_acllist) {
- NS_ASSERT(*acllistp && *acllistp != ACL_LIST_NO_ACLS);
+ PR_ASSERT(*acllistp && *acllistp != ACL_LIST_NO_ACLS);
*acllistp = tmp_acllist;
- NS_ASSERT(ACL_CritHeld());
+ PR_ASSERT(ACL_CritHeld());
tmp_acllist->ref_count++; /* we're gonna use it */
ACL_CritExit();
- NS_ASSERT(ACL_AssertAcllist(*acllistp));
+ PR_ASSERT(ACL_AssertAcllist(*acllistp));
return 1; /* Normal path */
} else { /* Wasn't in the list */
ACL_CritExit();
@@ -280,7 +280,7 @@ int
ACL_INTCacheCheck(int which, char *uri, ACLListHandle_t **acllistp)
{
PLHashTable *hash;
- NS_ASSERT(uri && acl_uri_hash && acl_uri_get_hash);
+ PR_ASSERT(uri && acl_uri_hash && acl_uri_get_hash);
/* ACL cache: If the ACL List is already in the cache, there's no need
* to go through the pathcheck directives.
@@ -300,12 +300,12 @@ ACL_INTCacheCheck(int which, char *uri, ACLListHandle_t **acllistp)
*acllistp = (ACLListHandle_t *)PR_HashTableLookup(hash, uri);
if (*acllistp != NULL) {
if (*acllistp != ACL_LIST_NO_ACLS) {
- NS_ASSERT((*acllistp)->ref_count >= 0);
- NS_ASSERT(ACL_CritHeld());
+ PR_ASSERT((*acllistp)->ref_count >= 0);
+ PR_ASSERT(ACL_CritHeld());
(*acllistp)->ref_count++;
}
ACL_CritExit();
- NS_ASSERT(ACL_AssertAcllist(*acllistp));
+ PR_ASSERT(ACL_AssertAcllist(*acllistp));
return 1; /* Normal path */
}
@@ -339,7 +339,7 @@ ACL_INTCacheEnter(int which, char *uri, ACLListHandle_t **acllistp)
NSErr_t *errp = 0;
PLHashTable *hash;
- NS_ASSERT(uri);
+ PR_ASSERT(uri);
ACL_CritEnter();
@@ -356,7 +356,7 @@ ACL_INTCacheEnter(int which, char *uri, ACLListHandle_t **acllistp)
tmpacllist = (ACLListHandle_t *)PR_HashTableLookup(hash, uri);
if (tmpacllist != NULL) {
if (tmpacllist != ACL_LIST_NO_ACLS) {
- NS_ASSERT(ACL_CritHeld());
+ PR_ASSERT(ACL_CritHeld());
tmpacllist->ref_count++; /* we're going to use it */
}
ACL_CritExit();
@@ -364,15 +364,15 @@ ACL_INTCacheEnter(int which, char *uri, ACLListHandle_t **acllistp)
ACL_ListDestroy(errp, *acllistp);
}
*acllistp = tmpacllist;
- NS_ASSERT(ACL_AssertAcllist(*acllistp));
+ PR_ASSERT(ACL_AssertAcllist(*acllistp));
return;
}
/* Didn't find another list, so put ours in. */
/* Look for a matching ACL List and use it if we find one. */
if (*acllistp) {
- NS_ASSERT(*acllistp != ACL_LIST_NO_ACLS);
- NS_ASSERT(ACL_AssertAcllist(*acllistp));
+ PR_ASSERT(*acllistp != ACL_LIST_NO_ACLS);
+ PR_ASSERT(ACL_AssertAcllist(*acllistp));
ACL_ListHashUpdate(acllistp);
} else {
*acllistp = ACL_LIST_NO_ACLS;
@@ -380,7 +380,7 @@ ACL_INTCacheEnter(int which, char *uri, ACLListHandle_t **acllistp)
PR_HashTableAdd(hash, pool_strdup((void **)acl_uri_hash_pool, uri), (void *)*acllistp);
ACL_CritExit();
- NS_ASSERT(ACL_AssertAcllist(*acllistp));
+ PR_ASSERT(ACL_AssertAcllist(*acllistp));
return;
}
@@ -422,13 +422,13 @@ ACL_AddAclName(char *path, ACLListHandle_t **acllistp, ACLListHandle_t
if (!acl)
return;
- NS_ASSERT(ACL_AssertAcl(acl));
+ PR_ASSERT(ACL_AssertAcl(acl));
if (!*acllistp)
*acllistp = ACL_ListNew(errp);
ACL_ListAppend(NULL, *acllistp, acl, 0);
- NS_ASSERT(ACL_AssertAcllist(*acllistp));
+ PR_ASSERT(ACL_AssertAcllist(*acllistp));
return;
}
@@ -456,8 +456,8 @@ ACLListHandle_t *masterlist)
int prefixlen;
char *dst;
- NS_ASSERT(path);
- NS_ASSERT(prefix);
+ PR_ASSERT(path);
+ PR_ASSERT(prefix);
dst = strncpy(ppath, prefix, ACL_PATH_MAX);
if (dst >= (ppath+ACL_PATH_MAX-1)) {
@@ -522,7 +522,7 @@ ACL_Init(void)
ACL_InitAttr2Index();
ACLGlobal = (ACLGlobal_p)PERM_CALLOC(sizeof(ACLGlobal_s));
oldACLGlobal = (ACLGlobal_p)PERM_CALLOC(sizeof(ACLGlobal_s));
- NS_ASSERT(ACLGlobal && oldACLGlobal);
+ PR_ASSERT(ACLGlobal && oldACLGlobal);
ACL_DATABASE_POOL = pool_create();
ACL_METHOD_POOL = pool_create();
ACL_CritInit();
diff --git a/lib/libaccess/aclerror.cpp b/lib/libaccess/aclerror.cpp
index 2cbf2874..68395c72 100644
--- a/lib/libaccess/aclerror.cpp
+++ b/lib/libaccess/aclerror.cpp
@@ -17,7 +17,7 @@
#else
#include "nspr/prprf.h"
#endif
-#include <base/nsassert.h>
+#include "prlog.h"
#include "libaccess/nserror.h"
#include "libaccess/nsautherr.h"
#include "libaccess/aclerror.h"
@@ -110,7 +110,7 @@ void aclErrorFmt(NSErr_t * errp, char * msgbuf, int maxlen, int maxdepth)
strncpy(msgbuf, efp->ef_errv[0], maxlen);
break;
default:
- NS_ASSERT(0); /* don't break -- continue into case 0 */
+ PR_ASSERT(0); /* don't break -- continue into case 0 */
case 0:
switch (efp->ef_retcode) {
case ACLERRFAIL:
diff --git a/lib/libaccess/aclflush.cpp b/lib/libaccess/aclflush.cpp
index dfee47d6..05fa18e4 100644
--- a/lib/libaccess/aclflush.cpp
+++ b/lib/libaccess/aclflush.cpp
@@ -7,7 +7,7 @@
* Source file for the ACL_CacheFlush-related routines.
*/
-#include <base/nsassert.h>
+#include <prlog.h>
#include <base/util.h>
#include <libaccess/acl.h>
#include "aclpriv.h"
@@ -25,15 +25,15 @@ deletelists(PRHashEntry *he, PRIntn i, void *arg)
ACLListHandle_t *acllist=(ACLListHandle_t *)he->value;
NSErr_t *errp = 0;
- NS_ASSERT(he);
- NS_ASSERT(he->value);
+ PR_ASSERT(he);
+ PR_ASSERT(he->value);
if (acllist->ref_count) {
// If the list is in use, increment the counter. Then set the
// stale flag. The other user can't delete the list since we're
// counted as well. Finally, decrement the counter and whoever
// sets it to zero will delete the ACL List.
- NS_ASSERT(ACL_CritHeld());
+ PR_ASSERT(ACL_CritHeld());
acllist->ref_count++;
acllist->flags |= ACL_LIST_STALE;
if (--acllist->ref_count == 0)
@@ -54,8 +54,8 @@ restartdeletelists(PRHashEntry *he, PRIntn i, void *arg)
// what.
ACLListHandle_t *acllist=(ACLListHandle_t *)he->value;
- NS_ASSERT(he);
- NS_ASSERT(he->value);
+ PR_ASSERT(he);
+ PR_ASSERT(he->value);
ACL_ListDestroy(errp, acllist);
@@ -67,7 +67,7 @@ static AclCacheFlushFunc_t AclCacheFlushRoutine = NULL;
NSAPI_PUBLIC int
ACL_CacheFlushRegister(AclCacheFlushFunc_t flush_func)
{
- NS_ASSERT(flush_func);
+ PR_ASSERT(flush_func);
AclCacheFlushRoutine = flush_func;
return 0;
@@ -79,12 +79,12 @@ ACL_CacheFlush(void)
ACLGlobal_p newACLGlobal;
NSErr_t *errp = 0;
- NS_ASSERT(ACLGlobal);
- NS_ASSERT(ACLGlobal->masterlist);
- NS_ASSERT(ACLGlobal->listhash);
- NS_ASSERT(ACLGlobal->urihash);
- NS_ASSERT(ACLGlobal->urigethash);
- NS_ASSERT(ACLGlobal->pool);
+ PR_ASSERT(ACLGlobal);
+ PR_ASSERT(ACLGlobal->masterlist);
+ PR_ASSERT(ACLGlobal->listhash);
+ PR_ASSERT(ACLGlobal->urihash);
+ PR_ASSERT(ACLGlobal->urigethash);
+ PR_ASSERT(ACLGlobal->pool);
ACL_CritEnter();
@@ -142,12 +142,12 @@ ACL_Restart(void *clntData)
{
NSErr_t *errp = 0;
- NS_ASSERT(ACLGlobal);
- NS_ASSERT(ACLGlobal->masterlist);
- NS_ASSERT(ACLGlobal->listhash);
- NS_ASSERT(ACLGlobal->urihash);
- NS_ASSERT(ACLGlobal->urigethash);
- NS_ASSERT(ACLGlobal->pool);
+ PR_ASSERT(ACLGlobal);
+ PR_ASSERT(ACLGlobal->masterlist);
+ PR_ASSERT(ACLGlobal->listhash);
+ PR_ASSERT(ACLGlobal->urihash);
+ PR_ASSERT(ACLGlobal->urigethash);
+ PR_ASSERT(ACLGlobal->pool);
// Unlike ACL_CacheFlush, this routine can be much more cavalier about
// freeing up memory, since there's guaranteed to be no users about at
diff --git a/lib/libaccess/acltools.cpp b/lib/libaccess/acltools.cpp
index 1283147e..9a9c820f 100644
--- a/lib/libaccess/acltools.cpp
+++ b/lib/libaccess/acltools.cpp
@@ -3384,9 +3384,9 @@ ACL_Decompose(NSErr_t *errp, char **acl, ACLListHandle_t *acl_list)
/*
* The following routines are used to validate input parameters. They always
- * return 1, or cause an NS_ASSERT failure. The proper way to use them is
- * with an NS_ASSERT in the calling function. E.g.
- * NS_ASSERT(ACL_AssertAcllist(acllist));
+ * return 1, or cause an PR_ASSERT failure. The proper way to use them is
+ * with an PR_ASSERT in the calling function. E.g.
+ * PR_ASSERT(ACL_AssertAcllist(acllist));
*/
int
@@ -3395,18 +3395,18 @@ ACL_AssertAcllist(ACLListHandle_t *acllist)
ACLWrapper_t *wrap;
if (acllist == ACL_LIST_NO_ACLS) return 1;
- NS_ASSERT(acllist);
- NS_ASSERT(acllist->acl_list_head);
- NS_ASSERT(acllist->acl_list_tail);
- NS_ASSERT(acllist->acl_count);
- NS_ASSERT(acllist->ref_count > 0);
+ PR_ASSERT(acllist);
+ PR_ASSERT(acllist->acl_list_head);
+ PR_ASSERT(acllist->acl_list_tail);
+ PR_ASSERT(acllist->acl_count);
+ PR_ASSERT(acllist->ref_count > 0);
for (wrap=acllist->acl_list_head; wrap; wrap=wrap->wrap_next) {
- NS_ASSERT(ACL_AssertAcl(wrap->acl));
+ PR_ASSERT(ACL_AssertAcl(wrap->acl));
}
/* Artificially limit ACL lists to 10 ACLs for now */
- NS_ASSERT(acllist->acl_count < 10);
+ PR_ASSERT(acllist->acl_count < 10);
return 1;
}
@@ -3414,11 +3414,11 @@ ACL_AssertAcllist(ACLListHandle_t *acllist)
int
ACL_AssertAcl(ACLHandle_t *acl)
{
- NS_ASSERT(acl);
- NS_ASSERT(acl->ref_count);
- NS_ASSERT(acl->expr_count);
- NS_ASSERT(acl->expr_list_head);
- NS_ASSERT(acl->expr_list_tail);
+ PR_ASSERT(acl);
+ PR_ASSERT(acl->ref_count);
+ PR_ASSERT(acl->expr_count);
+ PR_ASSERT(acl->expr_list_head);
+ PR_ASSERT(acl->expr_list_tail);
return 1;
}
diff --git a/lib/libaccess/aclutil.cpp b/lib/libaccess/aclutil.cpp
index 8d30fffb..add9a203 100644
--- a/lib/libaccess/aclutil.cpp
+++ b/lib/libaccess/aclutil.cpp
@@ -106,7 +106,7 @@ EvalToRes(int value)
case LAS_EVAL_NEED_MORE_INFO:
return ACL_RES_DENY;
default:
- NS_ASSERT(1);
+ PR_ASSERT(1);
return ACL_RES_ERROR;
}
}
diff --git a/lib/libaccess/avadb.c b/lib/libaccess/avadb.c
index c0d98704..a2884082 100644
--- a/lib/libaccess/avadb.c
+++ b/lib/libaccess/avadb.c
@@ -11,8 +11,6 @@
#include "libaccess/avadb.h"
#include "base/session.h"
#include "base/pblock.h"
-#include "frame/req.h"
-#include "frame/log.h"
#include "libadmin/libadmin.h"
#include "libaccess/avapfile.h"
diff --git a/lib/libaccess/oneeval.cpp b/lib/libaccess/oneeval.cpp
index be837599..088940ff 100644
--- a/lib/libaccess/oneeval.cpp
+++ b/lib/libaccess/oneeval.cpp
@@ -19,7 +19,6 @@
#include <netsite.h>
#include <base/systems.h>
#include <base/crit.h>
-#include <base/session.h>
#include <libaccess/nserror.h>
#include <libaccess/acl.h>
#include "aclpriv.h"
@@ -489,7 +488,7 @@ ACLEvalBuildContext(
break;
default:
- NS_ASSERT(0);
+ PR_ASSERT(0);
} /* switch expr_type */
@@ -683,14 +682,14 @@ ACL_INTEvalTestRights(
rarray_p->acelist[rarray_p->count++] =
(ACLAceNumEntry_t *)ACL_HashTableLookup_const(cache->Table,
(char *)generic_rights[g_num]);
- NS_ASSERT (rarray_p->count < ACL_MAX_GENERIC);
+ PR_ASSERT (rarray_p->count < ACL_MAX_GENERIC);
}
}
}
rights_cnt++;
rights++;
- NS_ASSERT (rights_cnt < ACL_MAX_TEST_RIGHTS);
+ PR_ASSERT (rights_cnt < ACL_MAX_TEST_RIGHTS);
}
/* Special case - look for an entry that applies to "all" rights */
@@ -974,10 +973,10 @@ ACL_EvalDestroy(NSErr_t *errp, pool_handle_t *pool, ACLEvalHandle_t *acleval)
{
if (!acleval->acllist || acleval->acllist == ACL_LIST_NO_ACLS)
return;
- NS_ASSERT(acleval->acllist->ref_count > 0);
+ PR_ASSERT(acleval->acllist->ref_count > 0);
ACL_CritEnter();
- NS_ASSERT(ACL_CritHeld());
+ PR_ASSERT(ACL_CritHeld());
if (--acleval->acllist->ref_count == 0) {
if (ACL_LIST_IS_STALE(acleval->acllist)) {
ACL_ListDestroy(errp, acleval->acllist);
@@ -1004,10 +1003,10 @@ ACL_ListDecrement(NSErr_t *errp, ACLListHandle_t *acllist)
if (!acllist || acllist == ACL_LIST_NO_ACLS)
return 0;
- NS_ASSERT(ACL_AssertAcllist(acllist));
+ PR_ASSERT(ACL_AssertAcllist(acllist));
ACL_CritEnter();
- NS_ASSERT(ACL_CritHeld());
+ PR_ASSERT(ACL_CritHeld());
if (--acllist->ref_count == 0) {
if (ACL_LIST_IS_STALE(acllist)) {
ACL_ListDestroy(errp, acllist);
@@ -1021,7 +1020,7 @@ ACL_ListDecrement(NSErr_t *errp, ACLListHandle_t *acllist)
NSAPI_PUBLIC int
ACL_EvalSetACL(NSErr_t *errp, ACLEvalHandle_t *acleval, ACLListHandle_t *acllist)
{
- NS_ASSERT(ACL_AssertAcllist(acllist));
+ PR_ASSERT(ACL_AssertAcllist(acllist));
acleval->acllist = acllist;
return(0);
diff --git a/lib/libaccess/register.cpp b/lib/libaccess/register.cpp
index 2973e1d5..22074d67 100644
--- a/lib/libaccess/register.cpp
+++ b/lib/libaccess/register.cpp
@@ -11,7 +11,7 @@
#include <plhash.h>
#include <base/systems.h>
#include <base/util.h>
-#include <base/nsassert.h>
+#include <prlog.h>
#include "permhash.h"
#include <libaccess/nserror.h>
#include <libaccess/acl.h>
@@ -48,7 +48,7 @@ ACL_LasHashInit()
PR_CompareValues,
&ACLPermAllocOps,
NULL);
- NS_ASSERT(ACLLasEvalHash);
+ PR_ASSERT(ACLLasEvalHash);
ACLLasFlushHash = PR_NewHashTable(0,
PR_HashString,
@@ -56,7 +56,7 @@ ACL_LasHashInit()
PR_CompareValues,
&ACLPermAllocOps,
NULL);
- NS_ASSERT(ACLLasFlushHash);
+ PR_ASSERT(ACLLasFlushHash);
ACLMethodHash = PR_NewHashTable(ACL_MAX_METHOD,
PR_HashCaseString,
@@ -64,7 +64,7 @@ ACL_LasHashInit()
PR_CompareValues,
&ACLPermAllocOps,
NULL);
- NS_ASSERT(ACLMethodHash);
+ PR_ASSERT(ACLMethodHash);
ACLDbTypeHash = PR_NewHashTable(ACL_MAX_DBTYPE,
PR_HashCaseString,
@@ -72,7 +72,7 @@ ACL_LasHashInit()
PR_CompareValues,
&ACLPermAllocOps,
NULL);
- NS_ASSERT(ACLDbTypeHash);
+ PR_ASSERT(ACLDbTypeHash);
for (i = 0; i < ACL_MAX_DBTYPE; i++)
ACLDbParseFnTable[i] = 0;
@@ -83,7 +83,7 @@ ACL_LasHashInit()
PR_CompareValues,
&ACLPermAllocOps,
NULL);
- NS_ASSERT(ACLDbTypeHash);
+ PR_ASSERT(ACLDbTypeHash);
ACLDbNameHash = PR_NewHashTable(0,
PR_HashCaseString,
@@ -91,7 +91,7 @@ ACL_LasHashInit()
PR_CompareValues,
&ACLPermAllocOps,
ACL_DATABASE_POOL);
- NS_ASSERT(ACLDbNameHash);
+ PR_ASSERT(ACLDbNameHash);
ACLUserLdbHash = PR_NewHashTable(0,
PR_HashCaseString,
@@ -99,7 +99,7 @@ ACL_LasHashInit()
PR_CompareValues,
&ACLPermAllocOps,
NULL);
- NS_ASSERT(ACLUserLdbHash);
+ PR_ASSERT(ACLUserLdbHash);
return;
}
@@ -166,7 +166,7 @@ NSAPI_PUBLIC int
ACL_LasFindEval(NSErr_t *errp, char *attr_name, LASEvalFunc_t *eval_funcp)
{
- NS_ASSERT(attr_name);
+ PR_ASSERT(attr_name);
if (!attr_name) return -1;
*eval_funcp = (LASEvalFunc_t)PR_HashTableLookup(ACLLasEvalHash, attr_name);
@@ -187,7 +187,7 @@ NSAPI_PUBLIC int
ACL_LasFindFlush(NSErr_t *errp, char *attr_name, LASFlushFunc_t *flush_funcp)
{
- NS_ASSERT(attr_name);
+ PR_ASSERT(attr_name);
if (!attr_name) return -1;
*flush_funcp = (LASFlushFunc_t)PR_HashTableLookup(ACLLasFlushHash, attr_name);
diff --git a/lib/libadmin/Makefile b/lib/libadmin/Makefile
index a1904250..dac26ef4 100644
--- a/lib/libadmin/Makefile
+++ b/lib/libadmin/Makefile
@@ -22,14 +22,10 @@ else
LIBS=$(OBJDIR)/lib/libadmin.a
endif
-OBJS=$(addprefix $(OBJDEST)/, admconf.o form_get.o error.o admlog.o \
- magconf.o ns-util.o objconf.o password.o \
- referer.o template.o util.o \
- hinstall.o admserv.o install.o nsnews.o \
- commit.o pcontrol.o get_msg.o \
- multconf.o httpcon.o authdb.o usrlists.o \
- dstats.o backup.o cluster.o \
- keyconf.o strlist.o $(OSOBJS))
+OBJS=$(addprefix $(OBJDEST)/, error.o \
+ template.o util.o \
+ authdb.o \
+ strlist.o $(OSOBJS))
# moved files [to libadminutil] : form_post.o strlist.o distadm.o cron_conf.o
# candidate for moing: admlog.o error.o admserv.o
@@ -39,8 +35,8 @@ OBJS=$(addprefix $(OBJDEST)/, admconf.o form_get.o error.o admlog.o \
all: $(OBJDEST) $(LIBS)
-$(LIBS): $(addprefix $(BUILD_ROOT)/include/libadmin/, \
- hadm_msgs.i la_msgs.i)
+#$(LIBS): $(addprefix $(BUILD_ROOT)/include/libadmin/, \
+# hadm_msgs.i la_msgs.i)
include $(BUILD_ROOT)/nsconfig.mk
diff --git a/lib/libadmin/authdb.c b/lib/libadmin/authdb.c
index 8aff4ca8..e111d567 100644
--- a/lib/libadmin/authdb.c
+++ b/lib/libadmin/authdb.c
@@ -12,196 +12,12 @@
* (blame Mike McCool for functions with an MLM)
*/
-#ifdef XP_UNIX
-#include <dirent.h>
-#endif /* WIN32? */
-
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include <stdio.h>
-#include "base/shexp.h"
-#include "base/util.h"
-#include "libadminutil/admutil.h"
-#include "libadmin/libadmin.h"
-
-#include "libaccess/nsgmgmt.h"
-#include "libaccess/nsumgmt.h"
-/* XXX MLM - This shouldn't have to define itself as private. */
-#define __PRIVATE_NSADB
-#include "libaccess/nsadb.h"
-#include "libaccess/nsamgmt.h"
-#include "libaccess/aclerror.h"
-#include "libaccess/aclbuild.h"
-#include "libaccess/acladmin.h"
-#include "usrlists.h"
-
-#define BUF_SIZE 10
-
-void list_authdbs(char *fullpath, char *partialpath);
-
-static char **list;
-static int listsize;
-static int curentry;
-
-/*
- * Rights we know about. This should be moved out to some
- * external location. Perhaps obj.conf?
- */
-NSAPI_PUBLIC char *acl_read_rights[] =
-{
- "GET",
- "HEAD",
- "POST",
- "INDEX",
-#ifdef MCC_PROXY
- "CONNECT",
-#endif
- NULL
-};
-
-NSAPI_PUBLIC char *acl_write_rights[] =
-{
- "PUT",
- "DELETE",
- "MKDIR",
- "RMDIR",
- "MOVE",
- NULL
-};
-
-
-/*
- * passfilter - function returns non-zero if the regular expression
- * passed in matches the string passed in.
- */
-static int passfilter(char *str, char *regexp)
-{
- if (!str)
- return 0; /* NULL string never matches */
- else if (!regexp)
- return 1; /* NULL regexp matches everything */
- else
- return(!shexp_casecmp(str, regexp));
-}
-
-NSAPI_PUBLIC char **list_auth_dbs(char *fullpath)
-{
- list = new_strlist(BUF_SIZE);
- listsize = BUF_SIZE;
- curentry = 0;
- list_authdbs(fullpath, "");
-
- return(list);
-}
-
-NSAPI_PUBLIC void output_authdb_selector(char *path, char *element, char *current) {
- char **pathlist = list_auth_dbs(path);
- int currentnum = -1;
- int plen = path ? strlen(path) : 0;
- register int x;
-
- /*
- * If the 'current' string begins with the 'path' string, remove the
- * 'path' prefix.
- */
- if (!strncmp(current, path, plen)) {
- current += plen;
- if (*current == FILE_PATHSEP) ++current;
- }
-
- if (pathlist[0]) /* Is there at least one database? */
- {
- /* Find current selection in list of databases. */
- for(x=0; pathlist[x]; x++) {
- if(!strcmp(current, pathlist[x])) {
- currentnum = x;
- continue;
- }
- }
-
-/* BONEHEAD */
- fprintf(stdout, "<SELECT name=\"%s\" %s>",
- element, (x>SELECT_OVERFLOW) ? "size=5" : "");
-
- /* If the current selection is in there, put it first. */
- if(currentnum != -1) {
- fprintf(stdout, "<OPTION value=\"%s\" SELECTED>%s\n",
- pathlist[currentnum], pathlist[currentnum]);
-
- }
- for(x=0; pathlist[x]; x++) {
- if (x == currentnum)
- continue;
-
- fprintf(stdout, "<OPTION value=\"%s\">%s\n",
- pathlist[x], pathlist[x]);
- }
- fprintf(stdout, "</SELECT>");
- } else {
- fprintf(stdout, "<b>No databases found.</b>");
- }
-}
-
-NSAPI_PUBLIC char *get_current_authdb()
-{
- char **config = get_adm_config();
- return(STRDUP(config[3]));
-}
-
-NSAPI_PUBLIC void set_current_authdb(char *current)
-{
- char **config = get_adm_config();
- config[3] = STRDUP(current);
- write_adm_config(config);
-}
-
-void list_authdbs(char *fullpath, char *partialpath)
-{
- int stat_good;
- struct stat finfo;
- char **dirlisting;
- char *path = (char *)MALLOC(strlen(fullpath)+strlen(partialpath)+2);
-
- sprintf(path, "%s%c%s", fullpath, FILE_PATHSEP, partialpath);
- if( !(dirlisting = list_directory(path,0)))
- return;
- else {
- register int x;
- char *entry, *newppath;
-
- for(x=0; dirlisting[x]; x++) {
- entry = (char *)MALLOC(strlen(path)+strlen(dirlisting[x])+2);
- sprintf(entry, "%s%s", path, dirlisting[x]);
-
-#ifdef XP_UNIX
- stat_good = (lstat(entry, &finfo) == -1 ? 0 : 1);
-#else /* WIN32 */
- stat_good = (stat(entry, &finfo) == -1 ? 0 : 1);
-#endif /* XP_UNIX */
-
- if(!stat_good)
- continue;
- newppath = (char *)MALLOC(strlen(partialpath)+strlen(dirlisting[x])+3);
-
- if(S_ISDIR(finfo.st_mode)) {
- sprintf(newppath, "%s%s", partialpath, dirlisting[x]);
- curentry++;
-
- if(!(curentry < listsize)) {
- listsize += BUF_SIZE;
- list = grow_strlist(list, listsize);
- }
- list[curentry-1] = STRDUP(newppath);
- list[curentry] = NULL;
- }
-
- FREE(entry);
- FREE(newppath);
- }
- }
-}
+#include "netsite.h"
/* Get the userdb directory. (V1.x) */
NSAPI_PUBLIC char *get_userdb_dir(void)
@@ -221,2247 +37,3 @@ NSAPI_PUBLIC char *get_userdb_dir(void)
userdb = STRDUP(line);
return userdb;
}
-
-/* Get the httpacl directory. (V2.x) */
-NSAPI_PUBLIC char *get_httpacl_dir(void)
-{
- char *httpacl;
- char line[BIG_LINE];
-
-#ifdef USE_ADMSERV
- char *tmp = getenv("NETSITE_ROOT");
-
- sprintf(line, "%s%chttpacl", tmp, FILE_PATHSEP);
-#else
- char *tmp = get_mag_var("#ServerRoot");
-
- sprintf(line, "%s%cadmin%chttpacl", tmp, FILE_PATHSEP, FILE_PATHSEP);
-#endif
- httpacl = STRDUP(line);
- return httpacl;
-}
-
-/* Get the authdb directory. (V2.x) */
-NSAPI_PUBLIC char *get_authdb_dir(void)
-{
- char *authdb;
- char line[BIG_LINE];
-
-#ifdef USE_ADMSERV
- char *tmp = getenv("NETSITE_ROOT");
-
- sprintf(line, "%s%cauthdb", tmp, FILE_PATHSEP);
-#else
- char *tmp = get_mag_var("#ServerRoot");
-
- sprintf(line, "%s%cadmin%cauthdb", tmp, FILE_PATHSEP, FILE_PATHSEP);
-#endif
- authdb = STRDUP(line);
- return authdb;
-}
-/*
- * groupOrUser - function sets its return variable flags
- * based on whether the name passed in is
- * a user or a group in the specified database.
- * It could be both, although the entry form
- * are intended to prohibit this.
- * Returns: 0 if no error occurs, something else otherwise.
- */
-NSAPI_PUBLIC int groupOrUser(char *db_path, char *name, int *is_user, int *is_group)
-{
- int rv = 1;
- UserObj_t *uoptr;
- GroupObj_t *goptr;
- void *padb;
-
- if (name && is_user && is_group) {
- *is_user = 0;
- *is_group = 0;
- rv = nsadbOpen(NULL, db_path, 0, &padb);
- if (!rv) {
-
- rv = nsadbFindByName(NULL, padb, name, AIF_USER, (void **)&uoptr);
- if (rv == AIF_USER) {
- *is_user = 1;
- }
-
- rv = nsadbFindByName(NULL, padb, name, AIF_GROUP, (void **)&goptr);
- if (rv == AIF_GROUP) {
- *is_group = 1;
- }
-
- nsadbClose(padb, 0);
- }
- }
-
- return rv;
-}
-
-/*
- * getfullname - function to get the fullname of a user.
- * Return: Returns 0 if it works, something else if it fails.
- */
-NSAPI_PUBLIC int getfullname(char *db_path, char *user, char **fullname) {
- int rv;
- UserObj_t *uoptr;
- void *padb;
-
- if (db_path && user)
- {
- rv = nsadbOpen(NULL, db_path, 0, &padb);
- if (rv == 0) {
- rv = nsadbFindByName(NULL, padb, user, AIF_USER, (void **)&uoptr);
- if (rv == AIF_USER) {
- *fullname = (uoptr->uo_rname != 0) ? STRDUP((char *)uoptr->uo_rname)
- : STRDUP("");
- }
- else
- rv = 1;
- nsadbClose(padb, 0);
- }
- }
- else
- rv = 1;
-
- return rv;
-}
-
-/*
- * setfullname - function to set the fullname for the specified user.
- * Return: Returns 0 if it works, something else if it fails.
- */
-NSAPI_PUBLIC int setfullname(char *db_path, char *user, char *fullname) {
- int rv;
- UserObj_t *uoptr;
- void *padb;
-
- rv = nsadbOpen(NULL, db_path, 0, &padb);
- if (rv < 0) {
- report_error(SYSTEM_ERROR, "Failed To Open Database",
- "An error occurred while trying to update "
- "the user's fullname in the database.");
- } else {
- /* See if the user already exists, if so, update it. */
- rv = nsadbFindByName(NULL, padb, user, AIF_USER, (void **)&uoptr);
- if (rv == AIF_USER) {
- uoptr->uo_rname = (NTS_t)fullname;
- } else {
- /* User doesn't exist, so we've failed. */
- report_error(SYSTEM_ERROR, user,
- "Unable to change this user's fullname, "
- "user was not found in the database.");
- rv = 1;
- }
-
- if (uoptr) {
- rv = nsadbModifyUser(NULL, padb, uoptr);
- if (rv < 0)
- report_error(SYSTEM_ERROR, user,
- "A database error occurred while "
- "trying to change the user fullname.");
- }
- nsadbClose(padb, 0);
- }
- return rv;
-}
-
-/* Set a user's login name MLM*/
-NSAPI_PUBLIC int setusername(char *db_path, char *user, char *newname) {
- int rv;
- UserObj_t *uoptr;
- void *padb;
-
- rv = nsadbOpen(NULL, db_path, 0, &padb);
- if (rv < 0) {
- report_error(SYSTEM_ERROR, "Failed To Open Database",
- "An error occurred while trying to update "
- "the user's fullname in the database.");
- } else {
- /* See if the user already exists, if so, update it. */
- rv = nsadbFindByName(NULL, padb, user, AIF_USER, (void **)&uoptr);
- if (rv != AIF_USER) {
- /* User doesn't exist, so we've failed. */
- report_error(SYSTEM_ERROR, user,
- "Unable to change this user's fullname, "
- "user was not found in the database.");
- rv = 1;
- }
- if (uoptr) {
- rv = userRename(NULL, ((AuthDB_t *)padb)->adb_userdb,
- uoptr, (NTS_t)newname);
-
- if (rv < 0)
- report_error(SYSTEM_ERROR, user,
- "A database error occurred while "
- "trying to change the login name.");
- }
- nsadbClose(padb, 0);
- }
- return rv;
-}
-
-/*
- * addusertogroup - function to add a user to a group
- * Return: Returns 0 if it works, something else if it fails.
- */
-NSAPI_PUBLIC int addusertogroup(char *db_path, char *user, char *group) {
- int rv;
- UserObj_t *uoptr;
- GroupObj_t *goptr;
- void *padb;
-
- rv = nsadbOpen(NULL, db_path, 0, &padb);
- if (rv < 0) {
- report_error(SYSTEM_ERROR, "Failed To Open Database",
- "An error occurred while trying to add "
- "user to a group.");
- } else {
- /* See if the user and group exist. */
- rv = nsadbFindByName(NULL, padb, group, AIF_GROUP, (void **)&goptr);
- rv = nsadbFindByName(NULL, padb, user, AIF_USER, (void **)&uoptr);
- if (goptr == 0) {
- report_error(INCORRECT_USAGE, group,
- "The group was not found.");
- }
- else if (uoptr == 0) {
- report_error(INCORRECT_USAGE, user,
- "The user was not found.");
- }
- else {
- rv = nsadbAddUserToGroup(NULL, padb, goptr, uoptr);
- }
-
- nsadbClose(padb, 0);
- }
- return rv;
-}
-
-/*
- * addgrouptogroup - function to add a group to a group
- * Return: Returns 0 if it works, something else if it fails.
- */
-NSAPI_PUBLIC int addgrouptogroup(char *db_path, char *memgroup, char *group) {
- int rv;
- GroupObj_t *goptr;
- GroupObj_t *mem_goptr;
- void *padb;
-
- if (!strcmp(memgroup, group)) {
- report_error(INCORRECT_USAGE, group,
- "You can't add a group to itself.");
- }
-
- rv = nsadbOpen(NULL, db_path, 0, &padb);
- if (rv < 0) {
- report_error(SYSTEM_ERROR, "Failed To Open Database",
- "An error occurred while trying to add "
- "group to a group.");
- } else {
- /* See if the groups exist. */
- rv = nsadbFindByName(NULL, padb, group, AIF_GROUP, (void **)&goptr);
- rv = nsadbFindByName(NULL,
- padb, memgroup, AIF_GROUP, (void **)&mem_goptr);
- if (goptr == 0) {
- report_error(INCORRECT_USAGE, group,
- "The target group was not found.");
- }
- else if (mem_goptr == 0) {
- report_error(INCORRECT_USAGE, memgroup,
- "The group to add was not found.");
- }
- else {
- rv = nsadbAddGroupToGroup(NULL, padb, goptr, mem_goptr);
- }
-
- nsadbClose(padb, 0);
- }
- return rv;
-}
-
-/*
- * remuserfromgroup - function to remove a user from a group
- * Return: Returns 0 if it works, something else if it fails.
- */
-NSAPI_PUBLIC int remuserfromgroup(char *db_path, char *user, char *group) {
- int rv;
- UserObj_t *uoptr;
- GroupObj_t *goptr;
- void *padb;
-
- rv = nsadbOpen(NULL, db_path, 0, &padb);
- if (rv < 0) {
- report_error(SYSTEM_ERROR, "Failed To Open Database",
- "An error occurred while trying to add "
- "user to a group.");
- } else {
- /* See if the user and group exist. */
- rv = nsadbFindByName(NULL, padb, group, AIF_GROUP, (void **)&goptr);
- rv = nsadbFindByName(NULL, padb, user, AIF_USER, (void **)&uoptr);
- if (goptr == 0) {
- report_error(SYSTEM_ERROR, group,
- "The group was not found.");
- }
- else if (uoptr == 0) {
- report_error(SYSTEM_ERROR, user,
- "The user was not found.");
- }
- else {
- rv = nsadbRemUserFromGroup(NULL, padb, goptr, uoptr);
- if (rv)
- report_error(SYSTEM_ERROR, "Error taking out user",
- "An error occured trying to take "
- "the user out of the group.");
- }
-
- nsadbClose(padb, 0);
- }
- return rv;
-}
-
-/*
- * remgroupfromgroup - function to remove a group to a group
- * Return: Returns 0 if it works, something else if it fails.
- */
-NSAPI_PUBLIC int remgroupfromgroup(char *db_path, char *memgroup, char *group) {
- int rv;
- GroupObj_t *goptr;
- GroupObj_t *mem_goptr;
- void *padb;
-
- rv = nsadbOpen(NULL, db_path, 0, &padb);
- if (rv < 0) {
- report_error(SYSTEM_ERROR, "Failed To Open Database",
- "An error occurred while trying to remove "
- "a group from a group.");
- } else {
- /* See if the groups exist. */
- rv = nsadbFindByName(NULL, padb, group, AIF_GROUP, (void **)&goptr);
- rv = nsadbFindByName(NULL,
- padb, memgroup, AIF_GROUP, (void **)&mem_goptr);
- if (goptr == 0) {
- report_error(SYSTEM_ERROR, group,
- "The target group was not found.");
- }
- else if (mem_goptr == 0) {
- report_error(SYSTEM_ERROR, memgroup,
- "The group to remove was not found.");
- }
- else {
- rv = nsadbRemGroupFromGroup(NULL, padb, goptr, mem_goptr);
- }
-
- nsadbClose(padb, 0);
- }
- return rv;
-}
-
-/*
- * setpw - function to set the password for the specified user.
- * Return: Returns 0 if it works, something else if it fails.
- */
-NSAPI_PUBLIC int setpw(char *db_path, char *user, char *pwd) {
- int rv;
- UserObj_t *uoptr = 0;
- void *padb;
-
- rv = nsadbOpen(NULL, db_path, 0, &padb);
- if (rv < 0) {
- report_error(SYSTEM_ERROR, "Failed To Open Database",
- "An error occurred while trying to add "
- "the password to the database.");
- } else {
- /* See if the user already exists, if so, update it. */
- rv = nsadbFindByName(NULL, padb, user, AIF_USER, (void **)&uoptr);
- if (uoptr != 0) {
- uoptr->uo_pwd = (NTS_t)STRDUP(pw_enc(pwd));
- } else {
- /* User doesn't exist, so we've failed. */
- report_error(SYSTEM_ERROR, user,
- "Unable to change this user's password, "
- "user was not found in the database.");
- rv = 1;
- }
-
- if (uoptr) {
- rv = nsadbModifyUser(NULL, padb, uoptr);
- if (rv < 0)
- report_error(SYSTEM_ERROR, user,
- "A database error occurred while "
- "trying to change the user password.");
- }
- nsadbClose(padb, 0);
- }
- return rv;
-}
-
-/*
- * setdbpw - function to set the password on the special user
- * who's password is used as the database password.
- * If the password passed in is NULL, the user is
- * removed or not created.
- * If the password is not NULL, then the user will
- * be created if needed, and it's password set to
- * the one passed in.
- *
- * Return: Returns 0 if it works, something else if it fails.
- */
-NSAPI_PUBLIC int setdbpw(char *db_path, char *pwd)
-{
- int rv;
- UserObj_t *uoptr = 0;
- void *padb;
-
- rv = nsadbOpen(NULL, db_path, 0, &padb);
- if (rv < 0) {
- report_error(SYSTEM_ERROR, "Failed To Open Database",
- "An error occurred while trying to add "
- "the password to the database.");
- }
- /*
- * If NULL pwd, remove the user if it exists.
- */
- else if (pwd == NULL) {
- rv = nsadbRemoveUser(NULL, padb, DBPW_USER);
- nsadbClose(padb, 0);
-
- /*
- * If we get success(0) or a no such user error(NSAERRNAME)
- * we're happy.
- */
- if (rv != 0 && rv != NSAERRNAME) {
- report_error(SYSTEM_ERROR, "Remove Password Failed",
- "An error occurred while trying to remove "
- "the password for the database.");
- }
- } else {
- /* See if the user already exists, if so, just update it. */
- rv = nsadbFindByName(NULL, padb, DBPW_USER, AIF_USER, (void **)&uoptr);
- if (uoptr == 0) {
- /* User doesn't exist, so add it. */
- uoptr = userCreate((NTS_t)DBPW_USER, (NTS_t)pw_enc(pwd), (NTS_t)DBPW_USER);
- if (uoptr == 0) {
- report_error(SYSTEM_ERROR, "Failed To Update Database",
- "An error occurred while trying to add "
- "the password to the database.");
- rv = 1;
- }
- else {
- rv = nsadbCreateUser(NULL, padb, uoptr);
- }
- } else {
- uoptr->uo_pwd = (NTS_t)STRDUP(pw_enc(pwd));
- rv = nsadbModifyUser(NULL, padb, uoptr);
- }
-
- nsadbClose(padb, 0);
-
- if (uoptr) {
- if (rv < 0) {
- report_error(SYSTEM_ERROR, "Failed To Set Database Password",
- "An error occurred while trying to save "
- "the password in the database.");
- rv = 1;
- }
- userFree(uoptr);
- }
- }
- return rv;
-}
-
-/*
- * checkdbpw - Return TRUE if the password is correct, or database
- * doesn't have one, because the password user isn't there.
- * Return FALSE if required password is not correct.
- */
-NSAPI_PUBLIC int checkdbpw(char *db_path, char *pwd)
-{
- int rv;
- UserObj_t *uoptr = 0;
- void *padb;
- int fpwOK = 0;
-
- rv = nsadbOpen(NULL, db_path, 0, &padb);
- if (rv == 0) {
- rv = nsadbFindByName(NULL, padb, DBPW_USER, AIF_USER, (void **)&uoptr);
- if (uoptr == 0) {
- fpwOK = 1; /* Password userid isn't there, so none required. */
- } else {
- if (pwd == NULL)
- fpwOK = 0; /* PW user exists, no pw passed in, return false. */
- else {
- if (pw_cmp(pwd, (char *)uoptr->uo_pwd))
- fpwOK = 0; /* passwords are different, so return false. */
- else
- fpwOK = 1; /* passwords are the same, so return true. */
- }
- userFree(uoptr);
- }
- nsadbClose(padb, 0);
- }
- return fpwOK;
-}
-
-/*
- * Create a link to another CGI:
- * val - value text on the link
- * targ - name of the CGI to start
- * arg - argument to pass to the CGI
- */
-void output_cgi_link(char *val, char *trg, char *arg)
-{
- char line[BIG_LINE];
- sprintf(line, "%s?%s", trg, arg);
- printf("<a href=index?options+acss+%s target='options'>%s</a>",
- util_uri_escape(NULL, line), val);
-}
-
-/*
- * groupEnumCB - callback function from libaccess group enumerator
- */
-static int groupEnumCB (NSErr_t * errp,
- void * padb, void *parg, GroupObj_t *goptr)
-{
- if (goptr && goptr->go_name && strlen((char *)goptr->go_name))
- ulsAddToList(parg, goptr->go_gid, (char *)goptr->go_name);
-
- return 0; /* 0: continue enumeration */
-}
-
-/*
- * userEnumCB - callback function from libaccess group enumerator
- */
-static int userEnumCB (NSErr_t * errp,
- void * padb, void *parg, UserObj_t *uoptr)
-{
- if (uoptr && uoptr->uo_name && strlen((char *)uoptr->uo_name))
- ulsAddToList(parg, uoptr->uo_uid, (char *)uoptr->uo_name);
-
- return 0; /* 0: continue enumeration */
-}
-
-/*
- * idfound - horribly inefficient scan through the idlist table
- * returning true if the specified id is found, false
- * otherwise.
- */
-int idfound(int id, int *idlist, int count)
-{
- int i;
- for (i = 0; i < count; ++i) {
- if (id == idlist[i])
- return 1;
- }
- return 0;
-}
-
-void output_groups_user_is_in(char *db_path, char *user)
-{
- int rv;
- UserObj_t *uoptr = 0;
- GroupObj_t *goptr = 0;
- void *padb;
- USI_t *gidlist;
- int i;
- int id;
- char *group;
- char *gname;
- int groupCount;
- char line[BIG_LINE];
-
- rv = nsadbOpen(NULL, db_path, 0, &padb);
- if (rv < 0) {
- report_error(SYSTEM_ERROR, db_path,
- "Failed to open database while trying "
- "to list group membership.");
- } else {
- /* See if the user exists. */
- rv = nsadbFindByName(NULL, padb, user, AIF_USER, (void **)&uoptr);
- if (uoptr == 0) {
- /* User doesn't exist, so we've failed. */
- report_error(SYSTEM_ERROR, user,
- "Unable to find user when trying to "
- "list group membership.");
- rv = 1;
- } else {
- groupCount = UILCOUNT(&uoptr->uo_groups);
- if (groupCount > 0) {
- void *DirectlyInList;
- void *IndirectlyInList;
- ulsAlloc(&DirectlyInList);
- ulsAlloc(&IndirectlyInList);
-
- gidlist = UILLIST(&uoptr->uo_groups);
- for (i = 0; i < groupCount; ++i) {
- rv = nsadbIdToName(NULL,
- padb, gidlist[i], AIF_GROUP, &gname);
- if (rv >= 0) {
- rv = nsadbFindByName(NULL, padb, gname, AIF_GROUP,
- (void **)&goptr);
- }
- if (goptr != 0) {
- if (goptr->go_name && strlen((char *)goptr->go_name)) {
- if (idfound(uoptr->uo_uid,
- (int*)UILLIST(&goptr->go_users),
- UILCOUNT(&goptr->go_users))) {
- ulsAddToList(DirectlyInList, goptr->go_gid,
- (char *)goptr->go_name);
- }
- else {
- ulsAddToList(IndirectlyInList, goptr->go_gid,
- (char *)goptr->go_name);
- }
- }
- groupFree(goptr);
- goptr = 0;
- }
- }
- ulsSortName(DirectlyInList);
- ulsGetCount(DirectlyInList, &groupCount);
- for (i=0; i<groupCount; ++i) {
- group = NULL;
- ulsGetEntry(DirectlyInList, i, &id, &group);
- if (group) {
- printf("<tr><td>");
- printf("Member of <b>%s</b></td><td>", group);
- sprintf(line, "group=%s", group);
- output_cgi_link("Edit Group", "grped", line);
- printf("</td><td>");
- sprintf(line, "remfromgrp_but=1&memuser=%s&group=%s",
- user, group);
- output_cgi_link("Remove from Group", "grped", line);
- printf("</td>\n");
- }
- }
- ulsSortName(IndirectlyInList);
- ulsGetCount(IndirectlyInList, &groupCount);
- for (i=0; i<groupCount; ++i) {
- group = NULL;
- ulsGetEntry(IndirectlyInList, i, &id, &group);
- if (group) {
- printf("<tr><td>");
- printf("Indirect member of <b>%s</b></td><td>", group);
- sprintf(line, "group=%s", group);
- output_cgi_link("Edit Group", "grped", group);
- printf("</td><td>");
- sprintf(line, "addtogrp_but=1&memuser=%s&group=%s",
- user, group);
- output_cgi_link("Add to Group", "grped", line);
- printf("</td>\n");
- }
- }
- ulsFree(&DirectlyInList);
- ulsFree(&IndirectlyInList);
- }
- }
- }
- return;
-}
-
-/*
- * output a table with the groups the user isn't a member of
- */
-void output_nonmembership(char *db_path, char *user)
-{
- int rv;
- UserObj_t *uoptr = 0;
- void *padb;
- USI_t *gidlist;
- int i;
- int id;
- char *group;
- int groupCount;
- char line[BIG_LINE];
-
- rv = nsadbOpen(NULL, db_path, 0, &padb);
- if (rv < 0) {
- report_error(SYSTEM_ERROR, db_path,
- "Failed to open database while trying "
- "to list group membership.");
- } else {
- rv = nsadbFindByName(NULL, padb, user, AIF_USER, (void **)&uoptr);
- if (uoptr == 0) {
- report_error(SYSTEM_ERROR, user,
- "Unable to find user when trying to "
- "list group membership.");
- rv = 1;
- } else {
- void *sortList;
-
- ulsAlloc(&sortList);
- rv = nsadbEnumerateGroups(NULL, padb,
- (void *)sortList, groupEnumCB);
-
- ulsSortName(sortList);
- ulsGetCount(sortList, &groupCount);
-
- if (groupCount > 0) {
- gidlist = UILLIST(&uoptr->uo_groups);
- for (i=0; i<groupCount; ++i) {
- group = NULL;
- ulsGetEntry(sortList, i, &id, &group);
- if (group && !idfound(id, (int*)gidlist, UILCOUNT(&uoptr->uo_groups))){
- printf("<tr><td>");
- printf("Not a member of <b>%s</b></td><td>", group);
- sprintf(line, "group=%s", group);
- output_cgi_link("Edit Group", "grped", line);
- printf("</td><td>");
- sprintf(line, "addtogrp_but=1&memuser=%s&group=%s",
- user, group);
- output_cgi_link("Add to Group", "grped", line);
- printf("</td>\n");
- }
- }
- }
- ulsFree(&sortList);
- userFree(uoptr);
- }
- }
- return;
-}
-
-/*
- * output_group_membership - output a table showing which
- * groups a user is in.
- */
-void output_group_membership(char *db_path, char *user)
-{
- printf("<table border=1><caption align=left>\n");
- printf("<b>%s group membership:</b>", user);
- printf("</caption>\n");
- output_groups_user_is_in(db_path, user);
- output_nonmembership(db_path, user);
- printf("</table>\n");
-}
-
-void output_grpgroup_membership(char *db_path, char *group, char *filter)
-{
- int rv;
- GroupObj_t *goptr = 0;
- void *padb;
- USI_t *gidlist;
- int i;
- int id;
- char *gname;
- char *memgroup;
- int groupCount;
- char line[BIG_LINE];
-
- rv = nsadbOpen(NULL, db_path, 0, &padb);
- if (rv < 0) {
- report_error(SYSTEM_ERROR, db_path,
- "Failed to open database while trying "
- "to list group membership.");
- } else {
- /* See if the group exists. */
- rv = nsadbFindByName(NULL, padb, group, AIF_GROUP, (void **)&goptr);
- if (goptr == 0) {
- /* Group doesn't exist, so we've failed. */
- report_error(SYSTEM_ERROR, group,
- "Unable to find group when trying to "
- "list group membership.");
- rv = 1;
- } else {
- groupCount = UILCOUNT(&goptr->go_groups);
- if (groupCount > 0) {
- void *sortList;
- ulsAlloc(&sortList);
-
- printf("<table border=1><caption align=left>\n");
- printf("<b>%s has these group members:</b>", group);
- printf("</caption>\n");
- gidlist = UILLIST(&goptr->go_groups);
- for (i = 0; i < groupCount; ++i) {
- rv = nsadbIdToName(NULL,
- padb, gidlist[i], AIF_GROUP, &gname);
- if ((rv >= 0) && (gname != 0) && (strlen(gname) != 0)) {
- ulsAddToList(sortList, gidlist[i], gname);
- }
- }
- ulsSortName(sortList);
- ulsGetCount(sortList, &groupCount);
- for (i=0; i<groupCount; ++i) {
- memgroup = NULL;
- ulsGetEntry(sortList, i, &id, &memgroup);
- if (memgroup && passfilter(memgroup, filter)) {
- printf("<tr><td>");
- printf("<b>%s</b></td><td>", memgroup);
- sprintf(line, "group=%s", memgroup);
- output_cgi_link("Edit Group", "grped", line);
- printf("</td><td>");
- sprintf(line, "remfromgrp_but=1&memgroup=%s&group=%s",
- memgroup, group);
- output_cgi_link("Remove from Group", "grped", line);
- printf("</td>\n");
- }
- }
- printf("</table>\n");
- ulsFree(&sortList);
- } else {
- printf("<b>This group has no group members.</b>");
- }
- groupFree(goptr);
- }
- nsadbClose(padb, 0);
- }
- return;
-}
-
-/*
- * Output a table showing the user members of a group.
- */
-NSAPI_PUBLIC void output_user_membership(char *db_path, char *group, char *filter)
-{
- int rv;
- GroupObj_t *goptr = 0;
- void *padb;
- USI_t *uidlist;
- char *user;
- int i;
- int id;
- char *memuser;
- int userCount;
- char line[BIG_LINE];
-
- rv = nsadbOpen(NULL, db_path, 0, &padb);
- if (rv < 0) {
- report_error(SYSTEM_ERROR, db_path,
- "Failed to open database while trying "
- "to list user membership.");
- } else {
- /* See if the group exists. */
- rv = nsadbFindByName(NULL, padb, group, AIF_GROUP, (void **)&goptr);
- if (goptr == 0) {
- /* Group doesn't exist, so we've failed. */
- nsadbClose(padb, 0);
- report_error(SYSTEM_ERROR, group,
- "Unable to find group when trying to "
- "list user membership.");
- rv = 1;
- } else {
- userCount = UILCOUNT(&goptr->go_users);
- if (userCount > 0) {
- void *sortList;
- ulsAlloc(&sortList);
-
- printf("<table border=1><caption align=left>\n");
- printf("<b>%s has these user members:</b>", group);
- printf("</caption>\n");
- uidlist = UILLIST(&goptr->go_users);
- for (i = 0; i < userCount; ++i) {
- rv = nsadbIdToName(NULL,
- padb, uidlist[i], AIF_USER, &user);
- if ((rv >= 0) && (user != 0) && (strlen(user) != 0)) {
- ulsAddToList(sortList, uidlist[i], user);
- }
- }
- nsadbClose(padb, 0);
- ulsSortName(sortList);
- ulsGetCount(sortList, &userCount);
- for (i=0; i<userCount; ++i) {
- memuser = NULL;
- ulsGetEntry(sortList, i, &id, &memuser);
- if (memuser && passfilter(memuser, filter)) {
- printf("<tr><td>");
- printf("<b>%s</b></td><td>", memuser);
- sprintf(line, "user=%s", memuser);
- output_cgi_link("Edit User", "usred", line);
- printf("</td><td>");
- sprintf(line, "remfromgrp_but=1&memuser=%s&group=%s",
- memuser, group);
- output_cgi_link("Remove from Group", "grped", line);
- printf("</td>\n");
- }
- }
- printf("</table>\n");
- ulsFree(&sortList);
- } else {
- nsadbClose(padb, 0);
- printf("<b>This group has no user members.</b>");
- }
- }
- }
- return;
-}
-
-/*
- * Output a group showing all users.
- */
-NSAPI_PUBLIC int output_users_list(char *db_path, char *filter)
-{
- int rv;
- void *padb;
- int i;
- int id;
- char *user;
- int userCount;
- char line[BIG_LINE];
-
- rv = nsadbOpen(NULL, db_path, 0, &padb);
- if (rv < 0)
- report_error(SYSTEM_ERROR, db_path,
- "Failed to open database while trying "
- "to list users.");
- else {
- void *sortList;
-
- ulsAlloc(&sortList);
- rv = nsadbEnumerateUsers(NULL, padb, (void *)sortList, userEnumCB);
- nsadbClose(padb, 0);
- ulsSortName(sortList);
- ulsGetCount(sortList, &userCount);
-
- if (userCount > 0) {
-
- printf("<table border=1><caption align=left>\n");
- printf("<b>User List:</b>");
- printf("</caption>\n");
-
- for (i=0; i<userCount; ++i) {
- user = NULL;
- ulsGetEntry(sortList, i, &id, &user);
- if (user && passfilter(user, filter)) {
- printf("<tr><td>");
- printf("<b>%s</b></td><td>", user);
- sprintf(line, "user=%s", user);
- output_cgi_link("Edit User", "usred", line);
- printf("</td><td>\n");
- output_cgi_link("Remove User", "usrrem", line);
- printf("</td>\n");
- }
- }
- printf("</table>\n");
- } else {
- printf("<b>There are no users in the database.</b>");
- }
- ulsFree(&sortList);
- }
- return rv;
-}
-
-/*
- * Output a table showing all groups.
- */
-NSAPI_PUBLIC int output_groups_list(char *db_path, char *filter)
-{
- int rv;
- void *padb;
- int i;
- int id;
- char *group;
- int groupCount;
- char line[BIG_LINE];
-
- rv = nsadbOpen(NULL, db_path, 0, &padb);
- if (rv < 0)
- report_error(SYSTEM_ERROR, db_path,
- "Failed to open database while trying "
- "to list groups.");
- else {
- void *sortList;
-
- ulsAlloc(&sortList);
- rv = nsadbEnumerateGroups(NULL, padb, (void *)sortList, groupEnumCB);
- nsadbClose(padb, 0);
- ulsSortName(sortList);
- ulsGetCount(sortList, &groupCount);
-
- if (groupCount > 0) {
-
- printf("<table border=1><caption align=left>\n");
- printf("<b>Group List:</b>");
- printf("</caption>\n");
-
- for (i=0; i<groupCount; ++i) {
- group = NULL;
- ulsGetEntry(sortList, i, &id, &group);
- if ((group) && (passfilter(group, filter))) {
- printf("<tr><td>");
- printf("<b>%s</b></td><td>", group);
- sprintf(line, "group=%s", group);
- output_cgi_link("Edit Group", "grped", line);
- printf("</td><td>");
- output_cgi_link("Remove Group", "grprem", line);
- printf("</td>\n");
- }
- }
- printf("</table>\n");
- } else {
- printf("<b>There are no groups in the database.</b>");
- }
- ulsFree(&sortList);
- }
- return rv;
-}
-
-/* Helper function: Return a uls list of all the groups a user is in. MLM */
-void *_list_user_groups(void *padb, char *user, int group_users)
-{
- int rv;
- register int i;
- UserObj_t *uoptr = 0;
- GroupObj_t *ugoptr = 0;
- GroupObj_t *goptr = 0;
- void *userGroupList = NULL;
- int userGroupCount= 0;
- USI_t *gidlist;
- char *ugname = NULL;
-
- if(!group_users) {
- rv = nsadbFindByName(NULL, padb, user, AIF_USER, (void **)&uoptr);
- } else {
- rv = nsadbFindByName(NULL, padb, user, AIF_GROUP, (void **)&ugoptr);
- }
- if ((uoptr == 0) && (ugoptr == 0)) {
- /* User doesn't exist, so we've failed. */
- return NULL;
- } else {
- if(uoptr) {
- userGroupCount = UILCOUNT(&uoptr->uo_groups);
- } else {
- userGroupCount = UILCOUNT(&ugoptr->go_groups);
- }
- if (userGroupCount > 0) {
- ulsAlloc(&userGroupList);
- if(uoptr) {
- gidlist = UILLIST(&uoptr->uo_groups);
- } else {
- gidlist = UILLIST(&ugoptr->go_groups);
- }
-
- for (i = 0; i < userGroupCount; ++i) {
- rv = nsadbIdToName(NULL, padb,
- gidlist[i], AIF_GROUP, &ugname);
-
- if (rv >= 0) {
- rv = nsadbFindByName(NULL, padb, ugname, AIF_GROUP,
- (void **)&goptr);
- }
- if (goptr != 0) {
- if (goptr->go_name && strlen((char *)goptr->go_name)) {
- if(uoptr) {
- if (idfound(uoptr->uo_uid,
- (int*)UILLIST(&goptr->go_users),
- UILCOUNT(&goptr->go_users))) {
- ulsAddToList(userGroupList, goptr->go_gid,
- (char *)goptr->go_name);
- }
- } else {
- ulsAddToList(userGroupList, goptr->go_gid,
- (char *)goptr->go_name);
- }
- }
- groupFree(goptr);
- goptr = 0;
- }
- }
- }
- }
- return userGroupList;
-}
-
-/* Output a selector box, with name "name", and make it a multiple
- * selector box if multiple=1. */
-/* If user is non-null, then if it's a multiple selector, correctly highlight
- * the groups the user is in.
- * If group_user is 1, then the variable "user" refers to a *group* as
- * a member, rather than a user.
- * Highlight the item "highlight" regardless of membership (as long as
- * it's non-NULL.) MLM */
-NSAPI_PUBLIC void output_group_selector(char *db_path, int group_user,
- char *user,
- char *highlight, char *except,
- char *name, int none, int multiple)
-{
- int rv;
- void *padb;
- int i, j, isselected;
- int id;
- char *group;
- int groupCount;
- void *userGroupList = NULL;
- int userGroupCount= 0;
- char *ugname = NULL;
-
- rv = nsadbOpen(NULL, db_path, 0, &padb);
- if (rv < 0)
- report_error(SYSTEM_ERROR, db_path,
- "Failed to open database while trying "
- "to list groups.");
- else {
- void *sortList;
-
- ulsAlloc(&sortList);
- rv = nsadbEnumerateGroups(NULL, padb, (void *)sortList, groupEnumCB);
-
- if((multiple) && (user)) {
- userGroupList=_list_user_groups(padb, user, group_user);
- if(userGroupList) {
- ulsSortName(userGroupList);
- ulsGetCount(userGroupList, &userGroupCount);
- }
- }
- nsadbClose(padb, 0);
- ulsSortName(sortList);
- ulsGetCount(sortList, &groupCount);
-
- if (groupCount > 0) {
- /* Make a pulldown if we can. If the size is bigger than the
- * overflow value, make it a box to hack around the fact that
- * the X Navigator can't scroll pulldown lists. */
- if((multiple) || (groupCount > SELECT_OVERFLOW)) {
- printf("<SELECT size=5 name=%s %s>",
- name, multiple? "MULTIPLE" : "");
- } else {
- printf("<SELECT name=%s>", name);
- }
- if((!multiple) && (none)) {
- printf("<OPTION value=NONE>NONE\n");
- }
-
- for (i=0; i<groupCount; ++i) {
- group = NULL;
- ugname = NULL;
- isselected=0;
- ulsGetEntry(sortList, i, &id, &group);
- if (group) {
- if((except) && (!strcmp(group, except)))
- continue;
- if((highlight) && (!strcmp(group, highlight)))
- isselected=1;
- if(userGroupList && !isselected) {
- for(j=0; j < userGroupCount; j++) {
- ulsGetEntry(userGroupList, j, &id, &ugname);
-#if 0
- if(ugname[0] > group[0]) {
- /* Both lists are sorted, therefore, if we've
- * hit a letter that's after the group letter,
- * it must not be here. */
- /* What can I say, it's a pathetic attempt
- * on my part to mask the fact that I know
- * this is inefficient. */
- break;
- }
-#endif
- if(!strcmp(ugname, group)) {
- isselected=1;
- break;
- }
- }
- }
- printf("<OPTION %s>%s\n",
- isselected? "SELECTED" : "", group);
- }
- }
- printf("</SELECT>");
- } else {
- printf("<b>(No groups have been created.)</b>");
- }
- ulsFree(&sortList);
- if(userGroupList)
- ulsFree(&userGroupList);
- }
-}
-
-void *_list_group_users(void *padb, char *group, int group_users)
-{
- int rv;
- GroupObj_t *goptr = 0;
- USI_t *uidlist;
- char *user;
- int i;
- int userCount;
- void *sortList=NULL;
-
- /* See if the group exists. */
- rv = nsadbFindByName(NULL, padb, group, AIF_GROUP, (void **)&goptr);
- if (goptr == 0) {
- /* Group doesn't exist, so we've failed. */
- return NULL;
- } else {
- if(group_users)
- userCount = UILCOUNT(&goptr->go_groups);
- else
- userCount = UILCOUNT(&goptr->go_users);
-
- if (userCount > 0) {
- ulsAlloc(&sortList);
-
- if(group_users)
- uidlist = UILLIST(&goptr->go_groups);
- else
- uidlist = UILLIST(&goptr->go_users);
-
- for (i = 0; i < userCount; ++i) {
- if(group_users)
- rv = nsadbIdToName(NULL,padb, uidlist[i], AIF_GROUP, &user);
- else
- rv = nsadbIdToName(NULL, padb, uidlist[i], AIF_USER, &user);
- if ((rv >= 0) && (user != 0) && (strlen(user) != 0)) {
- ulsAddToList(sortList, uidlist[i], user);
- }
- }
- }
- }
- return sortList;
-}
-
-/*
- * Output a selector box of users. If group is non-null, highlight the
- * users in that group. MLM
- */
-NSAPI_PUBLIC void output_user_selector(char *db_path, char *group,
- char *highlight, char *except,
- char *name, int none, int multiple)
-{
- int rv;
- void *padb;
- int i, j, isselected;
- int id;
- char *user;
- int userCount;
- void *groupUserList = NULL;
- int groupUserCount= 0;
- char *guname = NULL;
-
- rv = nsadbOpen(NULL, db_path, 0, &padb);
- if (rv < 0)
- report_error(SYSTEM_ERROR, db_path,
- "Failed to open database while trying "
- "to list groups.");
- else {
- void *sortList;
-
- ulsAlloc(&sortList);
- rv = nsadbEnumerateUsers(NULL, padb, (void *)sortList, userEnumCB);
-
- if((multiple) && (group)) {
- groupUserList=_list_group_users(padb, group, 0);
- if(groupUserList) {
- ulsSortName(groupUserList);
- ulsGetCount(groupUserList, &groupUserCount);
- }
- }
- nsadbClose(padb, 0);
- ulsSortName(sortList);
- ulsGetCount(sortList, &userCount);
-
- if (userCount > 0) {
- /* Make a pulldown if we can. If the size is bigger than the
- * overflow value, make it a box to hack around the fact that
- * the X Navigator can't scroll pulldown lists. */
- if((multiple) || (userCount > SELECT_OVERFLOW)) {
- printf("<SELECT size=5 name=%s %s>",
- name, multiple? "MULTIPLE" : "");
- } else {
- printf("<SELECT name=%s>", name);
- }
- if((!multiple) && (none)) {
- printf("<OPTION value=NONE>NONE\n");
- }
-
- for (i=0; i<userCount; ++i) {
- user = NULL;
- guname = NULL;
- isselected=0;
- ulsGetEntry(sortList, i, &id, &user);
- if (user) {
- if((except) && (!strcmp(user, except)))
- continue;
- if((highlight) && (!strcmp(user, highlight)))
- isselected=1;
- if(groupUserList && !isselected) {
- for(j=0; j < groupUserCount; j++) {
- ulsGetEntry(groupUserList, j, &id, &guname);
-#if 0
- if(guname[0] > user[0]) {
- /* Both lists are sorted, therefore, if we've
- * hit a letter that's after the group letter,
- * it must not be here. */
- /* What can I say, it's a pathetic attempt
- * on my part to mask the fact that I know
- * this is inefficient. */
- break;
- }
-#endif
- if(!strcmp(guname, user)) {
- isselected=1;
- break;
- }
- }
- }
- printf("<OPTION %s>%s\n",
- isselected? "SELECTED" : "", user);
- }
- }
- printf("</SELECT>");
- } else {
- printf("<b>(No users have been created.)</b>");
- }
- ulsFree(&sortList);
- if(groupUserList)
- ulsFree(&groupUserList);
- }
-}
-
-
-int _item_in_list(char *item, char **list)
-{
- register int i;
- if(!list) return -1;
- for(i=0; list[i]; i++) {
- if(!strcmp(list[i], item))
- return i;
- }
- return -1;
-}
-
-/* Take a char ** null terminated list of group names, and change a user's
- * memberships so those are the only groups he's in. MLM */
-NSAPI_PUBLIC void change_user_membership(char *db_path, char *user,
- char **new_groups)
-{
- void *sortList;
- int rv;
- void *padb;
- UserObj_t *uoptr = NULL;
- GroupObj_t *goptr = NULL;
- int groupCount=0;
- register int i;
- int index;
- int id;
- char *group;
-
- rv = nsadbOpen(NULL, db_path, 0, &padb);
- if (rv < 0)
- report_error(SYSTEM_ERROR, db_path,
- "Failed to open database while trying "
- "to list groups.");
-
- sortList=_list_user_groups(padb, user, 0);
- if(sortList) {
- ulsSortName(sortList);
- ulsGetCount(sortList, &groupCount);
- }
-
- rv = nsadbFindByName(NULL, padb, user, AIF_USER, (void **)&uoptr);
- if (uoptr == 0) {
- report_error(INCORRECT_USAGE, user, "The user was not found.");
- }
-
- /* First check the groups he's already in. Remove any that no longer
- * appear in the list. */
- for(i=0; i<groupCount; ++i) {
- ulsGetEntry(sortList, i, &id, &group);
-
- if( (index=_item_in_list(group, new_groups)) == -1) {
- goptr=0;
- rv = nsadbFindByName(NULL, padb, group, AIF_GROUP, (void **)&goptr);
- if (goptr == 0) {
- report_error(INCORRECT_USAGE, group,
- "The group was not found.");
- }
- rv = nsadbRemUserFromGroup(NULL, padb, goptr, uoptr);
- } else {
- /* This group is in the list, so mark it as taken care of. */
- if(new_groups)
- new_groups[index][0]='\0';
- }
- }
- /* Add the user to any remaining groups. */
- if(new_groups) {
- for(i=0; new_groups[i]; i++) {
- if(new_groups[i][0] == '\0')
- continue;
- goptr=0;
- rv = nsadbFindByName(NULL, padb, new_groups[i],
- AIF_GROUP, (void **)&goptr);
- if (goptr == 0) {
- report_error(INCORRECT_USAGE, group,"The group was not found.");
- }
- rv = nsadbAddUserToGroup(NULL, padb, goptr, uoptr);
- }
- }
-
- nsadbClose(padb, 0);
-}
-
-/* Take a char ** null terminated list of user names, and change a group's
- * memberships so those are the only users it has. MLM */
-/* Again, if group_users is 1, then the new_users are assumed to be groups. */
-NSAPI_PUBLIC void change_group_membership(char *db_path, char *group,
- int group_users, char **new_users)
-{
- void *sortList;
- int rv;
- void *padb;
- UserObj_t *uoptr = NULL;
- GroupObj_t *goptr = NULL;
- GroupObj_t *ugoptr = NULL;
- int userCount=0;
- register int i;
- int index;
- int id;
- char *user;
-
- rv = nsadbOpen(NULL, db_path, 0, &padb);
- if (rv < 0)
- report_error(SYSTEM_ERROR, db_path,
- "Failed to open database while trying "
- "to list groups.");
-
- sortList=_list_group_users(padb, group, group_users);
- if(sortList) {
- ulsSortName(sortList);
- ulsGetCount(sortList, &userCount);
- }
-
- rv = nsadbFindByName(NULL, padb, group, AIF_GROUP, (void **)&goptr);
- if (goptr == 0) {
- report_error(INCORRECT_USAGE, group, "The group was not found.");
- }
-
- /* First check the users already there. Remove any that no longer
- * appear in the list. */
- for(i=0; i<userCount; ++i) {
- ulsGetEntry(sortList, i, &id, &user);
- if( (index=_item_in_list(user, new_users)) == -1) {
- if(group_users) {
- ugoptr=0;
- rv = nsadbFindByName(NULL, padb, user, AIF_GROUP,
- (void **)&ugoptr);
- if (ugoptr == 0) {
- report_error(INCORRECT_USAGE, user,
- "The group was not found.");
- }
- rv = nsadbRemGroupFromGroup(NULL, padb, goptr, ugoptr);
- } else {
- uoptr=0;
- rv = nsadbFindByName(NULL, padb, user, AIF_USER,
- (void **)&uoptr);
- if (uoptr == 0) {
- report_error(INCORRECT_USAGE, user,
- "The user was not found.");
- }
- rv = nsadbRemUserFromGroup(NULL, padb, goptr, uoptr);
- }
- } else {
- /* This user is in the list, so mark it as taken care of. */
- if(new_users)
- new_users[index][0]='\0';
- }
- }
- /* Add any remaining users. */
- if(new_users) {
- for(i=0; new_users[i]; i++) {
- if(new_users[i][0] == '\0')
- continue;
- if(group_users) {
- ugoptr=0;
- rv = nsadbFindByName(NULL, padb, new_users[i],
- AIF_GROUP, (void **)&ugoptr);
- if (ugoptr == 0) {
- report_error(INCORRECT_USAGE, new_users[i],
- "The group was not found.");
- }
- rv = nsadbAddGroupToGroup(NULL, padb, goptr, ugoptr);
- if(rv) report_error(SYSTEM_ERROR, new_users[i],
- "Unable to add group to group");
- } else {
- uoptr=0;
- rv = nsadbFindByName(NULL, padb, new_users[i],
- AIF_USER, (void **)&uoptr);
- if (uoptr == 0) {
- report_error(INCORRECT_USAGE, new_users[i],
- "The user was not found.");
- }
- rv = nsadbAddUserToGroup(NULL, padb, goptr, uoptr);
- if(rv) report_error(SYSTEM_ERROR, new_users[i],
- "Unable to add user to group");
- }
- }
- }
-
- nsadbClose(padb, 0);
-}
-
-/*
- * output a table with the groups that aren't members of the group
- */
-NSAPI_PUBLIC void output_nongrpgroup_membership(char *db_path, char *group, char *filter)
-{
- int rv;
- GroupObj_t *goptr = 0;
- void *padb;
- USI_t *gidlist;
- int i;
- int id;
- char *memgroup;
- int groupCount;
- char line[BIG_LINE];
-
- rv = nsadbOpen(NULL, db_path, 0, &padb);
- if (rv < 0) {
- report_error(SYSTEM_ERROR, db_path,
- "Failed to open database while trying "
- "to list group membership.");
- } else {
- rv = nsadbFindByName(NULL, padb, group, AIF_GROUP, (void **)&goptr);
- if (goptr == 0) {
- report_error(SYSTEM_ERROR, group,
- "Unable to find group when trying to "
- "list group membership.");
- rv = 1;
- nsadbClose(padb, 0);
- } else {
- void *sortList;
-
- printf("<table border=1><caption align=left>\n");
- printf("<b>These groups are not members of %s:</b>", group);
- printf("</caption>\n");
-
- ulsAlloc(&sortList);
- rv = nsadbEnumerateGroups(NULL,
- padb, (void *)sortList, groupEnumCB);
- nsadbClose(padb, 0);
- ulsSortName(sortList);
- ulsGetCount(sortList, &groupCount);
-
- if (groupCount > 0) {
- gidlist = UILLIST(&goptr->go_groups);
- for (i=0; i<groupCount; ++i) {
- memgroup = NULL;
- ulsGetEntry(sortList, i, &id, &memgroup);
- if ( memgroup &&
- strcmp(memgroup, group) &&
- !idfound(id, (int*)gidlist, UILCOUNT(&goptr->go_groups)) &&
- passfilter(memgroup, filter)) {
- printf("<tr>");
- printf("<td><b>%s</b></td><td>", memgroup);
- sprintf(line, "group=%s", memgroup);
- output_cgi_link("Edit Group", "grped", line);
- printf("</td><td>");
- sprintf(line, "addtogrp_but=1&memgroup=%s&group=%s",
- memgroup, group);
- output_cgi_link("Add to Group", "grped", line);
- printf("</td>\n");
- }
- }
- printf("</table>\n");
- }
- ulsFree(&sortList);
- groupFree(goptr);
- }
- }
- return;
-}
-
-/*
- * output a table with the users that aren't members of the group
- */
-NSAPI_PUBLIC void output_nonuser_membership(char *db_path, char *group, char *filter)
-{
- int rv;
- GroupObj_t *goptr = 0;
- void *padb;
- USI_t *gidlist;
- int i;
- int id;
- char *memuser;
- int userCount;
- char line[BIG_LINE];
-
- rv = nsadbOpen(NULL, db_path, 0, &padb);
- if (rv < 0) {
- report_error(SYSTEM_ERROR, db_path,
- "Failed to open database while trying "
- "to list group membership.");
- } else {
- rv = nsadbFindByName(NULL, padb, group, AIF_GROUP, (void **)&goptr);
- if (goptr == 0) {
- nsadbClose(padb, 0);
- report_error(SYSTEM_ERROR, group,
- "Unable to find group when trying to "
- "list user membership.");
- rv = 1;
- } else {
- void *sortList;
-
- printf("<table border=1><caption align=left>\n");
- printf("<b>These users are not members of %s:</b>", group);
- printf("</caption>\n");
-
- ulsAlloc(&sortList);
- rv = nsadbEnumerateUsers(NULL, padb, (void *)sortList, userEnumCB);
- nsadbClose(padb, 0);
-
- ulsSortName(sortList);
- ulsGetCount(sortList, &userCount);
-
- if (userCount > 0) {
- gidlist = UILLIST(&goptr->go_users);
- for (i=0; i<userCount; ++i) {
- memuser = NULL;
- ulsGetEntry(sortList, i, &id, &memuser);
- if ( memuser &&
- !idfound(id, (int*)gidlist, UILCOUNT(&goptr->go_users)) &&
- passfilter(memuser, filter)) {
- printf("<tr>");
- printf("<td><b>%s</b></td><td>", memuser);
- sprintf(line, "memuser=%s", memuser);
- output_cgi_link("Edit User", "usred", line);
- printf("</td><td>");
- sprintf(line, "addtogrp_but=1&memuser=%s&group=%s",
- memuser, group);
- output_cgi_link("Add to Group", "grped", line);
- printf("</td>\n");
- }
- }
- printf("</table>\n");
- }
- ulsFree(&sortList);
- groupFree(goptr);
- }
- }
- return;
-}
-
-NSAPI_PUBLIC char *get_acl_file()
-{
- char line[BIG_LINE];
- char *acl_file = get_mag_var("ACLFile");
- if (!acl_file) {
- sprintf(line, "%s%cgenerated.%s.acl",
- get_httpacl_dir(), FILE_PATHSEP, get_srvname(0));
- set_mag_var("ACLFile", line);
- acl_file = STRDUP(line);
- }
- if(!file_exists(acl_file)) {
- FILE *f;
- if(! (f=fopen(acl_file, "w")) )
- report_error(FILE_ERROR, acl_file, "Could not open file.");
- fclose(f);
- }
- return acl_file;
-}
-
-NSAPI_PUBLIC char *get_workacl_file()
-{
- char line[BIG_LINE];
- char *workacl_file;
- sprintf(line, "%s%cgenwork.%s.acl",
- get_httpacl_dir(), FILE_PATHSEP, get_srvname(0));
- workacl_file = STRDUP(line);
-
- if(!file_exists(workacl_file)) {
- FILE *f;
- char *current=get_acl_file();
- if(file_exists(current)) {
- cp_file(current, workacl_file, 0644);
- } else {
- if(! (f=fopen(workacl_file, "w")) )
- report_error(FILE_ERROR, workacl_file, "Could not open file.");
- fclose(f);
- }
- }
- return workacl_file;
-}
-
-/*
- * get_acl_info - Open the specified ACL file. Return a context
- * handle into it, the data it contains, and whether this is
- * a default allow or default deny resource.
- *
- * Returns: 0 if it works
- * AUTHDB_ACL_FAIL (-1) if it fails
- * AUTHDB_ACL_ODD_ACL (-2) if the ACL doesn't appear to be one
- * generated by the CGI.
- */
-NSAPI_PUBLIC int get_acl_info(char *acl_file, char *acl_name, void **pacl,
- char ***hosts, authInfo_t **authinfo,
- char ***users, char ***userhosts,
- int *fdefaultallow)
-{
- int rv = 0;
- char *acl_sig = NULL;
- ACContext_t *acl_con = NULL;
- ACL_t *acl;
-
- if (hosts)
- *hosts = NULL;
- if (authinfo)
- *authinfo = NULL;
- if (users)
- *users = NULL;
- if (userhosts)
- *userhosts = NULL;
- if (fdefaultallow)
- *fdefaultallow = 0;
-
- if ((rv = accReadFile(NULL, acl_file, &acl_con)))
- rv = AUTHDB_ACL_FAIL;
- else if (!(rv = aclFindByName(acl_con, acl_name, NULL, 0, &acl)))
- rv = AUTHDB_ACL_NOT_FOUND;
- else {
- /*
- * If we get the ACL open, get it's signiture to see if
- * it looks like one of ours. Each directive is identified
- * by a single character in the signiture string. The ones
- * we care about are:
- * 'a' - default allow
- * 'd' - default deny
- * 'r' - default authenticate
- *
- * The ACL used for default allow access has these directives:
- * default allow anyone at *; (required, shows up as an 'a')
- * default deny anyone at (hosts); (optional, shows up as a 'd')
- *
- * The ACL used for default deny access has these directives:
- * default deny anyone at *; (required, shows up as an 'd')
- * default allow anyone at (hosts); (optional, shows up as a 'a')
- * default authenticate... (optional, shows up as an 'r')
- * default allow (users) at (hosts); (optional, shows up as a 'a')
- *
- * Valid signitures are:
- * "a"
- * "ad"
- * "d"
- * "da"
- * "dra"
- * "dara"
- */
-
- if (acl)
- acl_sig = aclGetSignature(acl);
-
- if (acl_sig) {
- if (!strcmp(acl_sig, "a")) {
- if (fdefaultallow)
- *fdefaultallow = 1;
- rv = 0;
- }
- else if (!strcmp(acl_sig, "ad")) {
- if (fdefaultallow)
- *fdefaultallow = 1;
- if (hosts)
- *hosts = aclGetHosts(acl, 2, 1);
- rv = 0;
- }
- else if (!strcmp(acl_sig, "d")) {
- if (fdefaultallow)
- *fdefaultallow = 0;
- rv = 0;
- }
- else if (!strcmp(acl_sig, "da")) {
- if (fdefaultallow)
- *fdefaultallow = 0;
- if (hosts)
- *hosts = aclGetHosts(acl, 2, 1);
- rv = 0;
- }
- else if (!strcmp(acl_sig, "dra")) {
- if (fdefaultallow)
- *fdefaultallow = 0;
- if (authinfo) {
- char *p;
- *authinfo = (authInfo_t *)MALLOC(sizeof(authInfo_t));
- memset(*authinfo, 0, (sizeof(authInfo_t)));
- if ((p = aclGetAuthMethod(acl, 2)))
- (*authinfo)->type = strdup(p);
- if ((p = aclGetDatabase(acl, 2)))
- (*authinfo)->db_path = strdup(p);
- if ((p = aclGetPrompt(acl, 2)))
- (*authinfo)->prompt = strdup(p);
- }
- if (users)
- *users = aclGetUsers(acl, 3, 1);
- if (userhosts)
- *userhosts = aclGetHosts(acl, 3, 1);
- rv = 0;
- }
- else if (!strcmp(acl_sig, "dara")) {
- if (fdefaultallow)
- *fdefaultallow = 0;
- if (hosts)
- *hosts = aclGetHosts(acl, 2, 1);
- if (authinfo) {
- char *p;
- *authinfo = (authInfo_t *)MALLOC(sizeof(authInfo_t));
- memset(*authinfo, 0, (sizeof(authInfo_t)));
- if ((p = aclGetAuthMethod(acl, 3)))
- (*authinfo)->type = strdup(p);
- if ((p = aclGetDatabase(acl, 3)))
- (*authinfo)->db_path = strdup(p);
- if ((p = aclGetPrompt(acl, 3)))
- (*authinfo)->prompt = strdup(p);
- }
- if (users)
- *users = aclGetUsers(acl, 4, 1);
- if (userhosts)
- *userhosts = aclGetHosts(acl, 4, 1);
- rv = 0;
- }
- else
- rv = AUTHDB_ACL_ODD_ACL;
- }
- if (pacl)
- *pacl = (void *)acl_con;
- }
- return rv;
-}
-
-
-static void add_acl_rights(ACContext_t *acc)
-{
- int rv;
- char **p;
- for (p = acl_read_rights; *p; ++p) {
- rv = aclRightDef(NULL, acc, *p, NULL);
- }
- for (p = acl_write_rights; *p; ++p) {
- rv = aclRightDef(NULL, acc, *p, NULL);
- }
-}
-
-/*
- * delete_acl_by_name - remove a specified acl.
- *
- * Return: 0 if it deletes an ACL. Otherwise something else.
- *
- */
-NSAPI_PUBLIC int delete_acl_by_name(char *acl_file, char *acl_name)
-{
- int rv = 1;
- ACContext_t *acl_con = NULL;
- ACL_t *acl = NULL;
-
- if (acl_file && acl_name)
- {
- rv = accReadFile(NULL, acl_file, &acl_con);
-
- if (!rv) {
- rv = aclFindByName(acl_con, acl_name, NULL, 0, &acl);
- if (rv == 1 && acl) {
- aclDelete(acl);
- rv = accWriteFile(acl_con, acl_file, 0);
- set_commit(0, 1);
- }
- }
- }
- return rv;
-}
-
-/*
- * set_acl_info - Replaces the specified ACL with the information
- * provided. The fdefaultallow is tells us whether
- * to generate a default allow everyone type ACL, or
- * a default deny everyone type ACL.
- *
- * If opening the ACL file fails with a file open
- * type error, it is assumed to not exist, and a
- * new one is created.
- *
- * Returns: 0 if it works
- * AUTHDB_ACL_FAIL if it fails
- */
-NSAPI_PUBLIC int set_acl_info(char *acl_file, char *acl_name, int prefix,
- void **pacl, char **rights,
- char **hosts, authInfo_t *authinfo,
- char **users, char **userhosts,
- int fdefaultallow)
-{
- int rv = AUTHDB_ACL_FAIL;
- ACContext_t *acl_con = NULL;
- ACL_t *acl = NULL;
- int amethod = AUTH_METHOD_BASIC;
- char *db_path = NULL;
- char *prompt = NULL;
-
- /*
- * Digest parms
- */
- if (authinfo) {
- if (!strcmp(authinfo->type, "SSL"))
- amethod = AUTH_METHOD_SSL;
- else
- amethod = AUTH_METHOD_BASIC;
- db_path = authinfo->db_path;
- prompt = authinfo->prompt;
- }
-
- if (prefix)
- prefix = ACLF_NPREFIX;
- else
- prefix = 0;
-
- /*
- * Open the specified ACL file, destroy the existing ACL with
- * the specified name if it exists, and then write the new
- * stuff back out.
- */
- if (acl_file && acl_name)
- {
- (void)delete_acl_by_name(acl_file, acl_name);
- rv = accReadFile(NULL, acl_file, &acl_con);
-
- /*
- * If the file isn't there, create an empty context.
- */
- if (rv == ACLERROPEN)
- rv = accCreate(0, 0, &acl_con);
-
- if (rv)
- rv = AUTHDB_ACL_FAIL;
- else {
- (void)add_acl_rights(acl_con);
-
- if (aclMakeNew(acl_con, "", acl_name,
- rights, prefix, &acl)) {
- rv = AUTHDB_ACL_FAIL;
- }
- else if (aclPutAllowDeny(
- NULL, acl, 0, fdefaultallow, NULL, NULL)) {
- rv = AUTHDB_ACL_FAIL;
- }
- else if (hosts &&
- (rv = aclPutAllowDeny(
- NULL, acl, 0, !fdefaultallow, NULL, hosts))) {
-
- rv = AUTHDB_ACL_FAIL;
- }
- else if (users && authinfo &&
- ((rv = aclPutAuth(NULL, acl, 0, amethod, db_path, prompt))||
- (rv = aclPutAllowDeny(NULL, acl, 0, !fdefaultallow,
- users, userhosts)))) {
-
- rv = AUTHDB_ACL_FAIL;
- }
- else {
- if (accWriteFile(acl_con, acl_file, 0)) {
- rv = AUTHDB_ACL_FAIL;
- }
- else {
- set_commit(0, 1);
- rv = 0;
- if (pacl)
- *pacl = (void *)acl;
- }
- }
- }
- }
- return rv;
-}
-
-/*
- * get_acl_names - Passes back the names of the read and write
- * ACLs for the current resource.
- * The directive parm is usually "acl", but is
- * also used to find stashed items under names
- * like "acl-disabled".
- * Returns 0 if no other ACLs are found, 1 if an ACL that
- * doesn't match the type of name we generate.
- */
-NSAPI_PUBLIC int get_acl_names(char **readaclname, char **writeaclname, char *directive)
-{
- pblock **pbs;
- char *aclname;
- int fother_acls = 0;
- char **config = get_adm_config();
- char *curres = get_current_resource(config);
- int rtype = get_current_restype(config);
- int i;
-
- *readaclname = NULL;
- *writeaclname = NULL;
-
- pbs = list_pblocks(rtype, curres, "PathCheck", CHECK_ACL_FN);
-
- if (pbs) {
- for (i=0; pbs[i]; ++i) {
- aclname = pblock_findval(directive, pbs[i]);
- if (is_readacl(aclname))
- *readaclname = strdup(aclname);
- else if (is_writeacl(aclname))
- *writeaclname = strdup(aclname);
- else
- fother_acls = 1;
- }
- }
- return fother_acls;
-}
-
-NSAPI_PUBLIC int is_readacl(char *name) {
- if (name)
- return strstr(name, ACLNAME_READ_COOKIE)?1:0;
- else
- return 0;
-}
-
-NSAPI_PUBLIC int is_writeacl(char *name) {
- if (name)
- return strstr(name, ACLNAME_WRITE_COOKIE)?1:0;
- else
- return 0;
-}
-
-NSAPI_PUBLIC int admin_is_ipaddr(char *p)
-{
- int i;
- int num_found = 0;
-
- if (!p || !p[0])
- return 0; /* NULL isn't an IP Address */
- else {
- for (i=0; p[i]; ++i) {
- if (isalpha(p[i]))
- return 0; /* If it has an alpha character, it's not IP addr */
- else if (isdigit(p[i])) {
- num_found = 1;
- }
- }
- }
- /*
- * Well, hard to say what it is, but if there's at least a number
- * in it, and the ip number checker can parse it, we'll call it
- * an IP address;
- */
- if (num_found && get_ip_and_mask(p))
- return 1;
- else
- return 0;
-}
-
-/*
- * Get the hostnames and ipaddrs strings from the single hosts array
- * of string pointers.
- */
-NSAPI_PUBLIC void get_hostnames_and_ipaddrs(char **hosts, char **hostnames, char **ipaddrs)
-{
- char *p;
- int nbipaddrs = 0;
- int nbhostnames = 0;
- int i;
- if (hosts && hostnames && ipaddrs) {
- *hostnames = NULL;
- *ipaddrs = NULL;
- /*
- * Make two passes, once to total the size needed for
- * the hosts and ipaddrs string, then alloc them and
- * strcat the strings in.
- */
- for(i=0, p=hosts[i]; p; p=hosts[++i]) {
- if (admin_is_ipaddr(p))
- nbipaddrs += strlen(p) + 2; /* Teminator and "," */
- else
- nbhostnames += strlen(p) + 2;
- }
-
- if (nbhostnames) {
- *hostnames = (char *)MALLOC(nbhostnames + 1);
- memset(*hostnames, 0, nbhostnames);
- }
- if (nbipaddrs) {
- *ipaddrs = (char *)MALLOC(nbipaddrs + 1);
- memset(*ipaddrs, 0, nbipaddrs);
- }
-
- /*
- * We've got the space, now go look at each, strcat it
- * into the correct string, prefixed with a "," for all
- * but the first.
- */
- for(i=0, p=hosts[i]; p; p=hosts[++i]) {
- if (admin_is_ipaddr(p)) {
- if (strlen(*ipaddrs))
- strcat(*ipaddrs, ",");
- strcat(*ipaddrs, p);
- }
- else {
- if (strlen(*hostnames))
- strcat(*hostnames, ",");
- strcat(*hostnames, p);
- }
- }
- }
- return;
-}
-
-/*
- * Get the usernames and groups strings from the single users array
- * of string pointers.
- */
-NSAPI_PUBLIC void get_users_and_groups(char **users, char **usernames, char **groups,
- char *db_path)
-{
- char *p;
- int nbusernames = 0;
- int nbgroups = 0;
- int i;
- int is_user = 0;
- int is_group = 0;
-
- if (users && usernames && groups) {
- *usernames = NULL;
- *groups = NULL;
- /*
- * Make two passes, once to total the size needed for
- * the strings, then alloc them and strcat the strings in.
- */
- for(i=0, p=users[i]; p; p=users[++i]) {
- is_user = 0;
- is_group = 0;
- groupOrUser(db_path, p, &is_user, &is_group);
-
- /* Enclose user/group name in quotes if necessary */
- p = aclSafeIdent(p);
-
- if (is_user)
- nbusernames += strlen(p) + 2; /* Teminator and "," */
- else if (is_group)
- nbgroups += strlen(p) + 2;
- }
-
- if (nbusernames) {
- *usernames = (char *)MALLOC(nbusernames + 1);
- memset(*usernames, 0, nbusernames);
- }
- if (nbgroups) {
- *groups = (char *)MALLOC(nbgroups + 1);
- memset(*groups, 0, nbgroups);
- }
-
- /*
- * We've got the space, now go look at each, strcat it
- * into the correct string, prefixed with a "," for all
- * but the first.
- */
- for(i=0, p=users[i]; p; p=users[++i]) {
- is_user = 0;
- is_group = 0;
- groupOrUser(db_path, p, &is_user, &is_group);
-
- /* Enclose user/group name in quotes if necessary */
- p = aclSafeIdent(p);
-
- if (is_user) {
- if (strlen(*usernames))
- strcat(*usernames, ",");
- strcat(*usernames, p);
- }
- else if (is_group) {
- if (strlen(*groups))
- strcat(*groups, ",");
- strcat(*groups, p);
- }
- }
- }
- return;
-}
-
-/*
- * Load from host and IP Addr strings into the array of
- * pointers to strings.
- */
-NSAPI_PUBLIC void load_host_array(char ***hosts, char *hostnames, char *ipaddrs)
-{
- char *tok;
- int nMax = 20;
- int nCur = 0;
- char **hostarr;
- char *valid_ip;
-
- if (hosts) {
- hostarr = new_strlist(nMax);
- hostarr[0] = NULL;
- if (hostnames) {
- for (tok = strtok(hostnames, ",");
- tok;
- tok = strtok(NULL, ","))
- {
- if (!(nCur < nMax)) {
- nMax += 20;
- hostarr = grow_strlist(hostarr, nMax);
- }
- hostarr[nCur] = strdup(tok);
- hostarr[++nCur] = NULL;
- }
- }
- if (ipaddrs) {
- for (tok = strtok(ipaddrs, ",");
- tok;
- tok = strtok(NULL, ","))
- {
- if (!(nCur < nMax)) {
- nMax += 20;
- hostarr = grow_strlist(hostarr, nMax);
- }
- valid_ip = get_ip_and_mask(tok);
- if (valid_ip) {
- hostarr[nCur] = strdup(valid_ip);
- hostarr[++nCur] = NULL;
- }
- }
- }
- *hosts = hostarr;
- }
-
- return;
-}
-
-void load_users_array(char ***users, char *usernames, char *groups)
-{
- char *tok;
- int nMax = 20;
- int nCur = 0;
- char **userarr;
-
- if (users) {
- userarr = new_strlist(nMax);
- userarr[0] = NULL;
- if (usernames) {
- for (tok = strtok(usernames, ",");
- tok;
- tok = strtok(NULL, ","))
- {
- if (!(nCur < nMax)) {
- nMax += 20;
- userarr = grow_strlist(userarr, nMax);
- }
- userarr[nCur] = strdup(tok);
- userarr[++nCur] = NULL;
- }
- }
- if (groups) {
- for (tok = strtok(groups, ",");
- tok;
- tok = strtok(NULL, ","))
- {
- if (!(nCur < nMax)) {
- nMax += 20;
- userarr = grow_strlist(userarr, nMax);
- }
- userarr[nCur] = strdup(tok);
- userarr[++nCur] = NULL;
- }
- }
- *users = userarr;
- }
-
- return;
-}
-
-/* Removes enclosing double quotes from a string (in place) */
-NSAPI_PUBLIC char * str_unquote(char * str)
-{
- if (str) {
- if (str[0] == '"') {
- int len = strlen(str);
-
- if (str[len-1] == '"') {
- str[len-1] = 0;
- ++str;
- }
- }
- }
-
- return str;
-}
diff --git a/lib/libadmin/error.c b/lib/libadmin/error.c
index a4f87842..2c3d740c 100644
--- a/lib/libadmin/error.c
+++ b/lib/libadmin/error.c
@@ -10,9 +10,6 @@
*/
#include "libadmin/libadmin.h"
-#if 0
-#include "cgiutils/cgi-util.h"
-#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -20,6 +17,7 @@
#include <windows.h>
#include "base/nterr.h"
#endif
+#include <base/file.h>
#define ERROR_HTML "error.html"
@@ -57,7 +55,7 @@ void _report_error(int type, char *info, char *details, int shouldexit)
/* Be sure headers are terminated. */
fputs("\n", stdout);
- fprintf(stdout, "<SCRIPT LANGUAGE=\"%s\">", MOCHA_NAME);
+ fprintf(stdout, "<SCRIPT LANGUAGE=\"JavaScript\">");
output_alert(type, info, details, 0);
if(shouldexit) {
fprintf(stdout, "if(history.length>1) history.back();");
diff --git a/lib/libadmin/template.c b/lib/libadmin/template.c
index a689d3b5..71e576cb 100644
--- a/lib/libadmin/template.c
+++ b/lib/libadmin/template.c
@@ -12,560 +12,13 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include "template.h"
#include "libadmin/libadmin.h"
-#include "libadmin/dbtlibadmin.h"
-#include "base/util.h"
-
-/* If you add something to this structure, don't forget to document it
- * in templates.h, and increase MAXTEMPLATE!
- *
- * Also, save yourself a lot of grief and put a space after the name.
- */
-
-static struct template_s templates[MAXTEMPLATE] = {
- {"IF ", "FUNC conditional"},
- {"ELSE ", "FUNC conditional"},
- {"ENDIF ", "FUNC conditional"},
- {"TITLE ", "<HTML><HEAD><TITLE>%s</TITLE></HEAD>\n"
- "<BODY bgcolor=\"#C0C0C0\" link=\"#0000EE\" "
- "vlink=\"#551A8B\" alink=\"#FF0000\" %s>\n"},
- {"PAGEHEADER ", "FUNC pageheader"},
- {"DOCSWITCHER ", ""},
- {"COPYRIGHT ", ""},
- {"RESOURCEPICKER ", "FUNC respicker"},
- {"BOOKTRACK ", "FUNC booktrack"},
- {"BEGININFO ", "<table border=2 width=100%% cellpadding=2>\n"
- "<tr><td align=center colspan=2>"
- "<b><FONT size=+1>%s</FONT></b></td></tr>"
-#if 0
- "<tr><td>"
- "<IMG src=\"../icons/b-open.gif\" hspace=8 alt=\"*\""
- "height=26 width=55></td>"
- "<td>\n"},
-#endif
- "<td colspan=2>\n"},
- {"ADDINFO ", "</td></tr><tr><td colspan=2>"},
- {"ENDINFO ", "</td></tr></table>\n<hr width=10%%>\n"},
- {"SUBMIT ", "FUNC submit\n"},
- {"DOCUMENTROOT ", "FUNC docroot"},
- {"BEGINELEM ", "<pre>"},
-/* {"ELEM ", "<hr width=100%%><b>%s</b>"}, */
- {"ELEM ", "\n<b>%s</b>"},
-/* {"ENDELEM ", "<hr width=100%%></pre>\n"}, */
- {"ENDELEM ", "</pre>\n"},
- {"ELEMADD ", "<b>%s</b>"},
-/* {"ELEMDIV ", "<hr width=100%%>"}, */
- {"ELEMDIV ", "\n"},
- {"REFERER ", "FUNC link_referer"},
- {"INDEX ", "<a href=\"index\">%s</a>\n"},
- {"SERVERROOT ", "FUNC serverroot"},
- {"RESTART ", "<a href=\"pcontrol\">%s</a>\n"},
- {"ACCESS ", "FUNC makeurl"},
- {"COMMIT ", "<a href=\"commit?commit\">%s</a>\n"},
- {"BACKOUT ", "<center>If you don't want to %s, you can <a href=index>"
- "return to the server manager.</a></center>\n"},
- {"CURSERVNAME", "FUNC curservname"},
- {"VERIFY ", "FUNC verify"},
- {"HELPBUTTON", "FUNC helpbutton"},
- {"DIALOGSUBMIT", "FUNC dialogsubmit"},
- {"HELPJSFN", "FUNC helpjsfn"}
-};
-
-int get_directive(char *string);
-void conditional(char *input, char **vars, int index);
-void respicker(char **config);
-void currentres(char **config);
-void prevres(char **config);
-void booktrack(char *input, char **vars);
-void docswitcher(char *input);
-void docroot(char **vars);
-void link_referer(char **input, char **vars);
-void serverroot(char **vars);
-char **get_vars(char *string);
-static void output(char *string);
-void makeurl(char **vars);
-void curservname(void);
-void pageheader(char **vars, char **config);
-void submit(int verify, char **vars);
-void helpbutton(char *topic);
-void dialogsubmit(char *topic);
-
-static int status = -1;
-
-/* Filter a page. Takes the page to filter as an argument. Uses above
- * filters to process.
- */
-NSAPI_PUBLIC int parse_line(char *line_input, char **input)
-{
- register int index;
- char *position;
- int dirlen = strlen(DIRECTIVE_START);
- char **vars;
-
-
- if(!strncmp(line_input, DIRECTIVE_START, dirlen)) {
- position = (char *) (line_input + dirlen);
- index = get_directive(position);
-
- /* did we get one? */
- if(index != -1) {
- /* if so, get the vars. */
- position += strlen(templates[index].name);
- vars = get_vars(position);
- /* Dispatch the correct function (done for readability,
- * although I'm starting to wonder if I should bother)
- */
- if(!strncmp(templates[index].format, "FUNC ", 5)) {
-
- if(!strncmp(templates[index].format+5, "conditional", 11))
- conditional(input[0], vars, index);
- else if(!strncmp(templates[index].format+5, "respicker", 9))
- respicker(input);
- else if(!strncmp(templates[index].format+5, "booktrack", 9))
- booktrack(input[0], vars);
- else if(!strncmp(templates[index].format+5, "docswitcher", 11))
- docswitcher(input[0]);
- else if(!strncmp(templates[index].format+5, "docroot", 7))
- docroot(vars);
- else if(!strncmp(templates[index].format+5, "link_referer",12))
- link_referer(input, vars);
- else if(!strncmp(templates[index].format+5, "serverroot",10))
- serverroot(vars);
- else if(!strncmp(templates[index].format+5, "makeurl",7))
- makeurl(vars);
- else if(!strncmp(templates[index].format+5, "curservname",11))
- curservname();
- else if(!strncmp(templates[index].format+5, "pageheader",10))
- pageheader(vars, input);
- else if(!strncmp(templates[index].format+5, "submit",6))
- submit(0, vars);
- else if(!strncmp(templates[index].format+5, "verify",6))
- submit(1, vars);
- else if(!strncmp(templates[index].format+5, "helpbutton",10))
- helpbutton(vars[0]);
- else if(!strncmp(templates[index].format+5, "dialogsubmit",12))
- dialogsubmit(vars[0]);
- /* We don't know what this template is. Send it back. */
- else return -1;
- } else {
- /* I just can't believe there's no easy way to create
- * a va_list. */
- char line[BIG_LINE];
- sprintf(line, templates[index].format,
- (vars[0] != NULL) ? vars[0]: "",
- (vars[1] != NULL) ? vars[1]: "",
- (vars[2] != NULL) ? vars[2]: "",
- (vars[3] != NULL) ? vars[3]: "");
- output(line);
- }
- } else {
- /* We found a directive, but we can't identify it. Send it back.*/
- /* Check status first; if we're not supposed to be outputing */
- /* because of an "IF" block, don't tell the program to */
- /* try and cope with it. */
- if(status)
- return -1;
- else
- return 0;
- }
- } else
- /* We found no directive. The line is normal. */
- output(line_input);
-
- /* If we're here, we either handled it correctly or the line was benign.*/
- return 0;
-}
-
-void conditional(char *input, char **vars, int index)
-{
- if((!strncmp(templates[index].name, "IF", 2)) &&
- (vars[0] != NULL)) {
- status = input[atoi(vars[0])] - '0';
- } else
- if((!strncmp(templates[index].name, "ELSE", 4)) &&
- (status != -1)) {
- status ^= 1;
- } else
- if(!strncmp(templates[index].name, "ENDIF", 5))
- status = -1;
-}
-
-void respicker(char **config)
-{
- output("<FORM action=rsrcpckr method=GET>\n");
- output("<hr size=4><center>\n");
- prevres(config);
- output("</center><hr size=4>\n");
- output("</FORM>\n");
-}
-
-void currentres(char **config)
-{
- int l;
- char line[BIG_LINE];
- char *resname, *restype;
-
- resname = get_current_resource(config);
- restype = get_current_typestr(config);
- if(!strcmp(restype, NAME)) {
- if(!strcmp(resname, "default"))
- sprintf(line, "<font size=+1>Modifying: "
- "<b>the entire server</b>.</font>");
- else
- sprintf(line, "<font size=+1>Modifying: "
- "<b>the object named %s</b>.</font>", resname);
- }
- else if(!strcmp(restype, FILE_OR_DIR)) {
- l = strlen(resname) - 1;
- if(resname[l] == '*') {
- sprintf(line, "<font size=+1>Modifying: <b>the directory "
- "%s</b></font>",
- resname);
- } else {
- sprintf(line, "<font size=+1>Modifying: <b>%s %s</b></font>",
- (strchr(resname, '*')) ? "files matching" : "the file",
- resname);
- }
- }
- else if(!strcmp(restype, TEMPLATE)) {
- sprintf(line, "<font size=+1>Modifying: <b>the template %s</b></font>",
- resname);
- }
- else if(!strcmp(restype, WILDCARD)) {
-#ifdef MCC_PROXY
- sprintf(line, "<font size=+1>Modifying: <b>URLs matching RE %s"
-#else
- sprintf(line, "<font size=+1>Modifying: <b>files matching %s"
-#endif
- "</b></font>",
- resname);
- }
- output(line);
-}
-
-void prevres(char **config)
-{
-#ifndef MCC_NEWS
- char *res = get_current_resource(config);
- int rtype = get_current_restype(config);
-
- if(status) {
- char **options = NULL;
- register int x=0;
- int found=0;
- int option_cnt = total_object_count();
-
- fprintf(stdout, "<SCRIPT language=JavaScript>\n");
- fprintf(stdout, "function checkForClick() {\n");
- fprintf(stdout, " document.forms[0].resource.blur();\n");
- fprintf(stdout, " var idx=document.forms[0]."
- "resource.options.selectedIndex;\n");
- fprintf(stdout, " if(document.forms[0].resource."
- "options[idx].defaultSelected == 0) {\n");
- fprintf(stdout, " document.forms[0].submit();\n");
- fprintf(stdout, " return 1;\n");
- fprintf(stdout, " } else return 0;\n");
- fprintf(stdout, "}\n");
- fprintf(stdout, "</SCRIPT>\n");
-
-#ifdef MCC_PROXY
- fprintf(stdout, "<TABLE BORDER=0>\n");
- fprintf(stdout, "<TR><TD><font size=+1>Editing:</font></TD>\n");
- fprintf(stdout,
- "<TD><SELECT name=\"resource\" onChange=\"checkForClick()\" SIZE=\"%d\">\n",
- option_cnt <= 20 ? 1 : 5);
-#else
- output("<nobr>");
- fputs("<font size=+1>Editing:</font>\n", stdout);
- fprintf(stdout, "<SELECT name=\"resource\" "
- "onChange=\"checkForClick()\" %s>\n",
- option_cnt <=20 ? "" : "size=5");
-#endif
-
-#ifdef MCC_HTTPD /* template->styles nightmare */
- if((rtype==PB_NAME) && (strcmp(res, "default"))) {
- /* enter: STYLES MODE */
- fprintf(stdout, "<OPTION value=ndefault>Exit styles mode\n");
- } else {
- fprintf(stdout, "<OPTION value=ndefault %s>The entire server\n",
- (!strcmp(res, "default")) ? "SELECTED" : "");
- }
-#else
- fprintf(stdout, "<OPTION value=ndefault %s>The entire server\n",
- (!strcmp(res, "default")) ? "SELECTED" : "");
-#endif
- if(!strcmp(res, "default")) found=1;
- options = list_objects(PB_PATH);
-#ifdef MCC_HTTPD /* template->styles nightmare */
- if((options) && !((rtype==PB_NAME) && (strcmp(res, "default"))) ) {
-#else
- if(options) {
-#endif
- for(x=0; options[x]; x++) {
- fprintf(stdout, "<OPTION value=f%s %s>%s\n",
- options[x],
- (!strcmp(options[x], res)) ? "SELECTED" : "",
- options[x]);
- if(!strcmp(options[x], res)) found=1;
- }
- }
- options=list_objects(PB_NAME);
-#ifdef MCC_HTTPD /* template->styles nightmare */
- if((options) && ((rtype==PB_NAME) && (strcmp(res, "default"))) ) {
-#else
- if(options) {
-#endif
- for(x=0; options[x]; x++) {
- if(!strcmp(options[x], "default") ||
- !strcmp(options[x], "cgi"))
- continue;
-#ifdef MCC_HTTPD /* template->style usability */
- fprintf(stdout, "<OPTION value=n%s %s>The style '%s'\n",
- options[x],
- (!strcmp(options[x], res)) ? "SELECTED":"",
- options[x]);
-#else
- fprintf(stdout, "<OPTION value=n%s %s>The template '%s'\n",
- options[x],
- (!strcmp(options[x], res)) ? "SELECTED":"",
- options[x]);
-#endif
- if(!strcmp(options[x], res)) found=1;
- }
- }
- if(!found) {
- if(rtype==PB_NAME) {
- fprintf(stdout, "<OPTION value=n%s SELECTED>The template %s\n",
- res, res);
- } else {
- fprintf(stdout, "<OPTION value=f%s SELECTED>%s\n",
- res, res);
- }
- }
- fputs("</SELECT></nobr>\n", stdout);
- fputs("<nobr>", stdout);
-#ifndef MCC_PROXY
- fprintf(stdout, "<INPUT type=button value=\"Browse...\" "
- "onClick=\"window.location='rsrcpckr?b'\"> ");
-#endif
-#ifdef MCC_PROXY
- fprintf(stdout, "</TD>\n<TD>");
- fprintf(stdout, "<INPUT type=button value=\"Regular Expression...\" "
- "onClick=\"var pat="
- "prompt('Enter the regular expression to edit:', ''); "
-#else
- fprintf(stdout, "<INPUT type=button value=\"Wildcard...\" "
- "onClick=\"var pat="
- "prompt('Enter the wildcard pattern to edit:', ''); "
-#endif
- "if(pat!=null) window.location='rsrcpckr?"
- "type="WILDCARD"&resource='+escape(pat);\">");
-#ifdef MCC_PROXY
- fprintf(stdout, "</TD>\n</TR>\n</TABLE>\n");
-#endif
- fputs("</nobr>", stdout);
- /* output("</td></tr>\n"); */
- }
-#endif
-}
-
-void booktrack(char *input, char **vars)
-{
- char line[BIG_LINE];
-
- if((vars[0] != NULL) && (vars[1] != NULL)) {
- sprintf(line, "<a href=index?0>"
- "<img src=\"%s\" hspace=8 align=%s alt=\"\"></a>",
- (input[0] - '0') ? vars[0] : vars[1],
- (vars[2] != NULL) ? vars[2] : "none");
- output(line);
- }
-}
-
-void docswitcher(char *input)
-{
- char line[BIG_LINE];
- char *whichimg, *whatmode;
-#ifdef USE_ADMSERV
- char *qs = getenv("QUERY_STRING");
- char *sname = getenv("SCRIPT_NAME");
- char *mtmp;
-
- char *tmp = getenv("SERVER_NAMES");
- char *servers = NULL;
- if(tmp) servers = STRDUP(tmp);
-#endif
-
- if(!(input[0] - '0')) {
- whichimg = "b-clsd.gif";
- whatmode = "Express mode";
- } else {
- whichimg = "b-open.gif";
- whatmode = "Full docs";
- }
-
- mtmp = (char *) MALLOC( (sname? strlen(sname) : 0) +
- (qs? strlen(qs) : 0) +
- (strlen(whichimg) + strlen(whatmode)) +
- 1024);
- sprintf(mtmp, "<center><table border=2 width=95%%>\n"
- "<tr><td rowspan=2><a href=index%s>"
- "<img src=\"../icons/%s\" "
- "alt=\"[%s] \" border=2>"
- "</td>\n",
- (qs ? "?0" : sname),
- whichimg, whatmode);
- output(mtmp);
-
-#ifdef USE_ADMSERV
- if(!servers) {
- sprintf(line, "<td width=100%% align=center rowspan=2><b>%s</b></td>\n",
- whatmode);
- output(line);
- } else
- if(servers[0] == '(') {
-
- sprintf(line, "<td width=100%% align=center>Current servers:<br>\n");
- output(line);
- output("<b>");
-
- tmp=strtok(++servers, "|)");
- while(tmp) {
- char *tmp2;
- output("<nobr>");
- tmp2=strchr(tmp, '-');
- tmp2++;
- output(tmp2);
- tmp=strtok(NULL, "|)");
- if(tmp)
- output(",");
- output("</nobr>\n");
- }
- output("</b></td>\n");
- } else {
-
- sprintf(line, "<td width=100%% align=center>Current server: ");
- output(line);
- output("<b>");
- tmp = strchr(servers, '-');
- *tmp++ = '\0';
- output(tmp);
- output("</b>");
- output("</td>\n");
- }
-#endif
- sprintf(mtmp, "<td rowspan=2><a href=index%s>"
- "<img src=\"../icons/%s\" "
- "alt=\"\" border=2></a></td></tr>\n",
- (qs? "?0" : sname),
- whichimg);
- output(mtmp);
-#ifdef USE_ADMSERV
- if(servers) {
- sprintf(line, "<tr><td align=center>"
- "<a href=\"/admin-serv/bin/chooser\">"
- "Choose</a> a new server or set of servers</a></td>\n");
- output(line);
- }
-#endif
- sprintf(line, "</tr></table></center>\n");
- output(line);
- output("<hr width=10%%>\n");
-}
-
-void docroot(char **vars)
-{
-#ifndef MCC_NEWS
- char line[BIG_LINE];
- pblock *pb = grab_pblock(PB_NAME, "default", "NameTrans", "document-root",
- NULL, NULL);
- char *docroot = "";
- if(pb)
- docroot = pblock_findval("root", pb);
- sprintf(line, "<b>%s%s</b>\n", docroot, (vars[0] != NULL) ? vars[0] : "");
- output(line);
-#endif
-}
-
-void serverroot(char **vars)
-{
- char line[BIG_LINE];
-#ifdef USE_ADMSERV
- char *sroot = getenv("NETSITE_ROOT");
-#else
- char *sroot = get_mag_var("#ServerRoot");
-#endif
- sprintf(line, "%s%s", (sroot) ? sroot : "", (vars[0]) ? vars[0] : "");
- output(line);
-}
-
-void makeurl(char **vars)
-{
- char line[BIG_LINE];
-
- sprintf(line,"<a href=%s target=_blank>%s</a>\n",
- get_serv_url(), vars[0] ? vars[0] : "");
- output(line);
-}
-
-void curservname(void)
-{
- output(get_srvname(0));
-}
-
-NSAPI_PUBLIC
-void pageheader(char **vars, char **config)
-{
- char line[BIG_LINE];
-#if 0 /* MLM - put in to have non-working Back button */
- char *ref=get_referer(config);
- char *t;
-#endif
-
- output("<center><table border=2 width=100%%>\n");
-
- util_snprintf(line, BIG_LINE, "<tr>");
- output(line);
-
- util_snprintf(line, BIG_LINE, "<td align=center width=100%%>");
- output(line);
- util_snprintf(line, BIG_LINE, "<hr size=0 width=0>");
- output(line);
-#if 0 /* MLM - put in to have non-working Back button */
- t=strrchr(ref, '/');
- *t++='\0';
- util_snprintf(line, BIG_LINE, "<a href=\"%s/index/%s\">", ref, t);
- output(line);
- util_snprintf(line, BIG_LINE, "<img align=right src=../icons/back.gif "
- "width=41 height=26 border=0></a>\n");
- output(line);
-#endif
- util_snprintf(line, BIG_LINE, "<FONT size=+2><b>%s</b></FONT>"
- "<hr size=0 width=0>"
- "</td>", vars[2]);
- output(line);
-
- output("</tr></table></center>\n");
-}
-
-char *_get_help_button(char *topic)
-{
- char line[BIG_LINE];
-
- util_snprintf( line, BIG_LINE,
- "<input type=button value=\"%s\" "
- "onClick=\"%s\">", XP_GetAdminStr(DBT_help_),
- topic ? helpJavaScriptForTopic( topic ) : helpJavaScript() );
-
- return(STRDUP(line));
-}
NSAPI_PUBLIC char *helpJavaScriptForTopic( char *topic )
{
char *tmp;
char line[BIG_LINE];
- char *server=get_srvname(0);
+ char *server="admserv";
char *type;
int typeLen;
@@ -605,216 +58,3 @@ NSAPI_PUBLIC char *helpJavaScript()
*sn++='\0';
return helpJavaScriptForTopic( sn );
}
-
-void submit(int verify, char **vars)
-{
- char line[BIG_LINE];
- char outline[BIG_LINE];
-
- if(verify) {
- util_snprintf(line, BIG_LINE, "<SCRIPT language="MOCHA_NAME">\n"
- "function verify(form) {\n"
- " if(confirm('Do you really want to %s?'))\n"
- " form.submit();\n"
- "}\n"
- "</SCRIPT>\n", vars[0]);
- output(line);
- }
-
- output("<center><table border=2 width=100%%><tr>");
-
- if(!verify) {
- util_snprintf(outline, BIG_LINE, "%s%s%s%s%s",
- "<td width=33%% align=center>",
- "<input type=submit value=\"",
- XP_GetAdminStr(DBT_ok_),
- "\">",
- "</td>\n");
- } else {
- util_snprintf(outline, BIG_LINE, "%s%s%s%s%s%s",
- "<td width=33%% align=center>",
- "<input type=button value=\"",
- XP_GetAdminStr(DBT_ok_),
- "\" ",
- "onclick=\"verify(this.form)\">",
- "</td>\n");
- }
- output(outline);
- util_snprintf(outline, BIG_LINE, "%s%s%s%s",
- "<td width=34%% align=center>",
- "<input type=reset value=\"",
- XP_GetAdminStr(DBT_reset_),
- "\"></td>\n");
- output(outline);
-
- util_snprintf(line, BIG_LINE, "<td width=33%% align=center>%s</td>\n",
- _get_help_button( vars[0] ));
- output(line);
-
- output("</tr></table></center>\n");
-
- output("</form>\n");
-
- output("<SCRIPT language="MOCHA_NAME">\n");
- output("</SCRIPT>\n");
-}
-
-void helpbutton(char *topic)
-{
- output("<form><p><div align=right><table width=33%% border=2>"
- "<tr><td align=center>");
- output(_get_help_button(topic));
- output("</td></tr></table></div></form>\n");
- output("<SCRIPT language="MOCHA_NAME">\n");
- output("</SCRIPT>\n");
-}
-
-void dialogsubmit(char *topic)
-{
- char line[BIG_LINE];
- char outline[BIG_LINE];
-
- output("<center><table border=2 width=100%%><tr>");
-
- util_snprintf(outline, BIG_LINE, "%s%s%s%s%s",
- "<td width=33%% align=center>",
- "<input type=submit value=\"",
- XP_GetAdminStr(DBT_done_),
- "\">",
- "</td>\n");
- output(outline);
- util_snprintf(outline, BIG_LINE, "%s%s%s%s%s",
- "<td width=34%% align=center>",
- "<input type=button value=\"",
- XP_GetAdminStr(DBT_cancel_),
- "\" "
- "onClick=\"top.close()\"></td>\n");
- output(outline);
-
- util_snprintf(line, BIG_LINE, "<td width=33%% align=center>%s</td>\n",
- _get_help_button(topic));
- output(line);
-
- output("</tr></table></center>\n");
-
- output("</form>\n");
-
- output("<SCRIPT language="MOCHA_NAME">\n");
- output("</SCRIPT>\n");
-}
-
-void helpjsfn(void)
-{
- char *tmp;
- char line[BIG_LINE];
- char *server=get_srvname(0);
- char *type;
- int typeLen;
-
- /* Get the server type, without the instance name into type */
- tmp = strchr( server, '-' );
- typeLen = tmp - server;
-
- type = (char *)MALLOC( typeLen + 1 );
- type[typeLen] = '\0';
- while ( typeLen-- ) {
- type[typeLen] = server[typeLen];
- }
-
- output("function displayHelpTopic(topic)\n");
- output("{\n");
- util_snprintf(line, BIG_LINE,
- " if (top.helpwin) {\n"
- " top.helpwin.focus();\n"
- " top.helpwin.infotopic.location='%s/%s/admin/tutor?!' + topic;\n"
- " } else {\n"
- " window.open('%s/%s/admin/tutor?' + topic, '"
- INFO_IDX_NAME"_%s', "
- HELP_WIN_OPTIONS");\n"
- " }\n"
- "}\n",
- getenv("SERVER_URL"), server,
- getenv("SERVER_URL"), server,
- type );
- output(line);
-}
-
-void link_referer(char **input, char **vars)
-{
- char line[BIG_LINE];
-
- sprintf( line, "<SCRIPT language="MOCHA_NAME">\n"
- "document.writeln( '%s'.link( '%s' ) );\n"
- "</SCRIPT>\n", ( vars[0] ? vars[0] : getenv( "SCRIPT_NAME" ) ),
- cookieValue( "adminReferer", NULL ) );
- output( line );
-}
-
-int get_directive(char *string)
-{
- int index = -1;
- register int x;
-
- for(x=0; x < MAXTEMPLATE; x++) {
- if(!strncmp(string, templates[x].name,
- strlen(templates[x].name))) {
- index = x;
- break;
- }
- }
- return index;
-}
-
-NSAPI_PUBLIC int directive_is(char *target, char *directive)
-{
- char *position = (target + strlen(DIRECTIVE_START));
- return(!(strncmp(directive, position, strlen(directive))));
-}
-
-char **get_vars(char *string)
-{
- char **vars;
- register int x;
- int isvar;
- char scratch[BIG_LINE];
- char lastchar;
-
-/* Initialize the vars array.
- */
- vars = (char **) MALLOC((MAXVARS)*(sizeof(char *)));
- for(x=0; x< MAXVARS; x++)
- vars[x] = NULL;
-
- isvar = -1;
- x = 0;
- scratch[0] = '\0';
- lastchar = ' ';
-
- while(*string != '\0') {
- if((*string == '\"') && (lastchar != '\\'))
- if(isvar != -1) {
- vars[x++] = (char *)STRDUP(scratch);
- isvar = -1;
- if(x == MAXVARS)
- break;
- } else
- isvar = 0;
- else
- if(isvar != -1) {
- scratch[isvar++] = *string;
- scratch[isvar] = '\0';
- }
- else
- if(*string == DIRECTIVE_END)
- break;
- lastchar = *string;
- string++;
- }
- return vars;
-}
-
-static void output(char *line)
-{
- if(status)
- fputs(line, stdout);
-}
diff --git a/lib/libadmin/util.c b/lib/libadmin/util.c
index b560055d..4af302f0 100644
--- a/lib/libadmin/util.c
+++ b/lib/libadmin/util.c
@@ -13,12 +13,12 @@
#include "base/util.h"
#include "private/pprio.h"
+#include <base/file.h>
#ifdef XP_UNIX
#include <dirent.h>
#include <sys/types.h>
#include <fcntl.h>
#else
-#include <base/file.h>
#include <sys/stat.h>
#endif /* WIN32? */
@@ -26,675 +26,6 @@
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
-#include <ctype.h> /* isdigit */
-
-#define NUM_ENTRIES 64
-
-#ifdef MCC_PROXY
-char *
-XP_GetString()
-{
- return "ZAP";
-}
-#endif
-
-#ifdef XP_WIN32
-char *GetQueryNT(void)
-{
- char *qs = getenv("QUERY_STRING");
- if(qs && (*qs == '\0'))
- qs = NULL;
- return qs;
-}
-#endif /* XP_WIN32 */
-
-void escape_for_shell(char *cmd) {
- register int x,y,l;
-
- l=strlen(cmd);
- for(x=0;cmd[x];x++) {
- if(strchr(" &;`'\"|*!?~<>^()[]{}$\\\x0A",cmd[x])){
- for(y=l+1;y>x;y--)
- cmd[y] = cmd[y-1];
- l++; /* length has been increased */
- cmd[x] = '\\';
- x++; /* skip the character */
- }
- }
-}
-
-int _admin_dumbsort(const void *s1, const void *s2)
-{
- return strcmp(*((char **)s1), *((char **)s2));
-}
-
-#ifdef XP_UNIX /* WIN32 change */
-/* Lists all files in a directory. */
-char **list_directory(char *path, int dashA)
-{
- char **ar;
- DIR *ds;
- struct dirent *d;
- int n, p;
-
- n = NUM_ENTRIES;
- p = 0;
-
- ar = (char **) MALLOC(n * sizeof(char *));
-
- if(!(ds = opendir(path))) {
- return NULL;
- }
-
- while( (d = readdir(ds)) ) {
- if ( ( d->d_name[0] != '.' ) ||
- ( dashA && d->d_name[1] &&
- ( d->d_name[1] != '.' || d->d_name[2] ) ) ) {
- if(p == (n-1)) {
- n += NUM_ENTRIES;
- ar = (char **) REALLOC(ar, n*sizeof(char *));
- }
- /* 2: Leave space to add a trailing slash later */
- ar[p] = (char *) MALLOC(strlen(d->d_name) + 2);
- strcpy(ar[p++], d->d_name);
- }
- }
- closedir(ds);
-
- qsort((void *)ar, p, sizeof(char *), _admin_dumbsort);
- ar[p] = NULL;
-
- return ar;
-}
-
-#else /* WIN32 change */
-/* Lists all files in a directory. */
-char **list_directory(char *path, int dashA)
-{
- char **ar;
- SYS_DIR ds;
- SYS_DIRENT *d;
- int n, p;
-
- n = NUM_ENTRIES;
- p = 0;
-
- ar = (char **) MALLOC(n * sizeof(char *));
-
- if(!(ds = dir_open(path))) {
- return NULL;
- }
-
- while( (d = dir_read(ds)) ) {
- if ( ( d->d_name[0] != '.' ) ||
- ( dashA && d->d_name[1] &&
- ( d->d_name[1] != '.' || d->d_name[2] ) ) ) {
- if(p == (n-1)) {
- n += NUM_ENTRIES;
- ar = (char **) REALLOC(ar, n*sizeof(char *));
- }
- /* 2: Leave space to add a trailing slash later */
- ar[p] = (char *) MALLOC(strlen(d->d_name) + 2);
- strcpy(ar[p++], d->d_name);
- }
- }
- dir_close(ds);
-
- qsort((void *)ar, p, sizeof(char *), _admin_dumbsort);
- ar[p] = NULL;
-
- return ar;
-}
-#endif /* WIN32 */
-
-int file_exists(char *fn)
-{
- struct stat finfo;
-
- if(!stat(fn, &finfo))
- return 1;
- else
- return 0;
-}
-
-int get_file_size(char *fn)
-{
- struct stat finfo;
- int ans = -1;
-
- if(!stat(fn, &finfo)) {
- ans = finfo.st_size;
- } else {
- report_error(FILE_ERROR, fn, "Could not get size of file.");
- }
- return ans;
-}
-
-int ADM_mkdir_p(char *dir, int mode)
-{
- char path[PATH_MAX];
- struct stat fi;
- char *slash = NULL;
-
- if (dir)
- strcpy (path, dir);
- else
- return 0;
-
- if (slash = strchr(path, FILE_PATHSEP))
- slash++; /* go past root */
- else
- return 0;
-
- while (slash && *slash) {
- slash = strchr(slash, FILE_PATHSEP);
- if (slash) *slash = '\0'; /* check path till here */
-
- if (stat(path, &fi) == -1) {
-#ifdef XP_UNIX
- if (mkdir(path, mode) == -1)
-#else /* XP_WIN32 */
- if (!CreateDirectory(path, NULL))
-#endif
- return 0;
- }
-
- if (slash) {
- *slash = FILE_PATHSEP; /* restore path */
- slash++; /* check remaining path */
- }
- }
- return 1;
-}
-
-int ADM_copy_directory(char *src_dir, char *dest_dir)
-{
- SYS_DIR ds;
- SYS_DIRENT *d;
- struct stat fi;
- char src_file[PATH_MAX], dest_file[PATH_MAX], fullname[PATH_MAX];
-
- if (!(ds = dir_open(src_dir)))
- report_error(FILE_ERROR, "Can't read directory", src_dir);
-
- while (d = dir_read(ds)) {
- if (d->d_name[0] != '.') {
- sprintf(fullname, "%s/%s", src_dir, d->d_name);
- if (system_stat(fullname, &fi) == -1)
- continue;
-
- sprintf(src_file, "%s%c%s", src_dir, FILE_PATHSEP, d->d_name);
- sprintf(dest_file, "%s%c%s", dest_dir, FILE_PATHSEP, d->d_name);
- if (S_ISDIR(fi.st_mode)) {
- char *sub_src_dir = STRDUP(src_file);
- char *sub_dest_dir = STRDUP(dest_file);
- if (!ADM_mkdir_p(sub_dest_dir, 0755)) {
- report_error(FILE_ERROR, "Cannot create directory",
- sub_dest_dir);
- return 0;
- }
- if (!ADM_copy_directory(sub_src_dir, sub_dest_dir))
- return 0;
- FREE(sub_src_dir);
- FREE(sub_dest_dir);
- }
- else
- cp_file(src_file, dest_file, 0644);
- }
- }
- dir_close(ds);
- return(1);
-}
-
-void ADM_remove_directory(char *path)
-{
- struct stat finfo;
- char **dirlisting;
- register int x=0;
- int stat_good = 0;
- char *fullpath = NULL;
-
-#ifdef XP_UNIX
- stat_good = (lstat(path, &finfo) == -1 ? 0 : 1);
-#else /* XP_WIN32 */
- stat_good = (stat(path, &finfo) == -1 ? 0 : 1);
-#endif
-
- if(!stat_good) return;
-
- if(S_ISDIR(finfo.st_mode)) {
- dirlisting = list_directory(path,1);
- if(!dirlisting) return;
-
- for(x=0; dirlisting[x]; x++) {
- fullpath = (char *) MALLOC(strlen(path) +
- strlen(dirlisting[x]) + 4);
- sprintf(fullpath, "%s%c%s", path, FILE_PATHSEP, dirlisting[x]);
-#ifdef XP_UNIX
- stat_good = (lstat(fullpath, &finfo) == -1 ? 0 : 1);
-#else /* XP_WIN32 */
- stat_good = (stat(fullpath, &finfo) == -1 ? 0 : 1);
-#endif
- if(!stat_good) continue;
- if(S_ISDIR(finfo.st_mode)) {
- ADM_remove_directory(fullpath);
- } else {
- unlink(fullpath);
- }
- FREE(fullpath);
- }
-#ifdef XP_UNIX
- rmdir(path);
-#else /* XP_WIN32 */
- RemoveDirectory(path);
-#endif
- } else {
- delete_file(path);
- }
- return;
-}
-
-/* return: mtime(f1) < mtime(f2) ? */
-int mtime_is_earlier(char *file1, char *file2)
-{
- struct stat fi1, fi2;
-
- if(stat(file1, &fi1)) {
- return -1;
- }
- if(stat(file2, &fi2)) {
- return -1;
- }
- return( (fi1.st_mtime < fi2.st_mtime) ? 1 : 0);
-}
-
-time_t get_mtime(char *fn)
-{
- struct stat fi;
-
- if(stat(fn, &fi))
- return 0;
- return fi.st_mtime;
-}
-
-int all_numbers(char *target)
-{
- register int x=0;
-
- while(target[x])
- if(!isdigit(target[x++]))
- return 0;
- return 1;
-}
-
-
-int all_numbers_float(char *target)
-{
- register int x;
- int seenpt;
-
- for(x = 0, seenpt = 0; target[x]; ++x) {
- if((target[x] == '.') && (!seenpt))
- seenpt = 1;
- else if((!isdigit(target[x])) && seenpt)
- return 0;
- }
- return 1;
-}
-
-/* Get the admin/config directory. */
-char *get_admcf_dir(int whichone)
-{
-#ifdef USE_ADMSERV
- char *confdir = NULL;
-
- char *tmp = get_num_mag_var(whichone, "#ServerRoot");
- if(!tmp) {
- /* sigh */
- report_error(INCORRECT_USAGE, "No server root variable",
- "The magnus.conf variable #ServerRoot was "
- "not set. Please set the value of your server "
- "root through the administrative forms.");
- }
- confdir = (char *) MALLOC(strlen(tmp) + strlen("config") + 4);
- sprintf(confdir, "%s%cconfig%c", tmp, FILE_PATHSEP, FILE_PATHSEP);
-
- return confdir;
-#else
- char *confdir;
- char line[BIG_LINE];
- sprintf(line, "%s%cadmin%cconfig%c", get_mag_var("#ServerRoot"),
- FILE_PATHSEP, FILE_PATHSEP, FILE_PATHSEP);
- confdir = STRDUP(line);
-#endif
- return STRDUP(confdir);
-}
-
-/* Get the current HTTP server URL. */
-char *get_serv_url(void)
-{
-#ifdef USE_ADMSERV
- char *name = get_mag_var("ServerName");
- char *port = get_mag_var("Port");
- char *protocol = NULL;
- char line[BIG_LINE];
-
-#ifndef NS_UNSECURE
- char *security = get_mag_var("Security");
-
- if(!security || strcasecmp(security, "on")) {
- protocol = STRDUP("http");
- if(!strcmp(port, "80"))
- port = STRDUP("");
- else {
- sprintf(line, ":%s", port);
- port = STRDUP(line);
- }
- } else {
- protocol = STRDUP("https");
- if(!strcmp(port, "443"))
- port = STRDUP("");
- else {
- sprintf(line, ":%s", port);
- port = STRDUP(line);
- }
- }
-#else
- protocol = STRDUP("http");
- if(!strcmp(port, "80"))
- port = STRDUP("");
- else {
- sprintf(line, ":%s", port);
- port = STRDUP(line);
- }
-#endif
-
- sprintf(line, "%s://%s%s", protocol, name, port);
- return(STRDUP(line));
-#else
- return(getenv("SERVER_URL"));
-#endif
-}
-
-/* ------------------------------- run_cmd -------------------------------- */
-
-
-/* Previously in install. This is also pretty UNIX-ish. */
-
-/* Nirmal: Added code for Win32 implementation of this function. */
-
-#include <signal.h>
-#ifdef XP_UNIX
-#include <sys/wait.h>
-#endif /* XP_UNIX */
-
-
-int run_cmd(char *cmd, FILE *closeme, struct runcmd_s *rm)
-{
-#ifdef WIN32
- HANDLE hproc;
- PROCESS_INFORMATION child;
- STARTUPINFO siStartInfo ;
-#else
- struct stat fi;
- int exstat;
- char *errmsg, tfn[128];
- FILE *f;
- int fd;
- pid_t pid;
-#endif
-
-
-#ifdef WIN32
- /* Nirmal:
- For now, i will just spawn
- a child in WINNT to execute the command. Communication to
- the parent is done through stdout pipe, that was setup by
- the parent.
-
- */
- hproc = OpenProcess(STANDARD_RIGHTS_REQUIRED, FALSE, GetCurrentProcessId());
- if (hproc == NULL) {
- fprintf(stdout, "Content-type: text/html\n\n");
- fflush(stdout);
- report_error(SYSTEM_ERROR, NULL, "Could not open handle to myself");
- return -1; // stmt. not reached.
- }
-
- ZeroMemory(&child, sizeof(PROCESS_INFORMATION));
- ZeroMemory(&siStartInfo, sizeof(STARTUPINFO));
- siStartInfo.cb = sizeof(STARTUPINFO);
- siStartInfo.lpReserved = siStartInfo.lpReserved2 = NULL;
- siStartInfo.cbReserved2 = 0;
- siStartInfo.lpDesktop = NULL;
- siStartInfo.dwFlags = STARTF_USESHOWWINDOW;
-// Several fields arent used when dwFlags is not set.
-// siStartInfo.hStdInput = hChildStdinRd;
-// siStartInfo.hStdOutput = siStartInfo.hStdError = hChildStdoutWr;
- siStartInfo.wShowWindow = SW_HIDE;
-
- if ( ! CreateProcess(
- NULL, // pointer to name of executable module
- cmd, // pointer to command line string
- NULL, // pointer to process security attribute
- NULL, // pointer to thread security attributes
- TRUE, // handle inheritance flag
- 0, // creation flags
- NULL, // pointer to new environment block
- NULL, // pointer to current directory name
- &siStartInfo, // pointer to STARTUPINFO
- &child // pointer to PROCESS_INFORMATION
- ))
- {
- rm->title = "CreateProcess failed";
- rm->msg = "run_cmd: Can't create new process. ";
- rm->arg = "";
- rm->sysmsg = 1;
- return -1;
- }
- else
- return 0;
-#else
- sprintf(cmd, "%s > /tmp/startmsg.%d 2>&1 < /dev/null", cmd, getpid()); /* */
- /* FUCK UNIX SIGNALS. */
- signal(SIGCHLD, SIG_DFL);
- switch( (pid = fork()) ) {
- case 0:
- /* Hmm. Work around an apparent bug in stdio. */
- if(closeme)
- close(fileno(closeme));
- execl("/bin/sh", "/bin/sh", "-c", cmd, (char *)NULL);
- /* DOH! */
- sprintf(tfn, "/tmp/startmsg.%d", getpid());
- if(!(f = fopen(tfn, "w")))
- exit(1);
- fprintf(f, "Exec of %s failed. The error was %s.\n", cmd,
- system_errmsg());
- fclose(f);
- exit(1);
- case -1:
- rm->title = "Fork failed";
- rm->msg = "Can't create new process. %s";
- rm->arg = "";
- rm->sysmsg = 1;
- return -1;
- default:
- sprintf(tfn, "/tmp/startmsg.%d", getpid());
-
- if(waitpid(pid, &exstat, 0) == -1) {
- rm->title = "Can't wait for child";
- rm->msg = "Can't wait for process. %s";
- rm->arg = "";
- rm->sysmsg = 1;
- return -1;
- }
- if(exstat) {
- if(!(fd = open(tfn, O_RDONLY))) {
- rm->title = "Can't open error file";
- rm->msg = "Can't find error file %s.";
- rm->arg = cmd;
- rm->sysmsg = 1;
- return -1;
- }
- fstat(fd, &fi);
- if((fi.st_size > 0) && (fi.st_size < 8192)) {
- errmsg = (char *) MALLOC(fi.st_size + 1);
- read(fd, errmsg, fi.st_size);
- errmsg[fi.st_size] = '\0';
- close(fd);
- unlink(tfn);
- rm->title = "Command execution failed";
- rm->msg = "The command did not execute. "
- "Here is the output:<p>\n<pre>\n%s\n</pre>\n";
- rm->arg = errmsg;
- rm->sysmsg = 0;
- return -1;
- }
- else {
- close(fd);
- unlink(tfn);
-
- rm->title = "Command execution failed";
- rm->msg = "The command didn't execute, and it did not produce "
- "any output. Run <code>%s</code> from the command "
- "line and examine the output.\n";
- rm->arg = cmd;
- rm->sysmsg = 0;
- return -1;
- }
- }
- unlink(tfn);
- return 0;
- }
-#endif /* WIN32 */
-
-}
-
-
-
-/* This is basically copy_file from the install section, with the error
- * reporting changed to match the admin stuff. Since some stuff depends
- * on copy_file being the install version, I'll cheat and call this one
- * cp_file. */
-#ifdef XP_UNIX
-
-#define COPY_BUFFER_SIZE 4096
-
-void cp_file(char *sfile, char *dfile, int mode)
-{
- int sfd, dfd, len;
- struct stat fi;
-
- char copy_buffer[COPY_BUFFER_SIZE];
- unsigned long read_len;
-
-/* Make sure we're in the right umask */
- umask(022);
-
- if( (sfd = open(sfile, O_RDONLY)) == -1)
- report_error(FILE_ERROR, sfile, "Can't open file for reading.");
-
- fstat(sfd, &fi);
- if(!(S_ISREG(fi.st_mode))) {
- close(sfd);
- return;
- }
- len = fi.st_size;
-
- if( (dfd = open(dfile, O_RDWR | O_CREAT | O_TRUNC, mode)) == -1)
- report_error(FILE_ERROR, dfile, "Can't write to file.");
-
- while(len) {
- read_len = len>COPY_BUFFER_SIZE?COPY_BUFFER_SIZE:len;
-
- if ( (read_len = read(sfd, copy_buffer, read_len)) == -1) {
- report_error(FILE_ERROR, sfile, "Error reading file for copy.");
- }
-
- if ( write(dfd, copy_buffer, read_len) != read_len) {
- report_error(FILE_ERROR, dfile, "Error writing file for copy.");
- }
-
- len -= read_len;
- }
- close(sfd);
- close(dfd);
-}
-
-#else /* XP_WIN32 */
-void cp_file(char *sfile, char *dfile, int mode)
-{
- HANDLE sfd, dfd, MapHandle;
- PCHAR fp;
- DWORD BytesWritten = 0;
- DWORD len;
-
- if( (sfd = CreateFile(sfile, GENERIC_READ,
- FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
- OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL))
- == INVALID_HANDLE_VALUE) {
- report_error(FILE_ERROR, "Cannot open file for reading", sfile);
- }
- len = GetFileSize(sfd, NULL);
- if( (dfd = CreateFile(dfile, GENERIC_READ | GENERIC_WRITE,
- FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,CREATE_ALWAYS,
- FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) {
- report_error(FILE_ERROR, "Cannot open destination file for writing",
- dfile);
- }
- if (len == 0)
- return;
- if( (MapHandle = CreateFileMapping(sfd, NULL, PAGE_READONLY,
- 0, 0, NULL)) == NULL) {
- report_error(FILE_ERROR, "Cannot create file mapping", sfile);
- }
- if (!(fp = MapViewOfFile(MapHandle, FILE_MAP_READ, 0, 0, 0))) {
- report_error(FILE_ERROR, "Cannot map file %s", sfile);
- }
- while ( len) {
- if(!WriteFile(dfd, fp, len, &BytesWritten, NULL)) {
- report_error(FILE_ERROR, "Cannot write new file", dfile);
- }
- len -= BytesWritten;
- fp += BytesWritten;
- }
-
- CloseHandle(sfd);
- UnmapViewOfFile(fp);
- CloseHandle(MapHandle);
- FlushFileBuffers(dfd);
- CloseHandle(dfd);
-}
-#endif
-
-int delete_file(char *path)
-{
-#ifdef XP_UNIX
- return unlink(path);
-#else
- return !(DeleteFile(path));
-#endif
-}
-
-void create_dir(char *dir, int mode)
-{
- if ((dir == (char *) NULL) || (strlen(dir) == 0)) {
- report_error(FILE_ERROR, "No directory is specified",
- "Could not create a necessary directory.");
- }
-
- if(!file_exists(dir)) {
-#ifdef XP_UNIX
- if(mkdir(dir, mode) == -1) {
-#else /* XP_WIN32 */
- if(!CreateDirectory(dir, NULL)) {
- if (GetLastError() != ERROR_ALREADY_EXISTS)
-#endif /* XP_WIN32 */
- report_error(FILE_ERROR, dir,
- "Could not create a necessary directory.");
- }
- }
-}
#ifdef XP_UNIX
SYS_FILE lf;
@@ -718,7 +49,7 @@ FILE *fopen_l(char *path, char *mode)
{
FILE *f = fopen(path, mode);
char *lockpath;
- char *sn=get_srvname(0);
+ char *sn="admserv";
char *flp=FILE_LOCK_PATH;
if(f == NULL) return NULL;
@@ -760,67 +91,6 @@ void fclose_l(FILE *f)
}
#endif /* XP_UNIX */
}
-
-/* Ripped off from the client. (Sorry, Lou.) */
-/* */
-/* The magic set of 64 chars in the uuencoded data */
-unsigned char uuset[] = {
-'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T',
-'U','V','W','X','Y','Z','a','b','c','d','e','f','g','h','i','j','k','l','m','n',
-'o','p','q','r','s','t','u','v','w','x','y','z','0','1','2','3','4','5','6','7',
-'8','9','+','/' };
-
-int do_uuencode(unsigned char *src, unsigned char *dst, int srclen)
-{
- int i, r;
- unsigned char *p;
-
-/* To uuencode, we snip 8 bits from 3 bytes and store them as
-6 bits in 4 bytes. 6*4 == 8*3 (get it?) and 6 bits per byte
-yields nice clean bytes
-
-It goes like this:
- AAAAAAAA BBBBBBBB CCCCCCCC
-turns into the standard set of uuencode ascii chars indexed by numbers:
- 00AAAAAA 00AABBBB 00BBBBCC 00CCCCCC
-
-Snip-n-shift, snip-n-shift, etc....
-
-*/
-
- for (p=dst,i=0; i < srclen; i += 3) {
- /* Do 3 bytes of src */
- register char b0, b1, b2;
-
- b0 = src[0];
- if (i==srclen-1)
- b1 = b2 = '\0';
- else if (i==srclen-2) {
- b1 = src[1];
- b2 = '\0';
- }
- else {
- b1 = src[1];
- b2 = src[2];
- }
-
- *p++ = uuset[b0>>2];
- *p++ = uuset[(((b0 & 0x03) << 4) | ((b1 & 0xf0) >> 4))];
- *p++ = uuset[(((b1 & 0x0f) << 2) | ((b2 & 0xc0) >> 6))];
- *p++ = uuset[b2 & 0x3f];
- src += 3;
- }
- *p = 0; /* terminate the string */
- r = (unsigned char *)p - (unsigned char *)dst;/* remember how many we did */
-
- /* Always do 4-for-3, but if not round threesome, have to go
- clean up the last extra bytes */
-
- for( ; i != srclen; i--)
- *--p = '=';
-
- return r;
-}
char *alert_word_wrap(char *str, int width, char *linefeed)
{
@@ -881,216 +151,6 @@ char *alert_word_wrap(char *str, int width, char *linefeed)
return ans;
}
-void remove_directory(char *path)
-{
- struct stat finfo;
- char **dirlisting;
- register int x=0;
- int stat_good = 0;
- char *fullpath = NULL;
-
-#ifdef XP_UNIX
- stat_good = (lstat(path, &finfo) == -1 ? 0 : 1);
-#else /* WIN32 */
- stat_good = (stat(path, &finfo) == -1 ? 0 : 1);
-#endif /* XP_UNIX */
-
- if(!stat_good) return;
-
- if(S_ISDIR(finfo.st_mode)) {
- dirlisting = list_directory(path,1);
- if(!dirlisting) return;
-
- for(x=0; dirlisting[x]; x++) {
- fullpath = (char *) MALLOC(strlen(path) +
- strlen(dirlisting[x]) + 4);
- sprintf(fullpath, "%s%c%s", path, FILE_PATHSEP, dirlisting[x]);
-#ifdef XP_UNIX
- stat_good = (lstat(fullpath, &finfo) == -1 ? 0 : 1);
-#else /* WIN32 */
- stat_good = (stat(fullpath, &finfo) == -1 ? 0 : 1);
-#endif /* XP_UNIX */
- if(!stat_good) continue;
- if(S_ISDIR(finfo.st_mode)) {
- remove_directory(fullpath);
- } else {
- fprintf(stdout, "<i>Removing file</i> "
- "<code>%s</code><br>\n", fullpath);
- unlink(fullpath);
- }
- FREE(fullpath);
- }
- fprintf(stdout, "<i>Removing directory</i> "
- "<code>%s</code><br>\n", path);
-#ifdef XP_UNIX
- rmdir(path);
-#else /* XP_WIN32 */
- RemoveDirectory(path);
-#endif /* XP_WIN32 */
- } else {
- fprintf(stdout, "<i>Removing file</i> <code>%s</code><br>\n", path);
- unlink(path);
- }
- return;
-}
-
-int str_flag_to_int(char *str_flag)
-{
- if (!str_flag)
- return -1;
- if (!strcmp(str_flag, "1"))
- return 1;
- return 0;
-}
-
-/*
- * get_ip_and_mask - function to take something that may be an IP Address
- * and netmaks, and validate it. It takes two possible
- *
- * Parmaters: char *candidate
- *
- * Returns NULL if it isn't a valid IP address and mask. It returns
- * the IP address and mask in the form "iii.iii.iii.iii mmm.mmm.mmm.mmm"
- * if it is valid. This is in a string dynamicly allocated in this
- * function.
- *
- * Processing: the candidate is assumed to be in one of
- * these two formats:
- *
- * 1. "iii.iii.iii.iii" (returns: "iii.iii.iii.iii 255.255.255.255")
- * 2. "iii.iii.iii.iii mmm.mmm.mmm.mmm"
- * 3. "iii.*", "iii.iii.*", or "iii.iii.iii.*"
- *
- * The rules are:
- * I. If it has a space in it, it is assumed to be the delimiter in
- * format 2.
- * II. If it has a "*" in it, it's assumed to be format 3.
- * III. If it's in format 3, the net mask returned is:
- * 255.0.0.0, 255.255.0.0, or 255.255.255.0 respectivly,
- * and parts of the address right of the * is replaced with 0s.
- * IV. We use inet_addr on the pieces to validate them.
- *
- *
- */
-
-char *get_ip_and_mask(char *candidate)
-{
- char work[BIG_LINE];
-
- char *p;
- char *result = NULL;
- int len;
- int dots = 0;
- int i;
-
- if (candidate && strlen(candidate) < (unsigned) BIG_LINE) {
-
- if ((p = strchr(candidate, ' '))) {
- len = p-candidate+1;
- memcpy(work, candidate, len);
- work[len] = '\0';
- if (inet_addr(work) != -1) {
- len = strlen(candidate)-strlen(p)-1;
- if (len > 0) {
- memcpy(work, p+1, len);
- work[len] = '\0';
- if (inet_addr(work) != -1) {
- result = strdup(candidate);
- }
- }
- }
- }
- else if ((p = strchr(candidate, '*')) &&
- (p-candidate > 1 ) &&
- (*(p-1) == '.') ) {
- memset(work, 0, BIG_LINE);
- for (i=0; candidate[i]!='*'; ++i) {
- if (candidate[i+1] != '*')
- work[i] = candidate[i];
- if (candidate[i] == '.')
- ++dots;
- }
- if (dots == 1 || dots == 2 || dots == 3) {
- for (i=0; i<4-dots; ++i) {
- strcat(work, ".0");
- }
- if (inet_addr(work) != -1) {
- strcat(work, " ");
- p = &work[strlen(work)];
- for (i=0; i<dots; ++i) {
- if (i==0)
- strcat(work, "255");
- else
- strcat(work, ".255");
- }
- for (i=0; i<4-dots; ++i) {
- strcat(work, ".0");
- }
- if (inet_addr(p) != -1) {
- result = strdup(work);
- }
- }
- }
- }
- else {
- if (inet_addr(candidate) != -1) {
- strcpy(work, candidate);
- strcat(work, " 255.255.255.255");
- result = strdup(work);
- }
- }
- }
- else
- result = NULL;
-
- return result;
-}
-
-/* do fgets with a filebuffer *, instead of a File *. Can't use util_getline
- because it complains if the line is too long.
- It does throw away <CR>s, though.
- */
-NSAPI_PUBLIC char *system_gets( char *line, int size, filebuffer *fb )
-{
- int c;
- int i = 0;
-
- while ( --size ) {
- switch ( c = filebuf_getc( fb ) ) {
- case IO_EOF:
- line[i] = '\0';
- return i ? line : NULL;
- case LF:
- line[i] = c;
- line[i+1] = '\0';
- return line; /* got a line, and it fit! */
- case IO_ERROR:
- return NULL;
- case CR:
- ++size;
- break;
- default:
- line[i++] = c;
- break;
- }
- }
- /* if we got here, then we overran the buffer size */
- line[i] = '\0';
- return line;
-}
-
-#ifndef WIN32
-
-/* make a zero length file, no matter how long it was before */
-NSAPI_PUBLIC int
-system_zero( SYS_FILE f )
-{
- ftruncate( PR_FileDesc2NativeHandle( f ), 0 );
- return 0;
-}
-
-#endif
-
/***********************************************************************
** FUNCTION: cookieValue
** DESCRIPTION:
@@ -1163,88 +223,6 @@ cookieValue( char *var, char *val )
return NULL;
}
-/***********************************************************************
-** FUNCTION: jsEscape
-** DESCRIPTION:
-** Escape the usual suspects, so the parser javascript parser won't eat them
-** INPUTS: src - the string
-** OUTPUTS: NONE
-** RETURN: A malloced string, containing the escaped src
-** SIDE EFFECTS:
-** None, except for more memory being eaten
-** RESTRICTIONS:
-** None
-** MEMORY: One Malloc, you should free this if you care
-***********************************************************************/
-
-NSAPI_PUBLIC char *
-jsEscape( char *src )
-{
- int needsEscaping = 0;
- int i;
- char *dest;
-
- for ( i = 0 ; src[i] ; ++i ) {
- if ( src[i] == '\\' || src[i] == '\'' || src[i] == '"' ) {
- ++needsEscaping;
- }
- }
- dest = (char *)MALLOC( i + needsEscaping + 1 );
- for ( i = 0 ; *src ; ++src ) {
- if ( ( *src == '\\' ) || ( *src == '\'' ) || ( *src == '"' ) ) {
- dest[i++] = '\\'; /* escape */
- }
- dest[i++] = *src;
- }
- dest[i] = '\0';
- return dest;
-}
-
-/***********************************************************************
-** FUNCTION: jsPWDialogSrc
-** DESCRIPTION:
-** Put the source to the passwordDialog JavaScript function out.
-** INPUTS: inScript - if true, don't put <SCRIPT> stuff out
-** otherJS - if nonNULL, other javascript to execute
-** OUTPUTS: None
-** RETURN: None
-** SIDE EFFECTS:
-** clogs up stdout
-** RESTRICTIONS:
-** Don't use this outside of a CGI, or before the Content-type:
-** MEMORY: No memory change
-** ALGORITHM:
-** @+@What's really going on?
-***********************************************************************/
-
-NSAPI_PUBLIC void
-jsPWDialogSrc( int inScript, char *otherJS )
-{
- static int srcSpewed = 0;
-
- otherJS = otherJS ? otherJS : "";
-
- if ( ! inScript ) {
- fprintf( stdout, "<SCRIPT LANGUAGE=\""MOCHA_NAME"\">\n" );
- }
- if ( ! srcSpewed ) {
- srcSpewed = 1;
- fprintf( stdout, "function passwordDialog( prompt, element ) {\n"
- " var dlg = window.open( '', 'dialog', 'height=60,width=500' );\n"
- " dlg.document.write(\n"
- " '<form name=f1 onSubmit=\"opener.document.'\n"
- " + element + '.value = goo.value; window.close(); "
- "%s; return false;\">',\n"
- " prompt, '<input type=password name=goo></form>' );\n"
- " dlg.document.f1.goo.focus();\n"
- " dlg.document.close();\n"
- "}\n", otherJS );
- }
- if ( ! inScript ) {
- fprintf( stdout, "</SCRIPT>\n" );
- }
-}
-
static int adm_initialized=0;
/* Initialize NSPR for all the base functions we use */
@@ -1256,85 +234,3 @@ NSAPI_PUBLIC int ADM_Init(void)
}
return 0;
}
-
-
-#ifdef XP_UNIX
-/*
- * This function will return the SuiteSpot user id and group id used to
- * recommend that Netscape Servers to run as. Any line starts with '#'
- * is treated as comment. It looks for SuiteSpotUser/SuiteSpotGroup
- * name/value pair.
- *
- * It returns 0 when success and allocate storage for user and group.
- * returns -1 when only SuiteSpot user id is found.
- * returns -2 when only SuiteSpot group id is found.
- * returns -3 when NO SuiteSpot user and group is found.
- * returns -4 when fails to open <server_root>/install/ssusers.conf
- */
-NSAPI_PUBLIC int ADM_GetUXSSid(char *sroot, char **user, char **group)
-{
- int foundUser, foundGroup;
- char fn[BIG_LINE];
- char line[BIG_LINE];
- FILE *f;
-
- foundUser = 0;
- foundGroup = 0;
- *user = (char *) NULL;
- *group = (char *) NULL;
-
- sprintf(fn, "%s/install/ssusers.conf", sroot);
- if (f = fopen(fn, "r")) {
- while (fgets(line, sizeof(line), f)) {
- if (line[0] == '#') {
- continue;
- }
- if (!strncmp(line, "SuiteSpotUser", strlen("SuiteSpotUser"))) {
- char *ptr1;
- ptr1 = line + strlen("SuiteSpotUser");
- while ((*ptr1 == '\t') || (*ptr1 == ' ')) {
- ptr1++;
- }
- if ((strlen(ptr1) > 0) && (*user == (char *) NULL)) {
- *user = (char *) MALLOC(strlen(ptr1)+1);
- if (ptr1[strlen(ptr1)-1] == '\n') {
- ptr1[strlen(ptr1)-1] = '\0';
- }
- strcpy(*user, ptr1);
- }
- foundUser = 1;
- continue;
- }
- if (!strncmp(line, "SuiteSpotGroup", strlen("SuiteSpotGroup"))) {
- char *ptr1;
- ptr1 = line + strlen("SuiteSpotGroup");
- while ((*ptr1 == '\t') || (*ptr1 == ' ')) {
- ptr1++;
- }
- if ((strlen(ptr1) > 0) && (*group == (char *) NULL)) {
- *group = (char *) MALLOC(strlen(ptr1)+1);
- if (ptr1[strlen(ptr1)-1] == '\n') {
- ptr1[strlen(ptr1)-1] = '\0';
- }
- strcpy(*group, ptr1);
- }
- foundGroup = 1;
- continue;
- }
- }
- fclose(f);
- } else {
- return(-4);
- }
-
- if (foundUser && foundGroup) {
- return(0);
- } else if (foundUser) {
- return(-1);
- } else if (foundGroup) {
- return(-2);
- } else {
- return(-3);
- }
-}
-#endif /* XP_UNIX */
diff --git a/lib/libsi18n/Makefile b/lib/libsi18n/Makefile
index d9926bd5..c9fd4e7c 100644
--- a/lib/libsi18n/Makefile
+++ b/lib/libsi18n/Makefile
@@ -49,76 +49,17 @@ ifeq ($(ARCH), SOLARIS)
MYLDFLAG = -xarch=v9
endif
endif
-ifeq ($(BUILD_MODULE), HTTP_ENTERPRISE)
-StringDatabase = ns-httpd.db
-L10N_SERVER = httpd
-DBTheaders = \
- ../../httpd/src/dbthttpd.h \
- ../../include/base/dbtbase.h \
- ../../include/frame/dbtframe.h \
- ../../include/httpdaemon/dbthttpdaemon.h \
- ../../include/libaccess/dbtlibaccess.h \
- ../../include/libadmin/dbtlibadmin.h \
- ../../include/libir/dbtlibir.h \
- gshttpd.h
-endif
ifeq ($(BUILD_MODULE), DIRECTORY)
StringDatabase = ns-slapd.properties
DBTheaders = \
- ../../httpd/src/dbthttpd.h \
../../include/base/dbtbase.h \
- ../../include/frame/dbtframe.h \
- ../../include/httpdaemon/dbthttpdaemon.h \
../../include/libaccess/dbtlibaccess.h \
../../include/libadmin/dbtlibadmin.h \
- ../../include/libir/dbtlibir.h \
../../ldap/clients/dsgw/dbtdsgw.h \
gsslapd.h
endif
-
-ifeq ($(BUILD_MODULE), HTTP_PERSONAL)
-StringDatabase = ns-httpd.db
-L10N_SERVER = httpd
-DBTheaders = \
- ../../httpd/src/dbthttpd.h \
- ../../include/base/dbtbase.h \
- ../../include/frame/dbtframe.h \
- ../../include/httpdaemon/dbthttpdaemon.h \
- ../../include/libaccess/dbtlibaccess.h \
- ../../include/libadmin/dbtlibadmin.h \
- gshttpd.h
-endif
-
-ifeq ($(BUILD_MODULE), HTTP_PROXY)
-StringDatabase = ns-proxy.db
-DBTheaders = \
- ../../httpd/src/dbthttpd.h \
- ../../include/base/dbtbase.h \
- ../../include/frame/dbtframe.h \
- ../../include/httpdaemon/dbthttpdaemon.h \
- ../../include/libaccess/dbtlibaccess.h \
- ../../include/libadmin/dbtlibadmin.h \
- gsproxy.h
-endif
-
-ifeq ($(BUILD_MODULE), HTTP_ADMIN)
-StringDatabase = ns-admin.db
-L10N_SERVER = admserv
-DBTheaders = \
- ../../admserv/src/dbtadmserv.h \
- ../../admserv/cgi-src/dbtcgiadmin.h \
- ../../admserv/user-forms/src/dbtuserforms.h \
- ../../include/base/dbtbase.h \
- ../../include/frame/dbtframe.h \
- ../../include/httpdaemon/dbthttpdaemon.h \
- ../../include/libaccess/dbtlibaccess.h \
- ../../include/libadmin/dbtlibadmin.h \
- ../../include/libir/dbtlibir.h \
- gsadmserv.h
-endif
-
include $(BUILD_ROOT)/nsconfig.mk
MCC_INCLUDE += $(ADMINUTIL_INCLUDE)
diff --git a/lib/libsi18n/getlang.c b/lib/libsi18n/getlang.c
index 5aa24d04..e5b4c998 100644
--- a/lib/libsi18n/getlang.c
+++ b/lib/libsi18n/getlang.c
@@ -11,7 +11,6 @@
#include <sys/stat.h>
#include "libadmin/libadmin.h"
-#include "frame/conf.h" /* get access on global language setting */
#include "i18n.h"
diff --git a/lib/libsi18n/gsslapd.h b/lib/libsi18n/gsslapd.h
index bbb44454..ccd73a5c 100644
--- a/lib/libsi18n/gsslapd.h
+++ b/lib/libsi18n/gsslapd.h
@@ -11,25 +11,16 @@
#undef LIBRARY_NAME
#include "base/dbtbase.h"
#undef LIBRARY_NAME
-#include "frame/dbtframe.h"
-#undef LIBRARY_NAME
-#include "httpdaemon/dbthttpdaemon.h"
-#undef LIBRARY_NAME
#include "libaccess/dbtlibaccess.h"
#undef LIBRARY_NAME
#include "libadmin/dbtlibadmin.h"
#undef LIBRARY_NAME
-#include "libir/dbtlibir.h"
-#undef LIBRARY_NAME
#include "../ldap/clients/dsgw/dbtdsgw.h"
static RESOURCE_GLOBAL allxpstr[] = {
base,
- frame,
- httpdaemon,
libaccess,
libadmin,
- libir,
dsgw,
0
};
diff --git a/lib/libsi18n/makstrdb.c b/lib/libsi18n/makstrdb.c
index 6f8b78dd..20155518 100644
--- a/lib/libsi18n/makstrdb.c
+++ b/lib/libsi18n/makstrdb.c
@@ -20,31 +20,11 @@
/* Begin: Application dependent information */
/********************************************/
-#ifdef MCC_ADMSERV
-#include "gsadmserv.h"
-#define GSXXX_H_INCLUDED
-#endif
-
-#ifdef NS_ENTERPRISE
-#include "gshttpd.h"
-#define GSXXX_H_INCLUDED
-#endif
-
#ifdef NS_DS
#include "gsslapd.h"
#define GSXXX_H_INCLUDED
#endif
-#ifdef NS_PERSONAL
-#include "gshttpd.h"
-#define GSXXX_H_INCLUDED
-#endif
-
-#ifdef MCC_PROXY
-#include "gsproxy.h"
-#define GSXXX_H_INCLUDED
-#endif
-
#ifdef buildAnotherServer
#include "gsanother.h"
#define GSXXX_H_INCLUDED
diff --git a/nsconfig.mk b/nsconfig.mk
index 997d8e64..05d2657c 100644
--- a/nsconfig.mk
+++ b/nsconfig.mk
@@ -21,7 +21,7 @@ all:
ABS_ROOT := $(shell cd $(BUILD_ROOT); pwd)
ABS_ROOT_PARENT := $(shell cd $(ABS_ROOT)/..; pwd)
-MAKE=gmake $(BUILDOPT) NO_MOCHA=1
+MAKE=gmake $(BUILDOPT)
# 7/12/96 Adrian - allow MAKEFLAGS to propagate
# override MAKEFLAGS :=
@@ -266,7 +266,7 @@ endif
NSCP_DIST = $(BUILD_ROOT)/../dist
NSCP_DISTDIR = $(BUILD_ROOT)/../dist/$(NSOBJDIR_NAME)
-MAKE=gmake $(BUILDOPT) NO_MOCHA=1 NO_JAVA=1
+MAKE=gmake $(BUILDOPT) NO_JAVA=1
export NSPR20=1