Use gpgme_op_import_ext() instead of gpgme_op_import()
This commit is contained in:
parent
49216a0360
commit
a579b5fa35
@ -1,6 +1,13 @@
|
|||||||
|
2002-08-20 Steffen Hansen <steffen@hrhansen.dk>
|
||||||
|
|
||||||
|
* Use gpgme_op_import_ext() instead of gpgme_op_import(). We
|
||||||
|
should now be able to better check for the case when we have no
|
||||||
|
error, but still no certificate was imported.
|
||||||
|
|
||||||
2002-07-31 Steffen Hansen <steffen@hrhansen.dk>
|
2002-07-31 Steffen Hansen <steffen@hrhansen.dk>
|
||||||
|
|
||||||
* Renamed importCertificate() to importCertificateWithFPR() and implemented importCertificateFromMem()
|
* Renamed importCertificate() to importCertificateWithFPR() and
|
||||||
|
implemented importCertificateFromMem().
|
||||||
|
|
||||||
2002-07-03 Werner Koch <wk@gnupg.org>
|
2002-07-03 Werner Koch <wk@gnupg.org>
|
||||||
|
|
||||||
|
@ -2243,6 +2243,7 @@ importCertificateWithFPR( const char* fingerprint, char** additional_info )
|
|||||||
char* buf;
|
char* buf;
|
||||||
const char* tmp1;
|
const char* tmp1;
|
||||||
char* tmp2;
|
char* tmp2;
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
err = gpgme_new( &ctx );
|
err = gpgme_new( &ctx );
|
||||||
/*fprintf( stderr, "2: gpgme returned %d\n", err );*/
|
/*fprintf( stderr, "2: gpgme returned %d\n", err );*/
|
||||||
@ -2305,15 +2306,23 @@ importCertificateWithFPR( const char* fingerprint, char** additional_info )
|
|||||||
free (buf);
|
free (buf);
|
||||||
buf = NULL;
|
buf = NULL;
|
||||||
|
|
||||||
err = gpgme_op_import( ctx, keydata );
|
err = gpgme_op_import_ext( ctx, keydata, &count );
|
||||||
*additional_info = gpgme_get_op_info( ctx, 0 );
|
*additional_info = gpgme_get_op_info( ctx, 0 );
|
||||||
if( err ) {
|
if( err ) {
|
||||||
fprintf( stderr, "gpgme_op_import returned %d\n", err );
|
fprintf( stderr, "gpgme_op_import_ext returned %d\n", err );
|
||||||
gpgme_recipients_release( recips );
|
gpgme_recipients_release( recips );
|
||||||
gpgme_data_release( keydata );
|
gpgme_data_release( keydata );
|
||||||
gpgme_release( ctx );
|
gpgme_release( ctx );
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
if( count < 1 ) {
|
||||||
|
/* we didn't import anything?!? */
|
||||||
|
fprintf( stderr, "gpgme_op_import_ext did not import any certificates\n" );
|
||||||
|
gpgme_recipients_release( recips );
|
||||||
|
gpgme_data_release( keydata );
|
||||||
|
gpgme_release( ctx );
|
||||||
|
return -1; /* FIXME */
|
||||||
|
}
|
||||||
|
|
||||||
gpgme_recipients_release( recips );
|
gpgme_recipients_release( recips );
|
||||||
gpgme_data_release( keydata );
|
gpgme_data_release( keydata );
|
||||||
@ -2326,6 +2335,7 @@ importCertificateFromMem( const char* data, size_t length , char** additional_in
|
|||||||
GpgmeError err;
|
GpgmeError err;
|
||||||
GpgmeCtx ctx;
|
GpgmeCtx ctx;
|
||||||
GpgmeData keydata;
|
GpgmeData keydata;
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
err = gpgme_new( &ctx );
|
err = gpgme_new( &ctx );
|
||||||
/*fprintf( stderr, "2: gpgme returned %d\n", err );*/
|
/*fprintf( stderr, "2: gpgme returned %d\n", err );*/
|
||||||
@ -2342,14 +2352,21 @@ importCertificateFromMem( const char* data, size_t length , char** additional_in
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = gpgme_op_import( ctx, keydata );
|
err = gpgme_op_import_ext( ctx, keydata, &count );
|
||||||
*additional_info = gpgme_get_op_info( ctx, 0 );
|
*additional_info = gpgme_get_op_info( ctx, 0 );
|
||||||
if( err) {
|
if( err) {
|
||||||
fprintf( stderr, "gpgme_op_import returned %d\n", err );
|
fprintf( stderr, "gpgme_op_import_ext returned %d\n", err );
|
||||||
gpgme_data_release( keydata );
|
gpgme_data_release( keydata );
|
||||||
gpgme_release( ctx );
|
gpgme_release( ctx );
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
if( count < 1 ) {
|
||||||
|
/* we didn't import anything?!? */
|
||||||
|
fprintf( stderr, "gpgme_op_import_ext did not import any certificate\n", err );
|
||||||
|
gpgme_data_release( keydata );
|
||||||
|
gpgme_release( ctx );
|
||||||
|
return -1; /* FIXME */
|
||||||
|
}
|
||||||
|
|
||||||
gpgme_data_release( keydata );
|
gpgme_data_release( keydata );
|
||||||
gpgme_release( ctx );
|
gpgme_release( ctx );
|
||||||
|
Loading…
Reference in New Issue
Block a user