/usr/share/perl5/X500/DN.pm is in libx500-dn-perl 0.29-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | # Copyright (c) 2002 Robert Joop <yaph-070708@timesink.de>
# All rights reserved.
# This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
package X500::DN;
use 5.6.1; # the "our" keyword below needs it
use strict;
use Carp;
use Parse::RecDescent;
use X500::RDN;
our $VERSION = '0.29';
my $rfc2253_grammar = q {
startrule: DistinguishedName /^\\Z/ { new X500::DN (reverse (@{$item[1]})); }
DistinguishedName: name(?) { @{$item[1]} > 0 ? $item[1][0] : []; }
name: nameComponent(s /[,;]\\s*/)
nameComponent: attributeTypeAndValue(s /\\s*\\+\\s*/) { new X500::RDN (map { @$_ } @{$item[1]}); }
attributeTypeAndValue: attributeType /\\s*=\\s*/ attributeValue { [ @item[1,3] ]; }
attributeType: Alpha keychar(s?) { join ('', $item[1], @{$item[2]}); }
| oid
keychar: Alpha | Digit | '-'
#oid: rfc1779oidprefix(?) Digits(s /\\./) { join ('.', @{$item[2]}) }
#rfc1779oidprefix: /oid\\./i
oid: Digits(s /\\./) { join ('.', @{$item[1]}) }
Digits: Digit(s) { join ('', @{$item[1]}); }
attributeValue: string
string: (stringchar | pair)(s) { join ('', @{$item[1]}); }
| '#' hexstring { $item[2] }
| '"' (pair | quotechar)(s) '"' { join ('', @{$item[2]}); }
quotechar: /[^"]/
special: /[,=+<>#; ]/
pair: '\\\\' ( special | '\\\\' | '"' | hexpair ) { $item[2] }
stringchar: /[^,=+<>#;\\\\"]/
hexstring: hexpair(s) { join ('', @{$item[1]}); }
hexpair: /[0-9A-Fa-f]{2}/ { chr (hex ($item[1])) }
Alpha: /[A-Za-z]/
Digit: /[0-9]/
};
#$::RD_TRACE = 1;
#$::RD_HINT = 1;
local $::RD_AUTOACTION = q{ $item[1] };
local $Parse::RecDescent::skip = undef;
my $parser = new Parse::RecDescent ($rfc2253_grammar) or die "Bad RFC 2253 grammar!\n";
sub new
{
my $class = shift;
my $self = [ @_ ];
bless $self, $class;
return $self;
}
sub hasMultivaluedRDNs
{
my $self = shift;
return grep { $_->isMultivalued } @$self;
}
sub getRDN
{
my $self = shift;
my $i = shift;
return $self->[$i];
}
sub getRDNs
{
my $self = shift;
return @$self;
}
sub ParseRFC2253
{
my $class = shift;
my $text = shift;
my $self = $parser->startrule ($text);
return $self;
}
sub ParseOpenSSL
{
croak "use 'openssl -nameopt RFC2253' and ParseRFC2253()";
}
sub getRFC2253String
{
my $self = shift;
return join (', ', map { $_->getRFC2253String } reverse (@{$self}));
}
sub getX500String
{
my $self = shift;
return '{' . join (',', map { $_->getX500String } @{$self}) . '}';
}
sub getOpenSSLString
{
my $self = shift;
return join ('/', '', map { $_->getOpenSSLString } @{$self});
}
1;
|