if (rv != SECSuccess) { SECU_PrintPRandOSError(progName); retval=NSS_INITIALIZE_FAILED_ERR; goto loser; }
init_crypto(PRBool create, PRBool readOnly){	char *dir;#ifdef notdef	char *moddbname=NULL, *keydbname, *certdbname;	PRBool free_moddbname = PR_FALSE;#endif	Error retval;	if(SECU_ConfigDirectory(dbdir)[0] == '\0') {		PR_fprintf(PR_STDERR, errStrings[NO_DBDIR_ERR]);		retval=NO_DBDIR_ERR;		goto loser;	}	dir = SECU_ConfigDirectory(NULL);	/* Make sure db directory exists and is readable */	if(PR_Access(dir, PR_ACCESS_EXISTS) != PR_SUCCESS) {		PR_fprintf(PR_STDERR, errStrings[DIR_DOESNT_EXIST_ERR], dir);		retval = DIR_DOESNT_EXIST_ERR;		goto loser;	} else if(PR_Access(dir, PR_ACCESS_READ_OK) != PR_SUCCESS) {		PR_fprintf(PR_STDERR, errStrings[DIR_NOT_READABLE_ERR], dir);		retval = DIR_NOT_READABLE_ERR;		goto loser;	}	/* Check for the proper permissions on databases */	if(create) {		/* Make sure dbs don't already exist, and the directory is			writeable */#ifdef notdef		if(PR_Access(moddbname, PR_ACCESS_EXISTS)==PR_SUCCESS) {			PR_fprintf(PR_STDERR, errStrings[FILE_ALREADY_EXISTS_ERR],			  moddbname);			retval=FILE_ALREADY_EXISTS_ERR;			goto loser;		} else if(PR_Access(keydbname, PR_ACCESS_EXISTS)==PR_SUCCESS) {			PR_fprintf(PR_STDERR, errStrings[FILE_ALREADY_EXISTS_ERR], keydbname);			retval=FILE_ALREADY_EXISTS_ERR;			goto loser;		} else if(PR_Access(certdbname, PR_ACCESS_EXISTS)==PR_SUCCESS) {			PR_fprintf(PR_STDERR, errStrings[FILE_ALREADY_EXISTS_ERR],certdbname);			retval=FILE_ALREADY_EXISTS_ERR;			goto loser;		} else #endif		if(PR_Access(dir, PR_ACCESS_WRITE_OK) != PR_SUCCESS) {			PR_fprintf(PR_STDERR, errStrings[DIR_NOT_WRITEABLE_ERR], dir);			retval=DIR_NOT_WRITEABLE_ERR;			goto loser;		}	} else {#ifdef notdef		/* Make sure dbs are readable and writeable */		if(PR_Access(moddbname, PR_ACCESS_READ_OK) != PR_SUCCESS) {#ifndef XP_PC			/* in serverland, they always use secmod.db, even on UNIX. Try			   this */			moddbname = PR_smprintf("%s/secmod.db", dir);			free_moddbname = PR_TRUE;			if(PR_Access(moddbname, PR_ACCESS_READ_OK) != PR_SUCCESS) {#endif			PR_fprintf(PR_STDERR, errStrings[FILE_NOT_READABLE_ERR], moddbname);			retval=FILE_NOT_READABLE_ERR;			goto loser;#ifndef XP_PC			}#endif		}		if(!nocertdb) { /* don't open cert and key db if -nocertdb */			if(PR_Access(keydbname, PR_ACCESS_READ_OK) != PR_SUCCESS) {				PR_fprintf(PR_STDERR, errStrings[FILE_NOT_READABLE_ERR],				  keydbname);				retval=FILE_NOT_READABLE_ERR;				goto loser;			}			if(PR_Access(certdbname, PR_ACCESS_READ_OK) != PR_SUCCESS) {				PR_fprintf(PR_STDERR, errStrings[FILE_NOT_READABLE_ERR],				  certdbname);				retval=FILE_NOT_READABLE_ERR;				goto loser;			}		}#endif		/* Check for write access if we'll be making changes */		if( !readOnly ) {#ifdef notdef			if(PR_Access(moddbname, PR_ACCESS_WRITE_OK) != PR_SUCCESS) {				PR_fprintf(PR_STDERR, errStrings[FILE_NOT_WRITEABLE_ERR],				  moddbname);				retval=FILE_NOT_WRITEABLE_ERR;				goto loser;			}			if(!nocertdb) { /* don't open key and cert db if -nocertdb */				if(PR_Access(keydbname, PR_ACCESS_WRITE_OK)															!= PR_SUCCESS) {					PR_fprintf(PR_STDERR, errStrings[FILE_NOT_WRITEABLE_ERR],					  keydbname);					retval=FILE_NOT_WRITEABLE_ERR;					goto loser;				}				if(PR_Access(certdbname, PR_ACCESS_WRITE_OK)															!= PR_SUCCESS) {					PR_fprintf(PR_STDERR, errStrings[FILE_NOT_WRITEABLE_ERR],					  certdbname);					retval=FILE_NOT_WRITEABLE_ERR;					goto loser;				}			}#endif		}		PR_fprintf(PR_STDOUT, msgStrings[USING_DBDIR_MSG],		  SECU_ConfigDirectory(NULL));	}	/* Open/create key database */	NSS_Initialize(SECU_ConfigDirectory(NULL), dbprefix, dbprefix,	               "secmod.db", readOnly);	retval=SUCCESS;loser:#ifdef notdef	if(free_moddbname) {		PR_Free(moddbname);	}#endif	return retval;}