Lines Matching refs:cu
103 #define NS_CONN_CHECK_ABORT_AND_LOCK(cmg, cu, errp) \ argument
824 ns_conn_user_t *cu; in __s_api_conn_user_init() local
840 cu = (ns_conn_user_t *)calloc(1, sizeof (*cu)); in __s_api_conn_user_init()
841 if (cu == NULL) { in __s_api_conn_user_init()
846 cu->type = type; in __s_api_conn_user_init()
847 cu->state = NS_CONN_USER_ALLOCATED; in __s_api_conn_user_init()
848 cu->tid = thr_self(); in __s_api_conn_user_init()
849 cu->userinfo = userinfo; in __s_api_conn_user_init()
850 cu->referral = referral; in __s_api_conn_user_init()
851 cu->ns_rc = NS_LDAP_SUCCESS; in __s_api_conn_user_init()
852 cu->conn_mgmt = cmg; in __s_api_conn_user_init()
856 return (cu); in __s_api_conn_user_init()
868 __s_api_conn_user_free(ns_conn_user_t *cu) in __s_api_conn_user_free() argument
872 if (cu == NULL) in __s_api_conn_user_free()
875 cu->state = NS_CONN_USER_FREED; in __s_api_conn_user_free()
876 if (cu->ns_error != NULL) in __s_api_conn_user_free()
877 (void) __ns_ldap_freeError(&cu->ns_error); in __s_api_conn_user_free()
879 cmg = cu->conn_mgmt; in __s_api_conn_user_free()
882 (void) free(cu); in __s_api_conn_user_free()
955 add_cu2cm(ns_conn_user_t *cu, ns_conn_mt_t *cm) in add_cu2cm() argument
959 cm->cu_head = cu; in add_cu2cm()
960 cm->cu_tail = cu; in add_cu2cm()
962 cm->cu_tail->next = cu; in add_cu2cm()
963 cm->cu_tail = cu; in add_cu2cm()
995 del_cu4cm(ns_conn_user_t *cu, ns_conn_mt_t *cm) in del_cu4cm() argument
999 if (cu == NULL || cm->cu_head == NULL || cm->cu_cnt == 0) in del_cu4cm()
1004 if (cu == cm->cu_head) { in del_cu4cm()
1007 cu->next = NULL; in del_cu4cm()
1013 if (cu == cm->cu_head) { in del_cu4cm()
1014 cm->cu_head = cu->next; in del_cu4cm()
1016 cu->next = NULL; in del_cu4cm()
1022 if (cu == u) in del_cu4cm()
1027 pu->next = cu->next; in del_cu4cm()
1031 cu->next = NULL; in del_cu4cm()
1114 wait_for_conn_mt(ns_conn_user_t *cu, ns_conn_mt_t *cm) in wait_for_conn_mt() argument
1117 cu->state = NS_CONN_USER_WAITING; in wait_for_conn_mt()
1118 add_cu2cm(cu, cm); in wait_for_conn_mt()
1119 cu->conn_mt = cm; in wait_for_conn_mt()
1131 (void) conn_wait(cm, cu); in wait_for_conn_mt()
1135 cu->state = NS_CONN_USER_WOKEUP; in wait_for_conn_mt()
1141 del_cu4cm(cu, cm); in wait_for_conn_mt()
1142 cu->conn_mt = NULL; in wait_for_conn_mt()
1143 cu->bad_mt_conn = B_FALSE; in wait_for_conn_mt()
1159 ns_conn_user_t *cu) in check_and_close_conn() argument
1244 cu->retry = B_TRUE; in check_and_close_conn()
1252 cu->retry = B_TRUE; in check_and_close_conn()
1276 match_conn_mt(ns_conn_user_t *cu, ns_conn_mt_t **cmt, in match_conn_mt() argument
1288 cm->referral != cu->referral) { in match_conn_mt()
1305 cu->type != NS_CONN_USER_WRITE && cm->cu_cnt == 0 && in match_conn_mt()
1320 switch (cu->type) { in match_conn_mt()
1353 drop_conn = check_and_close_conn(cmg, &cm, cu); in match_conn_mt()
1391 Connection **session, ns_ldap_error_t **errorp, ns_conn_user_t *cu) in __s_api_conn_mt_get() argument
1399 if (errorp == NULL || cu == NULL || session == NULL) in __s_api_conn_mt_get()
1403 cmg = cu->conn_mgmt; in __s_api_conn_mt_get()
1408 if (cu->type == NS_CONN_USER_AUTH) in __s_api_conn_mt_get()
1416 cu->keep_conn = B_TRUE; in __s_api_conn_mt_get()
1423 cu->keep_conn == B_TRUE) || cmg->state == NS_CONN_MGMT_ACTIVE)) in __s_api_conn_mt_get()
1427 cu->use_mt_conn = B_TRUE; in __s_api_conn_mt_get()
1429 NS_CONN_CHECK_ABORT_AND_LOCK(cmg, cu, errorp); in __s_api_conn_mt_get()
1433 cu->state = NS_CONN_USER_FINDING; in __s_api_conn_mt_get()
1437 rc = match_conn_mt(cu, &cn, st, server, cred); in __s_api_conn_mt_get()
1455 add_cu2cm(cu, cn); in __s_api_conn_mt_get()
1456 cu->conn_mt = cn; in __s_api_conn_mt_get()
1457 cu->state = NS_CONN_USER_CONNECTED; in __s_api_conn_mt_get()
1474 if (wait_for_conn_mt(cu, cn) != 1) { in __s_api_conn_mt_get()
1486 cu->state = NS_CONN_USER_CONNECT_ERROR; in __s_api_conn_mt_get()
1488 cu->state = NS_CONN_USER_FINDING; in __s_api_conn_mt_get()
1489 cu->use_mt_conn = B_FALSE; in __s_api_conn_mt_get()
1500 cu->state = NS_CONN_USER_CONNECTED; in __s_api_conn_mt_get()
1519 cu->conn_mt = cn; in __s_api_conn_mt_get()
1520 cn->opened_for = cu->type; in __s_api_conn_mt_get()
1521 cn->referral = cu->referral; in __s_api_conn_mt_get()
1543 __s_api_conn_mt_add(Connection *con, ns_conn_user_t *cu, ns_ldap_error_t **ep) in __s_api_conn_mt_add() argument
1545 ns_conn_mgmt_t *cmg = cu->conn_mgmt; in __s_api_conn_mt_add()
1546 ns_conn_mt_t *cm = cu->conn_mt; in __s_api_conn_mt_add()
1549 NS_CONN_CHECK_ABORT_AND_LOCK(cmg, cu, ep); in __s_api_conn_mt_add()
1566 cm->opened_for = cu->type; in __s_api_conn_mt_add()
1567 add_cu2cm(cu, cm); in __s_api_conn_mt_add()
1568 cu->conn_mt = cm; in __s_api_conn_mt_add()
1569 cu->state = NS_CONN_USER_CONNECTED; in __s_api_conn_mt_add()
1592 __s_api_conn_mt_return(ns_conn_user_t *cu) in __s_api_conn_mt_return() argument
1597 if (cu == NULL || cu->use_mt_conn == B_FALSE) in __s_api_conn_mt_return()
1599 cm = cu->conn_mt; in __s_api_conn_mt_return()
1602 cmg = cu->conn_mgmt; in __s_api_conn_mt_return()
1605 del_cu4cm(cu, cm); in __s_api_conn_mt_return()
1606 cu->state = NS_CONN_USER_DISCONNECTED; in __s_api_conn_mt_return()
1607 cu->conn_mt = NULL; in __s_api_conn_mt_return()
1608 cu->bad_mt_conn = B_FALSE; in __s_api_conn_mt_return()
1660 err_from_cm(ns_conn_user_t *cu, ns_conn_mt_t *cm) in err_from_cm() argument
1664 cu->ns_rc = cm->ns_rc; in err_from_cm()
1665 if (cu->ns_error != NULL) in err_from_cm()
1666 (void) __ns_ldap_freeError(&cu->ns_error); in err_from_cm()
1667 cu->ns_error = NULL; in err_from_cm()
1671 cu->ns_rc = NS_LDAP_MEMORY; in err_from_cm()
1673 cu->ns_error = ep; in err_from_cm()
1679 err_from_caller(ns_conn_user_t *cu, int rc, ns_ldap_error_t **errorp) in err_from_caller() argument
1682 cu->ns_rc = rc; in err_from_caller()
1684 if (cu->ns_error != NULL) in err_from_caller()
1685 (void) __ns_ldap_freeError(&cu->ns_error); in err_from_caller()
1686 cu->ns_error = *errorp; in err_from_caller()
1689 cu->ns_error = NULL; in err_from_caller()
1703 __s_api_conn_mt_remove(ns_conn_user_t *cu, int rc, ns_ldap_error_t **errorp) in __s_api_conn_mt_remove() argument
1709 if (cu == NULL || cu->use_mt_conn == B_FALSE) in __s_api_conn_mt_remove()
1711 if ((cm = cu->conn_mt) == NULL) in __s_api_conn_mt_remove()
1713 cmg = cu->conn_mgmt; in __s_api_conn_mt_remove()
1727 err_from_cm(cu, cm); in __s_api_conn_mt_remove()
1731 del_cu4cm(cu, cm); in __s_api_conn_mt_remove()
1732 cu->conn_mt = NULL; in __s_api_conn_mt_remove()
1733 cu->bad_mt_conn = B_FALSE; in __s_api_conn_mt_remove()
1747 __s_api_check_libldap_MT_conn_support(ns_conn_user_t *cu, LDAP *ld, in __s_api_check_libldap_MT_conn_support() argument
1754 if (cu->conn_mt == NULL || cu->use_mt_conn == B_FALSE) in __s_api_check_libldap_MT_conn_support()
1757 cmg = cu->conn_mgmt; in __s_api_check_libldap_MT_conn_support()
1766 NS_CONN_CHECK_ABORT_AND_LOCK(cmg, cu, ep); in __s_api_check_libldap_MT_conn_support()
1783 __s_api_conn_mt_remove(cu, NS_LDAP_NOTFOUND, NULL); in __s_api_check_libldap_MT_conn_support()
1794 ns_conn_user_t *cu) in close_conn_mt() argument
1823 if ((cu != NULL && cm->cu_cnt > 1) || in close_conn_mt()
1824 (cu == NULL && cm->cu_cnt > 0)) { in close_conn_mt()
1841 if ((cu != NULL && cm->cu_cnt == 1) || in close_conn_mt()
1842 (cu == NULL && cm->cu_cnt == 0)) { in close_conn_mt()
1864 __s_api_conn_mt_close(ns_conn_user_t *cu, int rc, ns_ldap_error_t **errorp) in __s_api_conn_mt_close() argument
1870 if (cu == NULL || cu->use_mt_conn == B_FALSE) in __s_api_conn_mt_close()
1873 if (cu->state != NS_CONN_USER_CONNECTED || (cm = cu->conn_mt) == NULL) in __s_api_conn_mt_close()
1875 cmg = cu->conn_mgmt; in __s_api_conn_mt_close()
1881 free_cm = close_conn_mt(cm, rc, errorp, cu); in __s_api_conn_mt_close()
1889 err_from_caller(cu, rc, errorp); in __s_api_conn_mt_close()
1891 err_from_cm(cu, cm); in __s_api_conn_mt_close()
1895 del_cu4cm(cu, cm); in __s_api_conn_mt_close()
1896 cu->conn_mt = NULL; in __s_api_conn_mt_close()
1897 cu->bad_mt_conn = B_FALSE; in __s_api_conn_mt_close()
1899 cu->retry = B_TRUE; in __s_api_conn_mt_close()
2297 ns_conn_user_t *cu = *conn_user; in __s_api_setup_retry_search() local
2300 if (*try_cnt > 0 && cu != NULL) { in __s_api_setup_retry_search()
2305 if (cu->type == NS_CONN_USER_GETENT && *rc == NS_LDAP_SUCCESS) in __s_api_setup_retry_search()
2307 cmg = cu->conn_mgmt; in __s_api_setup_retry_search()
2308 retry = cu->retry; in __s_api_setup_retry_search()
2309 if (cu->conn_mt != NULL) in __s_api_setup_retry_search()
2310 __s_api_conn_mt_return(cu); in __s_api_setup_retry_search()
2313 __s_api_conn_user_free(cu); in __s_api_setup_retry_search()
2343 __s_api_setup_getnext(ns_conn_user_t *cu, int *ns_err, in __s_api_setup_getnext() argument
2353 if (cu->conn_mt != NULL && (cmg = cu->conn_mgmt) != NULL) { in __s_api_setup_getnext()
2355 if (cu->bad_mt_conn == B_TRUE) { in __s_api_setup_getnext()
2356 __s_api_conn_mt_close(cu, 0, NULL); in __s_api_setup_getnext()
2357 *ns_err = cu->ns_rc; in __s_api_setup_getnext()
2358 *errorp = cu->ns_error; in __s_api_setup_getnext()
2359 cu->ns_error = NULL; in __s_api_setup_getnext()