~ubuntu-branches/ubuntu/natty/gnupg2/natty-security

« back to all changes in this revision

Viewing changes to sm/certdump.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Urlichs
  • Date: 2005-12-08 22:13:21 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20051208221321-4rvs2vu835iam5wv
Tags: 1.9.19-2
* Convert debian/changelog to UTF-8.
* Put gnupg-agent and gpgsm lintian overrides in the respectively
  right package.  Closes: #335066
* Added debhelper tokens to maintainer scripts.
* xsession fixes:
  o Added host name to gpg-agent PID file name.  Closes: #312717
  o Fixed xsession script to be able to run under zsh.  Closes: #308516
  o Don't run gpg-agent if one is already running.  Closes: #336480
* debian/control:
  o Fixed package description of gpgsm package.  Closes: #299842
  o Added mention of gpg-agent to description of gnupg-agent package.
    Closes: #304355
* Thanks to Peter Eisentraut <petere@debian.org> for all of the above.

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
 
51
51
/* print the first element of an S-Expression */
52
52
void
53
 
gpgsm_print_serial (FILE *fp, ksba_const_sexp_t p)
 
53
gpgsm_print_serial (FILE *fp, ksba_const_sexp_t sn)
54
54
{
 
55
  const char *p = (const char *)sn;
55
56
  unsigned long n;
56
57
  char *endp;
57
58
 
69
70
      else
70
71
        {
71
72
          for (p++; n; n--, p++)
72
 
            fprintf (fp, "%02X", *p);
 
73
            fprintf (fp, "%02X", *(const unsigned char*)p);
73
74
        }
74
75
    }
75
76
}
76
77
 
77
78
 
 
79
/* Dump the serial number or any other simple S-expression. */
78
80
void
79
 
gpgsm_dump_serial (ksba_const_sexp_t p)
 
81
gpgsm_dump_serial (ksba_const_sexp_t sn)
80
82
{
 
83
  const char *p = (const char *)sn;
81
84
  unsigned long n;
82
85
  char *endp;
83
86
 
95
98
      else
96
99
        {
97
100
          for (p++; n; n--, p++)
98
 
            log_printf ("%02X", *p);
 
101
            log_printf ("%02X", *(const unsigned char *)p);
99
102
        }
100
103
    }
101
104
}
102
105
 
103
106
 
104
107
char *
105
 
gpgsm_format_serial (ksba_const_sexp_t p)
 
108
gpgsm_format_serial (ksba_const_sexp_t sn)
106
109
{
 
110
  const char *p = (const char *)sn;
107
111
  unsigned long n;
108
112
  char *endp;
109
113
  char *buffer;
167
171
    {
168
172
      const unsigned char *s;
169
173
 
170
 
      for (s=string; *s; s++)
 
174
      for (s=(const unsigned char*)string; *s; s++)
171
175
        {
172
176
          if (*s < ' ' || (*s >= 0x7f && *s <= 0xa0))
173
177
            break;
189
193
gpgsm_dump_cert (const char *text, ksba_cert_t cert)
190
194
{
191
195
  ksba_sexp_t sexp;
192
 
  unsigned char *p;
 
196
  char *p;
193
197
  char *dn;
194
198
  ksba_isotime_t t;
195
199
 
259
263
  };
260
264
  const unsigned char *s, *s1;
261
265
  size_t n;
262
 
  unsigned char *p;
 
266
  char *p;
263
267
  int i;
264
268
 
265
269
  /* Parse attributeType */
305
309
        return NULL;
306
310
      for (s1=string; n; s1 += 2, n--, p++)
307
311
        {
308
 
          *p = xtoi_2 (s1);
 
312
          *(unsigned char *)p = xtoi_2 (s1);
309
313
          if (!*p)
310
314
            *p = 0x01; /* Better print a wrong value than truncating
311
315
                          the string. */
350
354
              s++;
351
355
              if (hexdigitp (s))
352
356
                {
353
 
                  *p++ = xtoi_2 (s);
 
357
                  *(unsigned char *)p++ = xtoi_2 (s);
354
358
                  s++;
355
359
                }
356
360
              else
484
488
void
485
489
gpgsm_print_name2 (FILE *fp, const char *name, int translate)
486
490
{
487
 
  const unsigned char *s;
 
491
  const unsigned char *s = (const unsigned char *)name;
488
492
  int i;
489
493
 
490
 
  s = name;
491
494
  if (!s)
492
495
    {
493
496
      fputs (_("[Error - No name]"), fp);
494
497
    }
495
498
  else if (*s == '<')
496
499
    {
497
 
      const unsigned char *s2 = strchr (s+1, '>');
 
500
      const char *s2 = strchr ( (char*)s+1, '>');
498
501
      if (s2)
499
502
        {
500
503
          if (translate)
501
 
            print_sanitized_utf8_buffer (fp, s + 1, s2 - s - 1, 0);
 
504
            print_sanitized_utf8_buffer (fp, s + 1, s2 - (char*)s - 1, 0);
502
505
          else
503
 
            print_sanitized_buffer (fp, s + 1, s2 - s - 1, 0);
 
506
            print_sanitized_buffer (fp, s + 1, s2 - (char*)s - 1, 0);
504
507
        }
505
508
    }
506
509
  else if (*s == '(')