Beispiel #1
0
/*
  a type checking varient of idr_find
 */
static void *_idr_find_type(struct idr_context *idp, int id, const char *type, const char *location)
{
	void *p = idr_find(idp, id);
	if (p && talloc_check_name(p, type) == NULL) {
		DEBUG(DEBUG_ERR,("%s idr_find_type expected type %s  but got %s\n",
			 location, type, talloc_get_name(p)));
		return NULL;
	}
	return p;
}
Beispiel #2
0
_PUBLIC_ void *_pytalloc_get_type(PyObject *py_obj, const char *type_name)
{
	void *ptr = _pytalloc_get_ptr(py_obj);
	void *type_obj = talloc_check_name(ptr, type_name);

	if (type_obj == NULL) {
		const char *name = talloc_get_name(ptr);
		PyErr_Format(PyExc_TypeError, "pytalloc: expected %s, got %s",
			     type_name, name);
		return NULL;
	}

	return ptr;
}
Beispiel #3
0
static int ejs_tree_disconnect(MprVarHandle eid, int argc, MprVar **argv)
{
	struct smbcli_tree *tree;
	NTSTATUS result;

	if (argc != 1) {
		ejsSetErrorMsg(eid, 
			       "tree_disconnect(): invalid number of args");
		return -1;
	}

	if (!IS_TREE_HANDLE(argv[0])) {
		ejsSetErrorMsg(eid, "first arg is not a tree handle");
		return -1;
	}

	tree = talloc_check_name(argv[0]->ptr, "struct smbcli_tree");

	result = smb_tree_disconnect(tree);

	mpr_Return(eid, mprNTSTATUS(result));

	return 0;
}