mirror of
git://git.gnupg.org/gnupg.git
synced 2025-03-28 22:49:59 +01:00
* misc.c (is_secured_filename): New.
* keydb.c (maybe_create_keyring) * tdbio.c (tdbio_set_dbname) * plaintext.c (handle_plaintext) * openfile.c (copy_options_file, open_outfile) * exec.c (exec_write) * keygen.c (do_generate_keypair, gen_card_key_with_backup) * sign.c (sign_file, clearsign_file) * keyring.c (create_tmp_file, do_copy): Check for secured files before creating them. * keygen.c (print_status_key_created): s/unsigned char/byte/ due to a strange typedef for RISC OS. Noted by Stefan.
This commit is contained in:
parent
0d6defc0da
commit
35774ec568
@ -1,3 +1,19 @@
|
|||||||
|
2004-10-14 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
|
* misc.c (is_secured_filename): New.
|
||||||
|
* keydb.c (maybe_create_keyring)
|
||||||
|
* tdbio.c (tdbio_set_dbname)
|
||||||
|
* plaintext.c (handle_plaintext)
|
||||||
|
* openfile.c (copy_options_file, open_outfile)
|
||||||
|
* exec.c (exec_write)
|
||||||
|
* keygen.c (do_generate_keypair, gen_card_key_with_backup)
|
||||||
|
* sign.c (sign_file, clearsign_file)
|
||||||
|
* keyring.c (create_tmp_file, do_copy): Check for secured files
|
||||||
|
before creating them.
|
||||||
|
|
||||||
|
* keygen.c (print_status_key_created): s/unsigned char/byte/ due
|
||||||
|
to a strange typedef for RISC OS. Noted by Stefan.
|
||||||
|
|
||||||
2004-10-13 David Shaw <dshaw@jabberwocky.com>
|
2004-10-13 David Shaw <dshaw@jabberwocky.com>
|
||||||
|
|
||||||
* armor.c (fake_packet): Allow arbitrary dash-escaped lines as per
|
* armor.c (fake_packet): Allow arbitrary dash-escaped lines as per
|
||||||
|
@ -477,13 +477,13 @@ int exec_write(struct exec_info **info,const char *program,
|
|||||||
log_debug("using temp file `%s'\n",(*info)->tempfile_in);
|
log_debug("using temp file `%s'\n",(*info)->tempfile_in);
|
||||||
|
|
||||||
/* It's not fork/exec/pipe, so create a temp file */
|
/* It's not fork/exec/pipe, so create a temp file */
|
||||||
(*info)->tochild=fopen((*info)->tempfile_in,binary?"wb":"w");
|
if( is_secured_filename ((*info)->tempfile_in) )
|
||||||
if((*info)->tochild && is_secured_file (fileno ((*info)->tochild)))
|
|
||||||
{
|
{
|
||||||
fclose ((*info)->tochild);
|
|
||||||
(*info)->tochild = NULL;
|
(*info)->tochild = NULL;
|
||||||
errno = EPERM;
|
errno = EPERM;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
(*info)->tochild=fopen((*info)->tempfile_in,binary?"wb":"w");
|
||||||
if((*info)->tochild==NULL)
|
if((*info)->tochild==NULL)
|
||||||
{
|
{
|
||||||
log_error(_("can't create file `%s': %s\n"),
|
log_error(_("can't create file `%s': %s\n"),
|
||||||
|
@ -154,7 +154,13 @@ maybe_create_keyring (char *filename, int force)
|
|||||||
|
|
||||||
/* The file does not yet exist, create it now. */
|
/* The file does not yet exist, create it now. */
|
||||||
oldmask = umask (077);
|
oldmask = umask (077);
|
||||||
iobuf = iobuf_create (filename);
|
if (is_secured_filename (filename))
|
||||||
|
{
|
||||||
|
iobuf = NULL;
|
||||||
|
errno = EPERM;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
iobuf = iobuf_create (filename);
|
||||||
umask (oldmask);
|
umask (oldmask);
|
||||||
if (!iobuf)
|
if (!iobuf)
|
||||||
{
|
{
|
||||||
|
28
g10/keygen.c
28
g10/keygen.c
@ -167,7 +167,7 @@ copy_mpi (MPI a, unsigned char *buffer, size_t len, size_t *ncopied)
|
|||||||
static void
|
static void
|
||||||
print_status_key_created (int letter, PKT_public_key *pk, const char *handle)
|
print_status_key_created (int letter, PKT_public_key *pk, const char *handle)
|
||||||
{
|
{
|
||||||
unsigned char array[MAX_FINGERPRINT_LEN], *s;
|
byte array[MAX_FINGERPRINT_LEN], *s;
|
||||||
char *buf, *p;
|
char *buf, *p;
|
||||||
size_t i, n;
|
size_t i, n;
|
||||||
|
|
||||||
@ -2683,9 +2683,14 @@ do_generate_keypair( struct para_data_s *para,
|
|||||||
outctrl->pub.fname = outctrl->pub.newfname;
|
outctrl->pub.fname = outctrl->pub.newfname;
|
||||||
outctrl->pub.newfname = NULL;
|
outctrl->pub.newfname = NULL;
|
||||||
|
|
||||||
outctrl->pub.stream = iobuf_create( outctrl->pub.fname );
|
if (is_secured_filename (outctrl->pub.fname) ) {
|
||||||
|
outctrl->pub.stream = NULL;
|
||||||
|
errno = EPERM;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
outctrl->pub.stream = iobuf_create( outctrl->pub.fname );
|
||||||
if( !outctrl->pub.stream ) {
|
if( !outctrl->pub.stream ) {
|
||||||
log_error("can't create `%s': %s\n", outctrl->pub.newfname,
|
log_error(_("can't create `%s': %s\n"), outctrl->pub.newfname,
|
||||||
strerror(errno) );
|
strerror(errno) );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -2707,10 +2712,15 @@ do_generate_keypair( struct para_data_s *para,
|
|||||||
outctrl->sec.newfname = NULL;
|
outctrl->sec.newfname = NULL;
|
||||||
|
|
||||||
oldmask = umask (077);
|
oldmask = umask (077);
|
||||||
outctrl->sec.stream = iobuf_create( outctrl->sec.fname );
|
if (is_secured_filename (outctrl->sec.fname) ) {
|
||||||
|
outctrl->sec.stream = NULL;
|
||||||
|
errno = EPERM;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
outctrl->sec.stream = iobuf_create( outctrl->sec.fname );
|
||||||
umask (oldmask);
|
umask (oldmask);
|
||||||
if( !outctrl->sec.stream ) {
|
if( !outctrl->sec.stream ) {
|
||||||
log_error("can't create `%s': %s\n", outctrl->sec.newfname,
|
log_error(_("can't create `%s': %s\n"), outctrl->sec.newfname,
|
||||||
strerror(errno) );
|
strerror(errno) );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -3328,7 +3338,13 @@ gen_card_key_with_backup (int algo, int keyno, int is_primary,
|
|||||||
|
|
||||||
fname = make_filename (backup_dir, name_buffer, NULL);
|
fname = make_filename (backup_dir, name_buffer, NULL);
|
||||||
oldmask = umask (077);
|
oldmask = umask (077);
|
||||||
fp = iobuf_create (fname);
|
if (is_secured_filename (fname))
|
||||||
|
{
|
||||||
|
fp = NULL;
|
||||||
|
errno = EPERM;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
fp = iobuf_create (fname);
|
||||||
umask (oldmask);
|
umask (oldmask);
|
||||||
if (!fp)
|
if (!fp)
|
||||||
{
|
{
|
||||||
|
@ -1185,7 +1185,13 @@ create_tmp_file (const char *template,
|
|||||||
|
|
||||||
/* Create the temp file with limited access */
|
/* Create the temp file with limited access */
|
||||||
oldmask=umask(077);
|
oldmask=umask(077);
|
||||||
*r_fp = iobuf_create (tmpfname);
|
if (is_secured_filename (tmpfname))
|
||||||
|
{
|
||||||
|
*r_fp = NULL;
|
||||||
|
errno = EPERM;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
*r_fp = iobuf_create (tmpfname);
|
||||||
umask(oldmask);
|
umask(oldmask);
|
||||||
if (!*r_fp) {
|
if (!*r_fp) {
|
||||||
log_error ("can't create `%s': %s\n", tmpfname, strerror(errno) );
|
log_error ("can't create `%s': %s\n", tmpfname, strerror(errno) );
|
||||||
@ -1467,7 +1473,7 @@ do_copy (int mode, const char *fname, KBNODE root, int secret,
|
|||||||
char *bakfname = NULL;
|
char *bakfname = NULL;
|
||||||
char *tmpfname = NULL;
|
char *tmpfname = NULL;
|
||||||
|
|
||||||
/* Open the source file. Because we do a rname, we have to check the
|
/* Open the source file. Because we do a rename, we have to check the
|
||||||
permissions of the file */
|
permissions of the file */
|
||||||
if (access (fname, W_OK))
|
if (access (fname, W_OK))
|
||||||
return G10ERR_WRITE_FILE;
|
return G10ERR_WRITE_FILE;
|
||||||
@ -1479,10 +1485,15 @@ do_copy (int mode, const char *fname, KBNODE root, int secret,
|
|||||||
mode_t oldmask;
|
mode_t oldmask;
|
||||||
|
|
||||||
oldmask=umask(077);
|
oldmask=umask(077);
|
||||||
newfp = iobuf_create (fname);
|
if (!secret && is_secured_filename (fname)) {
|
||||||
|
newfp = NULL;
|
||||||
|
errno = EPERM;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
newfp = iobuf_create (fname);
|
||||||
umask(oldmask);
|
umask(oldmask);
|
||||||
if( !newfp ) {
|
if( !newfp ) {
|
||||||
log_error (_("%s: can't create: %s\n"),
|
log_error (_("can't create `%s': %s\n"),
|
||||||
fname, strerror(errno));
|
fname, strerror(errno));
|
||||||
return G10ERR_OPEN_FILE;
|
return G10ERR_OPEN_FILE;
|
||||||
}
|
}
|
||||||
@ -1506,7 +1517,7 @@ do_copy (int mode, const char *fname, KBNODE root, int secret,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( !fp ) {
|
if( !fp ) {
|
||||||
log_error ("%s: can't open: %s\n", fname, strerror(errno) );
|
log_error ("can't open `%s': %s\n", fname, strerror(errno) );
|
||||||
rc = G10ERR_OPEN_FILE;
|
rc = G10ERR_OPEN_FILE;
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
|
@ -75,6 +75,7 @@ int disable_core_dumps(void);
|
|||||||
void register_secured_file (const char *fname);
|
void register_secured_file (const char *fname);
|
||||||
void unregister_secured_file (const char *fname);
|
void unregister_secured_file (const char *fname);
|
||||||
int is_secured_file (int fd);
|
int is_secured_file (int fd);
|
||||||
|
int is_secured_filename (const char *fname);
|
||||||
u16 checksum_u16( unsigned n );
|
u16 checksum_u16( unsigned n );
|
||||||
u16 checksum( byte *p, unsigned n );
|
u16 checksum( byte *p, unsigned n );
|
||||||
u16 checksum_mpi( MPI a );
|
u16 checksum_mpi( MPI a );
|
||||||
|
35
g10/misc.c
35
g10/misc.c
@ -198,6 +198,41 @@ is_secured_file (int fd)
|
|||||||
return 0; /* No. */
|
return 0; /* No. */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Return true if FNAME is corresponds to a secured file. Using NULL,
|
||||||
|
"" or "-" for FS is allowed and will return false. This function is
|
||||||
|
used before creating a file, thus it won't fail if the file does
|
||||||
|
not exist. */
|
||||||
|
int
|
||||||
|
is_secured_filename (const char *fname)
|
||||||
|
{
|
||||||
|
#ifdef ENABLE_SELINUX_HACKS
|
||||||
|
struct stat buf;
|
||||||
|
struct secured_file_item *sf;
|
||||||
|
|
||||||
|
if (iobuf_is_pipe_filename (fname) || !*fname)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/* Note that we print out a error here and claim that a file is
|
||||||
|
secure if something went wrong. */
|
||||||
|
if (stat (fname, &buf))
|
||||||
|
{
|
||||||
|
if (errno == ENOENT || errno == EPERM || errno == EACCES)
|
||||||
|
return 0;
|
||||||
|
log_error (_("fstat of `%s' failed in %s: %s\n"), fname,
|
||||||
|
"is_secured_filename", strerror (errno));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
/* log_debug ("is_secured_filename (%s) i=%lu.%lu\n", fname, */
|
||||||
|
/* (unsigned long)buf.st_dev, (unsigned long)buf.st_ino); */
|
||||||
|
for (sf=secured_files; sf; sf = sf->next)
|
||||||
|
{
|
||||||
|
if (sf->ino == buf.st_ino && sf->dev == buf.st_dev)
|
||||||
|
return 1; /* Yes. */
|
||||||
|
}
|
||||||
|
#endif /*ENABLE_SELINUX_HACKS*/
|
||||||
|
return 0; /* No. */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
u16
|
u16
|
||||||
|
@ -175,8 +175,9 @@ open_outfile( const char *iname, int mode, IOBUF *a )
|
|||||||
|
|
||||||
*a = NULL;
|
*a = NULL;
|
||||||
if( iobuf_is_pipe_filename (iname) && !opt.outfile ) {
|
if( iobuf_is_pipe_filename (iname) && !opt.outfile ) {
|
||||||
if( !(*a = iobuf_create(NULL)) ) {
|
*a = iobuf_create(NULL);
|
||||||
log_error(_("%s: can't open: %s\n"), "[stdout]", strerror(errno) );
|
if( !*a ) {
|
||||||
|
log_error(_("can't open `%s': %s\n"), "[stdout]", strerror(errno) );
|
||||||
rc = G10ERR_CREATE_FILE;
|
rc = G10ERR_CREATE_FILE;
|
||||||
}
|
}
|
||||||
else if( opt.verbose )
|
else if( opt.verbose )
|
||||||
@ -244,9 +245,16 @@ open_outfile( const char *iname, int mode, IOBUF *a )
|
|||||||
|
|
||||||
if( !rc )
|
if( !rc )
|
||||||
{
|
{
|
||||||
if( !(*a = iobuf_create( name )) )
|
if (is_secured_filename (name) )
|
||||||
{
|
{
|
||||||
log_error(_("%s: can't create: %s\n"), name, strerror(errno) );
|
*a = NULL;
|
||||||
|
errno = EPERM;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
*a = iobuf_create( name );
|
||||||
|
if( !*a )
|
||||||
|
{
|
||||||
|
log_error(_("can't create `%s': %s\n"), name, strerror(errno) );
|
||||||
rc = G10ERR_CREATE_FILE;
|
rc = G10ERR_CREATE_FILE;
|
||||||
}
|
}
|
||||||
else if( opt.verbose )
|
else if( opt.verbose )
|
||||||
@ -322,16 +330,22 @@ copy_options_file( const char *destdir )
|
|||||||
errno = EPERM;
|
errno = EPERM;
|
||||||
}
|
}
|
||||||
if( !src ) {
|
if( !src ) {
|
||||||
log_error(_("%s: can't open: %s\n"), fname, strerror(errno) );
|
log_error(_("can't open `%s': %s\n"), fname, strerror(errno) );
|
||||||
m_free(fname);
|
m_free(fname);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
strcpy(stpcpy(fname, destdir), DIRSEP_S "gpg" EXTSEP_S "conf" );
|
strcpy(stpcpy(fname, destdir), DIRSEP_S "gpg" EXTSEP_S "conf" );
|
||||||
oldmask=umask(077);
|
oldmask=umask(077);
|
||||||
dst = fopen( fname, "w" );
|
if ( is_secured_filename (fname) )
|
||||||
|
{
|
||||||
|
dst = NULL;
|
||||||
|
errno = EPERM;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
dst = fopen( fname, "w" );
|
||||||
umask(oldmask);
|
umask(oldmask);
|
||||||
if( !dst ) {
|
if( !dst ) {
|
||||||
log_error(_("%s: can't create: %s\n"), fname, strerror(errno) );
|
log_error(_("can't create `%s': %s\n"), fname, strerror(errno) );
|
||||||
fclose( src );
|
fclose( src );
|
||||||
m_free(fname);
|
m_free(fname);
|
||||||
return;
|
return;
|
||||||
@ -389,10 +403,10 @@ try_make_homedir( const char *fname )
|
|||||||
&& !compare_filenames( fname, defhome ) )
|
&& !compare_filenames( fname, defhome ) )
|
||||||
) {
|
) {
|
||||||
if( mkdir( fname, S_IRUSR|S_IWUSR|S_IXUSR ) )
|
if( mkdir( fname, S_IRUSR|S_IWUSR|S_IXUSR ) )
|
||||||
log_fatal( _("%s: can't create directory: %s\n"),
|
log_fatal( _("can't create directory `%s': %s\n"),
|
||||||
fname, strerror(errno) );
|
fname, strerror(errno) );
|
||||||
else if( !opt.quiet )
|
else if( !opt.quiet )
|
||||||
log_info( _("%s: directory created\n"), fname );
|
log_info( _("directory `%s' created\n"), fname );
|
||||||
copy_options_file( fname );
|
copy_options_file( fname );
|
||||||
/* log_info(_("you have to start GnuPG again, " */
|
/* log_info(_("you have to start GnuPG again, " */
|
||||||
/* "so it can read the new configuration file\n") ); */
|
/* "so it can read the new configuration file\n") ); */
|
||||||
|
@ -128,6 +128,13 @@ handle_plaintext( PKT_plaintext *pt, md_filter_context_t *mfx,
|
|||||||
#ifndef __riscos__
|
#ifndef __riscos__
|
||||||
if( fp || nooutput )
|
if( fp || nooutput )
|
||||||
;
|
;
|
||||||
|
else if (is_secured_filename (fname))
|
||||||
|
{
|
||||||
|
errno = EPERM;
|
||||||
|
log_error(_("error creating `%s': %s\n"), fname, strerror(errno) );
|
||||||
|
rc = G10ERR_CREATE_FILE;
|
||||||
|
goto leave;
|
||||||
|
}
|
||||||
else if( !(fp = fopen(fname,"wb")) ) {
|
else if( !(fp = fopen(fname,"wb")) ) {
|
||||||
log_error(_("error creating `%s': %s\n"), fname, strerror(errno) );
|
log_error(_("error creating `%s': %s\n"), fname, strerror(errno) );
|
||||||
rc = G10ERR_CREATE_FILE;
|
rc = G10ERR_CREATE_FILE;
|
||||||
|
16
g10/sign.c
16
g10/sign.c
@ -768,7 +768,13 @@ sign_file( STRLIST filenames, int detached, STRLIST locusr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( outfile ) {
|
if( outfile ) {
|
||||||
if( !(out = iobuf_create( outfile )) ) {
|
if (is_secured_filename ( outfile )) {
|
||||||
|
out = NULL;
|
||||||
|
errno = EPERM;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
out = iobuf_create( outfile );
|
||||||
|
if( !out ) {
|
||||||
log_error(_("can't create file `%s': %s\n"),
|
log_error(_("can't create file `%s': %s\n"),
|
||||||
outfile, strerror(errno) );
|
outfile, strerror(errno) );
|
||||||
rc = G10ERR_CREATE_FILE;
|
rc = G10ERR_CREATE_FILE;
|
||||||
@ -1019,7 +1025,13 @@ clearsign_file( const char *fname, STRLIST locusr, const char *outfile )
|
|||||||
handle_progress (&pfx, inp, fname);
|
handle_progress (&pfx, inp, fname);
|
||||||
|
|
||||||
if( outfile ) {
|
if( outfile ) {
|
||||||
if( !(out = iobuf_create( outfile )) ) {
|
if (is_secured_filename (outfile) ) {
|
||||||
|
outfile = NULL;
|
||||||
|
errno = EPERM;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
out = iobuf_create( outfile );
|
||||||
|
if( !out ) {
|
||||||
log_error(_("can't create file `%s': %s\n"),
|
log_error(_("can't create file `%s': %s\n"),
|
||||||
outfile, strerror(errno) );
|
outfile, strerror(errno) );
|
||||||
rc = G10ERR_CREATE_FILE;
|
rc = G10ERR_CREATE_FILE;
|
||||||
|
25
g10/tdbio.c
25
g10/tdbio.c
@ -494,7 +494,7 @@ tdbio_set_dbname( const char *new_dbname, int create )
|
|||||||
|
|
||||||
if( access( fname, R_OK ) ) {
|
if( access( fname, R_OK ) ) {
|
||||||
if( errno != ENOENT ) {
|
if( errno != ENOENT ) {
|
||||||
log_error( _("%s: can't access: %s\n"), fname, strerror(errno) );
|
log_error( _("can't access `%s': %s\n"), fname, strerror(errno) );
|
||||||
m_free(fname);
|
m_free(fname);
|
||||||
return G10ERR_TRUSTDB;
|
return G10ERR_TRUSTDB;
|
||||||
}
|
}
|
||||||
@ -519,25 +519,30 @@ tdbio_set_dbname( const char *new_dbname, int create )
|
|||||||
if( !lockhandle )
|
if( !lockhandle )
|
||||||
lockhandle = create_dotlock( db_name );
|
lockhandle = create_dotlock( db_name );
|
||||||
if( !lockhandle )
|
if( !lockhandle )
|
||||||
log_fatal( _("%s: can't create lock\n"), db_name );
|
log_fatal( _("can't create lock for `%s'\n"), db_name );
|
||||||
if( make_dotlock( lockhandle, -1 ) )
|
if( make_dotlock( lockhandle, -1 ) )
|
||||||
log_fatal( _("%s: can't make lock\n"), db_name );
|
log_fatal( _("can't lock `%s'\n"), db_name );
|
||||||
#endif /* __riscos__ */
|
#endif /* __riscos__ */
|
||||||
oldmask=umask(077);
|
oldmask=umask(077);
|
||||||
fp =fopen( fname, "wb" );
|
if (is_secured_filename (fname)) {
|
||||||
|
fp = NULL;
|
||||||
|
errno = EPERM;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
fp =fopen( fname, "wb" );
|
||||||
umask(oldmask);
|
umask(oldmask);
|
||||||
if( !fp )
|
if( !fp )
|
||||||
log_fatal( _("%s: can't create: %s\n"), fname, strerror(errno) );
|
log_fatal( _("can't create `%s': %s\n"), fname, strerror(errno) );
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
db_fd = open( db_name, O_RDWR | MY_O_BINARY );
|
db_fd = open( db_name, O_RDWR | MY_O_BINARY );
|
||||||
if( db_fd == -1 )
|
if( db_fd == -1 )
|
||||||
log_fatal( _("%s: can't open: %s\n"), db_name, strerror(errno) );
|
log_fatal( _("can't open `%s': %s\n"), db_name, strerror(errno) );
|
||||||
|
|
||||||
#ifndef __riscos__
|
#ifndef __riscos__
|
||||||
if( !lockhandle )
|
if( !lockhandle )
|
||||||
lockhandle = create_dotlock( db_name );
|
lockhandle = create_dotlock( db_name );
|
||||||
if( !lockhandle )
|
if( !lockhandle )
|
||||||
log_fatal( _("%s: can't create lock\n"), db_name );
|
log_fatal( _("can't create lock for `%s'\n"), db_name );
|
||||||
#endif /* !__riscos__ */
|
#endif /* !__riscos__ */
|
||||||
|
|
||||||
rc = create_version_record ();
|
rc = create_version_record ();
|
||||||
@ -580,10 +585,10 @@ open_db()
|
|||||||
if (!lockhandle )
|
if (!lockhandle )
|
||||||
lockhandle = create_dotlock( db_name );
|
lockhandle = create_dotlock( db_name );
|
||||||
if (!lockhandle )
|
if (!lockhandle )
|
||||||
log_fatal( _("%s: can't create lock\n"), db_name );
|
log_fatal( _("can't create lock for `%s'\n"), db_name );
|
||||||
#ifdef __riscos__
|
#ifdef __riscos__
|
||||||
if (make_dotlock( lockhandle, -1 ) )
|
if (make_dotlock( lockhandle, -1 ) )
|
||||||
log_fatal( _("%s: can't make lock\n"), db_name );
|
log_fatal( _("can't lock `%s'\n"), db_name );
|
||||||
#endif /* __riscos__ */
|
#endif /* __riscos__ */
|
||||||
db_fd = open (db_name, O_RDWR | MY_O_BINARY );
|
db_fd = open (db_name, O_RDWR | MY_O_BINARY );
|
||||||
if (db_fd == -1 && errno == EACCES) {
|
if (db_fd == -1 && errno == EACCES) {
|
||||||
@ -592,7 +597,7 @@ open_db()
|
|||||||
log_info (_("NOTE: trustdb not writable\n"));
|
log_info (_("NOTE: trustdb not writable\n"));
|
||||||
}
|
}
|
||||||
if ( db_fd == -1 )
|
if ( db_fd == -1 )
|
||||||
log_fatal( _("%s: can't open: %s\n"), db_name, strerror(errno) );
|
log_fatal( _("can't open `%s': %s\n"), db_name, strerror(errno) );
|
||||||
register_secured_file (db_name);
|
register_secured_file (db_name);
|
||||||
|
|
||||||
/* check whether we need to do a version migration */
|
/* check whether we need to do a version migration */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user