Fixed SEGV bug that occured when duplicate init requests was received
authorAdam Dickmeiss <adam@indexdata.dk>
Thu, 12 Feb 2004 20:40:22 +0000 (20:40 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Thu, 12 Feb 2004 20:40:22 +0000 (20:40 +0000)
and no cached init response was available.

ChangeLog
src/yaz-proxy.cpp

index 3889490..f1e1190 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,8 @@
+Fixed SEGV bug that occured when duplicate init requests was received and
+no cached init response was available.
 
 Add MODS version 3 conversion, MARC21slim2MODS3.xsl. Update voyager.xml,
-config.xml to use it.
+config.xml to use it. Default "mods" is still MODS v2.
 
 --- 0.7.7 2004/02/10 Internal release.
 
index 23538ad..83fae8a 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (c) 1998-2004, Index Data.
  * See the file LICENSE for details.
  * 
- * $Id: yaz-proxy.cpp,v 1.99 2004-02-11 10:01:54 adam Exp $
+ * $Id: yaz-proxy.cpp,v 1.100 2004-02-12 20:40:22 adam Exp $
  */
 
 #include <assert.h>
@@ -1997,19 +1997,22 @@ void Yaz_Proxy::handle_incoming_Z_PDU(Z_APDU *apdu)
        {
            if (handle_init_response_for_invalid_session(apdu))
                return;
-           Z_APDU *apdu2 = m_client->m_initResponse;
-           apdu2->u.initResponse->otherInfo = 0;
-           if (m_client->m_cookie && *m_client->m_cookie)
-               set_otherInformationString(apdu2, VAL_COOKIE, 1,
-                                          m_client->m_cookie);
-           apdu2->u.initResponse->referenceId =
-               apdu->u.initRequest->referenceId;
-           apdu2->u.initResponse->options = m_client->m_initResponse_options;
-           apdu2->u.initResponse->protocolVersion = 
-               m_client->m_initResponse_version;
-
-           send_to_client(apdu2);
-           return;
+           if (m_client->m_initResponse)
+           {
+               Z_APDU *apdu2 = m_client->m_initResponse;
+               apdu2->u.initResponse->otherInfo = 0;
+               if (m_client->m_cookie && *m_client->m_cookie)
+                   set_otherInformationString(apdu2, VAL_COOKIE, 1,
+                                              m_client->m_cookie);
+               apdu2->u.initResponse->referenceId =
+                   apdu->u.initRequest->referenceId;
+               apdu2->u.initResponse->options = m_client->m_initResponse_options;
+               apdu2->u.initResponse->protocolVersion = 
+                   m_client->m_initResponse_version;
+               
+               send_to_client(apdu2);
+               return;
+           }
        }
        m_client->m_init_flag = 1;
     }