-
Notifications
You must be signed in to change notification settings - Fork 126
Added 'refList' as a list containing all referrals returned from server. #459
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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.
@@ -162,9 +162,18 @@ LDAPraise_for_message(LDAP *l, LDAPMessage *m) | |||
} | |||
|
|||
if (errnum == LDAP_REFERRAL && refs != NULL && refs[0] != NULL) { | |||
/* Return all referrals as a list in "reflist" */ | |||
PyObject *referralList = PyList_New(0); |
There was a problem hiding this comment.
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++]); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing error check
Added a refList that contains all referrals returned from the server.
Still maintains the first referral in 'info'.