Back to index

lightning-sunbird  0.9+nobinonly
Functions | Variables
util.c File Reference
#include "signtool.h"
#include "prio.h"
#include "prmem.h"
#include "nss.h"

Go to the source code of this file.

Functions

static int is_dir (char *filename)
char * XP_GetString (int i)
void FE_SetPasswordEnabled ()
voidFE_GetInitContext (void)
voidXP_FindSomeContext ()
void ET_moz_CallFunction ()
int RemoveAllArc (char *tree)
int rm_dash_r (char *path)
void usage (void)
void print_error (int err)
void out_of_memory (void)
void VerifyCertDir (char *dir, char *keyName)
int foreach (char *dirname, char *prefix, int(*fn)(char *relpath, char *basedir, char *reldir, char *filename, void *arg), PRBool recurse, PRBool includeDirs, void *arg)
SECItem * password_hardcode (void *arg, void *handle)
char * pk11_password_hardcode (PK11SlotInfo *slot, PRBool retry, void *arg)
const char * secErrorString (long code)
void displayVerifyLog (CERTVerifyLog *log)
void JarListModules (void)
char * chop (char *str)
void FatalError (char *msg)
int InitCrypto (char *cert_dir, PRBool readOnly)
char * get_default_cert_dir (void)
void give_help (int status)
char * pr_fgets (char *buf, int size, PRFileDesc *file)

Variables

longmozilla_event_queue = 0

Function Documentation

char* chop ( char *  str)

Definition at line 749 of file util.c.

{
    char      *start, *end;

    if (str) {
       start = str;

       /* Nip leading whitespace */
       while (isspace(*start)) {
           start++;
       }

       /* Nip trailing whitespace */
       if (*start) {
           end = start + strlen(start) - 1;
           while (isspace(*end) && end > start) {
              end--;
           }
           *(end + 1) = '\0';
       }

       return start;
    } else {
       return NULL;
    }
}
void displayVerifyLog ( CERTVerifyLog *  log)

Definition at line 625 of file util.c.

{
    CERTVerifyLogNode        * node;
    CERTCertificate          * cert;
    char      *name;

    if ( !log  || (log->count <= 0) ) {
       return;
    }

    for (node = log->head; node != NULL; node = node->next) {

       if ( !(cert = node->cert) ) {
           continue;
       }

       /* Get a name for this cert */
       if (cert->nickname != NULL) {
           name = cert->nickname;
       } else if (cert->emailAddr && cert->emailAddr[0]) {
           name = cert->emailAddr;
       } else {
           name = cert->subjectName;
       }

       printf( "%s%s:\n", name,
           (node->depth > 0) ? " [Certificate Authority]" : "");

       printf("\t%s\n", secErrorString(node->error));

    }
}

Definition at line 75 of file util.c.

{
}

Here is the caller graph for this function:

void FatalError ( char *  msg)

Definition at line 784 of file util.c.

{
    if (!msg) 
       msg = "";

    PR_fprintf(errorFD, "FATAL ERROR: %s\n", msg);
    errorCount++;
    exit(ERRX);
}

Definition at line 62 of file util.c.

{
    return 0;
}

Here is the caller graph for this function:

Definition at line 57 of file util.c.

