-const char cgi_rcs[] = "$Id: cgi.c,v 1.70.2.2 2002/11/12 16:20:37 oes Exp $";
+const char cgi_rcs[] = "$Id: cgi.c,v 1.70.2.3 2002/11/28 18:14:32 oes Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/Attic/cgi.c,v $
*
* Revisions :
* $Log: cgi.c,v $
+ * Revision 1.70.2.3 2002/11/28 18:14:32 oes
+ * Disable access to critical CGIs via untrusted referrers.
+ * This prevents users from being tricked by malicious websites
+ * into making unintentional configuration changes:
+ *
+ * - Added flag to each cgi_dispatcher that allows or denies
+ * external linking
+ * - Introduced proviorical function that greps for the
+ * referrer header before regular header parsing happens
+ * - Added safety check to dispatch_known_cgi. CGI is called
+ * if (cgi harmless || no referrer || we are referrer).
+ * Else a) toggle calls are modified not to change status and
+ * b) all other calls are denied.
+ *
* Revision 1.70.2.2 2002/11/12 16:20:37 oes
* Added missing #ifdef FEATURE_TOGGLE around g_bToggleIJB; fixes bug #636651
*
#endif /* def FEATURE_CGI_EDIT_ACTIONS */
#include "loadcfg.h"
/* loadcfg.h is for g_bToggleIJB only */
-
+#ifdef FEATURE_PTHREAD
+#include <pthread.h>
+#include "jcc.h"
+/* jcc.h is for mutex semaphore globals only */
+#endif /* def FEATURE_PTHREAD */
const char cgi_h_rcs[] = CGI_H_VERSION;
/*
/* get and save the gmt */
{
-#ifdef HAVE_GMTIME_R
+#ifdef OSX_DARWIN
+ pthread_mutex_lock(&gmtime_mutex);
+ t = gmtime(¤t_time);
+ pthread_mutex_unlock(&gmtime_mutex);
+#elif HAVE_GMTIME_R
struct tm dummy;
t = gmtime_r(¤t_time, &dummy);
#else
dnl Process this file with autoconf to produce a configure script.
dnl
-dnl $Id: configure.in,v 1.68.2.10 2003/01/08 16:39:41 oes Exp $
+dnl $Id: configure.in,v 1.68.2.11 2003/03/06 15:22:37 oes Exp $
dnl
dnl Written by and Copyright (C) 2001, 2002 the SourceForge
dnl Privoxy team. http://www.privoxy.org/
dnl Temple Place - Suite 330, Boston, MA 02111-1307, USA.
dnl
dnl $Log: configure.in,v $
+dnl Revision 1.68.2.11 2003/03/06 15:22:37 oes
+dnl Fixed minor shell syntax bug
+dnl
dnl Revision 1.68.2.10 2003/01/08 16:39:41 oes
dnl Changing default to exclude FEATURE_IMAGE_DETECT_MSIE because of problem reports with recent IEs
dnl
dnl AutoConf Initialization
dnl =================================================================
-AC_REVISION($Revision: 1.68.2.10 $)
+AC_REVISION($Revision: 1.68.2.11 $)
AC_INIT(jcc.c)
if test ! -f config.h.in; then
dnl =================================================================
case "$host" in
-*-apple-darwin*) SPECIAL_CFLAGS="-Dunix"
+*-apple-darwin*) SPECIAL_CFLAGS="-Dunix -DOSX_DARWIN"
;;
esac
-const char errlog_rcs[] = "$Id: errlog.c,v 1.40.2.1 2002/09/25 12:47:42 oes Exp $";
+const char errlog_rcs[] = "$Id: errlog.c,v 1.40.2.2 2002/09/28 00:30:57 david__schmidt Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/Attic/errlog.c,v $
*
* Revisions :
* $Log: errlog.c,v $
+ * Revision 1.40.2.2 2002/09/28 00:30:57 david__schmidt
+ * Update error logging to give sane values for thread IDs on Mach kernels.
+ * It's still a hack, but at least it looks farily normal. We print the
+ * absolute value of the first 4 bytes of the pthread_t modded with 1000.
+ *
* Revision 1.40.2.1 2002/09/25 12:47:42 oes
* Make log_error safe against NULL string arguments
*
time (&now);
#ifdef HAVE_LOCALTIME_R
tm_now = *localtime_r(&now, &tm_now);
+#elif OSX_DARWIN
+ pthread_mutex_lock(&localtime_mutex);
+ tm_now = *localtime (&now);
+ pthread_mutex_unlock(&localtime_mutex);
#else
tm_now = *localtime (&now);
#endif
time (&now);
#ifdef HAVE_GMTIME_R
gmt = *gmtime_r(&now, &gmt);
+#elif OSX_DARWIN
+ pthread_mutex_lock(&gmtime_mutex);
+ gmt = *gmtime(&now);
+ pthread_mutex_unlock(&gmtime_mutex);
#else
gmt = *gmtime(&now);
#endif
#ifdef HAVE_LOCALTIME_R
tm_now = localtime_r(&now, &dummy);
+#elif OSX_DARWIN
+ pthread_mutex_lock(&localtime_mutex);
+ tm_now = localtime (&now);
+ pthread_mutex_unlock(&localtime_mutex);
#else
tm_now = localtime (&now);
#endif
-const char jbsockets_rcs[] = "$Id: jbsockets.c,v 1.35.2.1 2002/05/26 23:41:27 joergs Exp $";
+const char jbsockets_rcs[] = "$Id: jbsockets.c,v 1.35.2.2 2002/11/20 14:37:24 oes Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/Attic/jbsockets.c,v $
*
* Revisions :
* $Log: jbsockets.c,v $
+ * Revision 1.35.2.2 2002/11/20 14:37:24 oes
+ * Fixed Win32 error logging in bind_port.
+ * Thanks to Oliver Stoeneberg for the hint.
+ *
* Revision 1.35.2.1 2002/05/26 23:41:27 joergs
* AmigaOS: Fixed wrong type of len in write_socket()
*
#endif
+#ifdef OSX_DARWIN
+#include <pthread.h>
+#include "jcc.h"
+/* jcc.h is for mutex semaphores only */
+#endif /* def OSX_DARWIN */
+
#include "project.h"
#include "jbsockets.h"
#include "filters.h"
{
host = NULL;
}
+#elif defined(OSX_DARWIN)
+ pthread_mutex_lock(&gethostbyaddr_mutex);
+ host = gethostbyaddr((const char *)&server.sin_addr,
+ sizeof(server.sin_addr), AF_INET);
+ pthread_mutex_unlock(&gethostbyaddr_mutex);
#else
host = gethostbyaddr((const char *)&server.sin_addr,
sizeof(server.sin_addr), AF_INET);
{
hostp = NULL;
}
+#elif OSX_DARWIN
+ pthread_mutex_lock(&gethostbyname_mutex);
+ hostp = gethostbyname(host);
+ pthread_mutex_unlock(&gethostbyname_mutex);
#else
hostp = gethostbyname(host);
#endif /* def HAVE_GETHOSTBYNAME_R_(6|5|3)_ARGS */
-const char jcc_rcs[] = "$Id: jcc.c,v 1.92.2.2 2002/11/20 14:37:47 oes Exp $";
+const char jcc_rcs[] = "$Id: jcc.c,v 1.92.2.3 2003/02/28 12:53:06 oes Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/Attic/jcc.c,v $
*
* Revisions :
* $Log: jcc.c,v $
+ * Revision 1.92.2.3 2003/02/28 12:53:06 oes
+ * Fixed two mostly harmless mem leaks
+ *
* Revision 1.92.2.2 2002/11/20 14:37:47 oes
* Fix: Head of global clients list now initialized to NULL
*
#define sleep(N) DosSleep(((N) * 100))
#endif
+#ifdef OSX_DARWIN
+/*
+ * Hit OSX over the head with a hammer. Protect all *_r functions.
+ */
+pthread_mutex_t gmtime_mutex;
+pthread_mutex_t localtime_mutex;
+pthread_mutex_t gethostbyaddr_mutex;
+pthread_mutex_t gethostbyname_mutex;
+#endif /* def OSX_DARWIN */
+
#if defined(unix) || defined(__EMX__)
const char *basedir;
const char *pidfile = NULL;
InitWin32();
#endif
+#ifdef OSX_DARWIN
+ /*
+ * Prepare global mutex semaphores
+ */
+ pthread_mutex_init(&gmtime_mutex,0);
+ pthread_mutex_init(&localtime_mutex,0);
+ pthread_mutex_init(&gethostbyaddr_mutex,0);
+ pthread_mutex_init(&gethostbyname_mutex,0);
+#endif /* def OSX_DARWIN */
+
/*
* Unix signal handling
*
#ifndef JCC_H_INCLUDED
#define JCC_H_INCLUDED
-#define JCC_H_VERSION "$Id: jcc.h,v 1.11 2002/03/24 13:25:43 swa Exp $"
+#define JCC_H_VERSION "$Id: jcc.h,v 1.12 2002/03/26 22:29:55 swa Exp $"
/*********************************************************************
*
- * File : $Source: /cvsroot/ijbswa/current/jcc.h,v $
+ * File : $Source: /cvsroot/ijbswa/current/Attic/jcc.h,v $
*
* Purpose : Main file. Contains main() method, main loop, and
* the main connection-handling function.
*
* Revisions :
* $Log: jcc.h,v $
+ * Revision 1.12 2002/03/26 22:29:55 swa
+ * we have a new homepage!
+ *
* Revision 1.11 2002/03/24 13:25:43 swa
* name change related issues
*
extern int g_terminate;
#endif
+#ifdef OSX_DARWIN
+extern pthread_mutex_t gmtime_mutex;
+extern pthread_mutex_t localtime_mutex;
+extern pthread_mutex_t gethostbyaddr_mutex;
+extern pthread_mutex_t gethostbyname_mutex;
+#endif /* def OSX_DARWIN */
+
/* Functions */
#ifdef __MINGW32__
-const char parsers_rcs[] = "$Id: parsers.c,v 1.56.2.2 2002/09/25 14:59:53 oes Exp $";
+const char parsers_rcs[] = "$Id: parsers.c,v 1.56.2.3 2002/11/10 04:20:02 hal9 Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/Attic/parsers.c,v $
*
* Revisions :
* $Log: parsers.c,v $
+ * Revision 1.56.2.3 2002/11/10 04:20:02 hal9
+ * Fix typo: supressed -> suppressed
+ *
* Revision 1.56.2.2 2002/09/25 14:59:53 oes
* Improved cookie logging
*
#include <unistd.h>
#endif
+#ifdef OSX_DARWIN
+#include <pthread.h>
+#include "jcc.h"
+/* jcc.h is for mutex semapores only */
+#endif /* def OSX_DARWIN */
#include "project.h"
#include "list.h"
#include "parsers.h"
time (&now);
#ifdef HAVE_LOCALTIME_R
tm_now = *localtime_r(&now, &tm_now);
+#elif OSX_DARWIN
+ pthread_mutex_lock(&localtime_mutex);
+ tm_now = *localtime (&now);
+ pthread_mutex_unlock(&localtime_mutex);
#else
tm_now = *localtime (&now);
#endif