Rev 1316: Fix callback for get_file_revs, add extra checks. in http://people.samba.org/bzr/jelmer/bzr-svn/0.4

Jelmer Vernooij jelmer at samba.org
Mon Jun 23 15:16:22 BST 2008


At http://people.samba.org/bzr/jelmer/bzr-svn/0.4

------------------------------------------------------------
revno: 1316
revision-id: jelmer at samba.org-20080623141621-8t57ysrrjxzmlh3m
parent: jelmer at samba.org-20080623135919-lx5v0qilvg8ar51k
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Mon 2008-06-23 16:16:21 +0200
message:
  Fix callback for get_file_revs, add extra checks.
modified:
  ra.c                           ra.pyx-20080313140933-qybkqaxe3m4mcll7-1
=== modified file 'ra.c'
--- a/ra.c	2008-06-23 04:47:56 +0000
+++ b/ra.c	2008-06-23 14:16:21 +0000
@@ -450,12 +450,13 @@
 	if (py_rev_props == NULL)
 		return py_svn_error();
 
-	/* FIXME: delta handler */
 	ret = PyObject_CallFunction(fn, "slO", path, rev, py_rev_props);
 	Py_DECREF(py_rev_props);
 	if (ret == NULL)
 		return py_svn_error();
-	Py_DECREF(ret);
+
+    *delta_baton = (void *)ret;
+    *delta_handler = py_txdelta_window_handler;
     return NULL;
 }
 
@@ -1704,7 +1705,10 @@
 		PyErr_SetString(PyExc_TypeError, "expected tuple with simple credentials");
 		return py_svn_error();
 	}
-	/* FIXME: Check type of ret */
+	if (PyTuple_Size(ret) == 3) {
+		PyErr_SetString(PyExc_TypeError, "expected tuple of size 3");
+		return py_svn_error();
+	}
 	*cred = apr_pcalloc(pool, sizeof(**cred));
     (*cred)->username = apr_pstrdup(pool, PyString_AsString(PyTuple_GetItem(ret, 0)));
     (*cred)->password = apr_pstrdup(pool, PyString_AsString(PyTuple_GetItem(ret, 1)));
@@ -1749,11 +1753,14 @@
 	if (ret == NULL)
 		return py_svn_error();
 
-	/* FIXME: Check that ret is a tuple of size 2 */
 	if (!PyTuple_Check(ret)) {
 		PyErr_SetString(PyExc_TypeError, "expected tuple with server trust credentials");
 		return py_svn_error();
 	}
+	if (PyTuple_Size(ret) == 2) {
+		PyErr_SetString(PyExc_TypeError, "expected tuple of size 2");
+		return py_svn_error();
+	}
 	
 	*cred = apr_pcalloc(pool, sizeof(**cred));
 	(*cred)->accepted_failures = PyInt_AsLong(PyTuple_GetItem(ret, 0));
@@ -1787,7 +1794,15 @@
 	ret = PyObject_CallFunction(fn, "sb", realm, may_save);
 	if (ret == NULL) 
 		return py_svn_error();
-	/* FIXME: Check ret is a tuple of size 2 */
+	if (!PyTuple_Check(ret)) {
+		PyErr_SetString(PyExc_TypeError, "expected tuple with client cert pw credentials");
+		return py_svn_error();
+	}
+
+	if (PyTuple_Size(ret) == 2) {
+		PyErr_SetString(PyExc_TypeError, "expected tuple of size 2");
+		return py_svn_error();
+	}
 	*cred = apr_pcalloc(pool, sizeof(**cred));
 	(*cred)->password = apr_pstrdup(pool, PyString_AsString(PyTuple_GetItem(ret, 0)));
 	(*cred)->may_save = (PyTuple_GetItem(ret, 1) == Py_True);
@@ -1800,7 +1815,16 @@
 	ret = PyObject_CallFunction(fn, "sb", realm, may_save);
 	if (ret == NULL) 
 		return py_svn_error();
-	/* FIXME: Check ret is a tuple of size 2 */
+
+	if (!PyTuple_Check(ret)) {
+		PyErr_SetString(PyExc_TypeError, "expected tuple with client cert credentials");
+		return py_svn_error();
+	}
+
+	if (PyTuple_Size(ret) == 2) {
+		PyErr_SetString(PyExc_TypeError, "expected tuple of size 2");
+		return py_svn_error();
+	}
 	*cred = apr_pcalloc(pool, sizeof(**cred));
 	(*cred)->cert_file = apr_pstrdup(pool, PyString_AsString(PyTuple_GetItem(ret, 0)));
 	(*cred)->may_save = (PyTuple_GetItem(ret, 1) == Py_True);




More information about the bazaar-commits mailing list