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

Diff of /trunk/Src/wptCardDlg.cpp

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

revision 55 by werner, Mon Oct 31 21:14:11 2005 UTC revision 56 by twoaday, Wed Nov 2 09:36:52 2005 UTC
# Line 294  check_string (const char *str, int flags Line 294  check_string (const char *str, int flags
294    
295    
296  static int  static int
297  do_proc_card_cmds (HWND dlg, struct pin_cb_ctx_s *pincb, gpg_card_t card)  do_proc_card_cmds (HWND dlg, struct pin_cb_ctx_s *cb, gpg_card_t card)
298  {  {
299      static struct {      static struct {
300          int id;          int id;
# Line 338  do_proc_card_cmds (HWND dlg, struct pin_ Line 338  do_proc_card_cmds (HWND dlg, struct pin_
338              n++;              n++;
339          }          }
340      }      }
341      if (!pincb || !card) /* just return the changed elements */      if (!cb || !card) /* just return the changed elements */
342          return n;          return n;
343      if (!n)      if (!n)
344          return 0;          return 0;
345      if (!pincb->apin) {      if (!cb->apin) {
346          msg_box (dlg, _("No PINs found."), _("Card Edit"), MB_ERR);          msg_box (dlg, _("No PINs found."), _("Card Edit"), MB_ERR);
347          return 0;          return 0;
348      }      }
# Line 350  do_proc_card_cmds (HWND dlg, struct pin_ Line 350  do_proc_card_cmds (HWND dlg, struct pin_
350      ce = new GpgCardEdit ();      ce = new GpgCardEdit ();
351      if (!ce)      if (!ce)
352          BUG (NULL);          BUG (NULL);
353      ce->setAdminPIN (pincb->apin);      ce->setAdminPIN (cb->apin);
354      /*ce->setPIN (pincb->upin);*/      /*ce->setPIN (cb->upin);*/
355      for( i=0; idctl[i].id; i++ ) {      for( i=0; idctl[i].id; i++ ) {
356          if( idctl[i].changed ) {          if( idctl[i].changed ) {
357              GetDlgItemText( dlg, idctl[i].id, buf, sizeof (buf)-1 );              GetDlgItemText( dlg, idctl[i].id, buf, sizeof (buf)-1 );
# Line 422  free_pincb (struct pin_cb_ctx_s *ctx) Line 422  free_pincb (struct pin_cb_ctx_s *ctx)
422     Return value: 0 on success. */     Return value: 0 on success. */
423  static int  static int
424  do_askpin (HWND dlg, int which, gpg_card_t card,  do_askpin (HWND dlg, int which, gpg_card_t card,
425             struct pin_cb_ctx_s *pincb)             struct pin_cb_ctx_s *cb)
426  {  {
427      const char * s, * fmt;      const char * s, * fmt;
428      const char * n1, * n2, * serial;      const char * n1, * n2, * serial;
429      char * p;      char * p;
430      size_t n;      size_t n;
431    
432      if( (which == CARD_ADMIN_PIN && pincb->apin) ||      if( (which == CARD_ADMIN_PIN && cb->apin) ||
433          (which == CARD_USER_PIN && pincb->upin) )          (which == CARD_USER_PIN && cb->upin) )
434          return 0;          return 0;
435            
436      if (which == CARD_ADMIN_PIN)      if (which == CARD_ADMIN_PIN)
# Line 439  do_askpin (HWND dlg, int which, gpg_card Line 439  do_askpin (HWND dlg, int which, gpg_card
439          s = _("Please enter the 'User PIN'");          s = _("Please enter the 'User PIN'");
440      else      else
441          s = _("Please enter the PIN");          s = _("Please enter the PIN");
442      pincb->which = which;      cb->which = which;
443      free_if_alloc( pincb->info_text );      free_if_alloc (cb->info_text);
444      if( card ) {      if( card ) {
445          fmt = _("%s\nName: %s %s\nSerial-No: %s\n");          fmt = _("%s\nName: %s %s\nSerial-No: %s\n");
446          n1 = card->givenname;          n1 = card->givenname;
# Line 452  do_askpin (HWND dlg, int which, gpg_card Line 452  do_askpin (HWND dlg, int which, gpg_card
452          if (!serial)          if (!serial)
453              serial = "No Serial ID";              serial = "No Serial ID";
454          n = strlen( n1 ) + strlen( n2 ) + strlen( fmt ) + strlen( serial ) + 3;          n = strlen( n1 ) + strlen( n2 ) + strlen( fmt ) + strlen( serial ) + 3;
455          p = pincb->info_text = new char[strlen( s )+n+1 ];          p = cb->info_text = new char[strlen( s )+n+1 ];
456          if( !p )          if( !p )
457              BUG (0);              BUG (0);
458          sprintf( p, fmt, s, n1, n2, serial );          sprintf( p, fmt, s, n1, n2, serial );
459      }      }
460      else {      else {
461          p = pincb->info_text = m_strdup (s);          p = cb->info_text = m_strdup (s);
462          if (!p)          if (!p)
463              BUG (0);              BUG (0);
464      }      }
465      DialogBoxParam (glob_hinst, (LPCTSTR)IDD_WINPT_PIN, dlg,      DialogBoxParam (glob_hinst, (LPCTSTR)IDD_WINPT_PIN, dlg,
466                      pin_cb_dlg_proc, (LPARAM)pincb);                      pin_cb_dlg_proc, (LPARAM)cb);
467      if (!pincb->apin && !pincb->upin) {      if (!cb->apin && !cb->upin) {
468          safe_free (pincb->info_text);          safe_free (cb->info_text);
469          return -1;          return -1;
470      }      }
471      return 0;      return 0;
# Line 582  card_keygen_dlg_proc (HWND dlg, UINT msg Line 582  card_keygen_dlg_proc (HWND dlg, UINT msg
582      char name[128], email[128], comment[128];      char name[128], email[128], comment[128];
583      char pass[128];      char pass[128];
584      int card_flags = GPG_CARDFLAG_NONE;      int card_flags = GPG_CARDFLAG_NONE;
585      int expires=0, valid;      int expires=0, valid=0;
586      size_t n;      size_t n;
587    
588      switch (msg) {      switch (msg) {
# Line 765  card_changepin_dlg_proc (HWND dlg, UINT Line 765  card_changepin_dlg_proc (HWND dlg, UINT
765      gpgme_error_t err;      gpgme_error_t err;
766      GpgCardEdit *ce;          GpgCardEdit *ce;    
767      char pold[128], pnew[128], pnew2[128];      char pold[128], pnew[128], pnew2[128];
768      int which;      int which=0;
769      size_t n;      size_t n;
770    
771      switch( msg ) {      switch( msg ) {

Legend:
Removed from v.55  
changed lines
  Added in v.56

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26