[zorp] running policy.py error

Balazs Scheidler bazsi at balabit.hu
Fri Apr 4 21:08:36 CEST 2008


This problem is caused by using Python 2.5 which is not compatible with
the current version of Zorp. Please use an older Python version or apply
the patch below.

To use an older Python version try configure-ing Zorp the following way:

PYTHON=python2.4 ./configure <configure options>

--- orig/lib/pyattach.c
+++ mod/lib/pyattach.c
@@ -274,7 +274,7 @@
     z_policy_unref(self->policy);
 #endif /* END MARK */
   z_sockaddr_unref(self->local);
-  PyMem_DEL(self);
+  PyObject_Del(self);
   z_return();
 }
 
@@ -383,7 +383,7 @@
       break;
     }
   Py_XDECREF(fake_args);
-  self = PyObject_NEW(ZorpAttach, &z_py_zorp_attach_type);
+  self = PyObject_New(ZorpAttach, &z_py_zorp_attach_type);
   if (!self)
     z_return(NULL);
   


--- orig/lib/pydict.c
+++ mod/lib/pydict.c
@@ -469,7 +469,7 @@
 {
   ZPolicyMethod *self;
   
-  self = PyObject_NEW(ZPolicyMethod, &z_policy_method_type);
+  self = PyObject_New(ZPolicyMethod, &z_policy_method_type);
   if (!self)
     return NULL;
   self->user_data = user_data;
@@ -490,7 +490,7 @@
 {
   if (self->user_data && self->user_data_free)
     self->user_data_free(self->user_data);
-  PyMem_DEL(self);
+  PyObject_Del(self);
 }
 
 static PyTypeObject z_policy_method_type = 
@@ -967,7 +967,7 @@
 static ZPolicyHash *
 z_policy_hash_new(GHashTable *hash, gboolean consume)
 {
-  ZPolicyHash *self = PyObject_NEW(ZPolicyHash, &z_policy_hash_type);
+  ZPolicyHash *self = PyObject_New(ZPolicyHash, &z_policy_hash_type);
 
   self->hash = hash;
   self->consume = consume;
@@ -1012,7 +1012,7 @@
 {
   if (self->consume)
     z_policy_hash_destroy_table(self->hash);
-  PyMem_DEL(self);
+  PyObject_Del(self);
 }
 
 PyMappingMethods z_policy_hash_mapping =
@@ -1299,7 +1299,7 @@
 static ZPolicyDimHash *
 z_policy_dim_hash_new(ZDimHashTable *hash, gboolean consume)
 {
-  ZPolicyDimHash *self = PyObject_NEW(ZPolicyDimHash, &z_policy_dim_hash_type);
+  ZPolicyDimHash *self = PyObject_New(ZPolicyDimHash, &z_policy_dim_hash_type);
   
   self->hash = hash;
   self->consume = consume;
@@ -1318,7 +1318,7 @@
 {
   if (self->consume)
     z_dim_hash_table_free(self->hash, z_policy_dim_hash_unref_items);
-  PyMem_DEL(self);
+  PyObject_Del(self);
 }
 
 PyMappingMethods z_policy_dim_hash_mapping = 


--- orig/lib/pydispatch.c
+++ mod/lib/pydispatch.c
@@ -376,7 +376,7 @@
       
     }
 
-  self = PyObject_NEW(ZPolicyDispatch, &z_policy_dispatch_type);
+  self = PyObject_New(ZPolicyDispatch, &z_policy_dispatch_type);
   if (!self)
     goto error_exit;
 
@@ -451,7 +451,7 @@
       self->policy = NULL;
     }
 #endif /* END MARK */
-  PyMem_DEL(self);
+  PyObject_Del(self);
 }
 
 


--- orig/lib/pysatyr.c
+++ mod/lib/pysatyr.c
@@ -37,7 +37,7 @@
   if (!PyArg_ParseTuple(args, "iiiiss", &port, &timeout, &connect_timeout, &use_ssl, &cert_file, &key_file))
     z_return(NULL);
 
-  self = PyObject_NEW(ZorpSatyr, &z_py_zorp_satyr_type);
+  self = PyObject_New(ZorpSatyr, &z_py_zorp_satyr_type);
   self->port = port;
   self->timeout = timeout;
   self->connect_timeout = connect_timeout;
@@ -53,7 +53,7 @@
   z_enter();
   g_string_free(self->cert_file, TRUE);
   g_string_free(self->key_file, TRUE);
-  PyMem_DEL(self);
+  PyObject_Del(self);
   z_return();
 }
 


