From ad5b022ed13c7c46380cd9d278f30eda6ae677fa Mon Sep 17 00:00:00 2001
From: "Thies C. Arntzen" <thies@php.net>
Date: Mon, 6 Mar 2000 08:02:15 +0000
Subject: @- OCINLogon() sessions are now closed again. (Thies) # happy hacking
 in hongkong!

---
 ext/oci8/oci8.c     | 15 ++++++++-------
 ext/oci8/php_oci8.h |  1 +
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c
index 918f0cee4b..071ec418d3 100644
--- a/ext/oci8/oci8.c
+++ b/ext/oci8/oci8.c
@@ -647,6 +647,12 @@ _oci_conn_list_dtor(oci_connection *connection)
 
 	oci_debug("START _oci_conn_list_dtor: id=%d",connection->id);
 
+	if (connection->session->exclusive) {
+		/* exclusive connection created via OCINLogon() close their 
+		   associated session when destructed */
+		zend_list_delete(connection->session->num);
+	}
+
 	if (connection->pServiceContext) {
 		/*
 		connection->error = 
@@ -1843,6 +1849,7 @@ static oci_session *_oci_open_session(oci_server* server,char *username,char *pa
 	session->persistent = persistent;
 	session->hashed_details = hashed_details;
 	session->server = server;
+	session->exclusive = exclusive;
 
 	/* allocate temporary Service Context */
 	OCI(error) = 
@@ -1924,12 +1931,6 @@ static oci_session *_oci_open_session(oci_server* server,char *username,char *pa
 
 	if (exclusive) {
 		psession = session;
-		/*
-		zend_hash_next_index_insert(OCI(user),
-									(void *)session,
-									sizeof(oci_session),
-									(void**)&psession);
-		*/
 	} else {
 		zend_hash_update(OCI(user),
 						 session->hashed_details,
@@ -1944,7 +1945,7 @@ static oci_session *_oci_open_session(oci_server* server,char *username,char *pa
 
 	oci_debug("_oci_open_session new sess=%d user=%s",psession->num,username);
 
-	free(session);
+	if (! exclusive) free(session);
 
 	return psession;
 
diff --git a/ext/oci8/php_oci8.h b/ext/oci8/php_oci8.h
index 2e2a754d10..5d889da993 100644
--- a/ext/oci8/php_oci8.h
+++ b/ext/oci8/php_oci8.h
@@ -70,6 +70,7 @@ typedef struct {
 	int num;
 	int persistent;
 	int open;
+	int exclusive;
 	char *hashed_details;
 	oci_server *server;
 	OCISession *pSession;
-- 
cgit v1.2.1