From: Chris Masone <[email protected]>

---
 usr/sbin/pkcsslotd/shmem.c |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/usr/sbin/pkcsslotd/shmem.c b/usr/sbin/pkcsslotd/shmem.c
index 411219a..ec1686d 100755
--- a/usr/sbin/pkcsslotd/shmem.c
+++ b/usr/sbin/pkcsslotd/shmem.c
@@ -374,10 +374,20 @@ int CreateSharedMemory ( void ) {
 
 
    if ( shmid < 0 ) {
-      ErrLog(SLOTD_MSG(SHMEMCR, 
-              "Shared memory creation failed (0x%X)\n"), errno);
-      ErrLog(SLOTD_MSG(IPCRM, "perform ipcrm -M 0x%X\n"), tok);
-      return FALSE;
+      ErrLog(SLOTD_MSG(SHMEMCR,
+                       "Shared memory creation failed (0x%X)\n"), errno);
+      ErrLog(SLOTD_MSG(SHMEMCR, "Reclaiming 0x%X\n"), tok);
+      shmid = shmget( tok, sizeof( Slot_Mgr_Shr_t ), 0 );
+      DestroySharedMemory();
+      shmid = shmget( tok, sizeof( Slot_Mgr_Shr_t ),
+                      IPC_CREAT | IPC_EXCL |  S_IRUSR |
+                     S_IRGRP  | S_IWUSR | S_IWGRP   );
+      if ( shmid < 0 ) {
+          ErrLog(SLOTD_MSG(SHMEMCR,
+                           "Shared memory reclamation failed (0x%X)\n"), 
errno);
+          ErrLog(SLOTD_MSG(IPCRM, "perform ipcrm -M 0x%X\n"), tok);
+          return FALSE;
+      }
    }
 
    // SAB Set the group ownership of the shared mem segment..
-- 
1.7.4.rc1


------------------------------------------------------------------------------
Gaining the trust of online customers is vital for the success of any company
that requires sensitive data to be transmitted over the Web.   Learn how to 
best implement a security strategy that keeps consumers' information secure 
and instills the confidence they need to proceed with transactions.
http://p.sf.net/sfu/oracle-sfdevnl 
_______________________________________________
Opencryptoki-tech mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opencryptoki-tech

Reply via email to