src/_bonsai/ldapconnectiter.c
static ldapInitThreadData *
create_init_thread_data(PyObject *client, SOCKET sock) {
    ldapInitThreadData *data = NULL;
    PyObject *url = NULL;
    PyObject *tmp = NULL;

    DEBUG("create_init_thread_data (client:%p, sock:%d)", client, (int)sock);
    data = (ldapInitThreadData *)malloc(sizeof(ldapInitThreadData));
    if (data == NULL) {
        PyErr_NoMemory();
        return NULL;
    }
    data->url = NULL;

    /* Get URL policy from LDAPClient. */
    url = PyObject_GetAttrString(client, "url");
    if (url == NULL) goto error;

    /* Get URL address information from the LDAPClient's LDAPURL object. */
    tmp = PyObject_CallMethod(url, "get_address", NULL);
    Py_DECREF(url);
    if (tmp == NULL) goto error;
    data->url = PyObject2char(tmp);
    Py_DECREF(tmp);
    if (data->url == NULL) goto error;

    /* Set cert policy from LDAPClient. */
    tmp = PyObject_GetAttrString(client, "cert_policy");
    if (tmp == NULL) return NULL;
    data->cert_policy = (int)PyLong_AsLong(tmp);
    Py_DECREF(tmp);

     /* Set referrals from LDAPClient. */
    tmp = PyObject_GetAttrString(client, "server_chase_referrals");
    if (tmp == NULL) goto error;
    data->referrals = PyObject_IsTrue(tmp);
    Py_DECREF(tmp);

    data->ld = NULL;
    data->sock = sock;
    data->retval = 0;
    return data;
error:
    free(data->url);
    free(data);
    PyErr_BadInternalCall();
    return NULL;
}
/* Create and return a ldapInitThreadData struct for the initialisation thread. */
Create and return a ldapInitThreadData struct for the initialisation thread.
Create and return a ldapInitThreadData struct for the initialisation thread .
static ldapInitThreadData *
create_init_thread_data(PyObject *client, SOCKET sock) {
    ldapInitThreadData *data = NULL;
    PyObject *url = NULL;
    PyObject *tmp = NULL;
    DEBUG("create_init_thread_data (client:%p, sock:%d)", client, (int)sock);
    data = (ldapInitThreadData *)malloc(sizeof(ldapInitThreadData));
    if (data == NULL) {
        PyErr_NoMemory();
        return NULL;
    }
    data->url = NULL;
    url = PyObject_GetAttrString(client, "url");
    if (url == NULL) goto error;
    tmp = PyObject_CallMethod(url, "get_address", NULL);
    Py_DECREF(url);
    if (tmp == NULL) goto error;
    data->url = PyObject2char(tmp);
    Py_DECREF(tmp);
    if (data->url == NULL) goto error;
    tmp = PyObject_GetAttrString(client, "cert_policy");
    if (tmp == NULL) return NULL;
    data->cert_policy = (int)PyLong_AsLong(tmp);
    Py_DECREF(tmp);
    tmp = PyObject_GetAttrString(client, "server_chase_referrals");
    if (tmp == NULL) goto error;
    data->referrals = PyObject_IsTrue(tmp);
    Py_DECREF(tmp);
    data->ld = NULL;
    data->sock = sock;
    data->retval = 0;
    return data;
error:
    free(data->url);
    free(data);
    PyErr_BadInternalCall();
    return NULL;
}
static ldapInitThreadData * create_init_thread_data ( PyObject * client , SOCKET sock ) { ldapInitThreadData * data = NULL ; PyObject * url = NULL ; PyObject * tmp = NULL ; DEBUG ( " " , client , ( int ) sock ) ; data = ( ldapInitThreadData * ) malloc ( sizeof ( ldapInitThreadData ) ) ; if ( data == NULL ) { PyErr_NoMemory ( ) ; return NULL ; } data -> url = NULL ; url = PyObject_GetAttrString ( client , " " ) ; if ( url == NULL ) goto error ; tmp = PyObject_CallMethod ( url , " " , NULL ) ; Py_DECREF ( url ) ; if ( tmp == NULL ) goto error ; data -> url = PyObject2char ( tmp ) ; Py_DECREF ( tmp ) ; if ( data -> url == NULL ) goto error ; tmp = PyObject_GetAttrString ( client , " " ) ; if ( tmp == NULL ) return NULL ; data -> cert_policy = ( int ) PyLong_AsLong ( tmp ) ; Py_DECREF ( tmp ) ; tmp = PyObject_GetAttrString ( client , " " ) ; if ( tmp == NULL ) goto error ; data -> referrals = PyObject_IsTrue ( tmp ) ; Py_DECREF ( tmp ) ; data -> ld = NULL ; data -> sock = sock ; data -> retval = 0 ; return data ; error : free ( data -> url ) ; free ( data ) ; PyErr_BadInternalCall ( ) ; return NULL ; }
Create and return a ldapInitThreadData struct for the initialisation thread.
Create and return a ldapInitThreadData struct for the initialisation thread .
/* Get URL policy from LDAPClient. */ /* Get URL address information from the LDAPClient's LDAPURL object. */ /* Set cert policy from LDAPClient. */ /* Set referrals from LDAPClient. */