* tdbio.c (tdbio_set_dbname): Create new trustdbs with user-only
authorDavid Shaw <dshaw@jabberwocky.com>
Thu, 8 Aug 2002 19:09:34 +0000 (19:09 +0000)
committerDavid Shaw <dshaw@jabberwocky.com>
Thu, 8 Aug 2002 19:09:34 +0000 (19:09 +0000)
permissions.

g10/ChangeLog
g10/tdbio.c

index 422c2ca..b240e9c 100644 (file)
@@ -1,3 +1,8 @@
+2002-08-08  David Shaw  <dshaw@jabberwocky.com>
+
+       * tdbio.c (tdbio_set_dbname): Create new trustdbs with user-only
+       permissions.
+
 2002-08-07  David Shaw  <dshaw@jabberwocky.com>
 
        * sig-check.c (signature_check2): Sanity check that the md has a
index 20b32af..cdeba46 100644 (file)
@@ -458,6 +458,7 @@ tdbio_set_dbname( const char *new_dbname, int create )
            TRUSTREC rec;
            int rc;
            char *p = strrchr( fname, DIRSEP_C );
+           mode_t oldmask;
 
            assert(p);
            *p = 0;
@@ -477,7 +478,9 @@ tdbio_set_dbname( const char *new_dbname, int create )
             if( make_dotlock( lockhandle, -1 ) )
                 log_fatal( _("%s: can't make lock\n"), db_name );
 #endif /* __riscos__ */
+           oldmask=umask(077);
            fp =fopen( fname, "wb" );
+           umask(oldmask);
            if( !fp )
                log_fatal( _("%s: can't create: %s\n"), fname, strerror(errno) );
            fclose(fp);