{
}
int foreach ( char *  dirname,
char *  prefix,
int(*)(char *relpath, char *basedir, char *reldir, char *filename, void *arg fn,
PRBool  recurse,
PRBool  includeDirs,
void arg 
)

Definition at line 368 of file util.c.

{
    char      newdir [FNSIZE];
    int       retval = 0;

    PRDir * dir;
    PRDirEntry * entry;

    strcpy (newdir, dirname);
    if (*prefix) {
       strcat (newdir, "/");
       strcat (newdir, prefix);
    }

    dir = PR_OpenDir (newdir);
    if (!dir) 
       return - 1;

    for (entry = PR_ReadDir (dir, 0); entry; entry = PR_ReadDir (dir, 0)) {
       if ( strcmp(entry->name, ".") == 0   || 
           strcmp(entry->name, "..") == 0 ) {
           /* no infinite recursion, please */
           continue;
       }

       /* can't sign self */
       if (!strcmp (entry->name, "META-INF"))
           continue;

       /* -x option */
       if (PL_HashTableLookup(excludeDirs, entry->name))
           continue;

       strcpy (newdir, dirname);
       if (*dirname)
           strcat (newdir, "/");

       if (*prefix) {
           strcat (newdir, prefix);
           strcat (newdir, "/");
       }
       strcat (newdir, entry->name);

       if (!is_dir(newdir) || includeDirs) {
           char      newpath [FNSIZE];

           strcpy (newpath, prefix);
           if (*newpath)
              strcat (newpath, "/");
           strcat (newpath, entry->name);

           if ( (*fn) (newpath, dirname, prefix, (char *) entry->name,
                arg)) {
              retval = -1;
              break;
           }
       }

       if (is_dir (newdir)) {
           if (recurse) {
              char   newprefix [FNSIZE];

              strcpy (newprefix, prefix);
              if (*newprefix) {
                  strcat (newprefix, "/");
              }
              strcat (newprefix, entry->name);

              if (foreach (dirname, newprefix, fn, recurse,
                   includeDirs, arg)) {
                  retval = -1;
                  break;
              }
           }
       }

    }

    PR_CloseDir (dir);

    return retval;
}

Here is the call graph for this function:

Definition at line 889 of file util.c.

{
    char      *home;

    char      *cd = NULL;
    static char      db [FNSIZE];

#ifdef XP_UNIX
    home = getenv ("HOME");

    if (home && *home) {
       sprintf (db, "%s/.netscape", home);
       cd = db;
    }
#endif

#ifdef XP_PC
    FILE * fp;

    /* first check the environment override */

    home = getenv ("JAR_HOME");

    if (home && *home) {
       sprintf (db, "%s/cert7.db", home);

       if ((fp = fopen (db, "r")) != NULL) {
           fclose (fp);
           cd = home;
       }
    }

    /* try the old navigator directory */

    if (cd == NULL) {
       home = "c:/Program Files/Netscape/Navigator";

       sprintf (db, "%s/cert7.db", home);

       if ((fp = fopen (db, "r")) != NULL) {
           fclose (fp);
           cd = home;
       }
    }

    /* Try the current directory, I wonder if this
     is really a good idea. Remember, Windows only.. */

    if (cd == NULL) {
       home = ".";

       sprintf (db, "%s/cert7.db", home);

       if ((fp = fopen (db, "r")) != NULL) {
           fclose (fp);
           cd = home;
       }
    }

#endif

    if (!cd) {
       PR_fprintf(errorFD,
           "You must specify the location of your certificate directory\n");
       PR_fprintf(errorFD,
           "with the -d option. Example: -d ~/.netscape in many cases with Unix.\n");
       errorCount++;
       exit (ERRX);
    }

    return cd;
}
void give_help ( int  status)

Definition at line 966 of file util.c.

{
    if (status == SEC_ERROR_UNKNOWN_ISSUER) {
       PR_fprintf(errorFD,
           "The Certificate Authority (CA) for this certificate\n");
       PR_fprintf(errorFD,
           "does not appear to be in your database. You should contact\n");
       PR_fprintf(errorFD,
           "the organization which issued this certificate to obtain\n");
       PR_fprintf(errorFD, "a copy of its CA Certificate.\n");
    }
}
int InitCrypto ( char *  cert_dir,
PRBool  readOnly 
)

Definition at line 800 of file util.c.

{
    SECStatus rv;
    static int       prior = 0;
    PK11SlotInfo * slotinfo;

    if (prior == 0) {
       /* some functions such as OpenKeyDB expect this path to be
        * implicitly set prior to calling */
       if (readOnly) {
           rv = NSS_Init(cert_dir);
       } else {
           rv = NSS_InitReadWrite(cert_dir);
       }
       if (rv != SECSuccess) {
           SECU_PrintPRandOSError(PROGRAM_NAME);
           exit(-1);
       }

       SECU_ConfigDirectory (cert_dir);

       /* Been there done that */
       prior++;

       if (password) {
           PK11_SetPasswordFunc(pk11_password_hardcode);
       } else {
           PK11_SetPasswordFunc(SECU_GetModulePassword);
       }

       /* Must login to FIPS before you do anything else */
       if (PK11_IsFIPS()) {
           slotinfo = PK11_GetInternalSlot();
           if (!slotinfo) {
              fprintf(stderr, "%s: Unable to get PKCS #11 Internal Slot."
                                "\n", PROGRAM_NAME);
              return - 1;
           }
           if (PK11_Authenticate(slotinfo, PR_FALSE /*loadCerts*/,
                                     NULL /*wincx*/) != SECSuccess) {
              fprintf(stderr, "%s: Unable to authenticate to %s.\n",
                                PROGRAM_NAME, PK11_GetSlotName(slotinfo));
              PK11_FreeSlot(slotinfo);
              return - 1;
           }
           PK11_FreeSlot(slotinfo);
       }

       /* Make sure there is a password set on the internal key slot */
       slotinfo = PK11_GetInternalKeySlot();
       if (!slotinfo) {
           fprintf(stderr, "%s: Unable to get PKCS #11 Internal Key Slot."
               "\n", PROGRAM_NAME);
           return - 1;
       }
       if (PK11_NeedUserInit(slotinfo)) {
           PR_fprintf(errorFD,
               "\nWARNING: No password set on internal key database.  Most operations will fail."
               "\nYou must create a password.\n");
           warningCount++;
       }

       /* Make sure we can authenticate to the key slot in FIPS mode */
       if (PK11_IsFIPS()) {
           if (PK11_Authenticate(slotinfo, PR_FALSE /*loadCerts*/,
                                     NULL /*wincx*/) != SECSuccess) {
              fprintf(stderr, "%s: Unable to authenticate to %s.\n",
                            PROGRAM_NAME, PK11_GetSlotName(slotinfo));
              PK11_FreeSlot(slotinfo);
              return - 1;
           }
       }
       PK11_FreeSlot(slotinfo);
    }

    return 0;
}
static int is_dir ( char *  filename) [static]

Definition at line 462 of file util.c.

{
    PRFileInfo       finfo;

    if ( PR_GetFileInfo(filename, &finfo) != PR_SUCCESS ) {
       printf("Unable to get information about %s\n", filename);
       return 0;
    }

    return ( finfo.type == PR_FILE_DIRECTORY );
}

Here is the caller graph for this function:

Definition at line 668 of file util.c.

{
    int       i;
    int       count = 0;

    SECMODModuleList * modules = NULL;
    static SECMODListLock *moduleLock = NULL;

    SECMODModuleList * mlp;

    modules = SECMOD_GetDefaultModuleList();

    if (modules == NULL) {
       PR_fprintf(errorFD, "%s: Can't get module list\n", PROGRAM_NAME);
       errorCount++;
       exit (ERRX);
    }

    if ((moduleLock = SECMOD_NewListLock()) == NULL) {
       /* this is the wrong text */
       PR_fprintf(errorFD, "%s: unable to acquire lock on module list\n",
                     PROGRAM_NAME);
       errorCount++;
       exit (ERRX);
    }

    SECMOD_GetReadLock (moduleLock);

    PR_fprintf(outputFD, "\nListing of PKCS11 modules\n");
    PR_fprintf(outputFD, "-----------------------------------------------\n");

    for (mlp = modules; mlp != NULL; mlp = mlp->next) {
       count++;
       PR_fprintf(outputFD, "%3d. %s\n", count, mlp->module->commonName);

       if (mlp->module->internal)
           PR_fprintf(outputFD, "          (this module is internally loaded)\n");
       else
           PR_fprintf(outputFD, "          (this is an external module)\n");

       if (mlp->module->dllName)
           PR_fprintf(outputFD, "          DLL name: %s\n",
               mlp->module->dllName);

       if (mlp->module->slotCount == 0)
           PR_fprintf(outputFD, "          slots: There are no slots attached to this module\n");
       else
           PR_fprintf(outputFD, "          slots: %d slots attached\n",
                mlp->module->slotCount);

       if (mlp->module->loaded == 0)
           PR_fprintf(outputFD, "          status: Not loaded\n");
       else
           PR_fprintf(outputFD, "          status: loaded\n");

       for (i = 0; i < mlp->module->slotCount; i++) {
           PK11SlotInfo * slot = mlp->module->slots[i];

           PR_fprintf(outputFD, "\n");
           PR_fprintf(outputFD, "    slot: %s\n", PK11_GetSlotName(slot));
           PR_fprintf(outputFD, "   token: %s\n", PK11_GetTokenName(slot));
       }
    }

    PR_fprintf(outputFD, "-----------------------------------------------\n");

    if (count == 0)
       PR_fprintf(outputFD,
           "Warning: no modules were found (should have at least one)\n");

    SECMOD_ReleaseReadLock (moduleLock);
}

Definition at line 293 of file util.c.

{
    PR_fprintf(errorFD, "%s: out of memory\n", PROGRAM_NAME);
    errorCount++;
    exit (ERRX);
}

Here is the call graph for this function:

SECItem* password_hardcode ( void arg,
void handle 
)

Definition at line 486 of file util.c.

{
    SECItem * pw = NULL;
    if (password) {
       pw = SECITEM_AllocItem(NULL, NULL, PL_strlen(password));
       pw->data = (unsigned char *)PL_strdup(password);
       password = NULL;
    }
    return pw;
}
char* pk11_password_hardcode ( PK11SlotInfo *  slot,
PRBool  retry,
void arg 
)

Definition at line 499 of file util.c.

{
    char      *pw;
    if (retry) {
       return NULL; /* the password is incorrect, fail */
    }
    pw = password ? PORT_Strdup (password) : NULL;
    /* XXX don't do this, or FIPS won't work */
    /*password = NULL;*/
    return pw;
}
char* pr_fgets ( char *  buf,
int  size,
PRFileDesc file 
)

Definition at line 987 of file util.c.

{
    int       i;
    int       status;
    char      c;

    i = 0;
    while (i < size - 1) {
       status = PR_Read(file, (void * ) &c, 1);
       if (status == -1) {
           return NULL;
       } else if (status == 0) {
           break;
       }
       buf[i++] = c;
       if (c == '\n') {
           break;
       }
    }
    buf[i] = '\0';

    return buf;
}
void print_error ( int  err)

Definition at line 278 of file util.c.

{
    PR_fprintf(errorFD, "Error %d: %s\n", err, JAR_get_error (err));
    errorCount++;
    give_help (err);
}
int RemoveAllArc ( char *  tree)

Definition at line 88 of file util.c.

{
    PRDir * dir;
    PRDirEntry * entry;
    char      *archive = NULL;
    int       retval = 0;

    dir = PR_OpenDir (tree);
    if (!dir) 
       return - 1;

    for (entry = PR_ReadDir (dir, 0); entry; entry = PR_ReadDir (dir,
         0)) {

       if (entry->name[0] == '.') {
           continue;
       }

       if (archive) 
           PR_Free(archive);
       archive = PR_smprintf("%s/%s", tree, entry->name);

       if (PL_strcaserstr (entry->name, ".arc")
            == (entry->name + strlen(entry->name) - 4) ) {

           if (verbosity >= 0) {
              PR_fprintf(outputFD, "removing: %s\n", archive);
           }

           if (rm_dash_r(archive)) {
              PR_fprintf(errorFD, "Error removing %s\n", archive);
              errorCount++;
              retval = -1;
              goto finish;
           }
       } else if (is_dir(archive)) {
           if (RemoveAllArc(archive)) {
              retval = -1;
              goto finish;
           }
       }
    }

finish:
    PR_CloseDir (dir);
    if (archive) 
       PR_Free(archive);

    return retval;
}
int rm_dash_r ( char *  path)

Definition at line 146 of file util.c.

{
    PRDir      * dir;
    PRDirEntry * entry;
    PRFileInfo fileinfo;
    char      filename[FNSIZE];

    if (PR_GetFileInfo(path, &fileinfo) != PR_SUCCESS) {
       /*fprintf(stderr, "Error: Unable to access %s\n", filename);*/
       return - 1;
    }
    if (fileinfo.type == PR_FILE_DIRECTORY) {

       dir = PR_OpenDir(path);
       if (!dir) {
           PR_fprintf(errorFD, "Error: Unable to open directory %s.\n", path);
           errorCount++;
           return - 1;
       }

       /* Recursively delete all entries in the directory */
       while ((entry = PR_ReadDir(dir, PR_SKIP_BOTH)) != NULL) {
           sprintf(filename, "%s/%s", path, entry->name);
           if (rm_dash_r(filename)) 
              return - 1;
       }

       if (PR_CloseDir(dir) != PR_SUCCESS) {
           PR_fprintf(errorFD, "Error: Could not close %s.\n", path);
           errorCount++;
           return - 1;
       }

       /* Delete the directory itself */
       if (PR_RmDir(path) != PR_SUCCESS) {
           PR_fprintf(errorFD, "Error: Unable to delete %s\n", path);
           errorCount++;
           return - 1;
       }
    } else {
       if (PR_Delete(path) != PR_SUCCESS) {
           PR_fprintf(errorFD, "Error: Unable to delete %s\n", path);
           errorCount++;
           return - 1;
       }
    }
    return 0;
}
const char* secErrorString ( long  code)

Definition at line 521 of file util.c.

{
    static char      errstring[80]; /* dynamically constructed error string */
    char      *c; /* the returned string */

    switch (code) {
    case SEC_ERROR_IO: 
       c = "io error";
       break;
    case SEC_ERROR_LIBRARY_FAILURE: 
       c = "security library failure";
       break;
    case SEC_ERROR_BAD_DATA: 
       c = "bad data";
       break;
    case SEC_ERROR_OUTPUT_LEN: 
       c = "output length";
       break;
    case SEC_ERROR_INPUT_LEN: 
       c = "input length";
       break;
    case SEC_ERROR_INVALID_ARGS: 
       c = "invalid args";
       break;
    case SEC_ERROR_EXPIRED_CERTIFICATE: 
       c = "expired certificate";
       break;
    case SEC_ERROR_REVOKED_CERTIFICATE: 
       c = "revoked certificate";
       break;
    case SEC_ERROR_INADEQUATE_KEY_USAGE: 
       c = "inadequate key usage";
       break;
    case SEC_ERROR_INADEQUATE_CERT_TYPE: 
       c = "inadequate certificate type";
       break;
    case SEC_ERROR_UNTRUSTED_CERT: 
       c = "untrusted cert";
       break;
    case SEC_ERROR_NO_KRL: 
       c = "no key revocation list";
       break;
    case SEC_ERROR_KRL_BAD_SIGNATURE: 
       c = "key revocation list: bad signature";
       break;
    case SEC_ERROR_KRL_EXPIRED: 
       c = "key revocation list expired";
       break;
    case SEC_ERROR_REVOKED_KEY: 
       c = "revoked key";
       break;
    case SEC_ERROR_CRL_BAD_SIGNATURE:
       c = "certificate revocation list: bad signature";
       break;
    case SEC_ERROR_CRL_EXPIRED: 
       c = "certificate revocation list expired";
       break;
    case SEC_ERROR_CRL_NOT_YET_VALID:
       c = "certificate revocation list not yet valid";
       break;
    case SEC_ERROR_UNKNOWN_ISSUER: 
       c = "unknown issuer";
       break;
    case SEC_ERROR_EXPIRED_ISSUER_CERTIFICATE: 
       c = "expired issuer certificate";
       break;
    case SEC_ERROR_BAD_SIGNATURE: 
       c = "bad signature";
       break;
    case SEC_ERROR_BAD_KEY: 
       c = "bad key";
       break;
    case SEC_ERROR_NOT_FORTEZZA_ISSUER: 
       c = "not fortezza issuer";
       break;
    case SEC_ERROR_CA_CERT_INVALID:
       c = "Certificate Authority certificate invalid";
       break;
    case SEC_ERROR_EXTENSION_NOT_FOUND: 
       c = "extension not found";
       break;
    case SEC_ERROR_CERT_NOT_IN_NAME_SPACE: 
       c = "certificate not in name space";
       break;
    case SEC_ERROR_UNTRUSTED_ISSUER: 
       c = "untrusted issuer";
       break;
    default:
       sprintf(errstring, "security error %ld", code);
       c = errstring;
       break;
    }

    return c;
}
void usage ( void  )

Definition at line 203 of file util.c.

{
    PR_fprintf(outputFD, "\n");
    PR_fprintf(outputFD, "%s %s - a signing tool for jar files\n", LONG_PROGRAM_NAME,
         NSS_VERSION);
    PR_fprintf(outputFD, "\n");
    PR_fprintf(outputFD, "Usage:  %s [options] directory-tree \n\n",
        PROGRAM_NAME);
    PR_fprintf(outputFD, "    -b \"basename\"\t\tbasename of .sf, .rsa files for signing\n");
    PR_fprintf(outputFD, "    -c#\t\t\t\tCompression level, 0-9, 0=none\n");
    PR_fprintf(outputFD, "    -d \"certificate directory\"\tcontains cert*.db and key*.db\n");
    PR_fprintf(outputFD, "    -e \".ext\"\t\t\tsign only files with this extension\n");
    PR_fprintf(outputFD, "    -f \"filename\"\t\t\tread commands from file\n");
    PR_fprintf(outputFD, "    -G \"nickname\"\t\tcreate object-signing cert with this nickname\n");
    PR_fprintf(outputFD, "    -i \"installer script\"\tassign installer javascript\n");
    PR_fprintf(outputFD, "    -j \"javascript directory\"\tsign javascript files in this subtree\n");
    PR_fprintf(outputFD, "    -J\t\t\t\tdirectory contains HTML files. Javascript will\n"
        "\t\t\t\tbe extracted and signed.\n");
    PR_fprintf(outputFD, "    -k \"cert nickname\"\t\tsign with this certificate\n");
    PR_fprintf(outputFD, "    --leavearc\t\t\tdo not delete .arc directories created\n"
        "\t\t\t\tby -J option\n");
    PR_fprintf(outputFD, "    -m \"metafile\"\t\tinclude custom meta-information\n");
    PR_fprintf(outputFD, "    --norecurse\t\t\tdo not operate on subdirectories\n");
    PR_fprintf(outputFD, "    -o\t\t\t\toptimize - omit optional headers\n");
    PR_fprintf(outputFD, "    -O\t\t\t\tenableOCSP - enable OCSP checking\n");
    PR_fprintf(outputFD, "    --outfile \"filename\"\tredirect output to file\n");
    PR_fprintf(outputFD, "    -p \"password\"\t\tfor password on command line (insecure)\n");
    PR_fprintf(outputFD, "    -s keysize\t\t\tkeysize in bits of generated cert\n");
    PR_fprintf(outputFD, "    -t token\t\t\tname of token on which to generate cert\n");
    PR_fprintf(outputFD, "    --verbosity #\t\tSet amount of debugging information to generate.\n"
        "\t\t\t\tLower number means less output, 0 is default.\n");
    PR_fprintf(outputFD, "    -x \"name\"\t\t\tdirectory or filename to exclude\n");
    PR_fprintf(outputFD, "    -X\t\t\t\tCreate XPI Compatible Archive\n"
        "\t\t\t\t(used in conjunction with the -Z)\n");
    PR_fprintf(outputFD, "    -z\t\t\t\tomit signing time from signature\n");
    PR_fprintf(outputFD, "    -Z \"jarfile\"\t\tcreate JAR file with the given name.\n"
        "\t\t\t\t(Default compression level is 6.)\n");
    PR_fprintf(outputFD, "\n");
    PR_fprintf(outputFD, "%s -l\n", PROGRAM_NAME);
    PR_fprintf(outputFD, "  lists the signing certificates in your database\n");
    PR_fprintf(outputFD, "\n");
    PR_fprintf(outputFD, "%s -L\n", PROGRAM_NAME);
    PR_fprintf(outputFD, "  lists all certificates in your database, marks object-signing certificates\n");
    PR_fprintf(outputFD, "\n");
    PR_fprintf(outputFD, "%s -M\n", PROGRAM_NAME);
    PR_fprintf(outputFD, "  lists the PKCS #11 modules available to %s\n",
         PROGRAM_NAME);
    PR_fprintf(outputFD, "\n");
    PR_fprintf(outputFD, "%s -v file.jar\n", PROGRAM_NAME);
    PR_fprintf(outputFD, "  show the contents of the specified jar file\n");
    PR_fprintf(outputFD, "\n");
    PR_fprintf(outputFD, "%s -w file.jar\n", PROGRAM_NAME);
    PR_fprintf(outputFD, "  if valid, tries to tell you who signed the jar file\n");
    PR_fprintf(outputFD, "\n");
    PR_fprintf(outputFD, "%s -d \"certificate directory\" -K -k \"cert nickname\" -p \"password\" -X -Z \"file.xpi\" directory-tree\n",
         PROGRAM_NAME);
    PR_fprintf(outputFD, "  Common syntax to create a XPInstall compatible signed archive\n\n");
    PR_fprintf(outputFD, "For more details, visit\n");
    PR_fprintf(outputFD, 
        "  http://developer.netscape.com/library/documentation/signedobj/signtool/\n");

    exit (ERRX);
}

Here is the call graph for this function:

void VerifyCertDir ( char *  dir,
char *  keyName 
)

Definition at line 309 of file util.c.

{
    char      fn [FNSIZE];

    /* don't try verifying if we don't have a local directory */
    if (strncmp(dir, "multiaccess:", sizeof("multiaccess:") - 1) == 0) {
       return;
    }

    /* This code is really broken because it makes underlying assumptions about
   * how the NSS profile directory is laid out, but these names can change
   * from release to release. */
    sprintf (fn, "%s/cert8.db", dir);

    if (PR_Access (fn, PR_ACCESS_EXISTS)) {
       PR_fprintf(errorFD, "%s: No certificate database in \"%s\"\n",
                      PROGRAM_NAME, dir);
       PR_fprintf(errorFD, "%s: Check the -d arguments that you gave\n",
                     PROGRAM_NAME);
       errorCount++;
       exit (ERRX);
    }

    if (verbosity >= 0) {
       PR_fprintf(outputFD, "using certificate directory: %s\n", dir);
    }

    if (keyName == NULL)
       return;

    /* if the user gave the -k key argument, verify that 
     a key database already exists */

    sprintf (fn, "%s/key3.db", dir);

    if (PR_Access (fn, PR_ACCESS_EXISTS)) {
       PR_fprintf(errorFD, "%s: No private key database in \"%s\"\n",
            PROGRAM_NAME,
           dir);
       PR_fprintf(errorFD, "%s: Check the -d arguments that you gave\n",
                     PROGRAM_NAME);
       errorCount++;
       exit (ERRX);
    }
}

Definition at line 68 of file util.c.

{
    /* No windows context in command tools */
    return NULL;
}

Here is the caller graph for this function:

char* XP_GetString ( int  i)

Definition at line 51 of file util.c.

{
    return SECU_ErrorStringRaw ((int16) i);
}

Here is the call graph for this function:


Variable Documentation

Definition at line 48 of file util.c.