619 static PyObject*
620 l_ldap_sasl_interactive_bind_s( LDAPObject* self, PyObject* args )
621 {
622 char *c_mechanism;
623 char *who;
624
625 PyObject *serverctrls = Py_None;
626 PyObject *clientctrls = Py_None;
627 LDAPControl** server_ldcs = NULL;
628 LDAPControl** client_ldcs = NULL;
629
630 PyObject *SASLObject = NULL;
631 PyObject *mechanism = NULL;
632 int msgid;
633
634 static unsigned sasl_flags = LDAP_SASL_QUIET;
635
636 /*
637 * In Python 2.3+, a "I" format argument indicates that we're either converting
638 * the Python object into a long or an unsigned int. In versions prior to that,
639 * it will always convert to a long. Since the sasl_flags variable is an
640 * unsigned int, we need to use the "I" flag if we're running Python 2.3+ and a
641 * "i" otherwise.
642 */
643 #if (PY_MAJOR_VERSION == 2) && (PY_MINOR_VERSION < 3)
644 if (!PyArg_ParseTuple(args, "sOOOi", &who, &SASLObject, &serverctrls, &clientctrls, &sasl_flags ))
645 #else
646 if (!PyArg_ParseTuple(args, "sOOOI", &who, &SASLObject, &serverctrls, &clientctrls, &sasl_flags ))
when _PyArg_ParseTuple_SizeT() succeeds
taking False path
647 #endif
648 return NULL;
649
650 if (not_valid(self)) return NULL;
when considering value == (int)0 from Modules/LDAPObject.c:650
taking False path
651
652 if (!PyNone_Check(serverctrls)) {
taking True path
653 if (!LDAPControls_from_object(serverctrls, &server_ldcs))
when considering range: -0x80000000 <= value <= -1
taking False path
654 return NULL;
655 }
656
657 if (!PyNone_Check(clientctrls)) {
taking True path
658 if (!LDAPControls_from_object(clientctrls, &client_ldcs))
when considering value == (int)0 from Modules/LDAPObject.c:658
taking True path
659 return NULL;
660 }
661
662 /* now we extract the sasl mechanism from the SASL Object */
663 mechanism = PyObject_GetAttrString(SASLObject, "mech");
664 if (mechanism == NULL) return NULL;
665 c_mechanism = PyString_AsString(mechanism);
666 Py_DECREF(mechanism);
667 mechanism = NULL;
668
669 /* Don't know if it is the "intended use" of the defaults
670 parameter of ldap_sasl_interactive_bind_s when we pass the
671 Python object SASLObject, but passing it through some
672 static variable would destroy thread safety, IMHO.
673 */
674 msgid = ldap_sasl_interactive_bind_s(self->ldap,
675 who,
676 c_mechanism,
677 (LDAPControl**) server_ldcs,
678 (LDAPControl**) client_ldcs,
679 sasl_flags,
680 py_ldap_sasl_interaction,
681 SASLObject);
682
683 LDAPControl_List_DEL( server_ldcs );
684 LDAPControl_List_DEL( client_ldcs );
685
686 if (msgid != LDAP_SUCCESS)
687 return LDAPerror( self->ldap, "ldap_sasl_interactive_bind_s" );
688 return PyInt_FromLong( msgid );
689 }
returning (PyObject*)NULL without setting an exception
found 1 similar trace(s) to this