Beispiel #1
0
/** 
 * xmlSecCryptoDLUnloadLibrary:
 * @crypto:		the desired crypto library name ("openssl", "nss", ...).
 *
 * Unloads the xmlsec-<crypto> library. All pointers to this library
 * functions tables became invalid. This function is NOT thread safe, 
 * application MUST NOT call #xmlSecCryptoDLLoadLibrary, #xmlSecCryptoDLGetLibraryFunctions,
 * and #xmlSecCryptoDLUnloadLibrary functions from multiple threads.
 *
 * Returns 0 on success or a negative value if an error occurs.
 */
int 
xmlSecCryptoDLUnloadLibrary(const xmlChar* crypto) {
    xmlSecCryptoDLLibraryPtr lib;
    int pos;
    int ret;
    
    xmlSecAssert2(crypto != NULL, -1);

    pos = xmlSecCryptoDLLibrariesListFindByName(&gXmlSecCryptoDLLibraries, crypto);
    if(pos < 0) {
	/* todo: is it an error? */
	return(0);
    }
    
    lib = (xmlSecCryptoDLLibraryPtr)xmlSecPtrListGetItem(&gXmlSecCryptoDLLibraries, pos);
    if((lib != NULL) && (lib->functions == gXmlSecCryptoDLFunctions)) {
	gXmlSecCryptoDLFunctions = NULL;
    }
    
    ret = xmlSecPtrListRemove(&gXmlSecCryptoDLLibraries, pos);
    if(ret < 0) {
        xmlSecErr_a_ignorar5(XMLSEC_ERRORS_HERE,
	    	    NULL,
		    "xmlSecPtrListRemove",
		    XMLSEC_ERRORS_R_XMLSEC_FAILED,
		    XMLSEC_ERRORS_NO_MESSAGE);
	return(-1);
    }

    return(0);
}
Beispiel #2
0
PyObject *xmlsec_PtrListRemove(PyObject *self, PyObject *args) {
  PyObject *list_obj;
  xmlSecPtrListPtr list;
  xmlSecSize pos;
  int ret;

  if (CheckArgs(args, "OI:ptrListRemove")) {
    if (!PyArg_ParseTuple(args, "Oi:ptrListRemove", &list_obj, &pos))
      return NULL;
  }
  else return NULL;

  list = xmlSecPtrListPtr_get(list_obj);
  ret = xmlSecPtrListRemove(list, pos);

  return (wrap_int(ret));
}