~ubuntu-branches/ubuntu/hardy/opencryptoki/hardy

« back to all changes in this revision

Viewing changes to usr/sbin/pkcsslotd/no_odm.c

  • Committer: Bazaar Package Importer
  • Author(s): Stephan Hermann
  • Date: 2008-01-24 14:22:58 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080124142258-i0nmjvqoy6wxe8x1
Tags: 2.2.5+dfsg-1ubuntu1
* Merge from debian unstable
* debian/libopencryptoki0.install, debian/libopencryptoki-dev.install: 
  - removed /usr/lib/opencryptoki/stdll/*, it's empty now
 

Show diffs side-by-side

added added

removed removed

Lines of Context:
498
498
#ifdef ALLOCATE
499
499
    slot_entry = (char *)malloc(sizeof(char)*(PATH_MAX));
500
500
#else
501
 
    bzero(slot_entry,PATH_MAX);
 
501
    memset(slot_entry, 0, PATH_MAX);
502
502
#endif
503
503
 
504
504
    fgets(slot_entry, PATH_MAX, fp);
519
519
  //  if( feof(fp) )
520
520
  //    break;
521
521
 
522
 
    bzero(&sinfo_struct,sizeof(sinfo_struct));  // for good measure zero it out before use each time
 
522
    memset(&sinfo_struct, 0, sizeof(sinfo_struct));  // for good measure zero it out before use each time
523
523
 
524
524
    sinfo_struct.global_sessions = 0;   // initializing to zero
525
525
    element_num = Present;
723
723
            ? (sizeof(sinfo_struct.dll_location)) 
724
724
                  : (strlen(slot_element)) ) ); // took away an ")"
725
725
 
726
 
      /* Set the last character in string to NULL since strncpy may mor may not copy the trailing NULL */
727
 
      sinfo_struct.dll_location[sizeof(sinfo_struct.dll_location) - 1] = (char) NULL;
728
 
 
729
 
#if 0      
730
 
      {
731
 
        /* check for file existance */
732
 
        struct stat statbuf;
733
 
        int Err;
734
 
 
735
 
        if ( stat( sinfo_struct.dll_location, &statbuf ) < 0 ) {
736
 
          /* File not found, or other error */
737
 
            Err = errno;
738
 
 
739
 
          if ( Err == ENOENT ) {
740
 
            fprintf(stderr, "\nReading Slot Info: %s: file not found (%s).  Skipping slot entry.", sinfo_struct.dll_location, SysError(Err) );
741
 
            /* WarnLog ( "***** ReadSlotInfoDB: %s: file not found (%s).  Skipping DB entry.", sinfo[Index].dll_location, SysError(Err) ); */
742
 
          }
743
 
          else {
744
 
            fprintf(stderr, "\nReading Slot Info: looking at %s, stat64() returned %s (%d; %#x)", sinfo_struct.dll_location, SysError(Err), Err, Err);
745
 
            /* DbgLog (DL0, "***** ReadSlotInfoDB: looking at %s, stat64() returned %s (%d; %#x)", sinfo[Index].dll_location, SysError(Err), Err, Err); */
746
 
          }
747
 
          memset( pSlot, '\0', sizeof(*pSlot) );
748
 
          sinfo_struct.present = (CK_BOOL) FALSE;
749
 
          continue;
750
 
        }
751
 
 
752
 
      } /* end DLLLocation unconditional block */
753
 
#endif
 
726
        /* Set the last character in string to NULL since strncpy may mor may not copy the trailing NULL */
 
727
        sinfo_struct.dll_location[sizeof(sinfo_struct.dll_location) - 1] = (char) NULL;
754
728
      }
755
729
 
756
730
      element_num++;
805
779
    if( (sinfo_struct.dll_location != NULL) &&
806
780
        (sinfo_struct.slot_init_fcn != NULL) ) {
807
781
 
808
 
      bcopy(&sinfo_struct,&sinfo[Index],sizeof(sinfo_struct));  // similar to sinfo[Index] = &sinfo_struct;
 
782
      memcpy(&sinfo[Index], &sinfo_struct, sizeof(sinfo_struct));  // similar to sinfo[Index] = &sinfo_struct;
809
783
      PrintSlotInfo( &(sinfo[Index]) );
810
784
      Index++;
811
785