nss-shared-helper/db.c
changeset 4 69b7ac3efaa2
parent 3 1d5c74914855
equal deleted inserted replaced
3:1d5c74914855 4:69b7ac3efaa2
    53 char *
    53 char *
    54 nsshelp_get_user_db_path (void)
    54 nsshelp_get_user_db_path (void)
    55 {
    55 {
    56   const char  *env;
    56   const char  *env;
    57   char        *path;
    57   char        *path;
    58   char         system_path[] = DEFAULT_PATH;
    58   char        *system_path;
    59   struct stat  sbuf;
    59   struct stat  sbuf;
    60   int          result;
    60   int          result;
    61 
    61 
    62   env = getenv ("NSS_SHARED_DB_PATH");
    62   env = getenv ("NSS_SHARED_DB_PATH");
       
    63   system_path = strdup(DEFAULT_PATH);
    63 
    64 
    64   /*
    65   /*
    65    * 1. use env NSS_SHARED_DB_PATH
    66    * 1. use env NSS_SHARED_DB_PATH
    66    * 2. try /etc/pki/nssdb
    67    * 2. try /etc/pki/nssdb
    67    * 3. use $HOME/.pki/nssdb
    68    * 3. use $HOME/.pki/nssdb
   118   /* $HOME/.pki/nssdb */
   119   /* $HOME/.pki/nssdb */
   119   if (stat(path, &sbuf) == 0 && S_ISDIR (sbuf.st_mode))
   120   if (stat(path, &sbuf) == 0 && S_ISDIR (sbuf.st_mode))
   120     return path;
   121     return path;
   121 
   122 
   122   free (path);
   123   free (path);
       
   124   free (system_path);
   123   return NULL;
   125   return NULL;
   124 }
   126 }
   125 
   127 
   126 SECStatus
   128 SECStatus
   127 nsshelp_open_db (const char *app_id, const char *old_path, PRUint32 flags)
   129 nsshelp_open_db (const char *app_id, const char *old_path, PRUint32 flags)