/[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 69 by twoaday, Sat Nov 5 12:28:12 2005 UTC revision 123 by twoaday, Wed Dec 14 09:01:45 2005 UTC
# Line 17  Line 17 
17   * along with this program; if not, write to the Free Software   * along with this program; if not, write to the Free Software
18   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
19   */   */
20    
21  #ifdef HAVE_CONFIG_H  #ifdef HAVE_CONFIG_H
22  #include <config.h>  #include <config.h>
23  #endif  #endif
# Line 27  Line 28 
28  #include <malloc.h>  #include <malloc.h>
29  #include <ctype.h>  #include <ctype.h>
30  #include <assert.h>  #include <assert.h>
31    #include <gpgme.h>
32    
 #include "w32gpgme.h"  
33  #include "wptKeyCache.h"  #include "wptKeyCache.h"
34  #include "openpgp.h"  #include "openpgp.h"
35  #include "wptNLS.h"  #include "wptNLS.h"
# Line 53  buffer_to_string (char *dst, size_t dlen Line 54  buffer_to_string (char *dst, size_t dlen
54  }  }
55  #endif  #endif
56    
57    
58  /* Parse the secret keyring and retrieve some additional information  /* Parse the secret keyring and retrieve some additional information
59     for each key which was found. */     for each key which was found. */
60  static void  static void
# Line 118  keycache_prepare2 (gpg_keycache_t ctx, c Line 120  keycache_prepare2 (gpg_keycache_t ctx, c
120      if (secring) {      if (secring) {
121          parse_secring (ctx, kid, secring);          parse_secring (ctx, kid, secring);
122          if (!pubring) {          if (!pubring) {
123              safe_free(pkt);              safe_free (pkt);
124              return 0;              return 0;
125          }          }
126      }      }
127      inp = gpg_iobuf_open (pubring);      inp = gpg_iobuf_open (pubring);
128      if (!inp) {      if (!inp) {
129          safe_free( pkt );          safe_free (pkt);
130          return gpg_error (GPG_ERR_KEYRING_OPEN);          return gpg_error (GPG_ERR_KEYRING_OPEN);
131      }      }
132      gpg_iobuf_ioctl( inp, 3, 1, NULL ); /* disable cache */      gpg_iobuf_ioctl (inp, 3, 1, NULL); /* disable cache */
133    
134      gpg_init_packet( pkt );      gpg_init_packet (pkt);
135      while (gpg_parse_packet (inp, pkt) != -1) {      while (gpg_parse_packet (inp, pkt) != -1) {
136          if (pkt->pkttype == PKT_PUBLIC_KEY) {          if (pkt->pkttype == PKT_PUBLIC_KEY) {
137              strcpy (keyid, "");              strcpy (keyid, "");
# Line 515  key_divert_to_card (gpgme_key_t key) Line 517  key_divert_to_card (gpgme_key_t key)
517  }  }
518    
519    
520    static unsigned char*
521    copy_uid_prefs (const unsigned char *prefs)
522    {
523        unsigned char *p;
524        size_t pos=0;
525    
526        while (prefs[pos] != 0)
527            pos++;
528        p = (unsigned char*)calloc (1, pos+1);
529        if (!p)
530            abort ();
531        memcpy (p, prefs, pos);
532        return p;
533    }
534    
535    
536  gpgme_error_t  gpgme_error_t
537  gpg_keycache_sync (gpg_keycache_t pub, gpg_keycache_t sec)  gpg_keycache_sync (gpg_keycache_t pub, gpg_keycache_t sec)
538  {  {
# Line 530  gpg_keycache_sync (gpg_keycache_t pub, g Line 548  gpg_keycache_sync (gpg_keycache_t pub, g
548              c_sec->gloflags.divert_to_card = c->gloflags.divert_to_card;              c_sec->gloflags.divert_to_card = c->gloflags.divert_to_card;
549              if (!c->gloflags.divert_to_card)              if (!c->gloflags.divert_to_card)
550                  c->gloflags.divert_to_card = key_divert_to_card (key);                  c->gloflags.divert_to_card = key_divert_to_card (key);
551                c->sym_prefs = copy_uid_prefs (c_sec->sym_prefs);
552              c->pubpart = c_sec;              c->pubpart = c_sec;
553              c->pubpart->key = key;              c->pubpart->key = key;
554          }          }

Legend:
Removed from v.69  
changed lines
  Added in v.123

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26