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

Diff of /trunk/Src/wptKeyCache.cpp

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

revision 234 by twoaday, Tue Jun 27 10:16:41 2006 UTC revision 271 by twoaday, Sun Nov 5 08:57:45 2006 UTC
# Line 163  parse_attr_data (const char *keyid, attr Line 163  parse_attr_data (const char *keyid, attr
163          fwrite (status, 1, strlen (status), tmp);          fwrite (status, 1, strlen (status), tmp);
164          fflush (tmp);          fflush (tmp);
165          rewind (tmp);          rewind (tmp);
   
166          ndata = parse_attr_list (tmp, data, ndata, list);          ndata = parse_attr_list (tmp, data, ndata, list);
         fclose (tmp);  
         DeleteFile (tmpnam);  
167      }      }
168      else      else
169          *list = NULL;          *list = NULL;
170        if (tmp != NULL) {
171            fclose (tmp);
172            DeleteFile (tmpnam);
173        }
174    
175      safe_free (status);      safe_free (status);
176      safe_free (data);      safe_free (data);
# Line 762  gpg_keycache_delete_key (gpg_keycache_t Line 763  gpg_keycache_delete_key (gpg_keycache_t
763          return rc;          return rc;
764            
765      c = ctx->item;      c = ctx->item;
766      if (c->next == NULL) {      if (!c) /* empty */
767            return 0;
768        else if (c->next == NULL) {
769          if (itm->key)          if (itm->key)
770              gpgme_key_release (itm->key);              gpgme_key_release (itm->key);
771          itm->key = NULL;          itm->key = NULL;
772          free_if_alloc (itm);          free_if_alloc (itm);
773            /* the cache has no other items, so we set the context to NULL
774               to indicate that the entire cache is empty. */
775            ctx->item = NULL;
776      }      }
777      else {      else {
778          for (; c != NULL; c = c->next) {          for (; c != NULL; c = c->next) {
# Line 830  static int Line 836  static int
836  key_divert_to_card (gpgme_key_t key)  key_divert_to_card (gpgme_key_t key)
837  {  {
838      gpgme_subkey_t k;      gpgme_subkey_t k;
839      int n=0, n_alg=0;      int n=0;
840      int can_auth = 0, can_encr = 0;      int can_auth = 0, can_encr = 0;
841    
842      for (k = key->subkeys; k; k = k->next) {      for (k = key->subkeys; k; k = k->next) {
843          n++;          n++;
844          if (k->pubkey_algo == GPGME_PK_RSA && k->length == 1024)          if (k->pubkey_algo != GPGME_PK_RSA || k->length != 1024) {
845              n_alg++;              return 0;
846                break;
847            }
848          if (k->can_authenticate)          if (k->can_authenticate)
849              can_auth++;              can_auth++;
850          if (k->can_encrypt)          if (k->can_encrypt)
851              can_encr++;              can_encr++;
852      }      }
853      if (n == 3 && n_alg == 3 && can_auth == 1 && can_encr == 1)      if (n >= 3 && can_auth >= 1 && can_encr >= 1)
854          return 1;          return 1;
855      return 0;      return 0;
856  }  }

Legend:
Removed from v.234  
changed lines
  Added in v.271

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26