Compare commits
1 Commits
v1
...
tags/MAILT
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ded5fece10 |
248
CVSROOT/modules
248
CVSROOT/modules
@@ -1,248 +0,0 @@
|
||||
# Three different line formats are valid:
|
||||
# key -a aliases...
|
||||
# key [options] directory
|
||||
# key [options] directory files...
|
||||
#
|
||||
# Where "options" are composed of:
|
||||
# -i prog Run "prog" on "cvs commit" from top-level of module.
|
||||
# -o prog Run "prog" on "cvs checkout" of module.
|
||||
# -e prog Run "prog" on "cvs export" of module.
|
||||
# -t prog Run "prog" on "cvs rtag" of module.
|
||||
# -u prog Run "prog" on "cvs update" of module.
|
||||
# -d dir Place module in directory "dir" instead of module name.
|
||||
# -l Top-level directory only -- do not recurse.
|
||||
#
|
||||
# NOTE: If you change any of the "Run" options above, you'll have to
|
||||
# release and re-checkout any working directories of these modules.
|
||||
#
|
||||
# And "directory" is a path to a directory relative to $CVSROOT.
|
||||
#
|
||||
# The "-a" option specifies an alias. An alias is interpreted as if
|
||||
# everything on the right of the "-a" had been typed on the command line.
|
||||
#
|
||||
# You can encode a module within a module by using the special '&'
|
||||
# character to interpose another module into the current module. This
|
||||
# can be useful for creating a module that consists of many directories
|
||||
# spread out over the entire source repository.
|
||||
|
||||
ClientSourceProduct -a \
|
||||
ClientSourceProductWin \
|
||||
ClientSourceProductMac \
|
||||
ClientSourceProductUnix \
|
||||
|
||||
ClientSourceProductWin -a MozillaCommon MozillaWinOnly
|
||||
|
||||
ClientSourceProductMac -a MozillaCommon MozillaMacOnly
|
||||
|
||||
ClientSourceProductUnix -a MozillaCommon MozillaUnixOnly
|
||||
|
||||
MozillaCommon -a \
|
||||
ns/LEGAL \
|
||||
ns/LICENSE \
|
||||
ns/build \
|
||||
ns/include \
|
||||
ns/jpeg \
|
||||
ns/js \
|
||||
ns/lib/htmldlgs \
|
||||
ns/lib/layout \
|
||||
ns/lib/libcnv \
|
||||
ns/lib/libi18n \
|
||||
ns/lib/liblayer \
|
||||
ns/lib/libmisc \
|
||||
ns/lib/libmime \
|
||||
ns/lib/libmocha \
|
||||
ns/lib/libnet \
|
||||
ns/lib/libparse \
|
||||
ns/lib/libpics \
|
||||
ns/lib/libpwcac \
|
||||
ns/lib/libstyle \
|
||||
ns/lib/plugin \
|
||||
ns/lib/xlate \
|
||||
ns/lib/xp \
|
||||
ns/modules/edtplug/src \
|
||||
ns/modules/edtplug/include \
|
||||
ns/modules/libfont/classes \
|
||||
ns/modules/libfont/public \
|
||||
ns/modules/libfont/src \
|
||||
ns/modules/libhook \
|
||||
ns/modules/libimg \
|
||||
ns/modules/libpref \
|
||||
ns/modules/libreg \
|
||||
ns/modules/libutil \
|
||||
ns/modules/progress/src \
|
||||
ns/modules/rdf \
|
||||
ns/modules/schedulr \
|
||||
ns/modules/security/freenav \
|
||||
ns/modules/zlib/src \
|
||||
ns/nav-java/stubs \
|
||||
ns/nsprpub \
|
||||
ns/xpcom \
|
||||
ns/l10n \
|
||||
ns/nsprpub \
|
||||
ns/dbm \
|
||||
ns/modules/schedulr
|
||||
|
||||
MozillaWinOnly -a \
|
||||
ns/client.mak \
|
||||
ns/cmd/makefile.win \
|
||||
ns/cmd/wincom \
|
||||
ns/cmd/winfe \
|
||||
ns/config \
|
||||
ns/lib/makefile.win \
|
||||
ns/modules/coreincl \
|
||||
ns/modules/edtplug/makefile.win \
|
||||
ns/makefile.win \
|
||||
ns/modules/libfont/jmcgen \
|
||||
ns/modules/libfont/makefile.win \
|
||||
ns/modules/libfont/producers/makefile.win \
|
||||
ns/modules/libfont/producers/win \
|
||||
ns/modules/libfont/producers/win/classes \
|
||||
ns/modules/libfont/producers/win/classes/netscape \
|
||||
ns/modules/libfont/producers/win/classes/netscape/fonts \
|
||||
ns/modules/libfont/producers/win/src \
|
||||
ns/modules/makefile.win \
|
||||
ns/modules/progress/makefile.win \
|
||||
ns/modules/progress/public \
|
||||
ns/modules/security/makefile.win \
|
||||
ns/modules/zlib/makefile.win \
|
||||
ns/nav-java/makefile.win \
|
||||
JavaStubWin
|
||||
|
||||
|
||||
MozillaUnixOnly -a \
|
||||
ns/cmd/Makefile \
|
||||
ns/cmd/stubfe \
|
||||
ns/cmd/xfe \
|
||||
ns/config/.cvsignore \
|
||||
ns/config/AIX.mk \
|
||||
ns/config/BSD_OS.mk \
|
||||
ns/config/bsdecho.c \
|
||||
ns/config/bsdecho.c \
|
||||
ns/config/clobber_miss.pl \
|
||||
ns/config/clobber_miss.pl \
|
||||
ns/config/common.mk \
|
||||
ns/config/common.mk \
|
||||
ns/config/config.guess \
|
||||
ns/config/config.mk \
|
||||
ns/config/coreconf.mk \
|
||||
ns/config/coreconf.mk \
|
||||
ns/config/cvsco.pl \
|
||||
ns/config/cvsco.pl \
|
||||
ns/config/fastcwd.pl \
|
||||
ns/config/fastcwd.pl \
|
||||
ns/config/FreeBSD.mk \
|
||||
ns/config/gtscc.c \
|
||||
ns/config/HP-UX.mk \
|
||||
ns/config/IRIX.mk \
|
||||
ns/config/Linux.mk \
|
||||
ns/config/makecopy.c \
|
||||
ns/config/makecopy.c \
|
||||
ns/config/Makefile \
|
||||
ns/config/Makefile \
|
||||
ns/config/mangle.c \
|
||||
ns/config/mangle.c \
|
||||
ns/config/mantomak.c \
|
||||
ns/config/mantomak.c \
|
||||
ns/config/mkdepend \
|
||||
ns/config/NCR.mk \
|
||||
ns/config/NEC.mk \
|
||||
ns/config/NEWS-OS.mk \
|
||||
ns/config/NEXTSTEP.mk \
|
||||
ns/config/nfspwd.pl \
|
||||
ns/config/nfspwd.pl \
|
||||
ns/config/nodl.pl \
|
||||
ns/config/nodl.pl \
|
||||
ns/config/nsinstall.c \
|
||||
ns/config/nsinstall.c \
|
||||
ns/config/OSF1.mk \
|
||||
ns/config/outofdate.pl \
|
||||
ns/config/outofdate.pl \
|
||||
ns/config/pathsub.c \
|
||||
ns/config/pathsub.c \
|
||||
ns/config/pathsub.h \
|
||||
ns/config/pathsub.h \
|
||||
ns/config/pkg2dpth.pl \
|
||||
ns/config/pkg2dpth.pl \
|
||||
ns/config/ports \
|
||||
ns/config/revdepth.pl \
|
||||
ns/config/revdepth.pl \
|
||||
ns/config/Rhapsody.mk \
|
||||
ns/config/rules.mk \
|
||||
ns/config/SCOOS.mk \
|
||||
ns/config/SINIX.mk \
|
||||
ns/config/sj.pl \
|
||||
ns/config/sj.pl \
|
||||
ns/config/SunOS.mk \
|
||||
ns/config/SunOS4.mk \
|
||||
ns/config/SunOS5.mk \
|
||||
ns/config/UNIXWARE.mk \
|
||||
ns/config/xmversion.sh \
|
||||
ns/lib/Makefile \
|
||||
ns/Makefile \
|
||||
ns/modules/edtplug/Makefile \
|
||||
ns/modules/libfont/jmcgen \
|
||||
ns/modules/libfont/Makefile \
|
||||
ns/modules/libfont/producers/Makefile \
|
||||
ns/modules/Makefile \
|
||||
ns/modules/progress/Makefile \
|
||||
ns/modules/progress/public \
|
||||
ns/modules/security/Makefile \
|
||||
ns/modules/softupdt/Makefile \
|
||||
ns/modules/zlib/Makefile \
|
||||
ns/nav-java/Makefile \
|
||||
ns/lib/mariner \
|
||||
JavaStubUnix
|
||||
|
||||
|
||||
MozillaMacOnly -a \
|
||||
ns/cmd/macfe \
|
||||
ns/lib/mac/AutoAdmin \
|
||||
ns/lib/mac/Includes \
|
||||
ns/lib/mac/MacMemoryAllocator \
|
||||
ns/lib/mac/Misc \
|
||||
ns/lib/mac/MoreFiles \
|
||||
ns/lib/mac/NSRuntime \
|
||||
ns/lib/mac/NSStdLib \
|
||||
ns/lib/mac/patches \
|
||||
ns/lib/mac/PowerPlant \
|
||||
ns/lib/mac/UserInterface \
|
||||
ns/modules/coreincl \
|
||||
ns/modules/edtplug/classes \
|
||||
ns/modules/edtplug/macbuild \
|
||||
ns/modules/libfont/jmcgen/include \
|
||||
ns/modules/libfont/jmcgen/src \
|
||||
ns/modules/libfont/macbuild \
|
||||
ns/modules/progress/macbuild \
|
||||
ns/modules/progress/public \
|
||||
ns/modules/zlib/macbuild \
|
||||
ns/lib/mariner \
|
||||
JavaStubMac
|
||||
|
||||
JavaStubAll -a \
|
||||
JavaStubWin \
|
||||
JavaStubMac \
|
||||
JavaStubUnix
|
||||
|
||||
JavaStubCore -a \
|
||||
ns/sun-java/stubs/include \
|
||||
ns/sun-java/stubs/src
|
||||
|
||||
JavaStubMac -a \
|
||||
JavaStubCore \
|
||||
ns/sun-java/stubs/macbuild \
|
||||
ns/sun-java/stubs/macjri
|
||||
|
||||
JavaStubUnix -a \
|
||||
JavaStubCore \
|
||||
ns/sun-java/Makefile \
|
||||
ns/sun-java/stubs/jri \
|
||||
ns/sun-java/stubs/Makefile
|
||||
|
||||
JavaStubWin -a \
|
||||
JavaStubCore \
|
||||
ns/sun-java/makefile.win \
|
||||
ns/sun-java/stubs/jri \
|
||||
ns/sun-java/stubs/makefile.win
|
||||
|
||||
|
||||
|
||||
50
mozilla/cmd/macfe/central/CSecureAttachment.cp
Normal file
50
mozilla/cmd/macfe/central/CSecureAttachment.cp
Normal file
@@ -0,0 +1,50 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
// CSecureAttachment.cp
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CSecureAttachment.h"
|
||||
#include "xp_core.h"
|
||||
#include "secnav.h"
|
||||
#include "secrng.h"
|
||||
|
||||
CSecureAttachment::CSecureAttachment()
|
||||
: LAttachment(msg_Event)
|
||||
{
|
||||
mTickCounter = 0;
|
||||
}
|
||||
|
||||
|
||||
void CSecureAttachment::ExecuteSelf(
|
||||
MessageT inMessage,
|
||||
void *ioParam)
|
||||
{
|
||||
if (mTickCounter < 500)
|
||||
{
|
||||
EventRecord* theEvent = (EventRecord*)ioParam;
|
||||
RNG_RandomUpdate(theEvent, sizeof(EventRecord));
|
||||
long ticks = ::TickCount();
|
||||
RNG_RandomUpdate(&ticks, sizeof(long));
|
||||
mTickCounter++;
|
||||
}
|
||||
else
|
||||
delete this;
|
||||
}
|
||||
|
||||
4266
mozilla/cmd/macfe/central/uapp.cp
Normal file
4266
mozilla/cmd/macfe/central/uapp.cp
Normal file
File diff suppressed because it is too large
Load Diff
3875
mozilla/cmd/winfe/fegui.cpp
Executable file
3875
mozilla/cmd/winfe/fegui.cpp
Executable file
File diff suppressed because it is too large
Load Diff
2031
mozilla/cmd/winfe/nsapp.cpp
Normal file
2031
mozilla/cmd/winfe/nsapp.cpp
Normal file
File diff suppressed because it is too large
Load Diff
123
mozilla/cmd/winfe/stdafx.h
Normal file
123
mozilla/cmd/winfe/stdafx.h
Normal file
@@ -0,0 +1,123 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef STDAFX_PCH
|
||||
#define STDAFX_PCH
|
||||
|
||||
#define OEMRESOURCE
|
||||
|
||||
#if defined(DEBUG_blythe)
|
||||
// Set up a flag specific to WFE developers in the client
|
||||
#define DEBUG_WFE
|
||||
#endif
|
||||
|
||||
/* Very windows specific includes.
|
||||
*/
|
||||
/* MFC, KFC, RUN DMC, whatever */
|
||||
#include <afxwin.h>
|
||||
#include <afxext.h>
|
||||
#include <afxpriv.h>
|
||||
#include <afxole.h>
|
||||
#include <afxdisp.h>
|
||||
#include <afxodlgs.h>
|
||||
#ifdef _WIN32
|
||||
#include <afxcmn.h>
|
||||
#endif
|
||||
|
||||
/* More XP than anything */
|
||||
#include "xp.h"
|
||||
#include "fe_proto.h"
|
||||
#include "fe_rgn.h"
|
||||
#include "libi18n.h"
|
||||
#include "xlate.h"
|
||||
#include "ntypes.h"
|
||||
#ifdef EDITOR
|
||||
#include "edttypes.h"
|
||||
#endif
|
||||
#include "xpassert.h"
|
||||
#include "lo_ele.h"
|
||||
#include "layers.h"
|
||||
|
||||
/* Standard C includes */
|
||||
#ifndef _WIN32
|
||||
#include <dos.h>
|
||||
#endif
|
||||
#include <malloc.h>
|
||||
#include <direct.h>
|
||||
#include <stdarg.h>
|
||||
#include <time.h>
|
||||
#include <io.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#ifdef DEBUG
|
||||
#include <assert.h>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
/* Very windows specific includes.
|
||||
*/
|
||||
/* WFE needs a layout file */
|
||||
extern "C" {
|
||||
#include "layout.h"
|
||||
}
|
||||
|
||||
/* Some common defines. */
|
||||
#ifndef _AFXDLL
|
||||
#define new DEBUG_NEW
|
||||
#endif
|
||||
|
||||
/* All front end forward declarations needed to compile. */
|
||||
#include "forward.h"
|
||||
|
||||
/* Front end Casting macros. */
|
||||
#include "cast.h"
|
||||
|
||||
/* General purpose utilities. */
|
||||
#include "feutil.h"
|
||||
|
||||
/* afxData/sysInfo */
|
||||
#include "sysinfo.h"
|
||||
|
||||
/* Some defines we like everywhere. */
|
||||
#include "resource.h"
|
||||
#include "defaults.h"
|
||||
|
||||
/* The application include and
|
||||
* Commonly used, rarely changed headers */
|
||||
#include "ncapiurl.h"
|
||||
#include "genedit.h"
|
||||
#include "genframe.h"
|
||||
#include "genview.h"
|
||||
#include "gendoc.h"
|
||||
#include "intlwin.h"
|
||||
#include "mozilla.h"
|
||||
#include "cxwin.h"
|
||||
#include "winproto.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef assert
|
||||
#undef assert
|
||||
#endif
|
||||
#define assert(x) ASSERT(x)
|
||||
#endif
|
||||
|
||||
#endif /* STDAFX_PCH */
|
||||
3284
mozilla/cmd/xfe/icons.c
Normal file
3284
mozilla/cmd/xfe/icons.c
Normal file
File diff suppressed because it is too large
Load Diff
5212
mozilla/cmd/xfe/mozilla.c
Normal file
5212
mozilla/cmd/xfe/mozilla.c
Normal file
File diff suppressed because it is too large
Load Diff
2654
mozilla/cmd/xfe/pref_helpers.c
Normal file
2654
mozilla/cmd/xfe/pref_helpers.c
Normal file
File diff suppressed because it is too large
Load Diff
874
mozilla/cmd/xfe/prefdialogs.c
Normal file
874
mozilla/cmd/xfe/prefdialogs.c
Normal file
@@ -0,0 +1,874 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
/*
|
||||
dialogs.c --- Preference dialogs.
|
||||
Created: Spence Murray <spence@netscape.com>, 30-Sep-95.
|
||||
*/
|
||||
|
||||
|
||||
#define PREFS_NET
|
||||
#define PREFS_SOCKS
|
||||
#define PREFS_DISK_CACHE
|
||||
#define PREFS_VERIFY
|
||||
#define PREFS_CLEAR_CACHE_BUTTONS
|
||||
#define PREFS_SIG
|
||||
#define PREFS_NEWS_MAX
|
||||
#define PREFS_8BIT
|
||||
/* #define PREFS_EMPTY_TRASH */
|
||||
/* #define PREFS_QUEUED_DELIVERY */
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "mozilla.h"
|
||||
#include "xlate.h"
|
||||
#include "xfe.h"
|
||||
#include "felocale.h"
|
||||
#include "nslocks.h"
|
||||
#include "secnav.h"
|
||||
#include "cert.h"
|
||||
#include "mozjava.h"
|
||||
#include "prnetdb.h"
|
||||
#include "e_kit.h"
|
||||
#include "pref_helpers.h"
|
||||
|
||||
#include "libmocha.h"
|
||||
|
||||
#include <Xm/Label.h>
|
||||
#include <Xm/CascadeBG.h>
|
||||
#include <Xm/PanedW.h>
|
||||
#include <Xm/PushB.h>
|
||||
#include <Xm/ToggleB.h>
|
||||
|
||||
#include <Xm/ArrowBG.h>
|
||||
|
||||
#ifndef _STDC_
|
||||
#define _STDC_ 1
|
||||
#define HACKED_STDC 1
|
||||
#endif
|
||||
|
||||
#include <XmL/Folder.h>
|
||||
|
||||
#ifdef HACKED_STDC
|
||||
#undef HACKED_STDC
|
||||
#undef _STDC_
|
||||
#endif
|
||||
|
||||
#include "msgcom.h"
|
||||
|
||||
#include "libimg.h" /* Image Library public API. */
|
||||
|
||||
|
||||
/* For sys_errlist and sys_nerr */
|
||||
#include <sys/errno.h>
|
||||
#if !defined(__FreeBSD__) && !defined(LINUX_GLIBC_2)
|
||||
extern char *sys_errlist[];
|
||||
extern int sys_nerr;
|
||||
#endif
|
||||
|
||||
#include "prprf.h"
|
||||
#include "libi18n.h"
|
||||
#include "fonts.h"
|
||||
|
||||
|
||||
/* for XP_GetString() */
|
||||
#include <xpgetstr.h>
|
||||
extern int XFE_UNKNOWN_ERROR;
|
||||
|
||||
extern int XFE_FILE_DOES_NOT_EXIST;
|
||||
extern int XFE_FTP_PROXY_HOST;
|
||||
#ifdef MOZ_MAIL_NEWS
|
||||
extern int XFE_GLOBAL_MAILCAP_FILE;
|
||||
extern int XFE_GLOBAL_MIME_FILE;
|
||||
#endif
|
||||
extern int XFE_GOPHER_PROXY_HOST;
|
||||
extern int XFE_HOST_IS_UNKNOWN;
|
||||
extern int XFE_HTTPS_PROXY_HOST;
|
||||
extern int XFE_HTTP_PROXY_HOST;
|
||||
extern int XFE_NO_PORT_NUMBER;
|
||||
#ifdef MOZ_MAIL_NEWS
|
||||
extern int XFE_MAIL_HOST;
|
||||
extern int XFE_NEWS_HOST;
|
||||
extern int XFE_NEWS_RC_DIRECTORY;
|
||||
extern int XFE_PRIVATE_MAILCAP_FILE;
|
||||
extern int XFE_PRIVATE_MIME_FILE;
|
||||
#endif
|
||||
extern int XFE_SOCKS_HOST;
|
||||
extern int XFE_TEMP_DIRECTORY;
|
||||
extern int XFE_WAIS_PROXY_HOST;
|
||||
extern int XFE_WARNING;
|
||||
extern int XFE_ERROR_SAVING_OPTIONS;
|
||||
extern int XFE_GENERAL;
|
||||
extern int XFE_PASSWORDS;
|
||||
extern int XFE_PERSONAL_CERTIFICATES;
|
||||
extern int XFE_SITE_CERTIFICATES;
|
||||
extern int XFE_APPEARANCE;
|
||||
extern int XFE_BOOKMARKS;
|
||||
extern int XFE_COLORS;
|
||||
extern int XFE_FONTS;
|
||||
extern int XFE_APPLICATIONS;
|
||||
extern int XFE_HELPERS;
|
||||
extern int XFE_IMAGES;
|
||||
extern int XFE_LANGUAGES;
|
||||
extern int XFE_CACHE;
|
||||
extern int XFE_CONNECTIONS;
|
||||
extern int XFE_PROXIES;
|
||||
extern int XFE_PROTOCOLS;
|
||||
extern int XFE_LANG;
|
||||
extern int XFE_APPEARANCE;
|
||||
extern int XFE_COMPOSE_DLG;
|
||||
extern int XFE_SERVERS;
|
||||
extern int XFE_IDENTITY;
|
||||
extern int XFE_ORGANIZATION;
|
||||
extern int XFE_CHANGE_PASSWORD;
|
||||
extern int XFE_SET_PASSWORD;
|
||||
#ifdef MOZ_MAIL_NEWS
|
||||
extern int XFE_PRIVATE_MIMETYPE_RELOAD;
|
||||
extern int XFE_PRIVATE_MAILCAP_RELOAD;
|
||||
extern int XFE_PRIVATE_RELOADED_MIMETYPE;
|
||||
extern int XFE_PRIVATE_RELOADED_MAILCAP;
|
||||
#endif
|
||||
|
||||
extern void fe_installGeneralAppearance(void);
|
||||
extern void fe_installGeneralFonts(void);
|
||||
extern void fe_installGeneralColors(void);
|
||||
extern void fe_installGeneralAdvanced(void);
|
||||
extern void fe_installGeneralPasswd(void);
|
||||
extern void fe_installGeneralCache(void);
|
||||
extern void fe_installGeneralProxies(void);
|
||||
extern void fe_installBrowser(void);
|
||||
extern void fe_installBrowserAppl(void);
|
||||
#ifdef MOZ_MAIL_NEWS
|
||||
extern void fe_installMailNews(void);
|
||||
extern void fe_installMailNewsIdentity(void);
|
||||
extern void fe_installMailNewsComposition(void);
|
||||
extern void fe_installMailNewsMserver(void);
|
||||
extern void fe_installMailNewsNserver(void);
|
||||
extern void fe_installMailNewsAddrBook(void);
|
||||
extern void fe_installOfflineNews(void);
|
||||
extern void fe_installMserverMore(void);
|
||||
#endif
|
||||
extern void fe_installProxiesView(void);
|
||||
extern void fe_installDiskMore(void);
|
||||
extern void fe_installSslConfig(void);
|
||||
extern void fe_installOffline(void);
|
||||
extern void fe_installDiskSpace(void);
|
||||
|
||||
/* Preferences
|
||||
*/
|
||||
|
||||
struct fe_prefs_data
|
||||
{
|
||||
MWContext *context;
|
||||
|
||||
Widget shell, form;
|
||||
Widget promptDialog;
|
||||
|
||||
/*=== General prefs folder ===*/
|
||||
Widget general_form;
|
||||
|
||||
/* Appearance page */
|
||||
Widget styles1_selector, styles1_page;
|
||||
Widget icons_p, text_p, both_p, tips_p;
|
||||
Widget browser_p, mail_p, news_p;
|
||||
Widget blank_p, home_p, home_text;
|
||||
Widget underline_p;
|
||||
Widget expire_days_p, expire_days_text, never_expire_p;
|
||||
|
||||
/* Applications page */
|
||||
Widget apps_selector, apps_page;
|
||||
Widget tmp_text;
|
||||
Widget telnet_text, tn3270_text, rlogin_text, rlogin_user_text;
|
||||
|
||||
#if 0
|
||||
/* Bookmarks page */
|
||||
Widget bookmarks_selector, bookmarks_page;
|
||||
Widget book_text;
|
||||
#endif
|
||||
|
||||
/* Colors page */
|
||||
Widget colors_selector, colors_page;
|
||||
|
||||
/* Fonts page */
|
||||
Widget fonts_selector, fonts_page;
|
||||
Widget prop_family_pulldown, fixed_family_pulldown;
|
||||
Widget prop_family_option, fixed_family_option;
|
||||
Widget prop_size_pulldown, fixed_size_pulldown;
|
||||
Widget prop_size_option, fixed_size_option;
|
||||
Widget prop_size_field, fixed_size_field;
|
||||
Widget prop_size_toggle, fixed_size_toggle;
|
||||
int fonts_changed;
|
||||
|
||||
/* Helpers page */
|
||||
Widget helpers_selector, helpers_page;
|
||||
int helpers_changed;
|
||||
|
||||
struct fe_prefs_helpers_data *helpers;
|
||||
|
||||
/* Images page */
|
||||
Widget images_selector, images_page;
|
||||
Widget auto_p, dither_p, closest_p;
|
||||
Widget while_loading_p, after_loading_p;
|
||||
|
||||
/* Languages page */
|
||||
Widget languages_selector, languages_page;
|
||||
Widget lang_reg_avail, lang_reg_pref, lang_reg_text;
|
||||
Widget tmpDefaultButton;
|
||||
|
||||
/*=== Mail/News prefs folder ===*/
|
||||
Widget mailnews_form;
|
||||
|
||||
/* Appearance page */
|
||||
Widget appearance_selector, appearance_page;
|
||||
Widget fixed_message_font_p, var_message_font_p;
|
||||
Widget cite_plain_p, cite_bold_p, cite_italic_p, cite_bold_italic_p;
|
||||
Widget cite_normal_p, cite_bigger_p, cite_smaller_p;
|
||||
Widget cite_color_text;
|
||||
Widget mail_horiz_p, mail_vert_p, mail_stack_p;
|
||||
Widget news_horiz_p, news_vert_p, news_stack_p;
|
||||
Widget msgwin_use_mailwin_p, msgwin_use_new_p, msgwin_use_existing_p;
|
||||
|
||||
/* Compose page */
|
||||
Widget compose_selector, compose_page;
|
||||
Widget eightbit_toggle, qp_toggle;
|
||||
Widget deliverAuto_toggle, deliverQ_toggle;
|
||||
Widget mMailOutSelf_toggle, mMailOutOther_text;
|
||||
Widget nMailOutSelf_toggle, nMailOutOther_text;
|
||||
Widget mCopyOut_text;
|
||||
Widget nCopyOut_text;
|
||||
Widget autoquote_toggle;
|
||||
|
||||
/* Servers page */
|
||||
Widget dirs_selector, dirs_page;
|
||||
Widget srvr_text, user_text;
|
||||
Widget pop_toggle;
|
||||
Widget movemail_text;
|
||||
Widget external_toggle, builtin_toggle;
|
||||
Widget no_limit, msg_limit, limit_text;
|
||||
Widget msg_remove, msg_leave;
|
||||
Widget check_every, check_never, check_text;
|
||||
Widget smtp_text, maildir_text;
|
||||
Widget newshost_text, newsrc_text, newsmax_text;
|
||||
|
||||
/* Identity page */
|
||||
Widget identity_selector, identity_page;
|
||||
Widget user_name_text, user_mail_text, user_org_text, user_sig_text;
|
||||
|
||||
/* Organization page */
|
||||
Widget organization_selector, organization_page;
|
||||
Widget emptyTrash_toggle, rememberPswd_toggle;
|
||||
Widget threadmail_toggle, threadnews_toggle;
|
||||
Widget mdate_toggle, mnum_toggle, msubject_toggle, msender_toggle;
|
||||
Widget ndate_toggle, nnum_toggle, nsubject_toggle, nsender_toggle;
|
||||
|
||||
/*=== Network prefs folder ===*/
|
||||
Widget network_form;
|
||||
|
||||
/* Cache page */
|
||||
Widget cache_selector, cache_page;
|
||||
Widget memory_text, memory_clear;
|
||||
Widget disk_text, disk_dir, disk_clear;
|
||||
Widget verify_label, once_p, every_p, expired_p;
|
||||
Widget cache_ssl_p;
|
||||
|
||||
/* Nework page */
|
||||
Widget network_selector, network_page;
|
||||
Widget buf_label, buf_text;
|
||||
Widget conn_label, conn_text;
|
||||
|
||||
/* Proxies page */
|
||||
Widget proxies_selector, proxies_page;
|
||||
Widget no_proxies_p, manual_p, manual_browse;
|
||||
Widget auto_proxies_p, proxy_label, proxy_text;
|
||||
Widget proxy_reload;
|
||||
|
||||
Widget ftp_text, ftp_port;
|
||||
Widget gopher_text, gopher_port;
|
||||
Widget http_text, http_port;
|
||||
Widget https_text, https_port;
|
||||
Widget wais_text, wais_port;
|
||||
Widget no_text;
|
||||
Widget socks_text, socks_port;
|
||||
|
||||
/* Protocols page */
|
||||
Widget protocols_selector, protocols_page;
|
||||
Widget cookie_p; /* Show alert before accepting a cookie */
|
||||
Widget anon_ftp_p; /* Use email address for anon ftp */
|
||||
Widget email_form_p; /* Show alert before submiting a form by email */
|
||||
|
||||
/* Languages page */
|
||||
Widget lang_selector, lang_page;
|
||||
#ifdef JAVA
|
||||
Widget java_toggle;
|
||||
#endif
|
||||
|
||||
Widget javascript_toggle;
|
||||
|
||||
/*=== Security prefs folder ===*/
|
||||
Widget security_form;
|
||||
|
||||
/* General Security page */
|
||||
Widget sec_general_selector, sec_general_page;
|
||||
Widget enter_toggle, leave_toggle, mixed_toggle, submit_toggle;
|
||||
Widget ssl2_toggle, ssl3_toggle;
|
||||
|
||||
/* Security Passwords page */
|
||||
Widget sec_passwords_selector, sec_passwords_page;
|
||||
Widget once_toggle, every_toggle, periodic_toggle;
|
||||
Widget periodic_text, change_password;
|
||||
#ifdef FORTEZZA
|
||||
Widget fortezza_toggle, fortezza_timeout;
|
||||
#endif
|
||||
|
||||
/* Personal Certificates page */
|
||||
Widget personal_selector, personal_page;
|
||||
Widget pers_list, pers_info, pers_delete_cert, pers_new_cert;
|
||||
Widget site_default, pers_label;
|
||||
Widget pers_cert_menu;
|
||||
char *deleted_user_cert;
|
||||
|
||||
/* Site Certificates page */
|
||||
Widget site_selector, site_page;
|
||||
Widget all_list, all_edit_cert, all_delete_cert;
|
||||
Widget all_label;
|
||||
char *deleted_site_cert;
|
||||
};
|
||||
|
||||
void
|
||||
FE_SetPasswordAskPrefs(MWContext *context, int askPW, int timeout)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
FE_SetPasswordEnabled(MWContext *context, PRBool usePW)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
fe_MarkHelpersModified(MWContext *context)
|
||||
{
|
||||
/* Mark that the helpers have been modified. We need this
|
||||
* to detect if we need to save/reload all these helpers.
|
||||
* For doing this, the condition we adopt is
|
||||
* (1) User clicked on 'OK' button for the Edit Helpers Dialog
|
||||
* This also covers the "New" case as the same Dialog
|
||||
* is shown for the "New" and "Edit".
|
||||
* (2) User deleted a mime/type and confirmed it.
|
||||
*/
|
||||
if (context && CONTEXT_DATA(context)->fep)
|
||||
CONTEXT_DATA(context)->fep->helpers_changed = TRUE;
|
||||
}
|
||||
|
||||
|
||||
const char *multiline_continuator = "\t\t\n";
|
||||
/*
|
||||
* This belongs in a utility module
|
||||
*
|
||||
* Convert an array of strings
|
||||
* to multiline string (embedded new-lines)
|
||||
*
|
||||
* returns a string built up from the array
|
||||
*
|
||||
* The caller must free the array
|
||||
*/
|
||||
char *
|
||||
array_to_multiline_str(char **array, int cnt)
|
||||
{
|
||||
char *mstring, *p;
|
||||
int i, str_len;
|
||||
|
||||
/*
|
||||
* Handle an empty array
|
||||
*/
|
||||
if (cnt == 0) {
|
||||
/* always allocate an array so the caller can free it */
|
||||
mstring = strdup("\n");
|
||||
return mstring;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the length of the multiline string
|
||||
*/
|
||||
str_len = 0;
|
||||
for (i=0; i<cnt; i++) {
|
||||
if (i != 0)
|
||||
str_len += strlen(multiline_continuator);
|
||||
str_len += strlen(array[i]);
|
||||
}
|
||||
str_len += 2; /* space for new-line and terminator */
|
||||
mstring = (char *)XP_ALLOC(str_len);
|
||||
|
||||
for (p=mstring, i=0; i<cnt; i++) {
|
||||
if (i != 0) {
|
||||
strcpy(p, multiline_continuator);
|
||||
p += strlen(multiline_continuator);
|
||||
}
|
||||
strcpy(p, array[i]);
|
||||
p += strlen(array[i]);
|
||||
}
|
||||
/*
|
||||
* Note: don't add a final line-feed for multiline
|
||||
* as the prefs_write_string() function handles it funny
|
||||
*/
|
||||
return mstring;
|
||||
}
|
||||
|
||||
/*
|
||||
* This belongs in a utility module
|
||||
*
|
||||
* Convert an array of strings
|
||||
* to multiline preference (embedded new-lines)
|
||||
*
|
||||
* returns a preference value string built up from the array
|
||||
*
|
||||
* The caller must free the array
|
||||
*/
|
||||
char *
|
||||
array_to_multiline_pref(char **array, int cnt)
|
||||
{
|
||||
char *string;
|
||||
string = array_to_multiline_str(array, cnt);
|
||||
return string;
|
||||
}
|
||||
|
||||
/*
|
||||
* This belongs in a utility module
|
||||
*
|
||||
* Convert a multiline string (embedded new-lines)
|
||||
* to an array of strings
|
||||
* create the array
|
||||
* copies the lines into the array
|
||||
* returns length of the array
|
||||
*
|
||||
* To free the array:
|
||||
* for (i=0; i<cnt; i++)
|
||||
* XP_FREE(array[i]);
|
||||
* XP_FREE(array);
|
||||
*/
|
||||
int
|
||||
multiline_str_to_array(const char *string, char ***array_p)
|
||||
{
|
||||
char *p, *q, **array;
|
||||
int i, cnt, len;
|
||||
Boolean at_start_of_line;
|
||||
|
||||
/* handle null string */
|
||||
if (string == NULL) {
|
||||
/* always allocate an array so the caller can free it */
|
||||
array = (char **)XP_ALLOC(sizeof(char *));
|
||||
array[0] = NULL;
|
||||
*array_p = array;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* count the number of lines
|
||||
* (count beginnings so we will count any last line without a '\n')
|
||||
* This supports multibyte text only because '\n' is less than 0x40
|
||||
*/
|
||||
cnt = 0;
|
||||
at_start_of_line = True;
|
||||
for (p=(char *)string; *p; p++) {
|
||||
if (at_start_of_line) {
|
||||
cnt += 1;
|
||||
at_start_of_line = False;
|
||||
}
|
||||
if (*p == '\n') {
|
||||
at_start_of_line = True;
|
||||
}
|
||||
}
|
||||
|
||||
/* copy lines into the array */
|
||||
array = (char **)XP_ALLOC((cnt+1) * sizeof(char *));
|
||||
i = 0;
|
||||
len = 0;
|
||||
for (p=q=(char *)string; *p; p++) {
|
||||
if (*p == '\n') {
|
||||
array[i] = (char *)XP_ALLOC(len+1);
|
||||
strncpy(array[i], q, len);
|
||||
/* add a string terminator */
|
||||
array[i][len] = '\0';
|
||||
i += 1;
|
||||
len = 0;
|
||||
q = p + 1;
|
||||
}
|
||||
else
|
||||
len += 1;
|
||||
}
|
||||
if (len) { /* include ending chars with no newline */
|
||||
array[i] = (char *)XP_ALLOC(len+1);
|
||||
strncpy(array[i], q, len);
|
||||
/* add a string terminator */
|
||||
array[i][len] = '\0';
|
||||
}
|
||||
|
||||
*array_p = array;
|
||||
return cnt;
|
||||
}
|
||||
|
||||
/*
|
||||
* This belongs in a utility module
|
||||
*
|
||||
* Convert a multiline preference (embedded new-lines)
|
||||
* to an array of strings
|
||||
* create the array
|
||||
* copies the lines into the array
|
||||
* remove leading/trailing white space
|
||||
* remove blank lines
|
||||
* returns length of the array
|
||||
*
|
||||
* To free the array:
|
||||
* for (i=0; i<cnt; i++)
|
||||
* XP_FREE(array[i]);
|
||||
* XP_FREE(array);
|
||||
*/
|
||||
int
|
||||
multiline_pref_to_array(const char *string, char ***array_p)
|
||||
{
|
||||
int i, j, cnt;
|
||||
char **array;
|
||||
|
||||
/*
|
||||
* Convert the multiline string to an array
|
||||
* (with leading/trailing white space and blank lines)
|
||||
*/
|
||||
cnt = multiline_str_to_array(string, array_p);
|
||||
|
||||
/*
|
||||
* trim any leading/training white space
|
||||
*/
|
||||
array = *array_p;
|
||||
for (i=0; i<cnt; i++) {
|
||||
char *tmp;
|
||||
tmp = XP_StripLine(array[i]);
|
||||
/* we can't lose the malloc address else free will fail */
|
||||
/* so if there was white space at the beginning we make a copy */
|
||||
if (tmp != array[i]) {
|
||||
char *tmp2 = array[i];
|
||||
array[i] = strdup(tmp);
|
||||
XP_FREE(tmp2);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* remove any blank lines
|
||||
*/
|
||||
for (i=0; i<cnt; i++) {
|
||||
if (array[i][0] == '\0') {
|
||||
XP_FREE(array[i]);
|
||||
for (j=i+1; j<cnt; j++)
|
||||
array[j-1] = array[j];
|
||||
cnt -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
return cnt;
|
||||
}
|
||||
|
||||
IL_DitherMode
|
||||
fe_pref_string_to_dither_mode (char *s)
|
||||
{
|
||||
if (!XP_STRCASECMP(s, "True") || !XP_STRCASECMP(s, "Dither"))
|
||||
return IL_Dither;
|
||||
else if (!XP_STRCASECMP(s, "False") || !XP_STRCASECMP(s, "ClosestColor"))
|
||||
return IL_ClosestColor;
|
||||
|
||||
/* In the absence of a reasonable value, dithering is auto-selected */
|
||||
return IL_Auto;
|
||||
}
|
||||
|
||||
#ifdef MOZ_MAIL_NEWS
|
||||
void
|
||||
fe_SetMailNewsSortBehavior(MWContext* context, XP_Bool thread, int sortcode)
|
||||
{
|
||||
XP_ASSERT(context->type == MWContextMail || context->type == MWContextNews);
|
||||
if (context->type == MWContextMail || context->type == MWContextNews) {
|
||||
if (thread) {
|
||||
MSG_SetToggleStatus(ACTIVE_MAILTAB(context)->threadpane, MSG_SortByThread, NULL, 0,
|
||||
thread ? MSG_Checked : MSG_Unchecked);
|
||||
} else {
|
||||
switch (sortcode) {
|
||||
case 0:
|
||||
MSG_Command(ACTIVE_MAILTAB(context)->threadpane, MSG_SortByDate, NULL, 0);
|
||||
break;
|
||||
case 1:
|
||||
MSG_Command(ACTIVE_MAILTAB(context)->threadpane, MSG_SortByMessageNumber, NULL, 0);
|
||||
break;
|
||||
case 2:
|
||||
MSG_Command(ACTIVE_MAILTAB(context)->threadpane, MSG_SortBySubject, NULL, 0);
|
||||
break;
|
||||
case 3:
|
||||
MSG_Command(ACTIVE_MAILTAB(context)->threadpane, MSG_SortBySender, NULL, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
fe_InstallPreferences (MWContext *context)
|
||||
{
|
||||
/* This function is called from main() */
|
||||
|
||||
fe_installGeneralAppearance();
|
||||
fe_installGeneralFonts();
|
||||
fe_installGeneralColors();
|
||||
fe_installGeneralAdvanced();
|
||||
fe_installGeneralPasswd();
|
||||
fe_installGeneralCache();
|
||||
fe_installGeneralProxies();
|
||||
fe_installDiskSpace();
|
||||
|
||||
fe_installBrowser();
|
||||
fe_installBrowserAppl();
|
||||
|
||||
#ifdef MOZ_MAIL_NEWS
|
||||
fe_installMailNews();
|
||||
fe_installMailNewsIdentity();
|
||||
fe_installMailNewsComposition();
|
||||
fe_installMailNewsMserver();
|
||||
fe_installMailNewsNserver();
|
||||
fe_installMailNewsAddrBook();
|
||||
#endif
|
||||
|
||||
fe_installOffline();
|
||||
#ifdef MOZ_MAIL_NEWS
|
||||
fe_installOfflineNews();
|
||||
fe_installMserverMore();
|
||||
#endif
|
||||
|
||||
fe_installProxiesView();
|
||||
fe_installSslConfig();
|
||||
fe_installDiskMore();
|
||||
|
||||
/* CACHE
|
||||
*/
|
||||
|
||||
/* spider begin */
|
||||
FE_SARCacheDir = fe_globalPrefs.sar_cache_dir ;
|
||||
/* spider end */
|
||||
NET_DontDiskCacheSSL(!fe_globalPrefs.cache_ssl_p);
|
||||
|
||||
/* bookmark_file
|
||||
*/
|
||||
|
||||
FE_GlobalHist = fe_globalPrefs.history_file;
|
||||
|
||||
/* NETWORK
|
||||
*/
|
||||
|
||||
NET_ChangeMaxNumberOfConnections (50);
|
||||
NET_ChangeMaxNumberOfConnectionsPerContext (fe_globalPrefs.max_connections);
|
||||
/* The unit for tcp buffer size is changed from kbyes to btyes */
|
||||
NET_ChangeSocketBufferSize (fe_globalPrefs.network_buffer_size);
|
||||
|
||||
/* NEWS
|
||||
*/
|
||||
|
||||
#ifdef MOZ_MAIL_NEWS
|
||||
NET_SetNumberOfNewsArticlesInListing (fe_globalPrefs.news_max_articles);
|
||||
NET_SetCacheXOVER (fe_globalPrefs.news_cache_xover);
|
||||
#endif
|
||||
|
||||
/* PROTOCOLS
|
||||
*/
|
||||
|
||||
#ifdef MOZ_MAIL_NEWS
|
||||
NET_WarnOnMailtoPost(fe_globalPrefs.email_submit);
|
||||
#endif
|
||||
|
||||
#ifdef FORTEZZA
|
||||
if (fe_globalPrefs.fortezza_toggle) {
|
||||
int timeout = fe_globalPrefs.fortezza_timeout;
|
||||
/* '0' minute timeout because 1 minute... still pretty darn fast */
|
||||
FortezzaSetTimeout(timeout ? timeout : 1);
|
||||
} else {
|
||||
FortezzaSetTimeout(0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
fe_GeneralPrefsDialog (MWContext *context)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
fe_MailNewsPrefsDialog (MWContext *context)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
fe_NetworkPrefsDialog (MWContext *context)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
fe_SecurityPrefsDialog (MWContext *context)
|
||||
{
|
||||
}
|
||||
|
||||
/* spider begin */
|
||||
void
|
||||
fe_VerifyDiskCache (MWContext *context)
|
||||
{
|
||||
|
||||
#ifdef PREFS_DISK_CACHE
|
||||
|
||||
static Boolean done = False;
|
||||
if (done) return;
|
||||
done = True;
|
||||
|
||||
if (fe_globalPrefs.disk_cache_size <= 0)
|
||||
return;
|
||||
|
||||
fe_VerifyDiskCacheExistence(context, fe_globalPrefs.cache_dir) ;
|
||||
|
||||
#endif /* PREFS_DISK_CACHE */
|
||||
|
||||
#ifdef PREFS_OLD_WAY
|
||||
#ifdef PREFS_DISK_CACHE
|
||||
struct stat st;
|
||||
char file [1024];
|
||||
char message [4000];
|
||||
static Boolean done = False;
|
||||
if (done) return;
|
||||
done = True;
|
||||
|
||||
if (fe_globalPrefs.disk_cache_size <= 0)
|
||||
return;
|
||||
|
||||
strcpy (file, fe_globalPrefs.cache_dir);
|
||||
if (file [strlen (file) - 1] == '/')
|
||||
file [strlen (file) - 1] = 0;
|
||||
|
||||
if (stat (file, &st))
|
||||
{
|
||||
/* Doesn't exist - try to create it. */
|
||||
if (mkdir (file, 0700))
|
||||
{
|
||||
/* Failed. */
|
||||
char *error = ((errno >= 0 && errno < sys_nerr)
|
||||
? sys_errlist [errno]
|
||||
: XP_GetString( XFE_UNKNOWN_ERROR));
|
||||
PR_snprintf (message, sizeof (message),
|
||||
fe_globalData.create_cache_dir_message,
|
||||
file, error);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Suceeded. */
|
||||
PR_snprintf (message, sizeof (message),
|
||||
fe_globalData.created_cache_dir_message, file);
|
||||
}
|
||||
}
|
||||
else if (! (st.st_mode & S_IFDIR))
|
||||
{
|
||||
/* Exists but isn't a directory. */
|
||||
PR_snprintf (message, sizeof (message),
|
||||
fe_globalData.cache_not_dir_message, file);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* The disk cache is ok! */
|
||||
*message = 0;
|
||||
}
|
||||
|
||||
if (*message)
|
||||
{
|
||||
PR_snprintf(message + strlen (message), sizeof (message),
|
||||
fe_globalData.cache_suffix_message,
|
||||
fe_globalPrefs.disk_cache_size, fe_progclass);
|
||||
FE_Alert (context, message);
|
||||
}
|
||||
#endif /* PREFS_DISK_CACHE */
|
||||
#endif /* PREFS_OLD_WAY */
|
||||
}
|
||||
|
||||
void
|
||||
fe_VerifySARDiskCache (MWContext *context)
|
||||
{
|
||||
|
||||
#ifdef PREFS_DISK_CACHE
|
||||
|
||||
fe_VerifyDiskCacheExistence(context, fe_globalPrefs.sar_cache_dir) ;
|
||||
|
||||
#endif /* PREFS_DISK_CACHE */
|
||||
}
|
||||
|
||||
void
|
||||
fe_VerifyDiskCacheExistence (MWContext *context, char * cache_directory)
|
||||
{
|
||||
|
||||
#ifdef PREFS_DISK_CACHE
|
||||
struct stat st;
|
||||
char file [1024];
|
||||
char message [4000];
|
||||
|
||||
if (!cache_directory)
|
||||
return ;
|
||||
|
||||
strcpy (file, cache_directory);
|
||||
if (file [strlen (file) - 1] == '/')
|
||||
file [strlen (file) - 1] = 0;
|
||||
|
||||
if (stat (file, &st))
|
||||
{
|
||||
/* Doesn't exist - try to create it. */
|
||||
if (mkdir (file, 0700))
|
||||
{
|
||||
/* Failed. */
|
||||
char *error = ((errno >= 0 && errno < sys_nerr)
|
||||
? sys_errlist [errno]
|
||||
: XP_GetString( XFE_UNKNOWN_ERROR));
|
||||
PR_snprintf (message, sizeof (message),
|
||||
fe_globalData.create_cache_dir_message,
|
||||
file, error);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Suceeded. */
|
||||
PR_snprintf (message, sizeof (message),
|
||||
fe_globalData.created_cache_dir_message, file);
|
||||
}
|
||||
}
|
||||
else if (! (st.st_mode & S_IFDIR))
|
||||
{
|
||||
/* Exists but isn't a directory. */
|
||||
PR_snprintf (message, sizeof (message),
|
||||
fe_globalData.cache_not_dir_message, file);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* The disk cache is ok! */
|
||||
*message = 0;
|
||||
}
|
||||
|
||||
if (*message)
|
||||
{
|
||||
PR_snprintf(message + strlen (message), sizeof (message),
|
||||
fe_globalData.cache_suffix_message,
|
||||
fe_globalPrefs.disk_cache_size, fe_progclass);
|
||||
FE_Alert (context, message);
|
||||
}
|
||||
#endif /* PREFS_DISK_CACHE */
|
||||
}
|
||||
|
||||
/* spider end */
|
||||
|
||||
2104
mozilla/include/net.h
Normal file
2104
mozilla/include/net.h
Normal file
File diff suppressed because it is too large
Load Diff
129
mozilla/include/shistele.h
Normal file
129
mozilla/include/shistele.h
Normal file
@@ -0,0 +1,129 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef SHISTELE_H
|
||||
#define SHISTELE_H
|
||||
|
||||
#include "xp_list.h"
|
||||
|
||||
/*
|
||||
** This structure holds pointer so all saved data in the history. It is
|
||||
** also used by URL_Structs and is ultimately fed to layout.
|
||||
**
|
||||
** Warning: Don't change the names of the fields because they're used by
|
||||
** macros.
|
||||
*/
|
||||
typedef struct SHIST_SavedData {
|
||||
void* FormList; /* layout data to recreate forms */
|
||||
void* EmbedList; /* layout data to recreate embeds and applets */
|
||||
void* Grid; /* layout data to recreate grids */
|
||||
#ifdef MOCHA
|
||||
void* Window; /* window object for grid being resized */
|
||||
|
||||
/* XXX none of this would be necessary if frameset docs were reparsed */
|
||||
void* OnLoad; /* JavaScript onload event handler source */
|
||||
void* OnUnload; /* JavaScript onunload event handler source */
|
||||
void* OnFocus; /* JavaScript onfocus event handler source */
|
||||
void* OnBlur; /* JavaScript onblur event handler source */
|
||||
void* OnHelp; /* JavaScript onhelp event handler source */
|
||||
void* OnMouseOver; /* JavaScript onmouseover event handler source */
|
||||
void* OnMouseOut; /* JavaScript onmouseout event handler source */
|
||||
void* OnDragDrop; /* JavaScript ondragdrop event handler source */
|
||||
void* OnMove; /* JavaScript onmove event handler source */
|
||||
void* OnResize; /* JavaScript onresize event handler source */
|
||||
void* style_stack; /* JSSS style stack info */
|
||||
#endif
|
||||
} SHIST_SavedData;
|
||||
|
||||
/*
|
||||
This structure encapsulates all of the information needed for the
|
||||
session history. It should contain stuff like a list of all of the
|
||||
documents in the current history and a pointer to where the currently
|
||||
viewed document sits in the chain.
|
||||
|
||||
WARNING!! Some slots of this structure are shared with URL_Struct and
|
||||
net_CacheObject. If you add a slot, decide whether it needs to be
|
||||
shared as well.
|
||||
*/
|
||||
|
||||
struct _History_entry {
|
||||
char * title; /* title for this entry */
|
||||
char * address; /* URL address string */
|
||||
char * content_name; /* Server-provided "real name", used for
|
||||
default file name when saving. */
|
||||
int method; /* method of acessing URL */
|
||||
char * referer; /* What document points to this url */
|
||||
char * post_data; /* post data */
|
||||
int32 post_data_size; /* post data size */
|
||||
Bool post_data_is_file; /* is the post data a filename? */
|
||||
char * post_headers; /* content type for posted data */
|
||||
int32 position_tag; /* layout specific data for determining
|
||||
* where in the document the user was
|
||||
*/
|
||||
time_t last_modified; /* time of last modification */
|
||||
time_t last_access; /* time of last access */
|
||||
int history_num; /* special hack to add navigation */
|
||||
|
||||
SHIST_SavedData savedData; /* layout data */
|
||||
|
||||
PRPackedBool
|
||||
is_binary, /* is this a binary object pretending
|
||||
* to be HTML?
|
||||
*/
|
||||
is_active, /* is it an active stream? */
|
||||
is_netsite, /* did it come from netsite? */
|
||||
replace; /* did it come from netsite? */
|
||||
|
||||
int transport_method; /* network, disk cache, memory cache */
|
||||
|
||||
uint32 refresh; /* refresh interval */
|
||||
char *refresh_url; /* URL to refresh */
|
||||
char *wysiwyg_url; /* URL for WYSIWYG printing/saving */
|
||||
|
||||
/* Security information */
|
||||
int security_on; /* is security on? */
|
||||
/* Security info on a connection is opaque */
|
||||
unsigned char *sec_info;
|
||||
|
||||
/* Unique identifier */
|
||||
int32 unique_id;
|
||||
int32 ref_count;
|
||||
|
||||
/* Page services*/
|
||||
char *page_services_url; /* If it supports services, what link is used */
|
||||
|
||||
/* HTTP_11 support*/
|
||||
char *etag; /* Unique entity tag */
|
||||
char *origin_url; /* original referrer of javascript: URL */
|
||||
};
|
||||
|
||||
#define SHIST_CAME_FROM_NETWORK 0
|
||||
#define SHIST_CAME_FROM_DISK_CACHE 1
|
||||
#define SHIST_CAME_FROM_MEMORY_CACHE 2
|
||||
|
||||
struct History_ {
|
||||
XP_List * list_ptr; /* pointer to linked list */
|
||||
int cur_doc; /* an index into the list that points to the current document */
|
||||
History_entry *cur_doc_ptr; /* a ptr to the current doc entry */
|
||||
int32 num_entries; /* size of the history list */
|
||||
int32 max_entries; /* maximum size of list; -1 == no limit */
|
||||
};
|
||||
|
||||
|
||||
#endif /* SHISTELE_H */
|
||||
1107
mozilla/lib/libmisc/shist.c
Normal file
1107
mozilla/lib/libmisc/shist.c
Normal file
File diff suppressed because it is too large
Load Diff
1767
mozilla/lib/libmocha/lm_doc.c
Normal file
1767
mozilla/lib/libmocha/lm_doc.c
Normal file
File diff suppressed because it is too large
Load Diff
880
mozilla/lib/libnet/extcache.c
Normal file
880
mozilla/lib/libnet/extcache.c
Normal file
@@ -0,0 +1,880 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
/* Please leave outside of ifdef for window precompiled headers */
|
||||
#include "mkutils.h"
|
||||
|
||||
#ifdef MOZILLA_CLIENT
|
||||
|
||||
/* Publicly released Netscape cache access routines.
|
||||
*
|
||||
* These routines are shared between the netscape executable
|
||||
* and the programs released as a cache developers kit.
|
||||
*
|
||||
* Created: Lou Montulli <montulli@netscape.com>, July-95.
|
||||
* Modifications/Addition: Gagan Saksena, 97
|
||||
*/
|
||||
|
||||
#ifndef EXT_DB_ROUTINES
|
||||
#include "secnav.h"
|
||||
#include "sechash.h"
|
||||
#endif
|
||||
|
||||
#include "extcache.h" /* include this for everything */
|
||||
|
||||
#ifdef EXT_DB_ROUTINES
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <assert.h>
|
||||
|
||||
typedef struct {
|
||||
int32 len;
|
||||
char *data;
|
||||
} SECItem;
|
||||
|
||||
#ifdef _sgi
|
||||
#include <sys/endian.h>
|
||||
#endif /* _sgi */
|
||||
|
||||
|
||||
/* URL methods
|
||||
*/
|
||||
#define URL_GET_METHOD 0
|
||||
#define URL_POST_METHOD 1
|
||||
#define URL_HEAD_METHOD 2
|
||||
|
||||
#endif /* DB_STORE */
|
||||
|
||||
|
||||
MODULE_PRIVATE DBT *
|
||||
net_CacheDBTDup(DBT *obj)
|
||||
{
|
||||
DBT * rv = XP_NEW(DBT);
|
||||
|
||||
if(!rv)
|
||||
return(NULL);
|
||||
|
||||
rv->size = obj->size;
|
||||
rv->data = XP_ALLOC(rv->size);
|
||||
|
||||
if(!rv->data)
|
||||
{
|
||||
FREE(rv);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
XP_MEMCPY(rv->data, obj->data, rv->size);
|
||||
|
||||
return(rv);
|
||||
|
||||
}
|
||||
|
||||
/* free the cache object
|
||||
*/
|
||||
MODULE_PRIVATE void net_freeCacheObj (net_CacheObject * cache_obj)
|
||||
{
|
||||
|
||||
FREEIF(cache_obj->address);
|
||||
FREEIF(cache_obj->post_data);
|
||||
FREEIF(cache_obj->post_headers);
|
||||
FREEIF(cache_obj->content_type);
|
||||
FREEIF(cache_obj->charset);
|
||||
FREEIF(cache_obj->content_encoding);
|
||||
FREEIF(cache_obj->page_services_url);
|
||||
FREEIF(cache_obj->filename);
|
||||
|
||||
#ifndef EXT_DB_ROUTINES
|
||||
FREEIF(cache_obj->sec_info);
|
||||
#endif
|
||||
|
||||
FREE(cache_obj);
|
||||
}
|
||||
|
||||
/* returns true if this DBT looks like a valid
|
||||
* entry. It looks at the checksum and the
|
||||
* version number to see if it's valid
|
||||
*/
|
||||
#define MAX_VALID_DBT_SIZE 10000
|
||||
|
||||
MODULE_PRIVATE Bool
|
||||
net_IsValidCacheDBT(DBT *obj)
|
||||
{
|
||||
char *cur_ptr, *max_ptr;
|
||||
uint32 len;
|
||||
|
||||
if(!obj || obj->size < 9 || obj->size > MAX_VALID_DBT_SIZE)
|
||||
return(FALSE);
|
||||
|
||||
cur_ptr = (char *)obj->data;
|
||||
max_ptr = cur_ptr+obj->size;
|
||||
|
||||
/* get the total size of the struct out of
|
||||
* the first field to check it
|
||||
*/
|
||||
COPY_INT32(&len, cur_ptr);
|
||||
cur_ptr += sizeof(int32);
|
||||
|
||||
if(len != obj->size)
|
||||
{
|
||||
TRACEMSG(("Size going in is not the same as size coming out"));
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
/* get the version number of the written structure
|
||||
*/
|
||||
if(cur_ptr > max_ptr)
|
||||
return(FALSE);
|
||||
COPY_INT32(&len, cur_ptr);
|
||||
cur_ptr += sizeof(int32);
|
||||
|
||||
if(len != CACHE_FORMAT_VERSION)
|
||||
{
|
||||
TRACEMSG(("Version of cache structure is wrong!: %d", len));
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
/* looks good to me... */
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
|
||||
/* takes a cache object and returns a malloc'd
|
||||
* (void *) suitible for passing in as a database
|
||||
* data storage object
|
||||
*/
|
||||
MODULE_PRIVATE DBT *
|
||||
net_CacheStructToDBData(net_CacheObject * old_obj)
|
||||
{
|
||||
int32 len;
|
||||
char *cur_ptr;
|
||||
void *new_obj;
|
||||
int32 total_size;
|
||||
DBT *rv;
|
||||
|
||||
rv = XP_NEW(DBT);
|
||||
|
||||
if(!rv)
|
||||
return(NULL);
|
||||
|
||||
total_size = sizeof(net_CacheObject);
|
||||
|
||||
#define ADD_STRING_SIZE(string) \
|
||||
total_size += old_obj->string ? XP_STRLEN(old_obj->string)+1 : 0
|
||||
|
||||
ADD_STRING_SIZE(address);
|
||||
total_size += old_obj->post_data_size+1;
|
||||
ADD_STRING_SIZE(post_headers);
|
||||
ADD_STRING_SIZE(content_type);
|
||||
ADD_STRING_SIZE(content_encoding);
|
||||
ADD_STRING_SIZE(charset);
|
||||
ADD_STRING_SIZE(filename);
|
||||
total_size += sizeof(uint32); /* size of secinfo */
|
||||
total_size += SECNAV_SSLSocketStatusLength(old_obj->sec_info);
|
||||
ADD_STRING_SIZE(page_services_url);
|
||||
|
||||
#undef ADD_STRING_SIZE
|
||||
|
||||
new_obj = XP_ALLOC(total_size * sizeof(char));
|
||||
|
||||
if(!new_obj)
|
||||
{
|
||||
FREE(rv);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
XP_MEMSET(new_obj, 0, total_size * sizeof(char));
|
||||
|
||||
/*
|
||||
* order is:
|
||||
* int32 size of the entire structure;
|
||||
*
|
||||
* int32 version of the structure format (CACHE_FORMAT_VERSION)
|
||||
*
|
||||
* time_t last_modified;
|
||||
* time_t last_accessed;
|
||||
* time_t expires;
|
||||
* uint32 content_length;
|
||||
* Bool is_netsite;
|
||||
*
|
||||
* time_t lock_date;
|
||||
*
|
||||
* char * filename;
|
||||
* int32 filename_len;
|
||||
*
|
||||
* int32 security_on;
|
||||
* unsigned char * sec_info;
|
||||
*
|
||||
* int32 method;
|
||||
*
|
||||
* # don't store address, or post_data stuff
|
||||
* # char * address;
|
||||
* # uint32 post_data_size;
|
||||
* # char * post_data;
|
||||
*
|
||||
* char * post_headers;
|
||||
* char * content_type;
|
||||
* char * content_encoding;
|
||||
* char * charset;
|
||||
*
|
||||
* Bool incomplete_file;
|
||||
* uint32 total_content_length;
|
||||
*
|
||||
* char * page_services_url;
|
||||
*
|
||||
* string lengths all include null terminators
|
||||
* all integer constants are stored as 4 bytes
|
||||
* all booleans are stored as one byte
|
||||
*/
|
||||
|
||||
/* VERY VERY IMPORTANT. Whenever the
|
||||
* format of the record structure changes
|
||||
* you must verify that the byte positions
|
||||
* in extcache.h are updated
|
||||
*/
|
||||
|
||||
#define STUFF_STRING(string) \
|
||||
{ \
|
||||
len = (old_obj->string ? XP_STRLEN(old_obj->string)+1 : 0); \
|
||||
COPY_INT32((void *)cur_ptr, &len); \
|
||||
cur_ptr = cur_ptr + sizeof(int32); \
|
||||
if(len) \
|
||||
XP_MEMCPY((void *)cur_ptr, old_obj->string, len); \
|
||||
cur_ptr += len; \
|
||||
}
|
||||
|
||||
#define STUFF_NUMBER(number) \
|
||||
{ \
|
||||
COPY_INT32((void *)cur_ptr, &old_obj->number); \
|
||||
cur_ptr = cur_ptr + sizeof(int32); \
|
||||
}
|
||||
|
||||
#define STUFF_TIMET(number) \
|
||||
{ \
|
||||
COPY_INT32((void *)cur_ptr, &old_obj->number); \
|
||||
cur_ptr = cur_ptr + sizeof(time_t); \
|
||||
}
|
||||
|
||||
#define STUFF_BOOL(bool_val) \
|
||||
{ \
|
||||
if(old_obj->bool_val) \
|
||||
((char *)(cur_ptr))[0] = 1; \
|
||||
else \
|
||||
((char *)(cur_ptr))[0] = 0; \
|
||||
cur_ptr = cur_ptr + sizeof(char); \
|
||||
}
|
||||
|
||||
cur_ptr = (char *)new_obj;
|
||||
|
||||
/* put the total size of the struct into
|
||||
* the first field so that we have
|
||||
* a cross check against corruption
|
||||
*/
|
||||
COPY_INT32((void *)cur_ptr, &total_size);
|
||||
cur_ptr = cur_ptr + sizeof(int32);
|
||||
|
||||
/* put the version number of the structure
|
||||
* format that we are using
|
||||
* By using a version string when writting
|
||||
* we can support backwards compatibility
|
||||
* in our reading code
|
||||
* (use "len" as a temp variable)
|
||||
*/
|
||||
len = CACHE_FORMAT_VERSION;
|
||||
COPY_INT32((void *)cur_ptr, &len);
|
||||
cur_ptr = cur_ptr + sizeof(int32);
|
||||
|
||||
STUFF_TIMET(last_modified);
|
||||
STUFF_TIMET(last_accessed);
|
||||
STUFF_TIMET(expires);
|
||||
STUFF_NUMBER(content_length);
|
||||
STUFF_BOOL(is_netsite);
|
||||
|
||||
STUFF_TIMET(lock_date);
|
||||
|
||||
STUFF_STRING(filename);
|
||||
STUFF_NUMBER(filename_len);
|
||||
|
||||
STUFF_BOOL(is_relative_path);
|
||||
|
||||
STUFF_NUMBER(security_on);
|
||||
|
||||
#ifndef EXT_DB_ROUTINES
|
||||
/* save the security info */
|
||||
if ( old_obj->sec_info ) {
|
||||
len = SECNAV_SSLSocketStatusLength(old_obj->sec_info);
|
||||
COPY_INT32((void *)cur_ptr, &len);
|
||||
cur_ptr = cur_ptr + sizeof(int32);
|
||||
|
||||
XP_MEMCPY((void *)cur_ptr, old_obj->sec_info, len);
|
||||
cur_ptr += len;
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
len = 0;
|
||||
COPY_INT32((void *)cur_ptr, &len);
|
||||
cur_ptr = cur_ptr + sizeof(int32);
|
||||
}
|
||||
|
||||
STUFF_NUMBER(method);
|
||||
|
||||
#ifdef STORE_ADDRESS_AND_POST_DATA
|
||||
|
||||
STUFF_STRING(address);
|
||||
STUFF_NUMBER(post_data_size);
|
||||
|
||||
/* post_data
|
||||
* this is special since it not necessarily a string
|
||||
*/
|
||||
if(old_obj->post_data_size)
|
||||
{
|
||||
XP_MEMCPY(cur_ptr, old_obj->post_data, old_obj->post_data_size+1);
|
||||
cur_ptr += old_obj->post_data_size+1;
|
||||
}
|
||||
|
||||
#endif /* STORE_ADDRESS_AND_POST_DATA */
|
||||
|
||||
STUFF_STRING(post_headers);
|
||||
|
||||
STUFF_STRING(content_type);
|
||||
STUFF_STRING(content_encoding);
|
||||
STUFF_STRING(charset);
|
||||
|
||||
STUFF_BOOL(incomplete_file);
|
||||
STUFF_NUMBER(real_content_length);
|
||||
|
||||
STUFF_STRING(page_services_url);
|
||||
|
||||
#undef STUFF_STRING
|
||||
#undef STUFF_NUMBER
|
||||
#undef STUFF_BOOL
|
||||
|
||||
rv->data = new_obj;
|
||||
rv->size = total_size;
|
||||
|
||||
return(rv);
|
||||
|
||||
}
|
||||
|
||||
/* takes a database storage object and returns a malloc'd
|
||||
* cache data object. The cache object needs all of
|
||||
* it's parts free'd.
|
||||
*
|
||||
* returns NULL on parse error
|
||||
*/
|
||||
MODULE_PRIVATE net_CacheObject *
|
||||
net_DBDataToCacheStruct(DBT * db_obj)
|
||||
{
|
||||
net_CacheObject * rv = XP_NEW(net_CacheObject);
|
||||
char * cur_ptr;
|
||||
char * max_ptr;
|
||||
uint32 len;
|
||||
int32 version;
|
||||
|
||||
if(!rv)
|
||||
return NULL;
|
||||
|
||||
XP_MEMSET(rv, 0, sizeof(net_CacheObject));
|
||||
|
||||
/* if any strings are larger than this then
|
||||
* there was a serious database error
|
||||
*/
|
||||
#define MAX_HUGE_STRING_SIZE 10000
|
||||
|
||||
#define RETRIEVE_STRING(string) \
|
||||
{ \
|
||||
if(cur_ptr > max_ptr) \
|
||||
{ \
|
||||
net_freeCacheObj(rv); \
|
||||
return(NULL); \
|
||||
} \
|
||||
COPY_INT32(&len, cur_ptr); \
|
||||
cur_ptr += sizeof(int32); \
|
||||
if(len) \
|
||||
{ \
|
||||
if(len > MAX_HUGE_STRING_SIZE) \
|
||||
{ \
|
||||
net_freeCacheObj(rv); \
|
||||
return(NULL); \
|
||||
} \
|
||||
rv->string = (char*)XP_ALLOC(len); \
|
||||
if(!rv->string) \
|
||||
{ \
|
||||
net_freeCacheObj(rv); \
|
||||
return(NULL); \
|
||||
} \
|
||||
XP_MEMCPY(rv->string, cur_ptr, len); \
|
||||
cur_ptr += len; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define RETRIEVE_NUMBER(number) \
|
||||
{ \
|
||||
if(cur_ptr > max_ptr) \
|
||||
return(rv); \
|
||||
COPY_INT32(&rv->number, cur_ptr); \
|
||||
cur_ptr += sizeof(int32); \
|
||||
}
|
||||
|
||||
#define RETRIEVE_TIMET(number) \
|
||||
{ \
|
||||
if(cur_ptr > max_ptr) \
|
||||
return(rv); \
|
||||
COPY_INT32(&rv->number, cur_ptr); \
|
||||
cur_ptr += sizeof(time_t); \
|
||||
}
|
||||
|
||||
#define RETRIEVE_BOOL(bool) \
|
||||
{ \
|
||||
if(cur_ptr > max_ptr) \
|
||||
return(rv); \
|
||||
if(((char *)(cur_ptr))[0]) \
|
||||
rv->bool = TRUE; \
|
||||
else \
|
||||
rv->bool = FALSE; \
|
||||
cur_ptr += sizeof(char); \
|
||||
}
|
||||
|
||||
cur_ptr = (char *)db_obj->data;
|
||||
|
||||
max_ptr = cur_ptr+db_obj->size;
|
||||
|
||||
/* get the total size of the struct out of
|
||||
* the first field to check it
|
||||
*/
|
||||
COPY_INT32(&len, cur_ptr);
|
||||
cur_ptr += sizeof(int32);
|
||||
|
||||
if(len != db_obj->size)
|
||||
{
|
||||
TRACEMSG(("Size going in is not the same as size coming out"));
|
||||
FREE(rv);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/* get the version number of the written structure
|
||||
*/
|
||||
if(cur_ptr > max_ptr)
|
||||
return(rv);
|
||||
COPY_INT32(&version, cur_ptr);
|
||||
cur_ptr += sizeof(int32);
|
||||
|
||||
if(version != CACHE_FORMAT_VERSION)
|
||||
{
|
||||
TRACEMSG(("Version of cache structure is wrong!: %d", version));
|
||||
FREE(rv);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
RETRIEVE_TIMET(last_modified);
|
||||
RETRIEVE_TIMET(last_accessed);
|
||||
RETRIEVE_TIMET(expires);
|
||||
RETRIEVE_NUMBER(content_length);
|
||||
RETRIEVE_BOOL(is_netsite);
|
||||
|
||||
RETRIEVE_TIMET(lock_date);
|
||||
|
||||
RETRIEVE_STRING(filename);
|
||||
RETRIEVE_NUMBER(filename_len);
|
||||
|
||||
RETRIEVE_BOOL(is_relative_path);
|
||||
|
||||
RETRIEVE_NUMBER(security_on);
|
||||
|
||||
/* security info */
|
||||
if(cur_ptr > max_ptr)
|
||||
return(rv);
|
||||
COPY_INT32(&len, cur_ptr);
|
||||
cur_ptr += sizeof(int32);
|
||||
|
||||
if ( len == 0 ) {
|
||||
rv->sec_info = NULL;
|
||||
} else {
|
||||
rv->sec_info = XP_ALLOC(len);
|
||||
if ( rv->sec_info == NULL ) {
|
||||
return(rv);
|
||||
}
|
||||
|
||||
XP_MEMCPY(rv->sec_info, cur_ptr, len);
|
||||
cur_ptr += len;
|
||||
}
|
||||
|
||||
|
||||
RETRIEVE_NUMBER(method);
|
||||
|
||||
#ifdef STORE_ADDRESS_AND_POST_DATA
|
||||
|
||||
RETRIEVE_STRING(address);
|
||||
RETRIEVE_NUMBER(post_data_size);
|
||||
|
||||
/* post_data
|
||||
* this is special since it not necessarily a string
|
||||
*/
|
||||
if(rv->post_data_size)
|
||||
{
|
||||
rv->post_data = XP_ALLOC(rv->post_data_size+1);
|
||||
if(rv->post_data)
|
||||
XP_MEMCPY(rv->post_data, cur_ptr, rv->post_data_size+1);
|
||||
cur_ptr += rv->post_data_size+1;
|
||||
}
|
||||
|
||||
#endif /* STORE_ADDRESS_AND_POST_DATA */
|
||||
|
||||
RETRIEVE_STRING(post_headers);
|
||||
|
||||
RETRIEVE_STRING(content_type);
|
||||
RETRIEVE_STRING(content_encoding);
|
||||
RETRIEVE_STRING(charset);
|
||||
|
||||
RETRIEVE_BOOL(incomplete_file);
|
||||
RETRIEVE_NUMBER(real_content_length);
|
||||
|
||||
RETRIEVE_STRING(page_services_url);
|
||||
#undef RETRIEVE_STRING
|
||||
#undef RETRIEVE_NUMBER
|
||||
#undef RETRIEVE_BOOL
|
||||
|
||||
return(rv);
|
||||
}
|
||||
|
||||
#if defined(DEBUG) && defined(UNIX)
|
||||
int
|
||||
cache_test_me()
|
||||
{
|
||||
|
||||
net_CacheObject test;
|
||||
net_CacheObject *rv;
|
||||
int32 total_size;
|
||||
DBT *db_obj;
|
||||
|
||||
XP_MEMSET(&test, 0, sizeof(net_CacheObject));
|
||||
StrAllocCopy(test.address, "test1");
|
||||
db_obj = net_CacheStructToDBData(&test);
|
||||
rv = net_DBDataToCacheStruct(db_obj);
|
||||
printf("test1: %s\n", rv->address);
|
||||
|
||||
XP_MEMSET(&test, 0, sizeof(net_CacheObject));
|
||||
StrAllocCopy(test.address, "test2");
|
||||
StrAllocCopy(test.charset, "test2");
|
||||
db_obj = net_CacheStructToDBData(&test);
|
||||
rv = net_DBDataToCacheStruct(db_obj);
|
||||
printf("test2: %s %s\n", rv->address, rv->charset);
|
||||
|
||||
XP_MEMSET(&test, 0, sizeof(net_CacheObject));
|
||||
StrAllocCopy(test.address, "test3");
|
||||
StrAllocCopy(test.charset, "test3");
|
||||
test.content_length = 3 ;
|
||||
test.method = 3 ;
|
||||
test.is_netsite = 3 ;
|
||||
db_obj = net_CacheStructToDBData(&test);
|
||||
rv = net_DBDataToCacheStruct(db_obj);
|
||||
printf("test3: %s %s %d %d %s\n",
|
||||
rv->address, rv->charset,
|
||||
rv->content_length, rv->method,
|
||||
(rv->is_netsite == 3 ? "TRUE" : "FALSE"));
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
/* generates a key for use in the cache database
|
||||
* from a CacheObject struct
|
||||
*
|
||||
* Key is based on the address and the post_data
|
||||
*
|
||||
* looks like:
|
||||
* size checksum | size of address | ADDRESS | size of post data | POST DATA
|
||||
*/
|
||||
MODULE_PRIVATE DBT *
|
||||
net_GenCacheDBKey(char *address, char *post_data, int32 post_data_size)
|
||||
{
|
||||
DBT *rv = XP_NEW(DBT);
|
||||
char *hash;
|
||||
char *data_ptr;
|
||||
int32 str_len;
|
||||
int32 size;
|
||||
|
||||
#define MD5_HASH_SIZE 16 /* always 16 due to md5 hash type */
|
||||
|
||||
if(!rv)
|
||||
return(NULL);
|
||||
|
||||
if(!address)
|
||||
{
|
||||
XP_ASSERT(0);
|
||||
rv->size = 0;
|
||||
return(rv);
|
||||
}
|
||||
|
||||
hash = XP_STRCHR(address, '#');
|
||||
|
||||
/* don't include '#' in a key */
|
||||
if(hash)
|
||||
*hash = '\0';
|
||||
|
||||
str_len = XP_STRLEN(address)+1;
|
||||
|
||||
size = sizeof(int32); /* for check sum */
|
||||
size += sizeof(int32); /* for size of address */
|
||||
size += str_len; /* for address string */
|
||||
size += sizeof(int32); /* for size of post_data */
|
||||
|
||||
if(post_data_size)
|
||||
size += MD5_HASH_SIZE;
|
||||
|
||||
rv->size = size;
|
||||
rv->data = XP_ALLOC(size);
|
||||
|
||||
if(!rv->data)
|
||||
{
|
||||
FREE(rv);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
data_ptr = (char *) rv->data;
|
||||
|
||||
/* put in the checksum size */
|
||||
COPY_INT32(data_ptr, &size);
|
||||
data_ptr = data_ptr + sizeof(int32);
|
||||
|
||||
/* put in the size of the address string */
|
||||
COPY_INT32(data_ptr, &str_len);
|
||||
data_ptr = data_ptr + sizeof(int32);
|
||||
|
||||
/* put in the address string data */
|
||||
XP_MEMCPY(data_ptr, address, str_len);
|
||||
data_ptr = data_ptr + str_len;
|
||||
|
||||
/* set the address back to it's original form */
|
||||
if(hash)
|
||||
*hash = '#';
|
||||
|
||||
/* put in the size of the post data */
|
||||
if(post_data_size)
|
||||
{
|
||||
int32 size_of_md5 = MD5_HASH_SIZE;
|
||||
unsigned char post_data_hash[MD5_HASH_SIZE];
|
||||
|
||||
MD5_HashBuf(post_data_hash, (unsigned char*)post_data, post_data_size);
|
||||
|
||||
COPY_INT32(data_ptr, &size_of_md5);
|
||||
data_ptr = data_ptr + sizeof(int32);
|
||||
|
||||
/* put in the post data if there is any */
|
||||
XP_MEMCPY(data_ptr, post_data_hash, sizeof(post_data_hash));
|
||||
}
|
||||
else
|
||||
{
|
||||
COPY_INT32(data_ptr, &post_data_size);
|
||||
data_ptr = data_ptr + sizeof(int32);
|
||||
}
|
||||
|
||||
return(rv);
|
||||
}
|
||||
|
||||
/* returns a static string that contains the
|
||||
* URL->address of the key
|
||||
*
|
||||
* returns NULL on error
|
||||
*/
|
||||
MODULE_PRIVATE char *
|
||||
net_GetAddressFromCacheKey(DBT *key)
|
||||
{
|
||||
uint32 size;
|
||||
char *data;
|
||||
|
||||
/* check for minimum size */
|
||||
if(key->size < 10)
|
||||
return(NULL);
|
||||
|
||||
/* validate size checksum */
|
||||
data = (char *)key->data;
|
||||
COPY_INT32(&size, data);
|
||||
data += sizeof(int32);
|
||||
|
||||
if(size != key->size)
|
||||
return(NULL);
|
||||
|
||||
/* get size of address string */
|
||||
COPY_INT32(&size, data);
|
||||
data += sizeof(int32);
|
||||
|
||||
/* make sure it's a valid c string */
|
||||
if(data[size] != '\0')
|
||||
return(NULL);
|
||||
|
||||
/* it's valid return it */
|
||||
return(data);
|
||||
}
|
||||
|
||||
|
||||
/* checks a date within a DBT struct so
|
||||
* that we don't have to convert it into a CacheObject
|
||||
*
|
||||
* This works because of the fixed length record format
|
||||
* of the first part of the specific DBT format I'm
|
||||
* using
|
||||
*
|
||||
* returns 0 on error
|
||||
*/
|
||||
MODULE_PRIVATE time_t
|
||||
net_GetTimeInCacheDBT(DBT *data, int byte_position)
|
||||
{
|
||||
time_t date;
|
||||
char *ptr = (char *)data->data;
|
||||
|
||||
if(data->size < byte_position+sizeof(time_t))
|
||||
return(0);
|
||||
|
||||
if(!net_IsValidCacheDBT(data))
|
||||
return(0);
|
||||
|
||||
COPY_INT32(&date, ptr+byte_position);
|
||||
|
||||
/* TRACEMSG(("Got date from cache DBT: %d", date)); */
|
||||
|
||||
return(date);
|
||||
|
||||
}
|
||||
|
||||
/* Sets a date within a DBT struct so
|
||||
* that we don't have to convert it into a CacheObject
|
||||
*
|
||||
* This works because of the fixed length record format
|
||||
* of the first part of the specific DBT format I'm
|
||||
* using
|
||||
*
|
||||
* returns 0 on error
|
||||
*/
|
||||
MODULE_PRIVATE void
|
||||
net_SetTimeInCacheDBT(DBT *data, int byte_position, time_t date)
|
||||
{
|
||||
char *ptr = (char *)data->data;
|
||||
|
||||
if(data->size < byte_position+sizeof(time_t))
|
||||
return;
|
||||
|
||||
if(!net_IsValidCacheDBT(data))
|
||||
return;
|
||||
|
||||
COPY_INT32(ptr+byte_position, &date);
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
/* Gets the filename within a cache DBT struct so
|
||||
* that we don't have to convert it into a CacheObject
|
||||
*
|
||||
* This works because of the fixed length record format
|
||||
* of the first part of the specific DBT format I'm
|
||||
* using
|
||||
*
|
||||
* returns NULL on error
|
||||
*/
|
||||
#define MAX_FILE_SIZE 2048
|
||||
MODULE_PRIVATE char *
|
||||
net_GetFilenameInCacheDBT(DBT *data)
|
||||
{
|
||||
int32 size;
|
||||
char *rv;
|
||||
char *ptr = (char*)data->data;
|
||||
|
||||
if(data->size < FILENAME_BYTE_POSITION)
|
||||
return(NULL);
|
||||
|
||||
if(!net_IsValidCacheDBT(data))
|
||||
return(0);
|
||||
|
||||
COPY_INT32(&size, ptr+FILENAME_SIZE_BYTE_POSITION);
|
||||
|
||||
if(data->size < FILENAME_BYTE_POSITION+size
|
||||
|| size > MAX_FILE_SIZE)
|
||||
return(NULL);
|
||||
|
||||
rv = (char *)XP_ALLOC(size);
|
||||
if(!rv)
|
||||
return(NULL);
|
||||
XP_MEMCPY(rv, ptr+FILENAME_BYTE_POSITION, size);
|
||||
|
||||
TRACEMSG(("Got filename: %s from DBT", rv));
|
||||
|
||||
return(rv);
|
||||
}
|
||||
|
||||
/* Gets a int32 within a DBT struct so
|
||||
* that we don't have to convert it into a CacheObject
|
||||
*
|
||||
* This works because of the fixed length record format
|
||||
* of the first part of the specific DBT format I'm
|
||||
* using
|
||||
*
|
||||
* returns 0 on error
|
||||
*/
|
||||
MODULE_PRIVATE time_t
|
||||
net_GetInt32InCacheDBT(DBT *data, int byte_position)
|
||||
{
|
||||
int32 num;
|
||||
char *ptr = (char *)data->data;
|
||||
|
||||
if(!net_IsValidCacheDBT(data))
|
||||
return(0);
|
||||
|
||||
if(data->size < byte_position+sizeof(time_t))
|
||||
return(0);
|
||||
|
||||
COPY_INT32(&num, ptr+byte_position);
|
||||
|
||||
/* TRACEMSG(("Got int32 from cache DBT: %d", num)); */
|
||||
|
||||
return(num);
|
||||
|
||||
}
|
||||
|
||||
MODULE_PRIVATE void
|
||||
net_FreeCacheDBTdata(DBT *stuff)
|
||||
{
|
||||
if(stuff)
|
||||
{
|
||||
FREE(stuff->data);
|
||||
FREE(stuff);
|
||||
}
|
||||
}
|
||||
|
||||
/* takes a database storage object and returns an un-malloc'd
|
||||
* cache data object. The structure returned has pointers
|
||||
* directly into the database memory and are only valid
|
||||
* until the next call to any database function
|
||||
*
|
||||
* do not free anything returned by this structure
|
||||
*/
|
||||
MODULE_PRIVATE net_CacheObject *
|
||||
net_Fast_DBDataToCacheStruct(DBT *obj)
|
||||
{
|
||||
static net_CacheObject *rv=0;
|
||||
|
||||
/* free any previous one */
|
||||
if(rv)
|
||||
net_freeCacheObj(rv);
|
||||
|
||||
rv = net_DBDataToCacheStruct(obj);
|
||||
|
||||
return(rv);
|
||||
|
||||
}
|
||||
|
||||
#endif /* MOZILLA_CLIENT */
|
||||
273
mozilla/lib/libnet/extcache.h
Normal file
273
mozilla/lib/libnet/extcache.h
Normal file
@@ -0,0 +1,273 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#ifndef EXT_CACHE_H
|
||||
#define EXT_CACHE_H
|
||||
|
||||
#ifndef EXT_DB_ROUTINES
|
||||
#include "mcom_db.h"
|
||||
#endif
|
||||
|
||||
#ifdef EXT_DB_ROUTINES
|
||||
#define Bool char
|
||||
#define uint32 unsigned int
|
||||
#define int32 int
|
||||
#define XP_NEW(structure) ((structure *) malloc(sizeof(structure)))
|
||||
#define XP_ALLOC (void *) malloc
|
||||
#define XP_MEMCPY memcpy
|
||||
#define XP_MEMSET memset
|
||||
#define TRACEMSG(x) printf x
|
||||
#define FREEIF(x) do { if(x) free(x); } while(0)
|
||||
#define FREE free
|
||||
#define XP_STRLEN strlen
|
||||
#define XP_STRCHR strchr
|
||||
#define XP_STRCMP strcmp
|
||||
#define XP_ASSERT assert
|
||||
#define MODULE_PRIVATE
|
||||
#define PRIVATE static
|
||||
#define TRUE !0
|
||||
#define FALSE 0
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <db.h>
|
||||
#endif
|
||||
|
||||
#ifndef EXT_DB_ROUTINES
|
||||
#include "mkutils.h"
|
||||
|
||||
#ifndef NSPR20
|
||||
#include "prosdep.h" /* for IS_LITTLE_ENDIAN / IS_BIG_ENDIAN */
|
||||
#else
|
||||
#include "prtypes.h"
|
||||
#endif
|
||||
|
||||
#endif /* EXT_DB_ROUTINES */
|
||||
|
||||
#if !defined(IS_LITTLE_ENDIAN) && !defined(IS_BIG_ENDIAN)
|
||||
ERROR! Must have a byte order
|
||||
#endif
|
||||
|
||||
#ifdef IS_LITTLE_ENDIAN
|
||||
#define COPY_INT32(_a,_b) XP_MEMCPY(_a, _b, sizeof(int32));
|
||||
#else
|
||||
#define COPY_INT32(_a,_b) /* swap */ \
|
||||
do { \
|
||||
((char *)(_a))[0] = ((char *)(_b))[3]; \
|
||||
((char *)(_a))[1] = ((char *)(_b))[2]; \
|
||||
((char *)(_a))[2] = ((char *)(_b))[1]; \
|
||||
((char *)(_a))[3] = ((char *)(_b))[0]; \
|
||||
} while(0)
|
||||
#endif
|
||||
|
||||
#define EXT_CACHE_NAME_STRING "INT_ExternalCacheNameString"
|
||||
|
||||
/* Internal WARNING!! Some slots of this structure
|
||||
* are shared with URL_Struct and
|
||||
* History_entry. If you add a slot, decide whether it needs to be shared
|
||||
* as well.
|
||||
*/
|
||||
typedef struct _net_CacheObject {
|
||||
time_t last_modified;
|
||||
time_t last_accessed;
|
||||
time_t expires;
|
||||
Bool is_netsite;
|
||||
uint32 content_length;
|
||||
|
||||
char * filename; /* cache file name */
|
||||
int32 filename_len; /* optimization */
|
||||
Bool is_relative_path; /* is the path relative? */
|
||||
|
||||
/* Security information */
|
||||
int32 security_on; /* is security on? */
|
||||
unsigned char *sec_info;
|
||||
|
||||
time_t lock_date; /* the file is locked if this
|
||||
* is non-zero. The date
|
||||
* represents the time the
|
||||
* lock was put in place.
|
||||
* Locks are only valid for
|
||||
* one session
|
||||
*/
|
||||
|
||||
int32 method;
|
||||
char * address;
|
||||
uint32 post_data_size;
|
||||
char * post_data;
|
||||
char * post_headers;
|
||||
char * content_type;
|
||||
char * content_encoding;
|
||||
char * charset;
|
||||
|
||||
Bool incomplete_file; /* means that the whole
|
||||
* file is not there.
|
||||
* This can only be true
|
||||
* if the server supports byteranges
|
||||
*/
|
||||
uint32 real_content_length; /* the whole content length
|
||||
* i.e. the server size of a truncated
|
||||
* client file
|
||||
*/
|
||||
char * page_services_url;
|
||||
char * etag; /* HTTP/1.1 Etag */
|
||||
|
||||
} net_CacheObject;
|
||||
|
||||
/* this is the version number of the cache database entry.
|
||||
* It should be incremented in integer ingrements up
|
||||
* to MAXINT32
|
||||
*/
|
||||
#define CACHE_FORMAT_VERSION 5
|
||||
|
||||
/* these defines specify the exact byte position
|
||||
* of the first 4 elements in the DBT data struct
|
||||
* Change these if you change the order of entry into
|
||||
* the DBT
|
||||
*/
|
||||
#define LAST_MODIFIED_BYTE_POSITION \
|
||||
sizeof(int32)+sizeof(int32)
|
||||
#define LAST_ACCESSED_BYTE_POSITION \
|
||||
sizeof(int32)+sizeof(int32)+sizeof(time_t)
|
||||
#define EXPIRES_BYTE_POSITION \
|
||||
sizeof(int32)+sizeof(int32)+sizeof(time_t)+sizeof(time_t)
|
||||
#define CONTENT_LENGTH_BYTE_POSITION \
|
||||
sizeof(int32)+sizeof(int32)+sizeof(time_t)+sizeof(time_t) \
|
||||
+sizeof(time_t)
|
||||
#define IS_NETSITE_BYTE_POSITION \
|
||||
sizeof(int32)+sizeof(int32)+sizeof(time_t)+sizeof(time_t) \
|
||||
+sizeof(time_t)+sizeof(int32)
|
||||
|
||||
#define LOCK_DATE_BYTE_POSITION \
|
||||
sizeof(int32)+sizeof(int32)+sizeof(time_t)+sizeof(time_t) \
|
||||
+sizeof(time_t)+sizeof(int32)+sizeof(char)
|
||||
|
||||
#define FILENAME_SIZE_BYTE_POSITION \
|
||||
sizeof(int32)+sizeof(int32)+sizeof(time_t)+sizeof(time_t) \
|
||||
+sizeof(time_t)+sizeof(uint32)+sizeof(char)+sizeof(time_t)
|
||||
#define FILENAME_BYTE_POSITION \
|
||||
sizeof(int32)+sizeof(int32)+sizeof(time_t)+sizeof(time_t) \
|
||||
+sizeof(time_t)+sizeof(uint32)+sizeof(char)+sizeof(time_t) \
|
||||
+sizeof(int32)
|
||||
|
||||
/* generates a key for use in the cache database
|
||||
* from a CacheObject struct
|
||||
*
|
||||
* Key is based on the address and the post_data
|
||||
*/
|
||||
extern DBT *
|
||||
net_GenCacheDBKey(char *address, char *post_data, int32 post_data_size);
|
||||
|
||||
/* returns a static string that contains the
|
||||
* URL->address of the key
|
||||
*
|
||||
* returns NULL on error
|
||||
*/
|
||||
extern char *
|
||||
net_GetAddressFromCacheKey(DBT *key);
|
||||
|
||||
|
||||
/* allocs and copies a new DBT from an existing DBT
|
||||
*/
|
||||
extern DBT * net_CacheDBTDup(DBT *obj);
|
||||
|
||||
/* free the cache object
|
||||
*/
|
||||
extern void net_freeCacheObj (net_CacheObject * cache_obj);
|
||||
|
||||
/* takes a cache object and returns a malloc'd
|
||||
* (void *) suitible for passing in as a database
|
||||
* data storage object
|
||||
*/
|
||||
extern DBT * net_CacheStructToDBData(net_CacheObject * old_obj);
|
||||
|
||||
/* takes a database storage object and returns a malloc'd
|
||||
* cache data object. The cache object needs all of
|
||||
* it's parts free'd.
|
||||
*
|
||||
* returns NULL on parse error
|
||||
*/
|
||||
extern net_CacheObject * net_DBDataToCacheStruct(DBT * db_obj);
|
||||
|
||||
/* checks a date within a DBT struct so
|
||||
* that we don't have to convert it into a CacheObject
|
||||
*
|
||||
* This works because of the fixed length record format
|
||||
* of the first part of the specific DBT format I'm
|
||||
* using
|
||||
*
|
||||
* returns 0 on error
|
||||
*/
|
||||
extern time_t net_GetTimeInCacheDBT(DBT *data, int byte_position);
|
||||
|
||||
/* Sets a date within a DBT struct so
|
||||
* that we don't have to convert it into a CacheObject
|
||||
*
|
||||
* This works because of the fixed length record format
|
||||
* of the first part of the specific DBT format I'm
|
||||
* using
|
||||
*
|
||||
* returns 0 on error
|
||||
*/
|
||||
extern void net_SetTimeInCacheDBT(DBT *data, int byte_position, time_t date);
|
||||
|
||||
/* Gets the filename within a cache DBT struct so
|
||||
* that we don't have to convert it into a CacheObject
|
||||
*
|
||||
* This works because of the fixed length record format
|
||||
* of the first part of the specific DBT format I'm
|
||||
* using
|
||||
*
|
||||
* returns NULL on error
|
||||
*/
|
||||
extern char * net_GetFilenameInCacheDBT(DBT *data);
|
||||
|
||||
/* Gets a int32 within a DBT struct so
|
||||
* that we don't have to convert it into a CacheObject
|
||||
*
|
||||
* This works because of the fixed length record format
|
||||
* of the first part of the specific DBT format I'm
|
||||
* using
|
||||
*
|
||||
* returns 0 on error
|
||||
*/
|
||||
extern time_t net_GetInt32InCacheDBT(DBT *data, int byte_position);
|
||||
|
||||
/* free's a DBT struct
|
||||
*/
|
||||
extern void net_FreeCacheDBTdata(DBT *stuff);
|
||||
|
||||
/* stores a cache object in the DBM database
|
||||
*/
|
||||
extern void net_ExtCacheStore(DB *database, net_CacheObject * obj);
|
||||
|
||||
/* takes a database storage object and returns an un-malloc'd
|
||||
* cache data object. The structure returned has pointers
|
||||
* directly into the database memory and are only valid
|
||||
* until the next call to any database function
|
||||
*
|
||||
* do not free anything returned by this structure
|
||||
*/
|
||||
extern net_CacheObject * net_Fast_DBDataToCacheStruct(DBT *obj);
|
||||
|
||||
/* returns true if this DBT looks like a valid
|
||||
* entry. It looks at the checksum and the
|
||||
* version number to see if it's valid
|
||||
*/
|
||||
extern Bool net_IsValidCacheDBT(DBT *obj);
|
||||
|
||||
#endif /* EXT_CACHE_H */
|
||||
3430
mozilla/lib/libnet/mkcache.c
Normal file
3430
mozilla/lib/libnet/mkcache.c
Normal file
File diff suppressed because it is too large
Load Diff
1551
mozilla/lib/libnet/mkextcac.c
Normal file
1551
mozilla/lib/libnet/mkextcac.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -61,7 +61,6 @@
|
||||
#endif
|
||||
|
||||
#include "mktcp.h" /* for NET_InGetHostByName semaphore */
|
||||
#include "cert.h"
|
||||
#ifdef MOZILLA_CLIENT
|
||||
#include "secnav.h"
|
||||
#ifdef MOCHA
|
||||
@@ -76,7 +75,6 @@
|
||||
#include "il_strm.h" /* Image Lib public API. */
|
||||
|
||||
#include "libi18n.h"
|
||||
#include "xp_sec.h"
|
||||
#include "mkmocha.h"
|
||||
#include "htmldlgs.h"
|
||||
|
||||
@@ -4215,16 +4213,8 @@ NET_FreeURLStruct (URL_Struct * URL_s)
|
||||
FREEIF(URL_s->wysiwyg_url);
|
||||
FREEIF(URL_s->error_msg);
|
||||
|
||||
FREEIF(URL_s->key_cipher);
|
||||
FREEIF(URL_s->key_issuer);
|
||||
FREEIF(URL_s->key_subject);
|
||||
if ( URL_s->certificate ) {
|
||||
CERT_DestroyCertificate(URL_s->certificate);
|
||||
}
|
||||
|
||||
if ( URL_s->redirecting_cert ) {
|
||||
CERT_DestroyCertificate(URL_s->redirecting_cert);
|
||||
}
|
||||
FREEIF(URL_s->sec_info);
|
||||
FREEIF(URL_s->redirect_sec_info);
|
||||
|
||||
/* Free all memory associated with header information */
|
||||
net_FreeURLAllHeaders(URL_s);
|
||||
@@ -4460,10 +4450,8 @@ net_OutputURLDocInfo(MWContext *ctxt, char *which, char **data, int32 *length)
|
||||
}
|
||||
|
||||
if(URL_s->cache_file || URL_s->memory_copy)
|
||||
sec_msg = XP_PrettySecurityStatus(URL_s->security_on,
|
||||
URL_s->key_cipher,
|
||||
URL_s->key_size,
|
||||
URL_s->key_secret_size);
|
||||
sec_msg = SECNAV_PrettySecurityStatus(URL_s->security_on,
|
||||
URL_s->sec_info);
|
||||
else
|
||||
sec_msg = XP_STRDUP(XP_GetString(XP_STATUS_UNKNOWN));
|
||||
|
||||
@@ -4473,20 +4461,10 @@ net_OutputURLDocInfo(MWContext *ctxt, char *which, char **data, int32 *length)
|
||||
FREE(sec_msg);
|
||||
}
|
||||
|
||||
if(URL_s->certificate)
|
||||
sec_msg = CERT_HTMLCertInfo(URL_s->certificate, PR_TRUE,
|
||||
PR_TRUE);
|
||||
else
|
||||
sec_msg = 0;
|
||||
sec_msg = SECNAV_SSLSocketCertString(URL_s->sec_info);
|
||||
|
||||
if(sec_msg)
|
||||
{
|
||||
char *extstring;
|
||||
extstring = SECNAV_MakeCertButtonString(URL_s->certificate);
|
||||
if ( extstring ) {
|
||||
StrAllocCat(sec_msg, extstring);
|
||||
XP_FREE(extstring);
|
||||
}
|
||||
ADD_CELL(XP_GetString(XP_CERTIFICATE_), sec_msg);
|
||||
FREE(sec_msg);
|
||||
}
|
||||
@@ -4653,6 +4631,11 @@ PRIVATE int net_output_about_url(ActiveEntry * cur_entry)
|
||||
NET_DisplayMemCacheInfoAsHTML(cur_entry);
|
||||
return(-1);
|
||||
}
|
||||
else if(!strcasecomp(which, "logout"))
|
||||
{
|
||||
NET_RemoveAllAuthorizations();
|
||||
return(-1);
|
||||
}
|
||||
else if(!strcasecomp(which, "image-cache"))
|
||||
{
|
||||
IL_DisplayMemCacheInfoAsHTML(cur_entry->format_out, cur_entry->URL_s,
|
||||
|
||||
3772
mozilla/lib/libnet/mkhttp.c
Normal file
3772
mozilla/lib/libnet/mkhttp.c
Normal file
File diff suppressed because it is too large
Load Diff
5326
mozilla/lib/libnet/mknews.c
Normal file
5326
mozilla/lib/libnet/mknews.c
Normal file
File diff suppressed because it is too large
Load Diff
90
mozilla/lib/xp/Makefile
Normal file
90
mozilla/lib/xp/Makefile
Normal file
@@ -0,0 +1,90 @@
|
||||
#!gmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
|
||||
#
|
||||
|
||||
DEPTH = ../..
|
||||
|
||||
MODULE = xp
|
||||
LIBRARY_NAME = xp
|
||||
|
||||
CSRCS = xp_alloc.c \
|
||||
xp_cntxt.c \
|
||||
xp_core.c \
|
||||
xp_error.c \
|
||||
xp_file.c \
|
||||
xp_hash.c \
|
||||
xp_list.c \
|
||||
xp_ncent.c \
|
||||
xp_reg.c \
|
||||
xp_rgb.c \
|
||||
xp_qsort.c \
|
||||
xp_str.c \
|
||||
xp_thrmo.c \
|
||||
xp_time.c \
|
||||
xp_trace.c \
|
||||
xp_wrap.c \
|
||||
xpassert.c \
|
||||
xplocale.c \
|
||||
$(NULL)
|
||||
|
||||
REQUIRES = js nspr dbm security img util jtools layer java lay style pref rdf
|
||||
|
||||
CSRCS += allxpstr.c xp_intl.c
|
||||
|
||||
ifeq ($(STAND_ALONE_JAVA),1)
|
||||
CSRCS = xp_qsort.c
|
||||
endif
|
||||
|
||||
include $(DEPTH)/config/rules.mk
|
||||
|
||||
EMACS = lemacs
|
||||
|
||||
AUDIO_FILES = $(wildcard *.au)
|
||||
GIF_FILES = $(wildcard *.gif)
|
||||
JPEG_FILES = $(wildcard *.jpg)
|
||||
|
||||
GEN_OUT = $(AUDIO_FILES:.au=.h) $(GIF_FILES:.gif=.h) $(JPEG_FILES:.jpg=.h)
|
||||
|
||||
#
|
||||
# Uncomment these to (re)generate the headers.
|
||||
#
|
||||
#GARBAGE += $(GEN_OUT) $(wildcard *~)
|
||||
#
|
||||
#all:: $(GEN_OUT)
|
||||
|
||||
$(LIBRARY): $(OBJS)
|
||||
|
||||
#
|
||||
# Generate c header's for various binary files
|
||||
#
|
||||
.SUFFIXES: .au .gif .jpg
|
||||
|
||||
.au.h:
|
||||
@echo generating $*.h from $<...; \
|
||||
CNAME=`echo $*_au`; \
|
||||
$(EMACS) -batch -q -l bin-to-c.el -f batch-bin-to-c $$CNAME $< $*.h
|
||||
|
||||
.gif.h:
|
||||
@echo generating $*.h from $<...; \
|
||||
CNAME=`echo $*_gif`; \
|
||||
$(EMACS) -batch -q -l bin-to-c.el -f batch-bin-to-c $$CNAME $< $*.h
|
||||
|
||||
.jpg.h:
|
||||
@echo generating $*.h from $<...; \
|
||||
CNAME=`echo $*_jpg`; \
|
||||
$(EMACS) -batch -q -l bin-to-c.el -f batch-bin-to-c $$CNAME $< $*.h
|
||||
663
mozilla/modules/security/freenav/navstubs.c
Normal file
663
mozilla/modules/security/freenav/navstubs.c
Normal file
@@ -0,0 +1,663 @@
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
#include "secnav.h"
|
||||
#include "libmocha.h"
|
||||
#include "prlink.h"
|
||||
#include "prinrval.h"
|
||||
|
||||
int
|
||||
SSL_SetSockPeerID(PRFileDesc *fd, char *peerID)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
void
|
||||
SECNAV_Posting(PRFileDesc *fd)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
SECNAV_HTTPHead(PRFileDesc *fd)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
SECNAV_RegisterNetlibMimeConverters()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
char *
|
||||
SECNAV_MungeString(const char *unmunged_string)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
char *
|
||||
SECNAV_UnMungeString(const char *munged_string)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
PRBool
|
||||
SECNAV_GenKeyFromChoice(void *proto_win, LO_Element *form,
|
||||
char *choiceString, char *challenge,
|
||||
char *typeString, char *pqgString,
|
||||
char **pValue, PRBool *pDone)
|
||||
{
|
||||
return(PR_FALSE);
|
||||
}
|
||||
|
||||
|
||||
char **
|
||||
SECNAV_GetKeyChoiceList(char *type, char *pqgString)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
PRBool
|
||||
SECNAV_SecurityDialog(MWContext *context, int state)
|
||||
{
|
||||
return (state == SD_INSECURE_POST_FROM_INSECURE_DOC);
|
||||
}
|
||||
|
||||
JSObject *
|
||||
lm_DefinePkcs11(MochaDecoder *decoder)
|
||||
{
|
||||
return((JSObject *)1);
|
||||
}
|
||||
|
||||
JSObject *
|
||||
lm_DefineCrypto(MochaDecoder *decoder)
|
||||
{
|
||||
return((JSObject *)1);
|
||||
}
|
||||
|
||||
void
|
||||
NET_InitCertLdapProtocol(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
CERTCertificate *
|
||||
CERT_DupCertificate(CERTCertificate *cert)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
void
|
||||
CERT_DestroyCertificate(CERTCertificate *cert)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
CERTCertificate *
|
||||
CERT_NewTempCertificate (CERTCertDBHandle *handle, SECItem *derCert,
|
||||
char *nickname, PRBool isperm, PRBool copyDER)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
CERTCertDBHandle *
|
||||
CERT_GetDefaultCertDB(void)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
CERTCertificate *
|
||||
CERT_DecodeCertFromPackage(char *certbuf, int certlen)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
char *
|
||||
CERT_HTMLCertInfo(CERTCertificate *cert, PRBool showImages, PRBool showIssuer)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
PRBool
|
||||
CERT_CompareCertsForRedirection(CERTCertificate *c1, CERTCertificate *c2)
|
||||
{
|
||||
return(PR_FALSE);
|
||||
}
|
||||
|
||||
const char *
|
||||
SECNAV_GetPolicyNameString(void)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
int
|
||||
SECNAV_InitConfigObject(void)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
int
|
||||
SECNAV_RunInitialSecConfig(void)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
void
|
||||
SECNAV_EarlyInit(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
SECNAV_Init(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
SECNAV_Shutdown(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
SECNAV_SecurityAdvisor(void *proto_win, URL_Struct *url)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
char *
|
||||
SECNAV_MakeCertButtonString(CERTCertificate *cert)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
int
|
||||
SECNAV_SecURLData(char *which, NET_StreamClass *stream, MWContext *cx)
|
||||
{
|
||||
return(-1);
|
||||
}
|
||||
|
||||
char *
|
||||
SECNAV_SecURLContentType(char *which)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
int
|
||||
SECNAV_SecHandleSecurityAdvisorURL(MWContext *cx, const char *which)
|
||||
{
|
||||
return(-1);
|
||||
}
|
||||
|
||||
void
|
||||
SECNAV_HandleInternalSecURL(URL_Struct *url, MWContext *cx)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
PRBool
|
||||
SSL_IsDomestic(void)
|
||||
{
|
||||
return(PR_FALSE);
|
||||
}
|
||||
|
||||
SECStatus
|
||||
SECNAV_ComputeFortezzaProxyChallengeResponse(MWContext *context,
|
||||
char *asciiChallenge,
|
||||
char **signature_out,
|
||||
char **clientRan_out,
|
||||
char **certChain_out)
|
||||
{
|
||||
return(SECFailure);
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
SECNAV_PrettySecurityStatus(int level, unsigned char *status)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
char *
|
||||
SECNAV_SecurityVersion(PRBool longForm)
|
||||
{
|
||||
return("N");
|
||||
}
|
||||
|
||||
char *
|
||||
SECNAV_SSLCapabilities(void)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
unsigned char *
|
||||
SECNAV_SSLSocketStatus(PRFileDesc *fd, int *return_security_level)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
unsigned char *
|
||||
SECNAV_CopySSLSocketStatus(unsigned char *status)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
|
||||
unsigned int
|
||||
SECNAV_SSLSocketStatusLength(unsigned char *status)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
char *
|
||||
SECNAV_SSLSocketCertString(unsigned char *status)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
PRBool
|
||||
SECNAV_CompareCertsForRedirection(unsigned char *status1,
|
||||
unsigned char *status2)
|
||||
{
|
||||
return(PR_FALSE);
|
||||
}
|
||||
|
||||
CERTCertificate *
|
||||
SECNAV_CertFromSSLSocketStatus(unsigned char *status)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
SECStatus
|
||||
RNG_RNGInit(void)
|
||||
{
|
||||
return(SECSuccess);
|
||||
}
|
||||
|
||||
/*
|
||||
* probably need to provide something here
|
||||
*/
|
||||
SECStatus
|
||||
RNG_GenerateGlobalRandomBytes(void *dest, size_t len)
|
||||
{
|
||||
/* This is a temporary implementation to avoid */
|
||||
/* the cache filename horkage. This needs to have a more */
|
||||
/* secure/free implementation here - Gagan */
|
||||
|
||||
char* output=dest;
|
||||
size_t i;
|
||||
srand((unsigned int) PR_IntervalToMilliseconds(PR_IntervalNow()));
|
||||
for (i=0;i<len; i++)
|
||||
{
|
||||
int t = rand();
|
||||
*output = (char) (t % 256);
|
||||
output++;
|
||||
}
|
||||
return(SECSuccess);
|
||||
}
|
||||
|
||||
/*
|
||||
** Get the "noisiest" information available on the system.
|
||||
*/
|
||||
size_t
|
||||
RNG_GetNoise(void *buf, size_t maxbytes)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
/*
|
||||
** RNG_SystemInfoForRNG should be called before any use of SSL. It
|
||||
** gathers up the system specific information to help seed the
|
||||
** state of the global random number generator.
|
||||
*/
|
||||
void
|
||||
RNG_SystemInfoForRNG(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
** Use the contents (and stat) of a file to help seed the
|
||||
** global random number generator.
|
||||
*/
|
||||
void RNG_FileForRNG(char *filename)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
** Update the global random number generator with more seeding
|
||||
** material
|
||||
*/
|
||||
SECStatus
|
||||
RNG_RandomUpdate(void *data, size_t bytes)
|
||||
{
|
||||
return(SECFailure);
|
||||
}
|
||||
|
||||
PRStaticLinkTable jsl_nodl_tab[1];
|
||||
|
||||
void
|
||||
_java_jsl_init(void)
|
||||
{
|
||||
}
|
||||
|
||||
DIGESTS *PR_CALLBACK
|
||||
SOB_calculate_digest(void XP_HUGE *data, long length)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
|
||||
int PR_CALLBACK
|
||||
SOB_verify_digest(ZIG *siglist, const char *name, DIGESTS *dig)
|
||||
{
|
||||
return(-1);
|
||||
}
|
||||
|
||||
void PR_CALLBACK
|
||||
SOB_destroy (ZIG *zig)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
char *
|
||||
SOB_get_error (int status)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
ZIG_Context *
|
||||
SOB_find(ZIG *zig, char *pattern, int type)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
int
|
||||
SOB_find_next(ZIG_Context *ctx, SOBITEM **it)
|
||||
{
|
||||
return(-1);
|
||||
}
|
||||
|
||||
void
|
||||
SOB_find_end(ZIG_Context *ctx)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
char *
|
||||
SOB_get_url (ZIG *zig)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
ZIG *
|
||||
SOB_new (void)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
int
|
||||
SOB_set_callback (int type, ZIG *zig,
|
||||
int (*fn) (int status, ZIG *zig,
|
||||
const char *metafile,
|
||||
char *pathname, char *errortext))
|
||||
{
|
||||
return(-1);
|
||||
}
|
||||
|
||||
int PR_CALLBACK
|
||||
SOB_cert_attribute(int attrib, ZIG *zig, long keylen, void *key,
|
||||
void **result, unsigned long *length)
|
||||
{
|
||||
return(-1);
|
||||
}
|
||||
|
||||
int PR_CALLBACK
|
||||
SOB_stash_cert(ZIG *zig, long keylen, void *key)
|
||||
{
|
||||
return(-1);
|
||||
}
|
||||
|
||||
int SOB_parse_manifest(char XP_HUGE *raw_manifest, long length,
|
||||
const char *path, const char *url, ZIG *zig)
|
||||
{
|
||||
return(-1);
|
||||
}
|
||||
|
||||
void
|
||||
SECNAV_signedAppletPrivileges(void *proto_win, char *javaPrin,
|
||||
char *javaTarget, char *risk, int isCert)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
char *
|
||||
SOB_JAR_list_certs (void)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
int
|
||||
SOB_JAR_validate_archive (char *filename)
|
||||
{
|
||||
return(-1);
|
||||
}
|
||||
|
||||
void *
|
||||
SOB_JAR_new_hash (int alg)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
void *
|
||||
SOB_JAR_hash (int alg, void *cookie, int length, void *data)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
void *
|
||||
SOB_JAR_end_hash (int alg, void *cookie)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
int
|
||||
SOB_JAR_sign_archive (char *nickname, char *password, char *sf, char *outsig)
|
||||
{
|
||||
return(-1);
|
||||
}
|
||||
|
||||
int
|
||||
SOB_set_context (ZIG *zig, MWContext *mw)
|
||||
{
|
||||
return(-1);
|
||||
}
|
||||
|
||||
int
|
||||
SOB_pass_archive(int format, char *filename, const char *url, ZIG *zig)
|
||||
{
|
||||
return(-1);
|
||||
}
|
||||
|
||||
int
|
||||
SOB_get_metainfo(ZIG *zig, char *name, char *header, void **info,
|
||||
unsigned long *length)
|
||||
{
|
||||
return(-1);
|
||||
}
|
||||
|
||||
int
|
||||
SOB_verified_extract(ZIG *zig, char *path, char *outpath)
|
||||
{
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/*
|
||||
** Hash a non-null terminated string "src" into "dest" using MD5
|
||||
*/
|
||||
SECStatus
|
||||
MD5_HashBuf(unsigned char *dest, const unsigned char *src,
|
||||
uint32 src_length)
|
||||
{
|
||||
return(SECFailure);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** Create a new MD5 context
|
||||
*/
|
||||
MD5Context *
|
||||
MD5_NewContext(void)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
** Destroy an MD5 secure hash context.
|
||||
** "cx" the context
|
||||
** "freeit" if PR_TRUE then free the object as well as its sub-objects
|
||||
*/
|
||||
void
|
||||
MD5_DestroyContext(MD5Context *cx, PRBool freeit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
** Reset an MD5 context, preparing it for a fresh round of hashing
|
||||
*/
|
||||
void
|
||||
MD5_Begin(MD5Context *cx)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
** Update the MD5 hash function with more data.
|
||||
** "cx" the context
|
||||
** "input" the data to hash
|
||||
** "inputLen" the amount of data to hash
|
||||
*/
|
||||
void
|
||||
MD5_Update(MD5Context *cx, const unsigned char *input, unsigned int inputLen)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
** Finish the MD5 hash function. Produce the digested results in "digest"
|
||||
** "cx" the context
|
||||
** "digest" where the 16 bytes of digest data are stored
|
||||
** "digestLen" where the digest length (16) is stored
|
||||
** "maxDigestLen" the maximum amount of data that can ever be
|
||||
** stored in "digest"
|
||||
*/
|
||||
void
|
||||
MD5_End(MD5Context *cx, unsigned char *digest,
|
||||
unsigned int *digestLen, unsigned int maxDigestLen)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
** Hash a non-null terminated string "src" into "dest" using SHA-1
|
||||
*/
|
||||
SECStatus
|
||||
SHA1_HashBuf(unsigned char *dest, const unsigned char *src, uint32 src_length)
|
||||
{
|
||||
return(SECFailure);
|
||||
}
|
||||
|
||||
/*
|
||||
** Create a new SHA-1 context
|
||||
*/
|
||||
SHA1Context *
|
||||
SHA1_NewContext(void)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
** Destroy a SHA-1 secure hash context.
|
||||
** "cx" the context
|
||||
** "freeit" if PR_TRUE then free the object as well as its sub-objects
|
||||
*/
|
||||
void
|
||||
SHA1_DestroyContext(SHA1Context *cx, PRBool freeit)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
** Reset a SHA-1 context, preparing it for a fresh round of hashing
|
||||
*/
|
||||
void
|
||||
SHA1_Begin(SHA1Context *cx)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
** Update the SHA-1 hash function with more data.
|
||||
** "cx" the context
|
||||
** "input" the data to hash
|
||||
** "inputLen" the amount of data to hash
|
||||
*/
|
||||
void
|
||||
SHA1_Update(SHA1Context *cx, const unsigned char *input, unsigned int inputLen)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
** Finish the SHA-1 hash function. Produce the digested results in "digest"
|
||||
** "cx" the context
|
||||
** "digest" where the 16 bytes of digest data are stored
|
||||
** "digestLen" where the digest length (20) is stored
|
||||
** "maxDigestLen" the maximum amount of data that can ever be
|
||||
** stored in "digest"
|
||||
*/
|
||||
void
|
||||
SHA1_End(SHA1Context *cx, unsigned char *digest,
|
||||
unsigned int *digestLen, unsigned int maxDigestLen)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
** Return a malloc'd ascii string which is the base64 encoded
|
||||
** version of the input string.
|
||||
*/
|
||||
char *
|
||||
BTOA_DataToAscii(const unsigned char *data, unsigned int len)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
** Return a malloc'd string which is the base64 decoded version
|
||||
** of the input string; set *lenp to the length of the returned data.
|
||||
*/
|
||||
unsigned char *
|
||||
ATOB_AsciiToData(const char *string, unsigned int *lenp)
|
||||
{
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
|
||||
236
mozilla/modules/security/freenav/secstubn.h
Normal file
236
mozilla/modules/security/freenav/secstubn.h
Normal file
@@ -0,0 +1,236 @@
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
#ifndef _SECSTUBN_H_
|
||||
#define _SECSTUBN_H_
|
||||
|
||||
#include "xp.h"
|
||||
#include "ntypes.h"
|
||||
#include "net.h"
|
||||
|
||||
typedef struct _digests DIGESTS;
|
||||
typedef struct _zig ZIG;
|
||||
typedef struct _zigcontext ZIG_Context;
|
||||
typedef struct _peheader PEHeader;
|
||||
|
||||
typedef struct SOBITEM_ {
|
||||
char *pathname;
|
||||
int type;
|
||||
size_t size;
|
||||
void *data;
|
||||
} SOBITEM;
|
||||
|
||||
typedef struct FINGERZIG_ {
|
||||
size_t length;
|
||||
void *key;
|
||||
CERTCertificate *cert;
|
||||
} FINGERZIG;
|
||||
|
||||
#define ZIG_CB_SIGNAL 1
|
||||
#define ZIG_SIGN 10
|
||||
#define ZIG_F_GUESS 0
|
||||
#define ZIG_MF 2
|
||||
#define ZIG_ERR_PNF 12
|
||||
|
||||
SEC_BEGIN_PROTOS
|
||||
|
||||
void
|
||||
SECNAV_Posting(PRFileDesc *fd);
|
||||
|
||||
void
|
||||
SECNAV_HTTPHead(PRFileDesc *fd);
|
||||
|
||||
void
|
||||
SECNAV_RegisterNetlibMimeConverters();
|
||||
|
||||
char *
|
||||
SECNAV_MungeString(const char *unmunged_string);
|
||||
|
||||
char *
|
||||
SECNAV_UnMungeString(const char *munged_string);
|
||||
|
||||
PRBool
|
||||
SECNAV_GenKeyFromChoice(void *proto_win, LO_Element *form,
|
||||
char *choiceString, char *challenge,
|
||||
char *typeString, char *pqgString,
|
||||
char **pValue, PRBool *pDone);
|
||||
|
||||
char **
|
||||
SECNAV_GetKeyChoiceList(char *type, char *pqgString);
|
||||
|
||||
PRBool
|
||||
SECNAV_SecurityDialog(MWContext *context, int state);
|
||||
|
||||
void
|
||||
NET_InitCertLdapProtocol(void);
|
||||
const char *
|
||||
|
||||
SECNAV_GetPolicyNameString(void);
|
||||
|
||||
int
|
||||
SECNAV_InitConfigObject(void);
|
||||
|
||||
int
|
||||
SECNAV_RunInitialSecConfig(void);
|
||||
|
||||
void
|
||||
SECNAV_EarlyInit(void);
|
||||
|
||||
void
|
||||
SECNAV_Init(void);
|
||||
|
||||
void
|
||||
SECNAV_Shutdown(void);
|
||||
|
||||
void
|
||||
SECNAV_SecurityAdvisor(void *proto_win, URL_Struct *url);
|
||||
|
||||
char *
|
||||
SECNAV_MakeCertButtonString(CERTCertificate *cert);
|
||||
|
||||
int
|
||||
SECNAV_SecURLData(char *which, NET_StreamClass *stream, MWContext *cx);
|
||||
|
||||
char *
|
||||
SECNAV_SecURLContentType(char *which);
|
||||
|
||||
int
|
||||
SECNAV_SecHandleSecurityAdvisorURL(MWContext *cx, const char *which);
|
||||
|
||||
void
|
||||
SECNAV_HandleInternalSecURL(URL_Struct *url, MWContext *cx);
|
||||
|
||||
SECStatus
|
||||
SECNAV_ComputeFortezzaProxyChallengeResponse(MWContext *context,
|
||||
char *asciiChallenge,
|
||||
char **signature_out,
|
||||
char **clientRan_out,
|
||||
char **certChain_out);
|
||||
|
||||
char *
|
||||
SECNAV_PrettySecurityStatus(int level, unsigned char *status);
|
||||
|
||||
char *
|
||||
SECNAV_SecurityVersion(PRBool longForm);
|
||||
|
||||
char *
|
||||
SECNAV_SSLCapabilities(void);
|
||||
|
||||
unsigned char *
|
||||
SECNAV_SSLSocketStatus(PRFileDesc *fd, int *return_security_level);
|
||||
|
||||
unsigned char *
|
||||
SECNAV_CopySSLSocketStatus(unsigned char *status);
|
||||
|
||||
unsigned int
|
||||
SECNAV_SSLSocketStatusLength(unsigned char *status);
|
||||
|
||||
char *
|
||||
SECNAV_SSLSocketCertString(unsigned char *status);
|
||||
|
||||
PRBool
|
||||
SECNAV_CompareCertsForRedirection(unsigned char *status1,
|
||||
unsigned char *status2);
|
||||
|
||||
CERTCertificate *
|
||||
SECNAV_CertFromSSLSocketStatus(unsigned char *status);
|
||||
|
||||
|
||||
DIGESTS *PR_CALLBACK
|
||||
SOB_calculate_digest(void XP_HUGE *data, long length);
|
||||
|
||||
int PR_CALLBACK
|
||||
SOB_verify_digest(ZIG *siglist, const char *name, DIGESTS *dig);
|
||||
|
||||
void PR_CALLBACK
|
||||
SOB_destroy (ZIG *zig);
|
||||
|
||||
char *
|
||||
SOB_get_error (int status);
|
||||
|
||||
ZIG_Context *
|
||||
SOB_find(ZIG *zig, char *pattern, int type);
|
||||
|
||||
int
|
||||
SOB_find_next(ZIG_Context *ctx, SOBITEM **it);
|
||||
|
||||
void
|
||||
SOB_find_end(ZIG_Context *ctx);
|
||||
|
||||
char *
|
||||
SOB_get_url (ZIG *zig);
|
||||
|
||||
ZIG *
|
||||
SOB_new (void);
|
||||
|
||||
int
|
||||
SOB_set_callback (int type, ZIG *zig,
|
||||
int (*fn) (int status, ZIG *zig,
|
||||
const char *metafile,
|
||||
char *pathname, char *errortext));
|
||||
|
||||
int PR_CALLBACK
|
||||
SOB_cert_attribute(int attrib, ZIG *zig, long keylen, void *key,
|
||||
void **result, unsigned long *length);
|
||||
|
||||
int PR_CALLBACK
|
||||
SOB_stash_cert(ZIG *zig, long keylen, void *key);
|
||||
|
||||
int SOB_parse_manifest(char XP_HUGE *raw_manifest, long length,
|
||||
const char *path, const char *url, ZIG *zig);
|
||||
|
||||
void
|
||||
SECNAV_signedAppletPrivileges(void *proto_win, char *javaPrin,
|
||||
char *javaTarget, char *risk, int isCert);
|
||||
|
||||
char *
|
||||
SOB_JAR_list_certs (void);
|
||||
|
||||
int
|
||||
SOB_JAR_validate_archive (char *filename);
|
||||
|
||||
void *
|
||||
SOB_JAR_new_hash (int alg);
|
||||
|
||||
void *
|
||||
SOB_JAR_hash (int alg, void *cookie, int length, void *data);
|
||||
|
||||
void *
|
||||
SOB_JAR_end_hash (int alg, void *cookie);
|
||||
|
||||
int
|
||||
SOB_JAR_sign_archive (char *nickname, char *password, char *sf, char *outsig);
|
||||
|
||||
int
|
||||
SOB_set_context (ZIG *zig, MWContext *mw);
|
||||
|
||||
int
|
||||
SOB_pass_archive(int format, char *filename, const char *url, ZIG *zig);
|
||||
|
||||
int
|
||||
SOB_get_metainfo(ZIG *zig, char *name, char *header, void **info,
|
||||
unsigned long *length);
|
||||
|
||||
int
|
||||
SOB_verified_extract(ZIG *zig, char *path, char *outpath);
|
||||
|
||||
NET_StreamClass *
|
||||
SECNAV_MakePreencryptedWriteStream(FO_Present_Types format_out, void *data,
|
||||
URL_Struct *url, MWContext *window_id);
|
||||
|
||||
SEC_END_PROTOS
|
||||
|
||||
#endif /* _SECSTUBN_H_ */
|
||||
@@ -1,66 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "nsID.h"
|
||||
|
||||
const static char gIDFormat[] =
|
||||
"{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}";
|
||||
|
||||
/*
|
||||
* Turns a {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} string into
|
||||
* an nsID
|
||||
*/
|
||||
|
||||
PRBool nsID::Parse(char *aIDStr) {
|
||||
int count, n1, n2, n3[8];
|
||||
long int n0;
|
||||
|
||||
count = sscanf(aIDStr, gIDFormat,
|
||||
&n0, &n1, &n2,
|
||||
&n3[0],&n3[1],&n3[2],&n3[3],
|
||||
&n3[4],&n3[5],&n3[6],&n3[7]);
|
||||
|
||||
m0 = (PRInt32) n0;
|
||||
m1 = (PRInt16) n1;
|
||||
m2 = (PRInt16) n2;
|
||||
for (int i = 0; i < 8; i++) {
|
||||
m3[i] = (PRInt8) n3[i];
|
||||
}
|
||||
|
||||
return (PRBool) (count == 11);
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns an allocated string in {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
|
||||
* format. Caller should delete [] the string.
|
||||
*/
|
||||
|
||||
char *nsID::ToString() const
|
||||
{
|
||||
char *res = new char[39];
|
||||
|
||||
if (res != NULL) {
|
||||
sprintf(res, gIDFormat,
|
||||
(long int) m0, (int) m1, (int) m2,
|
||||
(int) m3[0], (int) m3[1], (int) m3[2], (int) m3[3],
|
||||
(int) m3[4], (int) m3[5], (int) m3[6], (int) m3[7]);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user