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

Diff of /trunk/Src/wptKeyEditCB.cpp

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

revision 273 by twoaday, Fri Dec 8 10:22:17 2006 UTC revision 328 by twoaday, Fri Sep 25 16:07:38 2009 UTC
# Line 13  Line 13 
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15   * General Public License for more details.   * General Public License for more details.
  *  
  * You should have received a copy of the GNU General Public License  
  * along with WinPT; if not, write to the Free Software Foundation,  
  * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA  
16   */   */
   
17  #ifdef HAVE_CONFIG_H  #ifdef HAVE_CONFIG_H
18  #include <config.h>  #include <config.h>
19  #endif  #endif
# Line 34  Line 29 
29  #include "wptContext.h"  #include "wptContext.h"
30  #include "wptKeyEdit.h"  #include "wptKeyEdit.h"
31  #include "wptErrors.h"  #include "wptErrors.h"
32    #include "wptTypes.h"
33    
34    
35  /* Possible errors for the edit key operation. */  /* Possible errors for the edit key operation. */
36  enum editkey_error_t {  enum editkey_error_t {
# Line 54  cmd_notation_handler (GpgKeyEdit *ctx, s Line 51  cmd_notation_handler (GpgKeyEdit *ctx, s
51          int uid = ctx->getUseridIndex ();          int uid = ctx->getUseridIndex ();
52          ctx->cmd_sent = 1;          ctx->cmd_sent = 1;
53          if (uid != -1) {          if (uid != -1) {
54              sprintf (buf, "uid %d", ctx->getUseridIndex ());              _snprintf (buf, DIM (buf)-1, "uid %d", ctx->getUseridIndex ());
55              return buf;              return buf;
56          }          }
57      }      }
# Line 81  cmd_keyserv_handler (GpgKeyEdit *ctx, gp Line 78  cmd_keyserv_handler (GpgKeyEdit *ctx, gp
78          int uid = ctx->getUseridIndex ();          int uid = ctx->getUseridIndex ();
79          ctx->cmd_sent = 1;          ctx->cmd_sent = 1;
80          if (uid != -1) {          if (uid != -1) {
81              sprintf (buf, "uid %d", ctx->getUseridIndex ());              _snprintf (buf, DIM (buf)-1, "uid %d", ctx->getUseridIndex ());
82              return buf;              return buf;
83          }          }
84      }      }
# Line 113  cmd_sign_handler (GpgKeyEdit *ctx, gpgme Line 110  cmd_sign_handler (GpgKeyEdit *ctx, gpgme
110      if (ctx->getUseridIndex () != -1 &&      if (ctx->getUseridIndex () != -1 &&
111          ctx->cnt == 0 && !strcmp (key, "keyedit.prompt")) {          ctx->cnt == 0 && !strcmp (key, "keyedit.prompt")) {
112          ctx->cnt++;          ctx->cnt++;
113          sprintf (buf, "uid %d", ctx->getUseridIndex ());          _snprintf (buf, DIM (buf)-1, "uid %d", ctx->getUseridIndex ());
114          return buf;          return buf;
115      }      }
116    
# Line 149  cmd_sign_handler (GpgKeyEdit *ctx, gpgme Line 146  cmd_sign_handler (GpgKeyEdit *ctx, gpgme
146          return "Y";          return "Y";
147      if (!strcmp (key, "keyedit.sign_all.okay"))      if (!strcmp (key, "keyedit.sign_all.okay"))
148          return "Y";          return "Y";
149      if (!strcmp ( key, "passphrase.enter"))      if (!ctx->usePassphraseCallback() && !strcmp (key, "passphrase.enter"))    
150          return ctx->pass;          return ctx->pass;
151      if (!strcmp (key, "keyedit.prompt")) {      if (!strcmp (key, "keyedit.prompt")) {
152          ctx->reset ();          ctx->reset ();
153          return "save";          return "save";
# Line 216  cmd_deluid_handler (GpgKeyEdit *ctx, gpg Line 213  cmd_deluid_handler (GpgKeyEdit *ctx, gpg
213      static char buf[64];      static char buf[64];
214    
215      if (ctx->cnt == 0 && !strcmp (key, "keyedit.prompt")) {      if (ctx->cnt == 0 && !strcmp (key, "keyedit.prompt")) {
216          sprintf (buf, "uid %d", ctx->getUseridIndex ());          _snprintf (buf, DIM (buf)-1, "uid %d", ctx->getUseridIndex ());
217          ctx->cnt = 1;          ctx->cnt = 1;
218          return buf;          return buf;
219      }      }
# Line 244  cmd_delsig_handler (GpgKeyEdit *ctx, gpg Line 241  cmd_delsig_handler (GpgKeyEdit *ctx, gpg
241      static int sig_cnt = 0;      static int sig_cnt = 0;
242    
243      if (ctx->cnt == 0 && !strcmp (key, "keyedit.prompt")) {      if (ctx->cnt == 0 && !strcmp (key, "keyedit.prompt")) {
244          sprintf (buf, "uid %d", ctx->getUseridIndex ());          _snprintf (buf, DIM (buf)-1, "uid %d", ctx->getUseridIndex ());
245          ctx->cnt = 1;          ctx->cnt = 1;
246          return buf;          return buf;
247      }      }
# Line 278  cmd_delkey_handler (GpgKeyEdit *ctx, gpg Line 275  cmd_delkey_handler (GpgKeyEdit *ctx, gpg
275      static char buf[64];      static char buf[64];
276    
277      if (ctx->cnt == 0 && !strcmp (key, "keyedit.prompt")) {      if (ctx->cnt == 0 && !strcmp (key, "keyedit.prompt")) {
278          sprintf (buf, "key %d", ctx->getKeyIndex ());          _snprintf (buf, DIM (buf)-1, "key %d", ctx->getKeyIndex ());
279          ctx->cnt = 1;          ctx->cnt = 1;
280          return buf;          return buf;
281      }      }
# Line 432  cmd_primary_handler (GpgKeyEdit *ctx, gp Line 429  cmd_primary_handler (GpgKeyEdit *ctx, gp
429      static char buf[64];      static char buf[64];
430            
431      if (ctx->cnt == 0 && !strcmp (key, "keyedit.prompt")) {      if (ctx->cnt == 0 && !strcmp (key, "keyedit.prompt")) {
432          sprintf (buf, "uid %d", ctx->getUseridIndex ());          _snprintf (buf, DIM (buf)-1, "uid %d", ctx->getUseridIndex ());
433          ctx->cnt = 1;          ctx->cnt = 1;
434          return buf;          return buf;
435      }      }
# Line 460  cmd_expire_handler (GpgKeyEdit *ctx, gpg Line 457  cmd_expire_handler (GpgKeyEdit *ctx, gpg
457      static char buf[64];      static char buf[64];
458    
459      if (ctx->cnt == 0 && !strcmp (key, "keyedit.prompt")) {      if (ctx->cnt == 0 && !strcmp (key, "keyedit.prompt")) {
460          sprintf (buf, "key %d", ctx->getKeyIndex ());          _snprintf (buf, DIM (buf)-1, "key %d", ctx->getKeyIndex ());
461          ctx->cnt = 1;          ctx->cnt = 1;
462          return buf;          return buf;
463      }      }
# Line 495  cmd_revuid_handler (GpgKeyEdit *ctx, gpg Line 492  cmd_revuid_handler (GpgKeyEdit *ctx, gpg
492            
493      if (ctx->cnt == 0 && !strcmp (key, "keyedit.prompt")) {      if (ctx->cnt == 0 && !strcmp (key, "keyedit.prompt")) {
494          ctx->cnt = 1;          ctx->cnt = 1;
495          sprintf (buf, "uid %d", ctx->getUseridIndex ());          _snprintf (buf, DIM (buf)-1, "uid %d", ctx->getUseridIndex ());
496          return buf;          return buf;
497      }      }
498      else if (ctx->cnt == 1 && !strcmp (key, "keyedit.prompt")) {      else if (ctx->cnt == 1 && !strcmp (key, "keyedit.prompt")) {
# Line 537  cmd_revsig_handler (GpgKeyEdit *ctx, gpg Line 534  cmd_revsig_handler (GpgKeyEdit *ctx, gpg
534      static char buf[64];      static char buf[64];
535            
536      if (ctx->cnt == 0 && !strcmp (key, "keyedit.prompt" )) {      if (ctx->cnt == 0 && !strcmp (key, "keyedit.prompt" )) {
537          sprintf( buf, "uid %d", ctx->getUseridIndex ());          _snprintf (buf, DIM (buf)-1, "uid %d", ctx->getUseridIndex ());
538          ctx->cnt = 1;          ctx->cnt = 1;
539          return buf;          return buf;
540      }      }
541      if (ctx->cnt == 1 && !strcmp ( key, "keyedit.prompt" ) ) {      if (ctx->cnt == 1 && !strcmp (key, "keyedit.prompt")) {
542          ctx->cnt = 2;          ctx->cnt = 2;
543          return "revsig";          return "revsig";
544      }      }
545      if (ctx->cnt == 2 && !strcmp (key, "ask_revoke_sig.one" ) ) {      if (ctx->cnt == 2 && !strcmp (key, "ask_revoke_sig.one")) {
546          ctx->cnt = 3;          ctx->cnt = 3;
547          return "Y";          return "Y";
548      }      }
549      if (ctx->cnt == 3 && !strcmp (key, "ask_revoke_sig.okay" ) ) {      if (ctx->cnt == 3 && !strcmp (key, "ask_revoke_sig.okay")) {
550          ctx->cnt = 4;          ctx->cnt = 4;
551          return "Y";          return "Y";
552      }      }
553      if (ctx->cnt == 4 && !strcmp ( key, "ask_revocation_reason.code" ) ) {      if (ctx->cnt == 4 && !strcmp (key, "ask_revocation_reason.code")) {
554          ctx->cnt = 5;          ctx->cnt = 5;
555          return "0";          return "0";
556      }      }
557      if (ctx->cnt == 5 && !strcmp ( key, "ask_revocation_reason.text" ) ) {      if (ctx->cnt == 5 && !strcmp (key, "ask_revocation_reason.text" )) {
558          ctx->cnt = 6;          ctx->cnt = 6;
559          return "";          return "";
560      }      }
# Line 569  cmd_revsig_handler (GpgKeyEdit *ctx, gpg Line 566  cmd_revsig_handler (GpgKeyEdit *ctx, gpg
566          ctx->cnt = 8;          ctx->cnt = 8;
567          return ctx->pass;          return ctx->pass;
568      }      }
569      if (ctx->cnt == 8 && !strcmp ( key, "keyedit.prompt" ) ) {      if (ctx->cnt == 8 && !strcmp (key, "keyedit.prompt")) {
570          ctx->reset ();          ctx->reset ();
571          return "save";          return "save";
572      }      }
# Line 586  cmd_revkey_handler (GpgKeyEdit *ctx, gpg Line 583  cmd_revkey_handler (GpgKeyEdit *ctx, gpg
583      static char buf[64];      static char buf[64];
584    
585      if (ctx->cnt == 0 && !strcmp ( key, "keyedit.prompt" ) ) {      if (ctx->cnt == 0 && !strcmp ( key, "keyedit.prompt" ) ) {
586          sprintf( buf, "key %d", ctx->getKeyIndex ());          _snprintf (buf, DIM (buf)-1, "key %d", ctx->getKeyIndex ());
587          ctx->cnt = 1;          ctx->cnt = 1;
588          return buf;          return buf;
589      }      }

Legend:
Removed from v.273  
changed lines
  Added in v.328

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26