Second try of the new patch attached
Bryan

On Thu, 2008-07-17 at 23:34 -0600, Bryan Sutula wrote:
> New patch to try attached
> 
> Bryan
> 
> On Wed, 2008-07-16 at 14:53 +0530, Raghavendra PG wrote:
> > Hi,
> > 
> > The openhpi clien library is crashing on passing the wrong session id.
> > This problem is found while running the saftest suite for
> > openhpi-2.11.4.
> > 
> > The crash is happening at openhpid/oh_client_session.cpp at line number
> > 208. Wrong session id from HPI user is not properly handled.
> > 
> > I've attached the patch for this problem.
> > 
> > Regards,
> > Raghavendra
> > -------------------------------------------------------------------------
> > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> > Build the coolest Linux based applications with Moblin SDK & win great 
> > prizes
> > Grand prize is a trip for two to an Open Source event anywhere in the world
> > http://moblin-contest.org/redirect.php?banner_id=100&url=/
> > _______________________________________________ Openhpi-devel mailing list 
> > [email protected] 
> > https://lists.sourceforge.net/lists/listinfo/openhpi-devel
Index: openhpid/oh_client_session.cpp
===================================================================
--- openhpid/oh_client_session.cpp	(revision 6848)
+++ openhpid/oh_client_session.cpp	(working copy)
@@ -174,6 +174,7 @@
         pthread_t thread_id = pthread_self();
         struct oh_client_session *client_session = NULL;
         pcstrmsock connx = NULL;
+        SaErrorT ret = SA_OK;
 
 	if (!csid || !dsid || !pinst)
 		return SA_ERR_HPI_INVALID_PARAMS;
@@ -191,7 +192,7 @@
                                                         &thread_id);
 
                 if (!connx) {
-                        oh_create_connx(client_session->did, &connx);
+                        ret = oh_create_connx(client_session->did, &connx);
                         if (connx) {
                         	g_hash_table_insert(client_session->connxs, 
                                 		    g_memdup(&thread_id,
@@ -201,14 +202,19 @@
 				    " in conns table");
                         }
                 }
-
-
+                *dsid = client_session->dsid;
+                *pinst = connx;
         }
-        *pinst = connx;
-        *dsid = client_session->dsid;
         g_static_rec_mutex_unlock(&sessions_sem);        
 
-        return SA_OK;
+	if (client_session) {
+                if (connx)
+                        return SA_OK;
+                else 
+                        return ret;
+	}
+	else
+		return SA_ERR_HPI_INVALID_SESSION;
 }
 
 static void __delete_connx(gpointer data)
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Openhpi-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openhpi-devel

Reply via email to