1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-05-28 21:50:02 +02:00

* keydb.c (keydb_add_resource): Don't assume that try_make_homedir

terminates but check again for the existence of the directory and
continue then.
* openfile.c (copy_options_file): Print a warning if the skeleton
file has active options.
This commit is contained in:
Werner Koch 2003-01-02 18:28:29 +00:00
parent 0bb73ee428
commit 842e690f54
3 changed files with 46 additions and 15 deletions

View File

@ -1,3 +1,11 @@
2003-01-02 Werner Koch <wk@gnupg.org>
* keydb.c (keydb_add_resource): Don't assume that try_make_homedir
terminates but check again for the existence of the directory and
continue then.
* openfile.c (copy_options_file): Print a warning if the skeleton
file has active options.
2002-12-29 David Shaw <dshaw@jabberwocky.com> 2002-12-29 David Shaw <dshaw@jabberwocky.com>
* getkey.c (merge_selfsigs_main), main.h, sig-check.c * getkey.c (merge_selfsigs_main), main.h, sig-check.c
@ -7527,7 +7535,7 @@ Thu Feb 12 22:24:42 1998 Werner Koch (wk@frodo)
* pubkey-enc.c (get_session_key): rewritten * pubkey-enc.c (get_session_key): rewritten
Copyright 1998,1999,2000,2001,2002 Free Software Foundation, Inc. Copyright 1998,1999,2000,2001,2002,2003 Free Software Foundation, Inc.
This file is free software; as a special exception the author gives This file is free software; as a special exception the author gives
unlimited permission to copy and/or distribute it, with or without unlimited permission to copy and/or distribute it, with or without

View File

@ -1,5 +1,5 @@
/* keydb.c - key database dispatcher /* keydb.c - key database dispatcher
* Copyright (C) 2001, 2002 Free Software Foundation, Inc. * Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
* *
* This file is part of GnuPG. * This file is part of GnuPG.
* *
@ -100,13 +100,13 @@ keydb_add_resource (const char *url, int flags, int secret)
rt = KEYDB_RESOURCE_TYPE_KEYRING; rt = KEYDB_RESOURCE_TYPE_KEYRING;
resname += 11; resname += 11;
} }
#if !defined(HAVE_DRIVE_LETTERS) && !defined(__riscos__) #if !defined(HAVE_DRIVE_LETTERS) && !defined(__riscos__)
else if (strchr (resname, ':')) { else if (strchr (resname, ':')) {
log_error ("invalid key resource URL `%s'\n", url ); log_error ("invalid key resource URL `%s'\n", url );
rc = G10ERR_GENERAL; rc = G10ERR_GENERAL;
goto leave; goto leave;
} }
#endif /* !HAVE_DRIVE_LETTERS && !__riscos__ */ #endif /* !HAVE_DRIVE_LETTERS && !__riscos__ */
} }
if (*resname != DIRSEP_C ) { /* do tilde expansion etc */ if (*resname != DIRSEP_C ) { /* do tilde expansion etc */
@ -163,14 +163,21 @@ keydb_add_resource (const char *url, int flags, int secret)
last_slash_in_filename = strrchr (filename, DIRSEP_C); last_slash_in_filename = strrchr (filename, DIRSEP_C);
*last_slash_in_filename = 0; *last_slash_in_filename = 0;
if (access(filename, F_OK)) if (access(filename, F_OK))
{ /* on the first time we try to create the default { /* On the first time we try to create the default
homedir and in this case the process will be homedir and check again. */
terminated, so that on the next invocation it can static int tried;
read the options file in on startup */
try_make_homedir (filename); if (!tried)
rc = G10ERR_OPEN_FILE; {
*last_slash_in_filename = DIRSEP_C; tried = 1;
goto leave; try_make_homedir (filename);
}
if (access (filename, F_OK))
{
rc = G10ERR_OPEN_FILE;
*last_slash_in_filename = DIRSEP_C;
goto leave;
}
} }
*last_slash_in_filename = DIRSEP_C; *last_slash_in_filename = DIRSEP_C;

View File

@ -1,5 +1,5 @@
/* openfile.c /* openfile.c
* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc. * Copyright (C) 1998, 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
* *
* This file is part of GnuPG. * This file is part of GnuPG.
* *
@ -286,7 +286,6 @@ open_sigfile( const char *iname )
return a; return a;
} }
/**************** /****************
* Copy the option file skeleton to the given directory. * Copy the option file skeleton to the given directory.
*/ */
@ -299,6 +298,8 @@ copy_options_file( const char *destdir )
int linefeeds=0; int linefeeds=0;
int c; int c;
mode_t oldmask; mode_t oldmask;
int esc = 0;
int any_option = 0;
if( opt.dry_run ) if( opt.dry_run )
return; return;
@ -327,12 +328,27 @@ copy_options_file( const char *destdir )
if( c == '\n' ) if( c == '\n' )
linefeeds++; linefeeds++;
} }
else else {
putc( c, dst ); putc( c, dst );
if (c== '\n')
esc = 1;
else if (esc == 1) {
if (c == ' ' || c == '\t')
;
else if (c == '#')
esc = 2;
else
any_option = 1;
}
}
} }
fclose( dst ); fclose( dst );
fclose( src ); fclose( src );
log_info(_("new configuration file `%s' created\n"), fname ); log_info(_("new configuration file `%s' created\n"), fname );
if (any_option)
log_info (_("WARNING: options in `%s'"
" are not yet active during this run\n"),
fname);
m_free(fname); m_free(fname);
} }