static char *_NSSUTIL_GetOldSecmodName(const char *dbname,const char *filename) { char *file = NULL; char *dirPath = PORT_Strdup(dbname); char *sep; sep = PORT_Strrchr(dirPath,*NSSUTIL_PATH_SEPARATOR); #ifdef WINDOWS if (!sep) { sep = PORT_Strrchr(dirPath,'\\'); } #endif if (sep) { *(sep)=0; } file= PR_smprintf("%s"NSSUTIL_PATH_SEPARATOR"%s", dirPath, filename); PORT_Free(dirPath); return file; }
static char *sftk_getOldSecmodName(const char *dbname,const char *filename) { char *file = NULL; char *dirPath = PORT_Strdup(dbname); char *sep; sep = PORT_Strrchr(dirPath,*PATH_SEPARATOR); #ifdef _WIN32 if (!sep) { /* pkcs11i.h defines PATH_SEPARATOR as "/" for all platforms. */ sep = PORT_Strrchr(dirPath,'\\'); } #endif if (sep) { *sep = 0; file = PR_smprintf("%s"PATH_SEPARATOR"%s", dirPath, filename); } else { file = PR_smprintf("%s", filename); } PORT_Free(dirPath); return file; }
static int sign_all_arc_fn(char *relpath, char *basedir, char *reldir, char *filename, void *arg) { char *zipfile = NULL; char *arc = NULL, *archive = NULL; int retval = 0; SignArcInfo * infop = (SignArcInfo * )arg; /* Make sure there is one and only one ".arc" in the relative path, * and that it is at the end of the path (don't sign .arcs within .arcs) */ if ( (PL_strcaserstr(relpath, ".arc") == relpath + strlen(relpath) - 4) && (PL_strcasestr(relpath, ".arc") == relpath + strlen(relpath) - 4) ) { if (!infop) { PR_fprintf(errorFD, "%s: Internal failure\n", PROGRAM_NAME); errorCount++; retval = -1; goto finish; } archive = PR_smprintf("%s/%s", basedir, relpath); zipfile = PL_strdup(archive); arc = PORT_Strrchr (zipfile, '.'); if (arc == NULL) { PR_fprintf(errorFD, "%s: Internal failure\n", PROGRAM_NAME); errorCount++; retval = -1; goto finish; } PL_strcpy (arc, ".jar"); if (verbosity >= 0) { PR_fprintf(outputFD, "\nsigning: %s\n", zipfile); } retval = SignArchive(archive, infop->keyName, zipfile, infop->javascript, infop->metafile, infop->install_script, infop->optimize, PR_TRUE /* recurse */); } finish: if (archive) PR_Free(archive); if (zipfile) PR_Free(zipfile); return retval; }