Rev 1289: More error checking. in http://people.samba.org/bzr/jelmer/bzr-svn/0.4
Jelmer Vernooij
jelmer at samba.org
Sun Jun 22 23:44:32 BST 2008
At http://people.samba.org/bzr/jelmer/bzr-svn/0.4
------------------------------------------------------------
revno: 1289
revision-id: jelmer at samba.org-20080622224431-u6ro2nqm89vnh0ab
parent: jelmer at samba.org-20080622223018-12t0c9pibvddldj0
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Mon 2008-06-23 00:44:31 +0200
message:
More error checking.
modified:
ra.c ra.pyx-20080313140933-qybkqaxe3m4mcll7-1
=== modified file 'ra.c'
--- a/ra.c 2008-06-22 22:30:06 +0000
+++ b/ra.c 2008-06-22 22:44:31 +0000
@@ -337,6 +337,8 @@
return NULL;
}
ops = PyList_New(window->num_ops);
+ if (ops == NULL)
+ return NULL;
for (i = 0; i < window->num_ops; i++) {
PyList_SetItem(ops, i, Py_BuildValue("(iII)", window->ops[i].action_code,
window->ops[i].offset,
@@ -755,10 +757,14 @@
}
#if SVN_VER_MAJOR <= 1 && SVN_VER_MINOR < 5
- if (revprops == NULL) {
+ if (revprops == Py_None) {
PyErr_SetString(PyExc_NotImplementedError, "fetching all revision properties not supported");
apr_pool_destroy(temp_pool);
return NULL;
+ } else if (!PyList_Check(revprops)) {
+ PyErr_SetString(PyExc_TypeError, "revprops should be a list");
+ apr_pool_destroy(temp_pool);
+ return NULL;
} else {
int i;
for (i = 0; i < PyList_Size(revprops); i++) {
@@ -1459,13 +1465,23 @@
if (ret == NULL)
return NULL;
+ if (!PyList_Check(providers)) {
+ PyErr_SetString(PyExc_TypeError, "Auth providers should be list");
+ return NULL;
+ }
+
ret->pool = Pool(NULL);
if (ret->pool == NULL)
return NULL;
+
ret->providers = providers;
Py_INCREF(providers);
c_providers = apr_array_make(ret->pool, PyList_Size(providers), 4);
+ if (c_providers == NULL) {
+ PyErr_NoMemory();
+ return NULL;
+ }
for (i = 0; i < PyList_Size(providers); i++) {
AuthProviderObject *provider;
el = (svn_auth_provider_object_t **)apr_array_push(c_providers);
@@ -1497,7 +1513,7 @@
return NULL;
}
- svn_auth_set_parameter(auth->auth_baton, name, (char *)value);
+ svn_auth_set_parameter(auth->auth_baton, name, (char *)vvalue);
Py_RETURN_NONE;
}
@@ -1515,6 +1531,9 @@
if (!strcmp(name, SVN_AUTH_PARAM_SSL_SERVER_FAILURES)) {
return PyInt_FromLong(*((apr_uint32_t *)value));
+ } else if (!strcmp(name, SVN_AUTH_PARAM_DEFAULT_USERNAME) ||
+ !strcmp(name, SVN_AUTH_PARAM_DEFAULT_PASSWORD)) {
+ return PyString_FromString((const char *)value);
} else {
PyErr_Format(PyExc_TypeError, "Unsupported auth parameter %s", name);
return NULL;
More information about the bazaar-commits
mailing list