Skip to content

Conversation

@nickfolino
Copy link

Added a refList that contains all referrals returned from the server.
Still maintains the first referral in 'info'.

Copy link
Member

@tiran tiran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Every Python API call requires an explicit error check.

Please also include documentation update and test cases.


if (errnum == LDAP_REFERRAL && refs != NULL && refs[0] != NULL) {
/* Return all referrals as a list in "reflist" */
PyObject *referralList = PyList_New(0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing error check.

PyObject *referralList = PyList_New(0);
int i = 0;
while (refs[i] != NULL) {
PyObject *referralURL = Py_BuildValue("s", refs[i++]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use PyUnicode_FromString() and check for error (NULL).

int i = 0;
while (refs[i] != NULL) {
PyObject *referralURL = Py_BuildValue("s", refs[i++]);
PyList_Append(referralList, referralURL);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing error check.

PyList_Append(referralList, referralURL);
Py_XDECREF(referralURL);
}
PyDict_SetItemString(info, "reflist", referralList);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing error check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants