~ubuntu-branches/ubuntu/gutsy/gnupg2/gutsy

« back to all changes in this revision

Viewing changes to agent/command.c

  • Committer: Bazaar Package Importer
  • Author(s): Michael Bienia
  • Date: 2007-02-02 14:29:54 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20070202142954-f5h55skq432ona6m
Tags: 2.0.2-0ubuntu1
* New upstream release
  - includes the patch for CVE-2006-6235
  - a PIN pad can now also be used for signing keys
* Remaining changes:
  - Remove libpcsclite-dev, libopensc2-dev build dependencies (they are in
    universe).
  - Build-depend on libcurl3-gnutls-dev
  - Include /doc files as done with gnupg
* g10/call-agent.c: set DBG_ASSUAN to 0 to suppress a debug message
* debian/rules: add doc/com-certs.pem to the docs for gpgsm
* debian/README.Debian: remove note the gnupg2 isn't released yet.
* Modified Maintainer values to match Debian-Maintainer-Field spec.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* command.c - gpg-agent command handler
2
 
 * Copyright (C) 2001, 2002, 2003, 2004, 2005  Free Software Foundation, Inc.
 
2
 * Copyright (C) 2001, 2002, 2003, 2004, 2005,
 
3
 *               2006  Free Software Foundation, Inc.
3
4
 *
4
5
 * This file is part of GnuPG.
5
6
 *
804
805
}
805
806
 
806
807
 
807
 
/* GET_PASSPHRASE [--data] <cache_id> [<error_message> <prompt> <description>]
 
808
/* GET_PASSPHRASE [--data] [--check] <cache_id>
 
809
                  [<error_message> <prompt> <description>]
808
810
 
809
811
   This function is usually used to ask for a passphrase to be used
810
812
   for conventional encryption, but may also be used by programs which
816
818
 
817
819
   If the option "--data" is used the passphrase is returned by usual
818
820
   data lines and not on the okay line.
 
821
 
 
822
   If the option "--check" is used the passphrase constraints checks as
 
823
   implemented by gpg-agent are applied.  A check is not done if the
 
824
   passphrase has been found in the cache.
819
825
*/
820
826
 
821
827
static int
828
834
  char *cacheid = NULL, *desc = NULL, *prompt = NULL, *errtext = NULL;
829
835
  char *p;
830
836
  void *cache_marker;
831
 
  int opt_data;
 
837
  int opt_data, opt_check;
832
838
 
833
839
  opt_data = has_option (line, "--data");
 
840
  opt_check = has_option (line, "--check");
834
841
  line = skip_options (line);
835
842
 
836
843
  cacheid = line;
857
864
              desc = p;
858
865
              p = strchr (desc, ' ');
859
866
              if (p)
860
 
                *p = 0; /* ignore garbage */
 
867
                *p = 0; /* Ignore trailing garbage. */
861
868
            }
862
869
        }
863
870
    }
895
902
      if (desc)
896
903
        plus_to_blank (desc);
897
904
 
898
 
      rc = agent_get_passphrase (ctrl, &response, desc, prompt, errtext);
 
905
      response = NULL;
 
906
      do
 
907
        {
 
908
          xfree (response);
 
909
          rc = agent_get_passphrase (ctrl, &response, desc, prompt, errtext);
 
910
        }
 
911
      while (!rc
 
912
             && opt_check
 
913
             && check_passphrase_constraints (ctrl, response));
 
914
 
899
915
      if (!rc)
900
916
        {
901
917
          if (cacheid)
1019
1035
 
1020
1036
  rc = parse_keygrip (ctx, line, grip);
1021
1037
  if (rc)
1022
 
    return rc; /* we can't jump to leave because this is already an
1023
 
                  Assuan error code. */
 
1038
    goto leave;
1024
1039
 
1025
1040
  rc = agent_key_from_file (ctrl, ctrl->server_local->keydesc,
1026
1041
                            grip, &shadow_info, CACHE_MODE_IGNORE, &s_skey);
1036
1051
 
1037
1052
  xfree (ctrl->server_local->keydesc);
1038
1053
  ctrl->server_local->keydesc = NULL;
 
1054
 
 
1055
 leave:
1039
1056
  gcry_sexp_release (s_skey);
1040
1057
  xfree (shadow_info);
1041
1058
  if (rc)