Parcourir la source

[1245] raise exception in _Check() if obj is NULL

Jelte Jansen il y a 13 ans
Parent
commit
0ea828cb5c

+ 3 - 0
src/lib/dns/python/edns_python.cc

@@ -392,6 +392,9 @@ createEDNSObject(const EDNS& source) {
 
 bool
 PyEDNS_Check(PyObject* obj) {
+    if (obj == NULL) {
+        isc_throw(PyCPPWrapperException, "obj argument NULL in typecheck");
+    }
     return (PyObject_TypeCheck(obj, &edns_type));
 }
 

+ 2 - 0
src/lib/dns/python/edns_python.h

@@ -36,6 +36,8 @@ PyObject* createEDNSObject(const EDNS& source);
 
 /// \brief Checks if the given python object is a EDNS object
 ///
+/// \exception PyCPPWrapperException if obj is NULL
+///
 /// \param obj The object to check the type of
 /// \return true if the object is of type EDNS, false otherwise
 bool PyEDNS_Check(PyObject* obj);

+ 3 - 0
src/lib/dns/python/messagerenderer_python.cc

@@ -283,6 +283,9 @@ createMessageRendererObject(const MessageRenderer& source) {
 
 bool
 PyMessageRenderer_Check(PyObject* obj) {
+    if (obj == NULL) {
+        isc_throw(PyCPPWrapperException, "obj argument NULL in typecheck");
+    }
     return (PyObject_TypeCheck(obj, &messagerenderer_type));
 }
 

+ 2 - 0
src/lib/dns/python/messagerenderer_python.h

@@ -37,6 +37,8 @@ PyObject* createMessageRendererObject(const MessageRenderer& source);
 
 /// \brief Checks if the given python object is a MessageRenderer object
 ///
+/// \exception PyCPPWrapperException if obj is NULL
+///
 /// \param obj The object to check the type of
 /// \return true if the object is of type MessageRenderer, false otherwise
 bool PyMessageRenderer_Check(PyObject* obj);

+ 3 - 0
src/lib/dns/python/name_python.cc

@@ -729,6 +729,9 @@ createNameObject(const Name& source) {
 
 bool
 PyName_Check(PyObject* obj) {
+    if (obj == NULL) {
+        isc_throw(PyCPPWrapperException, "obj argument NULL in typecheck");
+    }
     return (PyObject_TypeCheck(obj, &name_type));
 }
 

+ 2 - 0
src/lib/dns/python/name_python.h

@@ -58,6 +58,8 @@ PyObject* createNameObject(const Name& source);
 
 /// \brief Checks if the given python object is a Name object
 ///
+/// \exception PyCPPWrapperException if obj is NULL
+///
 /// \param obj The object to check the type of
 /// \return true if the object is of type Name, false otherwise
 bool PyName_Check(PyObject* obj);

+ 3 - 0
src/lib/dns/python/opcode_python.cc

@@ -404,6 +404,9 @@ createOpcodeObject(const Opcode& source) {
 
 bool
 PyOpcode_Check(PyObject* obj) {
+    if (obj == NULL) {
+        isc_throw(PyCPPWrapperException, "obj argument NULL in typecheck");
+    }
     return (PyObject_TypeCheck(obj, &opcode_type));
 }
 

+ 2 - 0
src/lib/dns/python/opcode_python.h

@@ -36,6 +36,8 @@ PyObject* createOpcodeObject(const Opcode& source);
 
 /// \brief Checks if the given python object is a Opcode object
 ///
+/// \exception PyCPPWrapperException if obj is NULL
+///
 /// \param obj The object to check the type of
 /// \return true if the object is of type Opcode, false otherwise
 bool PyOpcode_Check(PyObject* obj);

+ 3 - 0
src/lib/dns/python/question_python.cc

@@ -283,6 +283,9 @@ createQuestionObject(const Question& source) {
 
 bool
 PyQuestion_Check(PyObject* obj) {
+    if (obj == NULL) {
+        isc_throw(PyCPPWrapperException, "obj argument NULL in typecheck");
+    }
     return (PyObject_TypeCheck(obj, &question_type));
 }
 

+ 2 - 0
src/lib/dns/python/question_python.h

@@ -43,6 +43,8 @@ PyObject* createQuestionObject(const Question& source);
 
 /// \brief Checks if the given python object is a Question object
 ///
+/// \exception PyCPPWrapperException if obj is NULL
+///
 /// \param obj The object to check the type of
 /// \return true if the object is of type Question, false otherwise
 bool PyQuestion_Check(PyObject* obj);

+ 3 - 0
src/lib/dns/python/rcode_python.cc

@@ -445,6 +445,9 @@ createRcodeObject(const Rcode& source) {
 
 bool
 PyRcode_Check(PyObject* obj) {
+    if (obj == NULL) {
+        isc_throw(PyCPPWrapperException, "obj argument NULL in typecheck");
+    }
     return (PyObject_TypeCheck(obj, &rcode_type));
 }
 

+ 2 - 0
src/lib/dns/python/rcode_python.h

@@ -36,6 +36,8 @@ PyObject* createRcodeObject(const Rcode& source);
 
 /// \brief Checks if the given python object is a Rcode object
 ///
+/// \exception PyCPPWrapperException if obj is NULL
+///
 /// \param obj The object to check the type of
 /// \return true if the object is of type Rcode, false otherwise
 bool PyRcode_Check(PyObject* obj);

+ 3 - 0
src/lib/dns/python/rdata_python.cc

@@ -306,6 +306,9 @@ createRdataObject(ConstRdataPtr source) {
 
 bool
 PyRdata_Check(PyObject* obj) {
+    if (obj == NULL) {
+        isc_throw(PyCPPWrapperException, "obj argument NULL in typecheck");
+    }
     return (PyObject_TypeCheck(obj, &rdata_type));
 }
 

+ 2 - 0
src/lib/dns/python/rdata_python.h

@@ -43,6 +43,8 @@ PyObject* createRdataObject(isc::dns::rdata::ConstRdataPtr source);
 
 /// \brief Checks if the given python object is a Rdata object
 ///
+/// \exception PyCPPWrapperException if obj is NULL
+///
 /// \param obj The object to check the type of
 /// \return true if the object is of type Rdata, false otherwise
 bool PyRdata_Check(PyObject* obj);

+ 3 - 0
src/lib/dns/python/rrclass_python.cc

@@ -372,6 +372,9 @@ createRRClassObject(const RRClass& source) {
 
 bool
 PyRRClass_Check(PyObject* obj) {
+    if (obj == NULL) {
+        isc_throw(PyCPPWrapperException, "obj argument NULL in typecheck");
+    }
     return (PyObject_TypeCheck(obj, &rrclass_type));
 }
 

+ 2 - 0
src/lib/dns/python/rrclass_python.h

@@ -39,6 +39,8 @@ PyObject* createRRClassObject(const RRClass& source);
 
 /// \brief Checks if the given python object is a RRClass object
 ///
+/// \exception PyCPPWrapperException if obj is NULL
+///
 /// \param obj The object to check the type of
 /// \return true if the object is of type RRClass, false otherwise
 bool PyRRClass_Check(PyObject* obj);

+ 3 - 0
src/lib/dns/python/rrset_python.cc

@@ -405,6 +405,9 @@ createRRsetObject(const RRset& source) {
 
 bool
 PyRRset_Check(PyObject* obj) {
+    if (obj == NULL) {
+        isc_throw(PyCPPWrapperException, "obj argument NULL in typecheck");
+    }
     return (PyObject_TypeCheck(obj, &rrset_type));
 }
 

+ 2 - 0
src/lib/dns/python/rrset_python.h

@@ -45,6 +45,8 @@ PyObject* createRRsetObject(const RRset& source);
 
 /// \brief Checks if the given python object is a RRset object
 ///
+/// \exception PyCPPWrapperException if obj is NULL
+///
 /// \param obj The object to check the type of
 /// \return true if the object is of type RRset, false otherwise
 bool PyRRset_Check(PyObject* obj);

+ 3 - 0
src/lib/dns/python/rrttl_python.cc

@@ -324,6 +324,9 @@ createRRTTLObject(const RRTTL& source) {
 
 bool
 PyRRTTL_Check(PyObject* obj) {
+    if (obj == NULL) {
+        isc_throw(PyCPPWrapperException, "obj argument NULL in typecheck");
+    }
     return (PyObject_TypeCheck(obj, &rrttl_type));
 }
 

+ 2 - 0
src/lib/dns/python/rrttl_python.h

@@ -44,6 +44,8 @@ PyObject* createRRTTLObject(const RRTTL& source);
 
 /// \brief Checks if the given python object is a RRTTL object
 ///
+/// \exception PyCPPWrapperException if obj is NULL
+///
 /// \param obj The object to check the type of
 /// \return true if the object is of type RRTTL, false otherwise
 bool PyRRTTL_Check(PyObject* obj);

+ 3 - 0
src/lib/dns/python/rrtype_python.cc

@@ -465,6 +465,9 @@ createRRTypeObject(const RRType& source) {
 
 bool
 PyRRType_Check(PyObject* obj) {
+    if (obj == NULL) {
+        isc_throw(PyCPPWrapperException, "obj argument NULL in typecheck");
+    }
     return (PyObject_TypeCheck(obj, &rrtype_type));
 }
 

+ 2 - 0
src/lib/dns/python/rrtype_python.h

@@ -44,6 +44,8 @@ PyObject* createRRTypeObject(const RRType& source);
 
 /// \brief Checks if the given python object is a RRType object
 ///
+/// \exception PyCPPWrapperException if obj is NULL
+///
 /// \param obj The object to check the type of
 /// \return true if the object is of type RRType, false otherwise
 bool PyRRType_Check(PyObject* obj);

+ 3 - 0
src/lib/dns/python/tsig_python.cc

@@ -366,6 +366,9 @@ initModulePart_TSIGContext(PyObject* mod) {
 
 bool
 PyTSIGContext_Check(PyObject* obj) {
+    if (obj == NULL) {
+        isc_throw(PyCPPWrapperException, "obj argument NULL in typecheck");
+    }
     return (PyObject_TypeCheck(obj, &tsigcontext_type));
 }
 

+ 2 - 0
src/lib/dns/python/tsig_python.h

@@ -30,6 +30,8 @@ extern PyObject* po_TSIGContextError;
 
 /// \brief Checks if the given python object is a TSIGContext object
 ///
+/// \exception PyCPPWrapperException if obj is NULL
+///
 /// \param obj The object to check the type of
 /// \return true if the object is of type TSIGContext, false otherwise
 bool PyTSIGContext_Check(PyObject* obj);

+ 3 - 0
src/lib/dns/python/tsig_rdata_python.cc

@@ -374,6 +374,9 @@ createTSIGObject(const any::TSIG& source) {
 
 bool
 PyTSIG_Check(PyObject* obj) {
+    if (obj == NULL) {
+        isc_throw(PyCPPWrapperException, "obj argument NULL in typecheck");
+    }
     return (PyObject_TypeCheck(obj, &tsig_type));
 }
 

+ 2 - 0
src/lib/dns/python/tsig_rdata_python.h

@@ -40,6 +40,8 @@ PyObject* createTSIGObject(const rdata::any::TSIG& source);
 
 /// \brief Checks if the given python object is a TSIG object
 ///
+/// \exception PyCPPWrapperException if obj is NULL
+///
 /// \param obj The object to check the type of
 /// \return true if the object is of type TSIG, false otherwise
 bool PyTSIG_Check(PyObject* obj);

+ 6 - 0
src/lib/dns/python/tsigkey_python.cc

@@ -284,6 +284,9 @@ initModulePart_TSIGKey(PyObject* mod) {
 
 bool
 PyTSIGKey_Check(PyObject* obj) {
+    if (obj == NULL) {
+        isc_throw(PyCPPWrapperException, "obj argument NULL in typecheck");
+    }
     return (PyObject_TypeCheck(obj, &tsigkey_type));
 }
 
@@ -521,6 +524,9 @@ initModulePart_TSIGKeyRing(PyObject* mod) {
 
 bool
 PyTSIGKeyRing_Check(PyObject* obj) {
+    if (obj == NULL) {
+        isc_throw(PyCPPWrapperException, "obj argument NULL in typecheck");
+    }
     return (PyObject_TypeCheck(obj, &tsigkeyring_type));
 }
 

+ 2 - 0
src/lib/dns/python/tsigkey_python.h

@@ -28,6 +28,8 @@ extern PyTypeObject tsigkeyring_type;
 
 /// \brief Checks if the given python object is a TSIGKey object
 ///
+/// \exception PyCPPWrapperException if obj is NULL
+///
 /// \param obj The object to check the type of
 /// \return true if the object is of type TSIGKey, false otherwise
 bool PyTSIGKey_Check(PyObject* obj);

+ 3 - 0
src/lib/dns/python/tsigrecord_python.cc

@@ -316,6 +316,9 @@ createTSIGRecordObject(const TSIGRecord& source) {
 
 bool
 PyTSIGRecord_Check(PyObject* obj) {
+    if (obj == NULL) {
+        isc_throw(PyCPPWrapperException, "obj argument NULL in typecheck");
+    }
     return (PyObject_TypeCheck(obj, &tsigrecord_type));
 }
 

+ 2 - 0
src/lib/dns/python/tsigrecord_python.h

@@ -36,6 +36,8 @@ PyObject* createTSIGRecordObject(const TSIGRecord& source);
 
 /// \brief Checks if the given python object is a TSIGRecord object
 ///
+/// \exception PyCPPWrapperException if obj is NULL
+///
 /// \param obj The object to check the type of
 /// \return true if the object is of type TSIGRecord, false otherwise
 bool PyTSIGRecord_Check(PyObject* obj);