/[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 73 by twoaday, Tue Nov 8 07:15:13 2005 UTC revision 78 by twoaday, Tue Nov 15 08:54:44 2005 UTC
# Line 300  char* get_reg_entry_gpg4win (const char Line 300  char* get_reg_entry_gpg4win (const char
300  char*  char*
301  check_for_gpg4win (void)  check_for_gpg4win (void)
302  {  {
303      return get_reg_entry_gpg4win ("\\gpg.exe");      return get_reg_entry_gpg4win ("gpg.exe");
304  }  }
305    
306    
# Line 342  parse_version_nr (const char * buf, int Line 342  parse_version_nr (const char * buf, int
342      tmp[i] = 0; buf++;      tmp[i] = 0; buf++;
343      *minor = atol (tmp);      *minor = atol (tmp);
344      i=0;      i=0;
345      while (buf && isdigit( *buf ) && i < 8)      while (buf && isdigit (*buf) && i < 8)
346          tmp[i++] = *buf++;          tmp[i++] = *buf++;
347      tmp[i] = 0;      tmp[i] = 0;
348      *patch = atol (tmp);      *patch = atol (tmp);
# Line 358  check_gnupg_engine (int *r_major, int *r Line 358  check_gnupg_engine (int *r_major, int *r
358  {  {
359      gpgme_ctx_t ctx;      gpgme_ctx_t ctx;
360      gpgme_engine_info_t inf;      gpgme_engine_info_t inf;
361      char * eng = NULL;      char *eng = NULL;
362      int major=0, minor=0, patch=0;      int major=0, minor=0, patch=0;
363      int rc;      int rc = 1;
364                    
365      gpgme_new (&ctx);      gpgme_new (&ctx);
366      inf = gpgme_ctx_get_engine_info (ctx);      inf = gpgme_ctx_get_engine_info (ctx);
# Line 368  check_gnupg_engine (int *r_major, int *r Line 368  check_gnupg_engine (int *r_major, int *r
368          gpgme_release (ctx);          gpgme_release (ctx);
369          return -1;          return -1;
370      }      }
371    
372      /* We need to exec GPG again to find out if IDEA is available. */      /* We need to exec GPG again to find out if IDEA is available. */
373      if (gpg_get_version (&eng))      if (gpg_get_version (&eng))
374          return -1;          return -1;
375      if (strstr (eng, "IDEA"))      if (strstr (eng, "IDEA"))
376          idea_available = 1;          idea_available = 1;
377      free (eng);      free (eng);
378      rc = parse_version_nr( inf->version, &major, &minor, &patch );      rc = parse_version_nr (inf->version, &major, &minor, &patch);
379      if( rc ) {      if (rc) {
380          gpgme_release (ctx);          gpgme_release (ctx);
381          return rc;          return rc;
382      }      }
383      /* FIXME: This check is wrong! */  
384      if (major < *r_major || minor < *r_minor)      if (major > *r_major)
         rc = 1;  
     else {  
         if (patch < *r_patch)  
             rc = 1;  
385          rc = 0;          rc = 0;
386      }      else if (major == *r_major && minor > *r_minor)          
387            rc = 0;
388        else if (major == *r_major && minor == *r_minor &&
389                 patch >= *r_patch)
390            rc = 0;
391    
392      *r_major = major;      *r_major = major;
393      *r_minor = minor;      *r_minor = minor;
394      *r_patch = patch;      *r_patch = patch;
# Line 787  my_access (const char * fname) Line 789  my_access (const char * fname)
789  }  }
790    
791    
792    /* Check the file permissions of the public keyring.
793       If @showmsg is 1 output a message in case of errors.
794       Return value: 1 if read-only attribute
795                     2 if file is opened by another process exclusively. */
796  int  int
797  gpg_check_permissions (int showmsg)  gpg_check_permissions (int showmsg)
798  {  {
# Line 813  gpg_check_permissions (int showmsg) Line 819  gpg_check_permissions (int showmsg)
819                  }                  }
820              }              }
821              else if (ans == IDNO) {              else if (ans == IDNO) {
822                  /*                  /* All commands with write access will be disabled. */
                 msg_box (NULL, _("All commands with write access to the keyring\n"  
                                  "will be disabled."), _("GPG Information"), MB_INFO);  
                 */  
823                  failed = 1;                  failed = 1;
824              }              }
825          }          }
# Line 834  gpg_check_permissions (int showmsg) Line 837  gpg_check_permissions (int showmsg)
837      }      }
838      free_if_alloc (name);      free_if_alloc (name);
839      return failed;      return failed;
840  } /* gpg_check_permissions */  }
841    
842    
843  /* Check the GPG home dir. If all methods failed, try to  /* Check the GPG home dir. If all methods failed, try to
# Line 938  gnupg_copy_keyrings (void) Line 941  gnupg_copy_keyrings (void)
941          return WPTERR_GENERAL;          return WPTERR_GENERAL;
942      hwnd = GetDesktopWindow ();      hwnd = GetDesktopWindow ();
943    
944      pring = get_filename_dlg (hwnd, FILE_OPEN, _("Please choose your public keyring"),      pring = get_fileopen_dlg (hwnd, _("Please choose your public keyring"),
945                                _("GPG Keyrings (*.gpg)\0*.gpg\0\0"),NULL);                                _("GPG Keyrings (*.gpg)\0*.gpg\0\0"),NULL);
946      if (!pring) {      if (!pring) {
947          msg_box (hwnd, _("No keyring was chosen. Exit."), _("WinPT Error"), MB_ERR);          msg_box (hwnd, _("No keyring was chosen. Exit."), _("WinPT Error"), MB_ERR);
# Line 958  gnupg_copy_keyrings (void) Line 961  gnupg_copy_keyrings (void)
961      }      }
962      free_if_alloc (file);      free_if_alloc (file);
963    
964      sring = get_filename_dlg (hwnd, FILE_OPEN, _("Please choose your secret keyring"),      sring = get_fileopen_dlg (hwnd, _("Please choose your secret keyring"),
965                                _("GPG Keyrings (*.gpg)\0*.gpg\0\0"), NULL);                                _("GPG Keyrings (*.gpg)\0*.gpg\0\0"), NULL);
966      if (!sring) {      if (!sring) {
967          msg_box( NULL, _("No keyring was chosen. Exit."), _("WinPT Error"), MB_ERR );          msg_box( NULL, _("No keyring was chosen. Exit."), _("WinPT Error"), MB_ERR );

Legend:
Removed from v.73  
changed lines
  Added in v.78

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26