Lines Matching refs:cu
103 #define NS_CONN_CHECK_ABORT_AND_LOCK(cmg, cu, errp) \ argument
816 ns_conn_user_t *cu; in __s_api_conn_user_init() local
832 cu = (ns_conn_user_t *)calloc(1, sizeof (*cu)); in __s_api_conn_user_init()
833 if (cu == NULL) { in __s_api_conn_user_init()
838 cu->type = type; in __s_api_conn_user_init()
839 cu->state = NS_CONN_USER_ALLOCATED; in __s_api_conn_user_init()
840 cu->tid = thr_self(); in __s_api_conn_user_init()
841 cu->userinfo = userinfo; in __s_api_conn_user_init()
842 cu->referral = referral; in __s_api_conn_user_init()
843 cu->ns_rc = NS_LDAP_SUCCESS; in __s_api_conn_user_init()
844 cu->conn_mgmt = cmg; in __s_api_conn_user_init()
848 return (cu); in __s_api_conn_user_init()
860 __s_api_conn_user_free(ns_conn_user_t *cu) in __s_api_conn_user_free() argument
864 if (cu == NULL) in __s_api_conn_user_free()
867 cu->state = NS_CONN_USER_FREED; in __s_api_conn_user_free()
868 if (cu->ns_error != NULL) in __s_api_conn_user_free()
869 (void) __ns_ldap_freeError(&cu->ns_error); in __s_api_conn_user_free()
871 cmg = cu->conn_mgmt; in __s_api_conn_user_free()
874 (void) free(cu); in __s_api_conn_user_free()
947 add_cu2cm(ns_conn_user_t *cu, ns_conn_mt_t *cm) in add_cu2cm() argument
951 cm->cu_head = cu; in add_cu2cm()
952 cm->cu_tail = cu; in add_cu2cm()
954 cm->cu_tail->next = cu; in add_cu2cm()
955 cm->cu_tail = cu; in add_cu2cm()
987 del_cu4cm(ns_conn_user_t *cu, ns_conn_mt_t *cm) in del_cu4cm() argument
991 if (cu == NULL || cm->cu_head == NULL || cm->cu_cnt == 0) in del_cu4cm()
996 if (cu == cm->cu_head) { in del_cu4cm()
999 cu->next = NULL; in del_cu4cm()
1005 if (cu == cm->cu_head) { in del_cu4cm()
1006 cm->cu_head = cu->next; in del_cu4cm()
1008 cu->next = NULL; in del_cu4cm()
1014 if (cu == u) in del_cu4cm()
1019 pu->next = cu->next; in del_cu4cm()
1023 cu->next = NULL; in del_cu4cm()
1106 wait_for_conn_mt(ns_conn_user_t *cu, ns_conn_mt_t *cm) in wait_for_conn_mt() argument
1109 cu->state = NS_CONN_USER_WAITING; in wait_for_conn_mt()
1110 add_cu2cm(cu, cm); in wait_for_conn_mt()
1111 cu->conn_mt = cm; in wait_for_conn_mt()
1123 (void) conn_wait(cm, cu); in wait_for_conn_mt()
1127 cu->state = NS_CONN_USER_WOKEUP; in wait_for_conn_mt()
1133 del_cu4cm(cu, cm); in wait_for_conn_mt()
1134 cu->conn_mt = NULL; in wait_for_conn_mt()
1135 cu->bad_mt_conn = B_FALSE; in wait_for_conn_mt()
1151 ns_conn_user_t *cu) { in check_and_close_conn() argument
1235 cu->retry = B_TRUE; in check_and_close_conn()
1243 cu->retry = B_TRUE; in check_and_close_conn()
1267 match_conn_mt(ns_conn_user_t *cu, ns_conn_mt_t **cmt, in match_conn_mt() argument
1279 cm->referral != cu->referral) { in match_conn_mt()
1296 cu->type != NS_CONN_USER_WRITE && cm->cu_cnt == 0 && in match_conn_mt()
1311 switch (cu->type) { in match_conn_mt()
1344 drop_conn = check_and_close_conn(cmg, &cm, cu); in match_conn_mt()
1382 Connection **session, ns_ldap_error_t **errorp, ns_conn_user_t *cu) in __s_api_conn_mt_get() argument
1390 if (errorp == NULL || cu == NULL || session == NULL) in __s_api_conn_mt_get()
1394 cmg = cu->conn_mgmt; in __s_api_conn_mt_get()
1399 if (cu->type == NS_CONN_USER_AUTH) in __s_api_conn_mt_get()
1407 cu->keep_conn = B_TRUE; in __s_api_conn_mt_get()
1414 cu->keep_conn == B_TRUE) || cmg->state == NS_CONN_MGMT_ACTIVE)) in __s_api_conn_mt_get()
1418 cu->use_mt_conn = B_TRUE; in __s_api_conn_mt_get()
1420 NS_CONN_CHECK_ABORT_AND_LOCK(cmg, cu, errorp); in __s_api_conn_mt_get()
1424 cu->state = NS_CONN_USER_FINDING; in __s_api_conn_mt_get()
1428 rc = match_conn_mt(cu, &cn, st, server, cred); in __s_api_conn_mt_get()
1446 add_cu2cm(cu, cn); in __s_api_conn_mt_get()
1447 cu->conn_mt = cn; in __s_api_conn_mt_get()
1448 cu->state = NS_CONN_USER_CONNECTED; in __s_api_conn_mt_get()
1465 if (wait_for_conn_mt(cu, cn) != 1) { in __s_api_conn_mt_get()
1477 cu->state = NS_CONN_USER_CONNECT_ERROR; in __s_api_conn_mt_get()
1479 cu->state = NS_CONN_USER_FINDING; in __s_api_conn_mt_get()
1480 cu->use_mt_conn = B_FALSE; in __s_api_conn_mt_get()
1491 cu->state = NS_CONN_USER_CONNECTED; in __s_api_conn_mt_get()
1510 cu->conn_mt = cn; in __s_api_conn_mt_get()
1511 cn->opened_for = cu->type; in __s_api_conn_mt_get()
1512 cn->referral = cu->referral; in __s_api_conn_mt_get()
1534 __s_api_conn_mt_add(Connection *con, ns_conn_user_t *cu, ns_ldap_error_t **ep) in __s_api_conn_mt_add() argument
1536 ns_conn_mgmt_t *cmg = cu->conn_mgmt; in __s_api_conn_mt_add()
1537 ns_conn_mt_t *cm = cu->conn_mt; in __s_api_conn_mt_add()
1540 NS_CONN_CHECK_ABORT_AND_LOCK(cmg, cu, ep); in __s_api_conn_mt_add()
1557 cm->opened_for = cu->type; in __s_api_conn_mt_add()
1558 add_cu2cm(cu, cm); in __s_api_conn_mt_add()
1559 cu->conn_mt = cm; in __s_api_conn_mt_add()
1560 cu->state = NS_CONN_USER_CONNECTED; in __s_api_conn_mt_add()
1583 __s_api_conn_mt_return(ns_conn_user_t *cu) in __s_api_conn_mt_return() argument
1588 if (cu == NULL || cu->use_mt_conn == B_FALSE) in __s_api_conn_mt_return()
1590 cm = cu->conn_mt; in __s_api_conn_mt_return()
1593 cmg = cu->conn_mgmt; in __s_api_conn_mt_return()
1596 del_cu4cm(cu, cm); in __s_api_conn_mt_return()
1597 cu->state = NS_CONN_USER_DISCONNECTED; in __s_api_conn_mt_return()
1598 cu->conn_mt = NULL; in __s_api_conn_mt_return()
1599 cu->bad_mt_conn = B_FALSE; in __s_api_conn_mt_return()
1650 err_from_cm(ns_conn_user_t *cu, ns_conn_mt_t *cm) { in err_from_cm() argument
1653 cu->ns_rc = cm->ns_rc; in err_from_cm()
1654 if (cu->ns_error != NULL) in err_from_cm()
1655 (void) __ns_ldap_freeError(&cu->ns_error); in err_from_cm()
1656 cu->ns_error = NULL; in err_from_cm()
1660 cu->ns_rc = NS_LDAP_MEMORY; in err_from_cm()
1662 cu->ns_error = ep; in err_from_cm()
1668 err_from_caller(ns_conn_user_t *cu, int rc, ns_ldap_error_t **errorp) { in err_from_caller() argument
1670 cu->ns_rc = rc; in err_from_caller()
1672 if (cu->ns_error != NULL) in err_from_caller()
1673 (void) __ns_ldap_freeError(&cu->ns_error); in err_from_caller()
1674 cu->ns_error = *errorp; in err_from_caller()
1677 cu->ns_error = NULL; in err_from_caller()
1691 __s_api_conn_mt_remove(ns_conn_user_t *cu, int rc, ns_ldap_error_t **errorp) in __s_api_conn_mt_remove() argument
1697 if (cu == NULL || cu->use_mt_conn == B_FALSE) in __s_api_conn_mt_remove()
1699 if ((cm = cu->conn_mt) == NULL) in __s_api_conn_mt_remove()
1701 cmg = cu->conn_mgmt; in __s_api_conn_mt_remove()
1715 err_from_cm(cu, cm); in __s_api_conn_mt_remove()
1719 del_cu4cm(cu, cm); in __s_api_conn_mt_remove()
1720 cu->conn_mt = NULL; in __s_api_conn_mt_remove()
1721 cu->bad_mt_conn = B_FALSE; in __s_api_conn_mt_remove()
1735 __s_api_check_libldap_MT_conn_support(ns_conn_user_t *cu, LDAP *ld, in __s_api_check_libldap_MT_conn_support() argument
1742 if (cu->conn_mt == NULL || cu->use_mt_conn == B_FALSE) in __s_api_check_libldap_MT_conn_support()
1745 cmg = cu->conn_mgmt; in __s_api_check_libldap_MT_conn_support()
1754 NS_CONN_CHECK_ABORT_AND_LOCK(cmg, cu, ep); in __s_api_check_libldap_MT_conn_support()
1771 __s_api_conn_mt_remove(cu, NS_LDAP_NOTFOUND, NULL); in __s_api_check_libldap_MT_conn_support()
1782 ns_conn_user_t *cu) in close_conn_mt() argument
1811 if ((cu != NULL && cm->cu_cnt > 1) || in close_conn_mt()
1812 (cu == NULL && cm->cu_cnt > 0)) { in close_conn_mt()
1829 if ((cu != NULL && cm->cu_cnt == 1) || in close_conn_mt()
1830 (cu == NULL && cm->cu_cnt == 0)) { in close_conn_mt()
1852 __s_api_conn_mt_close(ns_conn_user_t *cu, int rc, ns_ldap_error_t **errorp) in __s_api_conn_mt_close() argument
1858 if (cu == NULL || cu->use_mt_conn == B_FALSE) in __s_api_conn_mt_close()
1861 if (cu->state != NS_CONN_USER_CONNECTED || (cm = cu->conn_mt) == NULL) in __s_api_conn_mt_close()
1863 cmg = cu->conn_mgmt; in __s_api_conn_mt_close()
1869 free_cm = close_conn_mt(cm, rc, errorp, cu); in __s_api_conn_mt_close()
1877 err_from_caller(cu, rc, errorp); in __s_api_conn_mt_close()
1879 err_from_cm(cu, cm); in __s_api_conn_mt_close()
1883 del_cu4cm(cu, cm); in __s_api_conn_mt_close()
1884 cu->conn_mt = NULL; in __s_api_conn_mt_close()
1885 cu->bad_mt_conn = B_FALSE; in __s_api_conn_mt_close()
1887 cu->retry = B_TRUE; in __s_api_conn_mt_close()
2285 ns_conn_user_t *cu = *conn_user; in __s_api_setup_retry_search() local
2288 if (*try_cnt > 0 && cu != NULL) { in __s_api_setup_retry_search()
2293 if (cu->type == NS_CONN_USER_GETENT && *rc == NS_LDAP_SUCCESS) in __s_api_setup_retry_search()
2295 cmg = cu->conn_mgmt; in __s_api_setup_retry_search()
2296 retry = cu->retry; in __s_api_setup_retry_search()
2297 if (cu->conn_mt != NULL) in __s_api_setup_retry_search()
2298 __s_api_conn_mt_return(cu); in __s_api_setup_retry_search()
2301 __s_api_conn_user_free(cu); in __s_api_setup_retry_search()
2331 __s_api_setup_getnext(ns_conn_user_t *cu, int *ns_err, in __s_api_setup_getnext() argument
2341 if (cu->conn_mt != NULL && (cmg = cu->conn_mgmt) != NULL) { in __s_api_setup_getnext()
2343 if (cu->bad_mt_conn == B_TRUE) { in __s_api_setup_getnext()
2344 __s_api_conn_mt_close(cu, 0, NULL); in __s_api_setup_getnext()
2345 *ns_err = cu->ns_rc; in __s_api_setup_getnext()
2346 *errorp = cu->ns_error; in __s_api_setup_getnext()
2347 cu->ns_error = NULL; in __s_api_setup_getnext()