mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-03 12:11:33 +01:00
vor muenchen
This commit is contained in:
parent
700c438def
commit
a350041cd5
2
TODO
2
TODO
@ -44,3 +44,5 @@
|
|||||||
|
|
||||||
* replace getkey.c#enum_secret_keys
|
* replace getkey.c#enum_secret_keys
|
||||||
|
|
||||||
|
* add readline support.
|
||||||
|
|
||||||
|
@ -243,7 +243,7 @@ Keyserver Message Format
|
|||||||
|
|
||||||
The keyserver may be contacted by a Unix Domain socket or via TCP.
|
The keyserver may be contacted by a Unix Domain socket or via TCP.
|
||||||
|
|
||||||
The Format of a request is:
|
The format of a request is:
|
||||||
|
|
||||||
----
|
----
|
||||||
command-tag
|
command-tag
|
||||||
@ -253,6 +253,7 @@ CRLF
|
|||||||
|
|
||||||
Where command-tag is
|
Where command-tag is
|
||||||
|
|
||||||
|
NOOP
|
||||||
GET <user-name>
|
GET <user-name>
|
||||||
PUT
|
PUT
|
||||||
DELETE <user-name>
|
DELETE <user-name>
|
||||||
|
@ -65,6 +65,8 @@ gpgm_SOURCES = dearmor.c \
|
|||||||
$(common_source)
|
$(common_source)
|
||||||
|
|
||||||
gpgd_SOURCES = gpgd.c \
|
gpgd_SOURCES = gpgd.c \
|
||||||
|
ks-proto.h \
|
||||||
|
ks-proto.c \
|
||||||
$(common_source)
|
$(common_source)
|
||||||
|
|
||||||
|
|
||||||
|
39
g10/ks-proto.c
Normal file
39
g10/ks-proto.c
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
/* ks-proto.c keyserver protocol handling
|
||||||
|
* Copyright (C) 1998 Free Software Foundation, Inc.
|
||||||
|
*
|
||||||
|
* This file is part of GNUPG.
|
||||||
|
*
|
||||||
|
* GNUPG is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNUPG is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include "util.h"
|
||||||
|
#include "ks-proto.h"
|
||||||
|
|
||||||
|
/****************
|
||||||
|
* Read a protocol line
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
read_line( FILE *fp )
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
23
g10/ks-proto.h
Normal file
23
g10/ks-proto.h
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
/* ks-proto.h
|
||||||
|
* Copyright (C) 1998 Free Software Foundation, Inc.
|
||||||
|
*
|
||||||
|
* This file is part of GNUPG.
|
||||||
|
*
|
||||||
|
* GNUPG is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GNUPG is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
|
*/
|
||||||
|
#ifndef G10_KS_PROTO_H
|
||||||
|
#define G10_KS_PROTO_H
|
||||||
|
|
||||||
|
#endif /*G10_KS_PROTO_H*/
|
@ -327,7 +327,7 @@ create_db( const char *fname )
|
|||||||
|
|
||||||
fp =fopen( fname, "w" );
|
fp =fopen( fname, "w" );
|
||||||
if( !fp )
|
if( !fp )
|
||||||
log_fatal("can't create %s: %s\n", fname, strerror(errno) );
|
log_fatal(_("can't create %s: %s\n"), fname, strerror(errno) );
|
||||||
fwrite_8( fp, 1 );
|
fwrite_8( fp, 1 );
|
||||||
fwrite_8( fp, 'g' );
|
fwrite_8( fp, 'g' );
|
||||||
fwrite_8( fp, 'p' );
|
fwrite_8( fp, 'p' );
|
||||||
@ -354,9 +354,9 @@ open_db()
|
|||||||
|
|
||||||
db_fd = open( db_name, O_RDWR );
|
db_fd = open( db_name, O_RDWR );
|
||||||
if( db_fd == -1 )
|
if( db_fd == -1 )
|
||||||
log_fatal("can't open %s: %s\n", db_name, strerror(errno) );
|
log_fatal(_("can't open %s: %s\n"), db_name, strerror(errno) );
|
||||||
if( read_record( 0, &rec, RECTYPE_VER ) )
|
if( read_record( 0, &rec, RECTYPE_VER ) )
|
||||||
log_fatal("TrustDB %s is invalid\n", db_name );
|
log_fatal(_("TrustDB %s is invalid\n"), db_name );
|
||||||
/* fixme: check ->locked and other stuff */
|
/* fixme: check ->locked and other stuff */
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -429,7 +429,7 @@ read_record( ulong recnum, TRUSTREC *rec, int expected )
|
|||||||
if( db_fd == -1 )
|
if( db_fd == -1 )
|
||||||
open_db();
|
open_db();
|
||||||
if( lseek( db_fd, recnum * TRUST_RECORD_LEN, SEEK_SET ) == -1 ) {
|
if( lseek( db_fd, recnum * TRUST_RECORD_LEN, SEEK_SET ) == -1 ) {
|
||||||
log_error("trustdb: lseek failed: %s\n", strerror(errno) );
|
log_error(_("trustdb: lseek failed: %s\n"), strerror(errno) );
|
||||||
return G10ERR_READ_FILE;
|
return G10ERR_READ_FILE;
|
||||||
}
|
}
|
||||||
n = read( db_fd, buf, TRUST_RECORD_LEN);
|
n = read( db_fd, buf, TRUST_RECORD_LEN);
|
||||||
@ -437,7 +437,7 @@ read_record( ulong recnum, TRUSTREC *rec, int expected )
|
|||||||
return -1; /* eof */
|
return -1; /* eof */
|
||||||
}
|
}
|
||||||
else if( n != TRUST_RECORD_LEN ) {
|
else if( n != TRUST_RECORD_LEN ) {
|
||||||
log_error("trustdb: read failed (n=%d): %s\n", n, strerror(errno) );
|
log_error(_("trustdb: read failed (n=%d): %s\n"), n, strerror(errno) );
|
||||||
return G10ERR_READ_FILE;
|
return G10ERR_READ_FILE;
|
||||||
}
|
}
|
||||||
p = buf;
|
p = buf;
|
||||||
@ -454,7 +454,7 @@ read_record( ulong recnum, TRUSTREC *rec, int expected )
|
|||||||
case RECTYPE_VER: /* version record */
|
case RECTYPE_VER: /* version record */
|
||||||
/* g10 was the original name */
|
/* g10 was the original name */
|
||||||
if( memcmp(buf+1, "gpg", 3 ) && memcmp(buf+1, "g10", 3 ) ) {
|
if( memcmp(buf+1, "gpg", 3 ) && memcmp(buf+1, "g10", 3 ) ) {
|
||||||
log_error("%s: not a trustdb file\n", db_name );
|
log_error(_("%s: not a trustdb file\n"), db_name );
|
||||||
rc = G10ERR_TRUSTDB;
|
rc = G10ERR_TRUSTDB;
|
||||||
}
|
}
|
||||||
p += 2; /* skip magic */
|
p += 2; /* skip magic */
|
||||||
@ -586,12 +586,12 @@ write_record( ulong recnum, TRUSTREC *rec )
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( lseek( db_fd, recnum * TRUST_RECORD_LEN, SEEK_SET ) == -1 ) {
|
if( lseek( db_fd, recnum * TRUST_RECORD_LEN, SEEK_SET ) == -1 ) {
|
||||||
log_error("trustdb: lseek failed: %s\n", strerror(errno) );
|
log_error(_("trustdb: lseek failed: %s\n"), strerror(errno) );
|
||||||
return G10ERR_WRITE_FILE;
|
return G10ERR_WRITE_FILE;
|
||||||
}
|
}
|
||||||
n = write( db_fd, buf, TRUST_RECORD_LEN);
|
n = write( db_fd, buf, TRUST_RECORD_LEN);
|
||||||
if( n != TRUST_RECORD_LEN ) {
|
if( n != TRUST_RECORD_LEN ) {
|
||||||
log_error("trustdb: write failed (n=%d): %s\n", n, strerror(errno) );
|
log_error(_("trustdb: write failed (n=%d): %s\n"), n, strerror(errno) );
|
||||||
return G10ERR_WRITE_FILE;
|
return G10ERR_WRITE_FILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -623,7 +623,7 @@ new_recnum()
|
|||||||
rec.rectype = 0; /* free record */
|
rec.rectype = 0; /* free record */
|
||||||
rc = write_record(recnum, &rec );
|
rc = write_record(recnum, &rec );
|
||||||
if( rc )
|
if( rc )
|
||||||
log_fatal("%s: failed to append a record: %s\n",
|
log_fatal(_("%s: failed to append a record: %s\n"),
|
||||||
db_name, g10_errstr(rc));
|
db_name, g10_errstr(rc));
|
||||||
return recnum ;
|
return recnum ;
|
||||||
}
|
}
|
||||||
@ -670,7 +670,7 @@ search_record( PKT_public_cert *pkc, TRUSTREC *rec )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( rc != -1 )
|
if( rc != -1 )
|
||||||
log_error("%s: search_db failed: %s\n",db_name, g10_errstr(rc) );
|
log_error(_("%s: search_db failed: %s\n"),db_name, g10_errstr(rc) );
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -714,12 +714,12 @@ keyid_from_local_id( ulong lid, u32 *keyid )
|
|||||||
|
|
||||||
rc = read_record( lid, &rec, RECTYPE_DIR );
|
rc = read_record( lid, &rec, RECTYPE_DIR );
|
||||||
if( rc ) {
|
if( rc ) {
|
||||||
log_error("error reading record with local_id %lu: %s\n",
|
log_error(_("error reading record with local_id %lu: %s\n"),
|
||||||
lid, g10_errstr(rc));
|
lid, g10_errstr(rc));
|
||||||
return G10ERR_TRUSTDB;
|
return G10ERR_TRUSTDB;
|
||||||
}
|
}
|
||||||
if( rec.rectype != RECTYPE_DIR ) {
|
if( rec.rectype != RECTYPE_DIR ) {
|
||||||
log_error("record with local_id %lu is not a dir record\n", lid);
|
log_error(_("record with local_id %lu is not a dir record\n"), lid);
|
||||||
return G10ERR_TRUSTDB;
|
return G10ERR_TRUSTDB;
|
||||||
}
|
}
|
||||||
keyid[0] = rec.r.dir.keyid[0];
|
keyid[0] = rec.r.dir.keyid[0];
|
||||||
@ -752,7 +752,7 @@ walk_sigrecs( SIGREC_CONTEXT *c, int create )
|
|||||||
if( !c->sigrec ) {
|
if( !c->sigrec ) {
|
||||||
rc = read_record( c->local_id, r, RECTYPE_DIR );
|
rc = read_record( c->local_id, r, RECTYPE_DIR );
|
||||||
if( rc ) {
|
if( rc ) {
|
||||||
log_error("%lu: error reading dir record: %s\n",
|
log_error(_("%lu: error reading dir record: %s\n"),
|
||||||
c->local_id, g10_errstr(rc));
|
c->local_id, g10_errstr(rc));
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
@ -763,14 +763,14 @@ walk_sigrecs( SIGREC_CONTEXT *c, int create )
|
|||||||
if( rc == G10ERR_BAD_CERT )
|
if( rc == G10ERR_BAD_CERT )
|
||||||
rc = -1; /* maybe no selcficnature */
|
rc = -1; /* maybe no selcficnature */
|
||||||
if( rc != -1 )
|
if( rc != -1 )
|
||||||
log_info("%lu: error building sigs on the fly: %s\n",
|
log_info(_("%lu: error building sigs on the fly: %s\n"),
|
||||||
c->local_id, g10_errstr(rc) );
|
c->local_id, g10_errstr(rc) );
|
||||||
c->ctl.eof = 1;
|
c->ctl.eof = 1;
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
rc = read_record( c->local_id, r, RECTYPE_DIR );
|
rc = read_record( c->local_id, r, RECTYPE_DIR );
|
||||||
if( rc ) {
|
if( rc ) {
|
||||||
log_error("%lu: error re-reading dir record: %s\n",
|
log_error(_("%lu: error re-reading dir record: %s\n"),
|
||||||
c->local_id, g10_errstr(rc));
|
c->local_id, g10_errstr(rc));
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
@ -797,12 +797,12 @@ walk_sigrecs( SIGREC_CONTEXT *c, int create )
|
|||||||
}
|
}
|
||||||
rc = read_record( rnum, r, RECTYPE_SIG );
|
rc = read_record( rnum, r, RECTYPE_SIG );
|
||||||
if( rc ) {
|
if( rc ) {
|
||||||
log_error("error reading sigrec: %s\n", g10_errstr(rc));
|
log_error(_("error reading sigrec: %s\n"), g10_errstr(rc));
|
||||||
c->ctl.eof = 1;
|
c->ctl.eof = 1;
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
if( r->r.sig.owner != c->local_id ) {
|
if( r->r.sig.owner != c->local_id ) {
|
||||||
log_error("chained sigrec %lu has a wrong owner\n", rnum );
|
log_error(_("chained sigrec %lu has a wrong owner\n"), rnum );
|
||||||
c->ctl.eof = 1;
|
c->ctl.eof = 1;
|
||||||
return G10ERR_TRUSTDB;
|
return G10ERR_TRUSTDB;
|
||||||
}
|
}
|
||||||
@ -852,12 +852,12 @@ verify_own_certs()
|
|||||||
memset( pkc, 0, sizeof *pkc );
|
memset( pkc, 0, sizeof *pkc );
|
||||||
rc = get_pubkey( pkc, keyid );
|
rc = get_pubkey( pkc, keyid );
|
||||||
if( rc ) {
|
if( rc ) {
|
||||||
log_error("keyid %08lX: secret key without public key\n",
|
log_error(_("keyid %08lX: secret key without public key\n"),
|
||||||
(ulong)keyid[1] );
|
(ulong)keyid[1] );
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
if( cmp_public_secret_cert( pkc, skc ) ) {
|
if( cmp_public_secret_cert( pkc, skc ) ) {
|
||||||
log_error("keyid %08lX: secret and public key don't match\n",
|
log_error(_("keyid %08lX: secret and public key don't match\n"),
|
||||||
(ulong)keyid[1] );
|
(ulong)keyid[1] );
|
||||||
rc = G10ERR_GENERAL;
|
rc = G10ERR_GENERAL;
|
||||||
goto leave;
|
goto leave;
|
||||||
@ -868,13 +868,13 @@ verify_own_certs()
|
|||||||
if( rc == -1 ) { /* put it into the trustdb */
|
if( rc == -1 ) { /* put it into the trustdb */
|
||||||
rc = insert_trust_record( pkc );
|
rc = insert_trust_record( pkc );
|
||||||
if( rc ) {
|
if( rc ) {
|
||||||
log_error("keyid %08lX: can't put it into the trustdb\n",
|
log_error(_("keyid %08lX: can't put it into the trustdb\n"),
|
||||||
(ulong)keyid[1] );
|
(ulong)keyid[1] );
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( rc ) {
|
else if( rc ) {
|
||||||
log_error("keyid %08lX: query record failed\n", (ulong)keyid[1] );
|
log_error(_("keyid %08lX: query record failed\n"), (ulong)keyid[1] );
|
||||||
goto leave;
|
goto leave;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -883,7 +883,7 @@ verify_own_certs()
|
|||||||
log_debug("putting %08lX(%lu) into ultikey_table\n",
|
log_debug("putting %08lX(%lu) into ultikey_table\n",
|
||||||
(ulong)keyid[1], pkc->local_id );
|
(ulong)keyid[1], pkc->local_id );
|
||||||
if( ins_lid_table_item( ultikey_table, pkc->local_id, 0 ) )
|
if( ins_lid_table_item( ultikey_table, pkc->local_id, 0 ) )
|
||||||
log_error("keyid %08lX: already in ultikey_table\n",
|
log_error(_("keyid %08lX: already in ultikey_table\n"),
|
||||||
(ulong)keyid[1]);
|
(ulong)keyid[1]);
|
||||||
|
|
||||||
|
|
||||||
@ -891,7 +891,7 @@ verify_own_certs()
|
|||||||
release_public_cert_parts( pkc );
|
release_public_cert_parts( pkc );
|
||||||
}
|
}
|
||||||
if( rc != -1 )
|
if( rc != -1 )
|
||||||
log_error("enum_secret_keys failed: %s\n", g10_errstr(rc) );
|
log_error(_("enum_secret_keys failed: %s\n"), g10_errstr(rc) );
|
||||||
else
|
else
|
||||||
rc = 0;
|
rc = 0;
|
||||||
|
|
||||||
@ -1159,32 +1159,32 @@ build_sigrecs( ulong pubkeyid )
|
|||||||
|
|
||||||
/* get the keyblock */
|
/* get the keyblock */
|
||||||
if( (rc=read_record( pubkeyid, &rec, RECTYPE_DIR )) ) {
|
if( (rc=read_record( pubkeyid, &rec, RECTYPE_DIR )) ) {
|
||||||
log_error("%lu: build_sigrecs: can't read dir record\n", pubkeyid );
|
log_error(_("%lu: build_sigrecs: can't read dir record\n"), pubkeyid );
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
if( (rc=read_record( rec.r.dir.keyrec, &krec, RECTYPE_KEY )) ) {
|
if( (rc=read_record( rec.r.dir.keyrec, &krec, RECTYPE_KEY )) ) {
|
||||||
log_error("%lu: build_sigrecs: can't read key record\n", pubkeyid);
|
log_error(_("%lu: build_sigrecs: can't read key record\n"), pubkeyid);
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
rc = get_keyblock_byfprint( &keyblock, krec.r.key.fingerprint );
|
rc = get_keyblock_byfprint( &keyblock, krec.r.key.fingerprint );
|
||||||
if( rc ) {
|
if( rc ) {
|
||||||
log_error("build_sigrecs: get_keyblock_byfprint failed\n" );
|
log_error(_("build_sigrecs: get_keyblock_byfprint failed\n") );
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
/* check all key signatures */
|
/* check all key signatures */
|
||||||
rc = check_sigs( keyblock, &selfsig, &revoked );
|
rc = check_sigs( keyblock, &selfsig, &revoked );
|
||||||
if( rc ) {
|
if( rc ) {
|
||||||
log_error("build_sigrecs: check_sigs failed\n" );
|
log_error(_("build_sigrecs: check_sigs failed\n") );
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
if( !selfsig ) {
|
if( !selfsig ) {
|
||||||
log_error("build_sigrecs: self-certificate missing\n" );
|
log_error(_("build_sigrecs: self-certificate missing\n") );
|
||||||
update_no_sigs( pubkeyid, 2 );
|
update_no_sigs( pubkeyid, 2 );
|
||||||
rc = G10ERR_BAD_CERT;
|
rc = G10ERR_BAD_CERT;
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
if( revoked ) {
|
if( revoked ) {
|
||||||
log_info("build_sigrecs: key has been revoked\n" );
|
log_info(_("build_sigrecs: key has been revoked\n") );
|
||||||
update_no_sigs( pubkeyid, 3 );
|
update_no_sigs( pubkeyid, 3 );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1209,7 +1209,7 @@ build_sigrecs( ulong pubkeyid )
|
|||||||
* not disturb us, because we have to chance them anyway. */
|
* not disturb us, because we have to chance them anyway. */
|
||||||
rc = set_signature_packets_local_id( node->pkt->pkt.signature );
|
rc = set_signature_packets_local_id( node->pkt->pkt.signature );
|
||||||
if( rc )
|
if( rc )
|
||||||
log_fatal("set_signature_packets_local_id failed: %s\n",
|
log_fatal(_("set_signature_packets_local_id failed: %s\n"),
|
||||||
g10_errstr(rc));
|
g10_errstr(rc));
|
||||||
}
|
}
|
||||||
if( i == SIGS_PER_RECORD ) {
|
if( i == SIGS_PER_RECORD ) {
|
||||||
@ -1220,7 +1220,7 @@ build_sigrecs( ulong pubkeyid )
|
|||||||
rec2.r.sig.chain = rnum; /* the next record number */
|
rec2.r.sig.chain = rnum; /* the next record number */
|
||||||
rc = write_record( rnum2, &rec2 );
|
rc = write_record( rnum2, &rec2 );
|
||||||
if( rc ) {
|
if( rc ) {
|
||||||
log_error("build_sigrecs: write_record failed\n" );
|
log_error(_("build_sigrecs: write_record failed\n") );
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
if( !first_sigrec )
|
if( !first_sigrec )
|
||||||
@ -1245,7 +1245,7 @@ build_sigrecs( ulong pubkeyid )
|
|||||||
rec2.r.sig.chain = rnum;
|
rec2.r.sig.chain = rnum;
|
||||||
rc = write_record( rnum2, &rec2 );
|
rc = write_record( rnum2, &rec2 );
|
||||||
if( rc ) {
|
if( rc ) {
|
||||||
log_error("build_sigrecs: write_record failed\n" );
|
log_error(_("build_sigrecs: write_record failed\n") );
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
if( !first_sigrec )
|
if( !first_sigrec )
|
||||||
@ -1256,7 +1256,7 @@ build_sigrecs( ulong pubkeyid )
|
|||||||
rec.r.sig.chain = 0;
|
rec.r.sig.chain = 0;
|
||||||
rc = write_record( rnum, &rec );
|
rc = write_record( rnum, &rec );
|
||||||
if( rc ) {
|
if( rc ) {
|
||||||
log_error("build_sigrecs: write_record failed\n" );
|
log_error(_("build_sigrecs: write_record failed\n") );
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
if( !first_sigrec )
|
if( !first_sigrec )
|
||||||
@ -1266,12 +1266,12 @@ build_sigrecs( ulong pubkeyid )
|
|||||||
if( first_sigrec ) {
|
if( first_sigrec ) {
|
||||||
/* update the dir record */
|
/* update the dir record */
|
||||||
if( (rc =read_record( pubkeyid, &rec, RECTYPE_DIR )) ) {
|
if( (rc =read_record( pubkeyid, &rec, RECTYPE_DIR )) ) {
|
||||||
log_error("update_dir_record: read failed\n");
|
log_error(_("update_dir_record: read failed\n"));
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
rec.r.dir.sigrec = first_sigrec;
|
rec.r.dir.sigrec = first_sigrec;
|
||||||
if( (rc=write_record( pubkeyid, &rec )) ) {
|
if( (rc=write_record( pubkeyid, &rec )) ) {
|
||||||
log_error("update_dir_record: write failed\n");
|
log_error(_("update_dir_record: write failed\n"));
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1281,7 +1281,7 @@ build_sigrecs( ulong pubkeyid )
|
|||||||
leave:
|
leave:
|
||||||
release_kbnode( keyblock );
|
release_kbnode( keyblock );
|
||||||
if( DBG_TRUST )
|
if( DBG_TRUST )
|
||||||
log_debug("trustdb: build_sigrecs: %s\n", g10_errstr(rc) );
|
log_debug(_("trustdb: build_sigrecs: %s\n"), g10_errstr(rc) );
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1500,7 +1500,7 @@ init_trustdb( int level, const char *dbname )
|
|||||||
: make_filename(opt.homedir, "trustdb.gpg", NULL );
|
: make_filename(opt.homedir, "trustdb.gpg", NULL );
|
||||||
if( access( fname, R_OK ) ) {
|
if( access( fname, R_OK ) ) {
|
||||||
if( errno != ENOENT ) {
|
if( errno != ENOENT ) {
|
||||||
log_error("can't access %s: %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;
|
||||||
}
|
}
|
||||||
@ -1516,11 +1516,11 @@ init_trustdb( int level, const char *dbname )
|
|||||||
#else
|
#else
|
||||||
if( mkdir( fname, S_IRUSR|S_IWUSR|S_IXUSR ) )
|
if( mkdir( fname, S_IRUSR|S_IWUSR|S_IXUSR ) )
|
||||||
#endif
|
#endif
|
||||||
log_fatal("can't create directory '%s': %s\n",
|
log_fatal(_("can't create directory '%s': %s\n"),
|
||||||
fname, strerror(errno) );
|
fname, strerror(errno) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
log_fatal("directory '%s' does not exist!\n", fname );
|
log_fatal(_("directory '%s' does not exist!\n"), fname );
|
||||||
}
|
}
|
||||||
*p = '/';
|
*p = '/';
|
||||||
create_db( fname );
|
create_db( fname );
|
||||||
@ -1705,30 +1705,30 @@ check_trust( PKT_public_cert *pkc, unsigned *r_trustlevel )
|
|||||||
/* get the pubkey record */
|
/* get the pubkey record */
|
||||||
if( pkc->local_id ) {
|
if( pkc->local_id ) {
|
||||||
if( read_record( pkc->local_id, &rec, RECTYPE_DIR ) ) {
|
if( read_record( pkc->local_id, &rec, RECTYPE_DIR ) ) {
|
||||||
log_error("check_trust: read record failed\n");
|
log_error(_("check_trust: read record failed\n"));
|
||||||
return G10ERR_TRUSTDB;
|
return G10ERR_TRUSTDB;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else { /* no local_id: scan the trustdb */
|
else { /* no local_id: scan the trustdb */
|
||||||
if( (rc=search_record( pkc, &rec )) && rc != -1 ) {
|
if( (rc=search_record( pkc, &rec )) && rc != -1 ) {
|
||||||
log_error("check_trust: search_record failed: %s\n",
|
log_error(_("check_trust: search_record failed: %s\n"),
|
||||||
g10_errstr(rc));
|
g10_errstr(rc));
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
else if( rc == -1 ) {
|
else if( rc == -1 ) {
|
||||||
rc = insert_trust_record( pkc );
|
rc = insert_trust_record( pkc );
|
||||||
if( rc ) {
|
if( rc ) {
|
||||||
log_error("failed to insert pubkey into trustdb: %s\n",
|
log_error(_("failed to insert pubkey into trustdb: %s\n"),
|
||||||
g10_errstr(rc));
|
g10_errstr(rc));
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
log_info("pubkey not in trustdb - inserted as %lu\n",
|
log_info(_("pubkey not in trustdb - inserted as %lu\n"),
|
||||||
pkc->local_id );
|
pkc->local_id );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cur_time = make_timestamp();
|
cur_time = make_timestamp();
|
||||||
if( pkc->timestamp > cur_time ) {
|
if( pkc->timestamp > cur_time ) {
|
||||||
log_info("public key created in future (time warp or clock problem)\n");
|
log_info(_("public key created in future (time warp or clock problem)\n"));
|
||||||
return G10ERR_TIME_CONFLICT;
|
return G10ERR_TIME_CONFLICT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1742,7 +1742,7 @@ check_trust( PKT_public_cert *pkc, unsigned *r_trustlevel )
|
|||||||
else {
|
else {
|
||||||
rc = do_check( pkc->local_id, &rec, &trustlevel );
|
rc = do_check( pkc->local_id, &rec, &trustlevel );
|
||||||
if( rc ) {
|
if( rc ) {
|
||||||
log_error("check_trust: do_check failed: %s\n", g10_errstr(rc));
|
log_error(_("check_trust: do_check failed: %s\n"), g10_errstr(rc));
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user