--- orig/lib/pystream.c
+++ mod/lib/pystream.c
@@ -96,7 +96,7 @@
       return NULL;
     }
 
-  self = PyObject_NEW(ZPolicyStream, &z_policy_stream_type);
+  self = PyObject_New(ZPolicyStream, &z_policy_stream_type);
   z_stream_ref(str);
   self->stream = str;
   return (PyObject *) self;
@@ -123,7 +123,7 @@
 
   if (!PyArg_ParseTuple(args, "is", &fd, &name))
     return NULL;
-  self = PyObject_NEW(ZPolicyStream, &z_policy_stream_type);
+  self = PyObject_New(ZPolicyStream, &z_policy_stream_type);
   if (!self)
     return NULL;
 
@@ -144,7 +144,7 @@
   ZPolicyStream *self = (ZPolicyStream *) o;
 
   z_stream_unref(self->stream);
-  PyMem_DEL(self);
+  PyObject_Del(self);
 }
 
 /**


--- orig/lib/pystruct.c
+++ mod/lib/pystruct.c
@@ -120,7 +120,7 @@
   ZPolicyStruct *self;
 
   g_assert(type > Z_PST_NONE && type < Z_PST_MAX);
-  self = PyObject_NEW(ZPolicyStruct, &z_policy_struct_types[type]);
+  self = PyObject_New(ZPolicyStruct, &z_policy_struct_types[type]);
 
   if (!self)
     return NULL;
@@ -142,7 +142,7 @@
       z_policy_dict_unwrap(self->dict, s);
       z_policy_dict_free(self->dict);
     }
-  PyMem_DEL(self);
+  PyObject_Del(self);
 }
 
 void


--- orig/lib/pyzasauth.c
+++ mod/lib/pyzasauth.c
@@ -50,7 +50,7 @@
       z_return(NULL);
     }
 
-  self = PyObject_NEW(ZorpZASAuth, &z_py_zorp_zasauth_type);
+  self = PyObject_New(ZorpZASAuth, &z_py_zorp_zasauth_type);
   if (!self)
     z_return(NULL);
   
@@ -72,7 +72,7 @@
   
   z_enter();
   z_zas_destroy(self->zas);
-  PyMem_DEL(self);
+  PyObject_Del(self);
   z_return();
 }
 


--- orig/modules/pssl2/psslpolicy.c
+++ mod/modules/pssl2/psslpolicy.c
@@ -39,7 +39,7 @@
   if (cert)
     {
 
-      self = PyObject_NEW(ZorpCertificate, &z_py_zorp_certificate_type);
+      self = PyObject_New(ZorpCertificate, &z_py_zorp_certificate_type);
       self->cert = cert;
       CRYPTO_add(&cert->references,1,CRYPTO_LOCK_X509);
       return (PyObject *) self;
@@ -102,7 +102,7 @@
 z_py_zorp_certificate_free(ZorpCertificate *self)
 {
   X509_free(self->cert);
-  PyMem_DEL(self);
+  PyObject_Del(self);
 }
 
 static PyTypeObject z_py_zorp_certificate_type =
@@ -146,7 +146,7 @@
 {
   ZorpCRL *self;
 
-  self = PyObject_NEW(ZorpCRL, &z_py_zorp_crl_type);
+  self = PyObject_New(ZorpCRL, &z_py_zorp_crl_type);
   self->crl = crl;
   CRYPTO_add(&crl->references,1,CRYPTO_LOCK_X509_CRL);
   return (PyObject *) self;
@@ -188,7 +188,7 @@
 z_py_zorp_crl_free(ZorpCRL *self)
 {
   X509_CRL_free(self->crl);
-  PyMem_DEL(self);
+  PyObject_Del(self);
 }
 
 static PyTypeObject z_py_zorp_crl_type =
@@ -233,7 +233,7 @@
 {
   ZorpCertList *self;
 
-  self = PyObject_NEW(ZorpCertList, &z_py_zorp_cert_list_type);
+  self = PyObject_New(ZorpCertList, &z_py_zorp_cert_list_type);
   self->certs = certs;
   return (PyObject *) self;
 }
@@ -241,7 +241,7 @@
 static void
 z_py_zorp_cert_list_free(ZorpCertList *self)
 {
-  PyMem_DEL(self);
+  PyObject_Del(self);
 }
 
 static int 
@@ -386,7 +386,7 @@
 {
   ZorpCertNameList *self;
 
-  self = PyObject_NEW(ZorpCertNameList, &z_py_zorp_cert_name_list_type);
+  self = PyObject_New(ZorpCertNameList, &z_py_zorp_cert_name_list_type);
   self->cert_names = cert_names;
   return (PyObject *) self;
 }
@@ -394,7 +394,7 @@
 static void
 z_py_zorp_cert_name_list_free(ZorpCertNameList *self)
 {
-  PyMem_DEL(self);
+  PyObject_Del(self);
 }
 
 static int 
@@ -498,7 +498,7 @@
 {
   ZorpCRLList *self;
 
-  self = PyObject_NEW(ZorpCRLList, &z_py_zorp_crl_list_type);
+  self = PyObject_New(ZorpCRLList, &z_py_zorp_crl_list_type);
   self->crls = crls;
   return (PyObject *) self;
 }
@@ -506,7 +506,7 @@
 static void
 z_py_zorp_crl_list_free(ZorpCRLList *self)
 {
-  PyMem_DEL(self);
+  PyObject_Del(self);
 }
 
 static int 






On Fri, 2008-04-04 at 15:48 +0900, 조성우 wrote:
>  
> 
> Now, I’m trying to study your tremendous job, zorp.
> 
> So, first of all, thank you for your sharing such a good proxy source.
> 
> Anyway, I have some problem with running zorp.
> 
> Please see the stack dump log below.
> 
>  
> 
> Apr 04 21:54:06 (nosession): Starting up; verbose_level='5',
> version='3.1.12', startup_id='1207313646'
> 
> [New Thread -1208752368 (LWP 31777)]
> 
> [Detaching after fork from child process 31780. (Try `set
> detach-on-fork off'.)]
> 
> [New Thread -1208755312 (LWP 31782)]
> 
> Apr 04 21:54:06 (nosession): Outbound service; zone='site-net',
> service='intra_http'
> 
> Apr 04 21:54:06 (nosession): Outbound service; zone='site-net',
> service='intra_ftp'
> 
> Apr 04 21:54:06 (nosession): Outbound service; zone='site-net',
> service='intra_cvs'
> 
> Apr 04 21:54:06 (nosession): Inbound service; zone='local',
> service='*'
> 
> Apr 04 21:54:06 (nosession): Inbound service; zone='internet',
> service='*'
> 
> *** glibc detected *** /home2/zorp/zorptest: munmap_chunk(): invalid
> pointer: 0xb7e7e350 ***
> 
>  
> 
> warning: Missing the separate debug info
> file: /usr/lib/debug/.build-id/db/8cb95645d5df469d4aece301cdb5e60087be21.debug
> 
> ======= Backtrace: =========
> 
> /lib/libc.so.6(cfree+0x1bb)[0x50221b]
> 
> /usr/local/lib/libzorp.so.0[0x1417bc]
> 
> /usr/lib/libpython2.5.so.1.0[0x619361d]
> 
> /usr/lib/libpython2.5.so.1.0(PyEval_EvalFrameEx+0x316b)[0x61c95db]
> 
> /usr/lib/libpython2.5.so.1.0(PyEval_EvalCodeEx+0x7ef)[0x61cd69f]
> 
> /usr/lib/libpython2.5.so.1.0[0x616c1ea]
> 
> /usr/lib/libpython2.5.so.1.0(PyObject_Call+0x37)[0x614d137]
> 
> /usr/lib/libpython2.5.so.1.0[0x614e423]
> 
> /usr/lib/libpython2.5.so.1.0(PyObject_CallFunction+0x3f)[0x614e70f]
> 
> /usr/local/lib/libzorp.so.0(z_policy_init+0x89)[0x123a8a]
> 
> /usr/local/lib/libzorp.so.0(z_load_policy+0xbf)[0x12579f]
> 
> /usr/local/lib/libzorp.so.0(z_main_loop+0x24)[0x125919]
> 
> /home2/zorp/zorptest[0x804a682]
> 
> /lib/libc.so.6(__libc_start_main+0xe0)[0x4ab390]
> 
>  
> 
> Actually I can not found DNS.py which is imported in “Matcher.py”
> 
> So, I download it from “http://pydns.sourceforge.net/index.html” but
> there is no method called “DiscoverNameServers”
> 
> So I remarked the line of calling “DiscoverNameServers” and then got
> the python error posted above.
> 
>  
> 
> I guess there are two possibilities, the first is using wrong
> “policy.py” and the other is using wrong “DNS.py”.
> 
> Please give a direction. Thanks.
> 
>  
> 
> 
> _______________________________________________
> zorp mailing list
> zorp at lists.balabit.hu
> https://lists.balabit.hu/mailman/listinfo/zorp
-- 
Bazsi




More information about the zorp mailing list