~ubuntu-branches/ubuntu/raring/nss/raring-security

« back to all changes in this revision

Viewing changes to mozilla/security/nss/lib/softoken/sftkmod.c

  • Committer: Bazaar Package Importer
  • Author(s): Chris Coulson
  • Date: 2010-03-25 13:46:06 UTC
  • mfrom: (1.1.11 upstream)
  • Revision ID: james.westby@ubuntu.com-20100325134606-bl6liuok2w9l7snv
Tags: 3.12.6-0ubuntu1
* New upstream release 3.12.6 RTM (NSS_3_12_6_RTM)
  - fixes CVE-2009-3555 aka US-CERT VU#120541
* Adjust patches to changed upstream code base
  - update debian/patches/38_kbsd.patch
  - update debian/patches/38_mips64_build.patch
  - update debian/patches/85_security_load.patch
* Remove patches that are merged upstream
  - delete debian/patches/91_nonexec_stack.patch
  - update debian/patches/series
* Bump nspr dependency to 4.8
  - update debian/control
* Add new symbols for 3.12.6
  - update debian/libnss3-1d.symbols

Show diffs side-by-side

added added

removed removed

Lines of Context:
197
197
#endif
198
198
#include <fcntl.h>
199
199
 
 
200
#ifndef WINCE
200
201
/* same as fopen, except it doesn't use umask, but explicit */
201
202
FILE *
202
203
lfopen(const char *name, const char *mode, int flags)
215
216
    /* file inherits fd */
216
217
    return file;
217
218
}
 
219
#endif
218
220
 
219
221
#define MAX_LINE_LENGTH 2048
220
222
#define SFTK_DEFAULT_INTERNAL_INIT1 "library= name=\"NSS Internal PKCS #11 Module\" parameters="
559
561
    /* do we really want to use streams here */
560
562
    fd = fopen(dbname, "r");
561
563
    if (fd == NULL) goto loser;
 
564
#ifdef WINCE
 
565
    fd2 = fopen(dbname2, "w+");
 
566
#else
562
567
    fd2 = lfopen(dbname2, "w+", O_CREAT|O_RDWR|O_TRUNC);
 
568
#endif
563
569
    if (fd2 == NULL) goto loser;
564
570
 
565
571
    name = sftk_argGetParamValue("name",args);
622
628
    } 
623
629
    fclose(fd);
624
630
    fclose(fd2);
625
 
    /* rename dbname2 to dbname */
626
631
    if (found) {
 
632
        /* rename dbname2 to dbname */
627
633
        PR_Delete(dbname);
628
634
        PR_Rename(dbname2,dbname);
 
635
    } else {
 
636
        PR_Delete(dbname2);
629
637
    }
630
638
    PORT_Free(dbname2);
 
639
    PORT_Free(lib);
 
640
    PORT_Free(name);
631
641
    return SECSuccess;
632
642
 
633
643
loser:
641
651
        PR_Delete(dbname2);
642
652
        PORT_Free(dbname2);
643
653
    }
 
654
    PORT_Free(lib);
 
655
    PORT_Free(name);
644
656
    return SECFailure;
645
657
}
646
658
 
668
680
    /* remove the previous version if it exists */
669
681
    (void) sftkdb_DeleteSecmodDB(dbType, appName, filename, dbname, module, rw);
670
682
 
 
683
#ifdef WINCE
 
684
    fd = fopen(dbname, "a+");
 
685
#else
671
686
    fd = lfopen(dbname, "a+", O_CREAT|O_RDWR|O_APPEND);
 
687
#endif
672
688
    if (fd == NULL) {
673
689
        return SECFailure;
674
690
    }
685
701
            block = sftkdb_DupCat(block, module);
686
702
            break;
687
703
        }
 
704
        block = sftkdb_DupnCat(block, module, keyEnd-module+1);
 
705
        if (block == NULL) { goto loser; }
688
706
        value = sftk_argFetchValue(&keyEnd[1], &count);
689
 
        block = sftkdb_DupnCat(block, module, keyEnd-module+1);
690
 
        if (block == NULL) { goto loser; }
691
707
        if (value) {
692
708
            block = sftkdb_DupCat(block, sftk_argStrip(value));
693
709
            PORT_Free(value);