~ubuntu-branches/ubuntu/jaunty/xulrunner-1.9/jaunty

« back to all changes in this revision

Viewing changes to mozilla/security/nss/cmd/signtool/util.c

  • Committer: Bazaar Package Importer
  • Author(s): Fabien Tassin, Sasa Bodiroza, Fabien Tassin, Alexander Sack
  • Date: 2008-09-02 11:54:00 UTC
  • mfrom: (1.1.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20080902115400-yfy26crvszpalvg5
Tags: 1.9.0.2+build3+nobinonly-0ubuntu1
[ Sasa Bodiroza ]
* In debian/rules:
  - Set 644 chmod to png files (LP: #252793) [Patch by Paolo Naldini]

[ Fabien Tassin ]
* improve create-build-system.sh to detect build-tree directory
  when embedded tarball is used. Fix un-escaped variables.
  Create build-system.tar.gz in the debian directory to prevent
  cdbs to check and unpack it during the build
  - update debian/create-build-system.sh
* Fix variables when an embedded tarball is used
  - update debian/rules
* Fix buffer overflow in realpath() at runtime and drop -U_FORTIFY_SOURCE
  from CPPFLAGS (LP: #263014)
  - add debian/patches/bz412610_att335369_realpath_overflow.patch
  - update debian/patches/series

[ Alexander Sack <asac@jwsdot.com> ]
* introduce preferred plugins by mime-type experimental feature;
  you can now set a pref to explicitly select a plugin to serve a particilar
  mime-type; patch contains further documentation.
  - add debian/patches/bzXXX_plugin_for_mimetype_pref.patch
  - update debian/patches/series
* drop patches applied upstream
  - drop bz120380_att326044.patch (fixed by bz442629)
  - update debian/patches/series

Show diffs side-by-side

added added

removed removed

Lines of Context:
629
629
}
630
630
 
631
631
 
632
 
/*
633
 
 *  p a s s w o r d _ h a r d c o d e 
634
 
 *
635
 
 *  A function to use the password passed in the -p(password) argument
636
 
 *  of the command line. This is only to be used for build & testing purposes,
637
 
 *  as it's extraordinarily insecure. 
638
 
 *
639
 
 *  After use once, null it out otherwise PKCS11 calls us forever.
640
 
 *
641
 
 */
642
 
SECItem *
643
 
password_hardcode(void *arg, void *handle)
644
 
{
645
 
    SECItem * pw = NULL;
646
 
    if (password) {
647
 
        pw = SECITEM_AllocItem(NULL, NULL, PL_strlen(password));
648
 
        pw->data = (unsigned char *)PL_strdup(password);
649
 
        password = NULL;
650
 
    }
651
 
    return pw;
652
 
}
653
 
 
654
 
char    *
655
 
pk11_password_hardcode(PK11SlotInfo *slot, PRBool retry, void *arg)
656
 
{
657
 
    char        *pw;
658
 
    if (retry) {
659
 
        return NULL; /* the password is incorrect, fail */
660
 
    }
661
 
    pw = password ? PORT_Strdup (password) : NULL;
662
 
    /* XXX don't do this, or FIPS won't work */
663
 
    /*password = NULL;*/
664
 
    return pw;
665
 
}
666
 
 
667
 
 
668
632
/***************************************************************
669
633
 *
670
634
 * s e c E r r o r S t r i n g
831
795
 
832
796
    SECMODModuleList * mlp;
833
797
 
 
798
    if ((moduleLock = SECMOD_GetDefaultModuleListLock()) == NULL) {
 
799
        /* this is the wrong text */
 
800
        PR_fprintf(errorFD, "%s: unable to acquire lock on module list\n",
 
801
                        PROGRAM_NAME);
 
802
        errorCount++;
 
803
        exit (ERRX);
 
804
    }
 
805
 
 
806
    SECMOD_GetReadLock (moduleLock);
 
807
 
834
808
    modules = SECMOD_GetDefaultModuleList();
835
809
 
836
810
    if (modules == NULL) {
 
811
        SECMOD_ReleaseReadLock (moduleLock);
837
812
        PR_fprintf(errorFD, "%s: Can't get module list\n", PROGRAM_NAME);
838
813
        errorCount++;
839
814
        exit (ERRX);
840
815
    }
841
816
 
842
 
    if ((moduleLock = SECMOD_NewListLock()) == NULL) {
843
 
        /* this is the wrong text */
844
 
        PR_fprintf(errorFD, "%s: unable to acquire lock on module list\n",
845
 
                        PROGRAM_NAME);
846
 
        errorCount++;
847
 
        exit (ERRX);
848
 
    }
849
 
 
850
 
    SECMOD_GetReadLock (moduleLock);
851
 
 
852
817
    PR_fprintf(outputFD, "\nListing of PKCS11 modules\n");
853
818
    PR_fprintf(outputFD, "-----------------------------------------------\n");
854
819
 
977
942
        /* Been there done that */
978
943
        prior++;
979
944
 
980
 
        if (password) {
981
 
            PK11_SetPasswordFunc(pk11_password_hardcode);
982
 
        } else {
983
 
            PK11_SetPasswordFunc(SECU_GetModulePassword);
984
 
        }
985
 
        
 
945
        PK11_SetPasswordFunc(SECU_GetModulePassword);
986
946
 
987
947
        /* Must login to FIPS before you do anything else */
988
948
        if (PK11_IsFIPS()) {
993
953
                return - 1;
994
954
            }
995
955
            if (PK11_Authenticate(slotinfo, PR_FALSE /*loadCerts*/,
996
 
                                          NULL /*wincx*/) != SECSuccess) {
 
956
                                          &pwdata) != SECSuccess) {
997
957
                fprintf(stderr, "%s: Unable to authenticate to %s.\n",
998
958
                                    PROGRAM_NAME, PK11_GetSlotName(slotinfo));
999
959
                PK11_FreeSlot(slotinfo);
1019
979
        /* Make sure we can authenticate to the key slot in FIPS mode */
1020
980
        if (PK11_IsFIPS()) {
1021
981
            if (PK11_Authenticate(slotinfo, PR_FALSE /*loadCerts*/,
1022
 
                                          NULL /*wincx*/) != SECSuccess) {
 
982
                                          &pwdata) != SECSuccess) {
1023
983
                fprintf(stderr, "%s: Unable to authenticate to %s.\n",
1024
984
                                PROGRAM_NAME, PK11_GetSlotName(slotinfo));
1025
985
                PK11_FreeSlot(slotinfo);