/[winpt]/trunk/Src/wptGPG.cpp
ViewVC logotype

Diff of /trunk/Src/wptGPG.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 22 by twoaday, Wed Aug 10 11:33:35 2005 UTC revision 23 by twoaday, Fri Sep 30 10:10:16 2005 UTC
# Line 161  get_gnupg_keyring (int pub, int strict) Line 161  get_gnupg_keyring (int pub, int strict)
161   * appended string 'gpg.exe' is used.   * appended string 'gpg.exe' is used.
162   */   */
163  char*  char*
164  get_gnupg_prog( void )  get_gnupg_prog (void)
165  {      {    
166      char *p, *path, *pgm = NULL;      char *p, *path, *pgm = NULL;
167      size_t nlen = 0;      size_t nlen = 0;
# Line 193  default_key_from_cache (int * ret_no_use Line 193  default_key_from_cache (int * ret_no_use
193      if (!sec)      if (!sec)
194          BUG (0);          BUG (0);
195      gpgme_keycache_rewind (sec);      gpgme_keycache_rewind (sec);
196      while (!gpgme_keycache_next_key (sec, 1, &key))      while (!gpgme_keycache_next_key (sec, 1, &key)) {
197      {          if (key_is_useable (key)) {
198          if (gpgme_key_get_ulong_attr (key, GPGME_ATTR_KEY_USABLE, NULL, 0))              s = key->subkeys->keyid;
         {  
             s = gpgme_key_get_string_attr (key, GPGME_ATTR_KEYID, NULL, 0);  
199              if (s)                  if (s)    
200                  keyid = m_strdup (s+8);                  keyid = m_strdup (s+8);
201              break;              break;
202          }          }
203      }      }
204      if (!keyid)      if (!keyid) {
     {  
205          *ret_no_useable = 1;          *ret_no_useable = 1;
206          msg_box( NULL, _("No useable secret key found."), _("GPG Error"), MB_ERR);          msg_box( NULL, _("No useable secret key found."), _("GPG Error"), MB_ERR);
207      }      }
# Line 302  parse_version_nr( const char * buf, int Line 299  parse_version_nr( const char * buf, int
299  int  int
300  check_gnupg_engine (int * r_major, int * r_minor, int * r_patch)  check_gnupg_engine (int * r_major, int * r_minor, int * r_patch)
301  {  {
302      gpgme_error_t err;      gpgme_ctx_t ctx;
303        gpgme_engine_info_t inf;
304      char * eng = NULL;      char * eng = NULL;
305      int major=0, minor=0, patch=0;      int major=0, minor=0, patch=0;
306      int rc;      int rc;
307                    
308      err = gpgme_op_version( &eng );      gpgme_new (&ctx);
309      if( err )      inf = gpgme_ctx_get_engine_info (ctx);
310        if (!inf) {
311            gpgme_release (ctx);
312          return -1;          return -1;
313        }
314      if( strstr( eng, "IDEA" ) )      if( strstr( eng, "IDEA" ) )
315          idea_available = 1;          idea_available = 1;
316      rc = parse_version_nr( eng, &major, &minor, &patch );      rc = parse_version_nr( inf->version, &major, &minor, &patch );
317      free( eng ); eng = NULL;      if( rc ) {
318      if( rc )          gpgme_release (ctx);
319          return rc;          return rc;
320        }
321      if( major < *r_major      if( major < *r_major
322       || minor < *r_minor)       || minor < *r_minor)
323          rc = 1;          rc = 1;
# Line 900  fail: Line 902  fail:
902    
903    
904  void  void
905  gnupg_backup_options (int keep)  gnupg_backup_options (void)
906  {  {
907      char *optfile = NULL;      char *cfgfile = NULL;
908      char bak[1024];      char bak[512];
909    
910      optfile = get_gnupg_cfgfile ();      cfgfile = get_gnupg_cfgfile ();
911      if (optfile == NULL)      if (cfgfile == NULL)
912          return;          return;
913      if (keep)      _snprintf (bak, DIM (bak)-1, "%s.bak", cfgfile);
914          _snprintf (bak, DIM (bak)-1, "%s.old", optfile);      CopyFile (cfgfile, bak, FALSE);
915      else      free_if_alloc (cfgfile);
         _snprintf (bak, DIM (bak)-1, "%s.O", optfile);  
     CopyFile (optfile, bak, keep);  
     free_if_alloc (optfile);  
916  } /* gnupg_backup_options */  } /* gnupg_backup_options */
917    
918    

Legend:
Removed from v.22  
changed lines
  Added in v.23

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26