~ubuntu-branches/ubuntu/oneiric/gnutls26/oneiric-updates

« back to all changes in this revision

Viewing changes to src/certtool-cfg.c

  • Committer: Bazaar Package Importer
  • Author(s): Steve Langasek
  • Date: 2011-05-20 13:07:18 UTC
  • mfrom: (12.1.11 sid)
  • Revision ID: james.westby@ubuntu.com-20110520130718-db41dybbanzfvlji
Tags: 2.10.5-1ubuntu1
* Merge from Debian unstable, remaining changes:
  - Fix build failure with --no-add-needed.
  - Build for multiarch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation
3
 
 *
4
 
 * This file is part of GNUTLS.
5
 
 *
6
 
 * GNUTLS is free software: you can redistribute it and/or modify
7
 
 * it under the terms of the GNU General Public License as published by
 
2
 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
 
3
 * Software Foundation, Inc.
 
4
 *
 
5
 * This file is part of GnuTLS.
 
6
 *
 
7
 * GnuTLS is free software: you can redistribute it and/or modify it
 
8
 * under the terms of the GNU General Public License as published by
8
9
 * the Free Software Foundation, either version 3 of the License, or
9
10
 * (at your option) any later version.
10
 
 *               
11
 
 * GNUTLS is distributed in the hope that it will be useful,
12
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 
 * GNU General Public License for more details.
15
 
 *                               
 
11
 *
 
12
 * GnuTLS is distributed in the hope that it will be useful, but
 
13
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
15
 * General Public License for more details.
 
16
 *
16
17
 * You should have received a copy of the GNU General Public License
17
 
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
18
 * along with this program.  If not, see
 
19
 * <http://www.gnu.org/licenses/>.
 
20
 *
 
21
 * Written by Nikos Mavrogiannopoulos <nmav@gnutls.org>.
18
22
 */
19
23
 
20
24
#include <config.h>
72
76
  int code_sign_key;
73
77
  int ocsp_sign_key;
74
78
  int time_stamping_key;
75
 
  char** key_purpose_oids;
 
79
  int ipsec_ike_key;
 
80
  char **key_purpose_oids;
76
81
  int crl_next_update;
77
82
  int crl_number;
78
83
  int crq_extensions;
162
167
     (void *) &cfg.ocsp_sign_key, 0},
163
168
    {NULL, '\0', "time_stamping_key", CFG_BOOL,
164
169
     (void *) &cfg.time_stamping_key, 0},
 
170
    {NULL, '\0', "ipsec_ike_key", CFG_BOOL,
 
171
     (void *) &cfg.ipsec_ike_key, 0},
165
172
    {NULL, '\0', "proxy_policy_language", CFG_STR,
166
173
     (void *) &cfg.proxy_policy_language, 0},
167
174
    CFG_END_OF_LIST
198
205
  int ret;
199
206
 
200
207
  fputs (input_str, stderr);
201
 
  fgets (input, sizeof (input), stdin);
 
208
  if (fgets (input, sizeof (input), stdin) == NULL)
 
209
    return;
202
210
 
203
211
  if (strlen (input) == 1)      /* only newline */
204
212
    return;
219
227
  int ret;
220
228
 
221
229
  fputs (input_str, stderr);
222
 
  fgets (input, sizeof (input), stdin);
 
230
  if (fgets (input, sizeof (input), stdin) == NULL)
 
231
    return;
223
232
 
224
233
  if (strlen (input) == 1)      /* only newline */
225
234
    return;
244
253
 
245
254
  printf (input_str, def);
246
255
  in = readline ("");
 
256
  if (in == NULL)
 
257
    {
 
258
      return def;
 
259
    }
247
260
 
248
261
  l = strtol (in, &endptr, 0);
249
262
 
302
315
  char input[128];
303
316
 
304
317
  fputs (input_str, stderr);
305
 
  fgets (input, sizeof (input), stdin);
 
318
  if (fgets (input, sizeof (input), stdin) == NULL)
 
319
    return 0;
306
320
 
307
321
  if (strlen (input) == 1)      /* only newline */
308
322
    return 0;
597
611
    {
598
612
      if (!cfg.key_purpose_oids)
599
613
        return;
600
 
      for (i = 0; cfg.key_purpose_oids[i] != NULL; i ++)
 
614
      for (i = 0; cfg.key_purpose_oids[i] != NULL; i++)
601
615
        {
602
 
          ret = gnutls_x509_crt_set_key_purpose_oid (crt, cfg.key_purpose_oids[i], 0);
 
616
          ret =
 
617
            gnutls_x509_crt_set_key_purpose_oid (crt, cfg.key_purpose_oids[i],
 
618
                                                 0);
603
619
 
604
620
          if (ret < 0)
605
621
            {
606
 
              fprintf (stderr, "set_key_purpose_oid (%s): %s\n",  cfg.key_purpose_oids[i], gnutls_strerror (ret));
 
622
              fprintf (stderr, "set_key_purpose_oid (%s): %s\n",
 
623
                       cfg.key_purpose_oids[i], gnutls_strerror (ret));
607
624
              exit (1);
608
625
            }
609
626
        }
986
1003
 
987
1004
      do
988
1005
        {
989
 
          p = read_str ("Enter a dnsName of the subject of the certificate: ");
 
1006
          p =
 
1007
            read_str ("Enter a dnsName of the subject of the certificate: ");
990
1008
          if (!p)
991
1009
            return;
992
1010
 
1124
1142
}
1125
1143
 
1126
1144
int
 
1145
get_ipsec_ike_status (void)
 
1146
{
 
1147
  if (batch)
 
1148
    {
 
1149
      return cfg.ipsec_ike_key;
 
1150
    }
 
1151
  else
 
1152
    {
 
1153
      return
 
1154
        read_yesno
 
1155
        ("Will the certificate be used for IPsec IKE operations? (y/N): ");
 
1156
    }
 
1157
}
 
1158
 
 
1159
int
1127
1160
get_crl_next_update (void)
1128
1161
{
1129
1162
  int days;