[git] GnuPG - branch, STABLE-BRANCH-2-0, updated. gnupg-2.0.28-7-g2371553
by NIIBE Yutaka
cvs at cvs.gnupg.org
Mon Jun 15 07:35:01 CEST 2015
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The GNU Privacy Guard".
The branch, STABLE-BRANCH-2-0 has been updated
via 2371553af156b5f8d6282e42cb8891f0c986d3d3 (commit)
via c30bcdeac0112680a61819c52ab90beb69fdc6c0 (commit)
from 0de9aedf3eb73608eb4d1197b80e8cae6a0736a6 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 2371553af156b5f8d6282e42cb8891f0c986d3d3
Author: NIIBE Yutaka <gniibe at fsij.org>
Date: Thu May 28 17:08:37 2015 +0900
g10: Fix a race condition initially creating trustdb.
* g10/tdbio.c (take_write_lock, release_write_lock): New.
(put_record_into_cache, tdbio_sync, tdbio_end_transaction): Use
new lock functions.
(tdbio_set_dbname): Fix the race.
(open_db): Don't call create_dotlock.
--
(backported from commit fe5c6edaed78839303d67e01e141cfc6b5de9aec)
GnuPG-bug-id: 1675
diff --git a/g10/tdbio.c b/g10/tdbio.c
index 6e26108..84a0ba6 100644
--- a/g10/tdbio.c
+++ b/g10/tdbio.c
@@ -93,7 +93,33 @@ static int in_transaction;
static void open_db(void);
+static int
+take_write_lock (void)
+{
+ if (!lockhandle)
+ lockhandle = create_dotlock (db_name);
+ if (!lockhandle)
+ log_fatal ( _("can't create lock for `%s'\n"), db_name );
+
+ if (!is_locked)
+ {
+ if (make_dotlock (lockhandle, -1) )
+ log_fatal ( _("can't lock `%s'\n"), db_name );
+ else
+ is_locked = 1;
+ return 0;
+ }
+ else
+ return 1;
+}
+static void
+release_write_lock (void)
+{
+ if (!opt.lock_once)
+ if (!release_dotlock (lockhandle))
+ is_locked = 0;
+}
/*************************************
************* record cache **********
@@ -249,12 +275,7 @@ put_record_into_cache( ulong recno, const char *data )
int n = dirty_count / 5; /* discard some dirty entries */
if( !n )
n = 1;
- if( !is_locked ) {
- if( make_dotlock( lockhandle, -1 ) )
- log_fatal("can't acquire lock - giving up\n");
- else
- is_locked = 1;
- }
+ take_write_lock ();
for( unused = NULL, r = cache_list; r; r = r->next ) {
if( r->flags.used && r->flags.dirty ) {
int rc = write_cache_item( r );
@@ -268,10 +289,7 @@ put_record_into_cache( ulong recno, const char *data )
break;
}
}
- if( !opt.lock_once ) {
- if( !release_dotlock( lockhandle ) )
- is_locked = 0;
- }
+ release_write_lock ();
assert( unused );
r = unused;
r->flags.used = 1;
@@ -310,13 +328,9 @@ tdbio_sync()
if( !cache_is_dirty )
return 0;
- if( !is_locked ) {
- if( make_dotlock( lockhandle, -1 ) )
- log_fatal("can't acquire lock - giving up\n");
- else
- is_locked = 1;
- did_lock = 1;
- }
+ if (!take_write_lock ())
+ did_lock = 1;
+
for( r = cache_list; r; r = r->next ) {
if( r->flags.used && r->flags.dirty ) {
int rc = write_cache_item( r );
@@ -325,10 +339,8 @@ tdbio_sync()
}
}
cache_is_dirty = 0;
- if( did_lock && !opt.lock_once ) {
- if( !release_dotlock( lockhandle ) )
- is_locked = 0;
- }
+ if (did_lock)
+ release_write_lock ();
return 0;
}
@@ -365,20 +377,12 @@ tdbio_end_transaction()
if( !in_transaction )
log_bug("tdbio: no active transaction\n");
- if( !is_locked ) {
- if( make_dotlock( lockhandle, -1 ) )
- log_fatal("can't acquire lock - giving up\n");
- else
- is_locked = 1;
- }
+ take_write_lock ();
block_all_signals();
in_transaction = 0;
rc = tdbio_sync();
unblock_all_signals();
- if( !opt.lock_once ) {
- if( !release_dotlock( lockhandle ) )
- is_locked = 0;
- }
+ release_write_lock ();
return rc;
}
@@ -476,6 +480,7 @@ int
tdbio_set_dbname( const char *new_dbname, int create, int *r_nofile)
{
char *fname;
+ struct stat statbuf;
static int initialized = 0;
if( !initialized ) {
@@ -497,12 +502,25 @@ tdbio_set_dbname( const char *new_dbname, int create, int *r_nofile)
else
fname = xstrdup (new_dbname);
+ xfree (db_name);
+ db_name = fname;
+
+ /*
+ * Quick check for (likely) case where there is trustdb.gpg
+ * already. This check is not required in theory, but it helps in
+ * practice, avoiding costly operations of preparing and taking
+ * the lock.
+ */
+ if (stat (fname, &statbuf) == 0 && statbuf.st_size > 0)
+ /* OK, we have the valid trustdb.gpg already. */
+ return 0;
+
+ take_write_lock ();
+
if( access( fname, R_OK ) ) {
- if( errno != ENOENT ) {
- log_error( _("can't access `%s': %s\n"), fname, strerror(errno) );
- xfree(fname);
- return G10ERR_TRUSTDB;
- }
+ if( errno != ENOENT )
+ log_fatal( _("can't access `%s': %s\n"), fname, strerror(errno) );
+
if (!create)
*r_nofile = 1;
else {
@@ -532,16 +550,6 @@ tdbio_set_dbname( const char *new_dbname, int create, int *r_nofile)
}
*p = save_slash;
- xfree(db_name);
- db_name = fname;
-#ifdef __riscos__
- if( !lockhandle )
- lockhandle = create_dotlock( db_name );
- if( !lockhandle )
- log_fatal( _("can't create lock for `%s'\n"), db_name );
- if( make_dotlock( lockhandle, -1 ) )
- log_fatal( _("can't lock `%s'\n"), db_name );
-#endif /* __riscos__ */
oldmask=umask(077);
if (is_secured_filename (fname)) {
fp = NULL;
@@ -557,13 +565,6 @@ tdbio_set_dbname( const char *new_dbname, int create, int *r_nofile)
if( db_fd == -1 )
log_fatal( _("can't open `%s': %s\n"), db_name, strerror(errno) );
-#ifndef __riscos__
- if( !lockhandle )
- lockhandle = create_dotlock( db_name );
- if( !lockhandle )
- log_fatal( _("can't create lock for `%s'\n"), db_name );
-#endif /* !__riscos__ */
-
rc = create_version_record ();
if( rc )
log_fatal( _("%s: failed to create version record: %s"),
@@ -574,12 +575,10 @@ tdbio_set_dbname( const char *new_dbname, int create, int *r_nofile)
if( !opt.quiet )
log_info(_("%s: trustdb created\n"), db_name);
-
- return 0;
}
}
- xfree(db_name);
- db_name = fname;
+
+ release_write_lock ();
return 0;
}
@@ -599,14 +598,6 @@ open_db()
assert( db_fd == -1 );
- if (!lockhandle )
- lockhandle = create_dotlock( db_name );
- if (!lockhandle )
- log_fatal( _("can't create lock for `%s'\n"), db_name );
-#ifdef __riscos__
- if (make_dotlock( lockhandle, -1 ) )
- log_fatal( _("can't lock `%s'\n"), db_name );
-#endif /* __riscos__ */
db_fd = open (db_name, O_RDWR | MY_O_BINARY );
if (db_fd == -1 && (errno == EACCES
#ifdef EROFS
commit c30bcdeac0112680a61819c52ab90beb69fdc6c0
Author: NIIBE Yutaka <gniibe at fsij.org>
Date: Mon Jun 15 13:58:07 2015 +0900
po:Update Japanese translation.
diff --git a/po/ja.po b/po/ja.po
index ad88b43..5ad7bc4 100644
--- a/po/ja.po
+++ b/po/ja.po
@@ -7,7 +7,7 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: GNU gnupg 2.0.27\n"
+"Project-Id-Version: GNU gnupg 2.0.28\n"
"Report-Msgid-Bugs-To: translations at gnupg.org\n"
"PO-Revision-Date: 2015-06-02 13:05+0200\n"
"Last-Translator: NIIBE Yutaka <gniibe at fsij.org>\n"
@@ -33,41 +33,31 @@ msgstr "|pinentry-label|_OK"
msgid "|pinentry-label|_Cancel"
msgstr "|pinentry-label|_キャンセル"
-#, fuzzy
-#| msgid "|pinentry-label|_OK"
msgid "|pinentry-label|_Yes"
-msgstr "|pinentry-label|_OK"
+msgstr "|pinentry-label|_Yes"
-#, fuzzy
-#| msgid "|pinentry-label|_OK"
msgid "|pinentry-label|_No"
-msgstr "|pinentry-label|_OK"
+msgstr "|pinentry-label|_No"
msgid "|pinentry-label|PIN:"
msgstr "|pinentry-label|PIN:"
-#, fuzzy
-#| msgid "|pinentry-label|_Cancel"
msgid "|pinentry-label|_Save in password manager"
-msgstr "|pinentry-label|_キャンセル"
+msgstr "|pinentry-label|_パスワードマネージャに保存する"
-#, fuzzy
-#| msgid "Do you really want to revoke the selected subkeys? (y/N) "
msgid "Do you really want to make your passphrase visible on the screen?"
-msgstr "選択した副鍵を本当に失効しますか? (y/N) "
+msgstr "本当に画面にパスフレーズを見えるようにしますか?"
msgid "|pinentry-tt|Make passphrase visible"
-msgstr ""
+msgstr "|pinentry-tt|パスフレーズを見えるようにする"
-#, fuzzy
-#| msgid "Enter new passphrase"
msgid "|pinentry-tt|Hide passphrase"
-msgstr "新しいパスフレーズを入力してください"
+msgstr "|pinentry-tt|パスフレーズを隠す"
#. TRANSLATORS: This string is displayed by Pinentry as the label
#. for the quality bar.
msgid "Quality:"
-msgstr "品質: %s"
+msgstr "品質:"
#. TRANSLATORS: This string is a tooltip, shown by pinentry when
#. hovering over the quality bar. Please use an appropriate
@@ -376,10 +366,8 @@ msgstr "sshサポートを有効にする"
msgid "enable putty support"
msgstr "puttyサポートを有効にする"
-#, fuzzy
-#| msgid "do not allow the reuse of old passphrases"
msgid "disallow the use of an external password cache"
-msgstr "古いパスフレーズを再使用することを認めない"
+msgstr "外部のパスワードキャッシュの使用を認めない"
msgid "|FILE|write environment settings also to FILE"
msgstr "|FILE|FILEに環境変数の設定も書き出す"
@@ -5178,12 +5166,10 @@ msgid "keyword too long"
msgstr "キーワードが長すぎます"
msgid "missing argument"
-msgstr "引数ありません"
+msgstr "引数がありません"
-#, fuzzy
-#| msgid "invalid value\n"
msgid "invalid argument"
-msgstr "無効な値\n"
+msgstr "無効な引数\n"
msgid "invalid command"
msgstr "無効なコマンド"
@@ -5201,10 +5187,9 @@ msgstr "無効なオプション"
msgid "missing argument for option \"%.50s\"\n"
msgstr "オプション\"%.50s\"に引数がありません\n"
-#, fuzzy, c-format
-#| msgid "missing argument for option \"%.50s\"\n"
+#, c-format
msgid "invalid argument for option \"%.50s\"\n"
-msgstr "オプション\"%.50s\"に引数がありません\n"
+msgstr "オプション\"%.50s\"に無効な引数です\n"
#, c-format
msgid "option \"%.50s\" does not expect an argument\n"
-----------------------------------------------------------------------
Summary of changes:
g10/tdbio.c | 121 ++++++++++++++++++++++++++++--------------------------------
po/ja.po | 41 +++++++-------------
2 files changed, 69 insertions(+), 93 deletions(-)
hooks/post-receive
--
The GNU Privacy Guard
http://git.gnupg.org
More information about the Gnupg-commits
mailing list