line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyright (c) 2001-2004 Graham Barr . All rights reserved. |
2
|
|
|
|
|
|
|
# This program is free software; you can redistribute it and/or |
3
|
|
|
|
|
|
|
# modify it under the same terms as Perl itself. |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Net::LDAP::Control::ProxyAuth; |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
493
|
use Net::LDAP::Control; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
57
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our @ISA = qw(Net::LDAP::Control); |
10
|
|
|
|
|
|
|
our $VERSION = '1.09'; |
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
6
|
use Net::LDAP::Constant qw(LDAP_CONTROL_PROXYAUTHORIZATION); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
46
|
|
13
|
1
|
|
|
1
|
|
6
|
use Net::LDAP::ASN qw(proxyAuthValue); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
8
|
|
14
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
465
|
|
15
|
|
|
|
|
|
|
|
16
|
0
|
|
|
0
|
0
|
0
|
sub LDAP_CONTROL_PROXYAUTHORIZATION_OLD { '2.16.840.1.113730.3.4.12'; } |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub init { |
19
|
2
|
|
|
2
|
1
|
4
|
my($self) = @_; |
20
|
|
|
|
|
|
|
|
21
|
2
|
|
|
|
|
10
|
delete $self->{asn}; |
22
|
|
|
|
|
|
|
|
23
|
2
|
50
|
|
|
|
6
|
if (defined($self->{proxyDN})) { |
24
|
0
|
|
|
|
|
0
|
$self->{type} = LDAP_CONTROL_PROXYAUTHORIZATION_OLD; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
$self->{asn} = { proxyDN => $self->{proxyDN} || '' } |
27
|
0
|
0
|
0
|
|
|
0
|
unless (exists $self->{value}); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
else { |
30
|
|
|
|
|
|
|
$self->{value} = $self->{authzID} || '' |
31
|
2
|
50
|
0
|
|
|
6
|
unless (exists $self->{value}); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# criticality must be set ! |
35
|
2
|
|
|
|
|
3
|
$self->{critical} = 1; |
36
|
|
|
|
|
|
|
|
37
|
2
|
|
|
|
|
7
|
$self; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub proxyDN { |
42
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
43
|
|
|
|
|
|
|
|
44
|
0
|
0
|
|
|
|
0
|
if (@_) { |
|
|
0
|
|
|
|
|
|
45
|
0
|
|
|
|
|
0
|
delete $self->{value}; |
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
0
|
$self->{type} = LDAP_CONTROL_PROXYAUTHORIZATION_OLD; |
48
|
0
|
|
0
|
|
|
0
|
return $self->{asn}{proxyDN} = shift || ''; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
elsif ($self->{type} eq LDAP_CONTROL_PROXYAUTHORIZATION) { |
51
|
0
|
|
|
|
|
0
|
$self->{error} = 'Illegal query method: use authzID()'; |
52
|
0
|
|
|
|
|
0
|
return undef; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
else { |
55
|
0
|
|
0
|
|
|
0
|
$self->{asn} ||= $proxyAuthValue->decode($self->{value}); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
0
|
$self->{asn}{proxyDN}; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub authzID { |
63
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
64
|
|
|
|
|
|
|
|
65
|
0
|
0
|
|
|
|
0
|
if (@_) { |
|
|
0
|
|
|
|
|
|
66
|
0
|
|
|
|
|
0
|
delete $self->{value}; |
67
|
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
0
|
$self->{type} = LDAP_CONTROL_PROXYAUTHORIZATION; |
69
|
0
|
|
0
|
|
|
0
|
return $self->{authzID} = shift || ''; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
elsif ($self->{type} eq LDAP_CONTROL_PROXYAUTHORIZATION_OLD) { |
72
|
0
|
|
|
|
|
0
|
$self->{error} = 'Illegal query method: use proxyDN()'; |
73
|
0
|
|
|
|
|
0
|
return undef; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
else { |
76
|
0
|
|
0
|
|
|
0
|
$self->{authzID} ||= $self->{value}; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
0
|
|
|
|
|
0
|
$self->{authzID}; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub value { |
84
|
2
|
|
|
2
|
1
|
4
|
my $self = shift; |
85
|
|
|
|
|
|
|
|
86
|
2
|
50
|
|
|
|
5
|
unless (exists $self->{value}) { |
87
|
|
|
|
|
|
|
$self->{value} = ($self->{type} eq LDAP_CONTROL_PROXYAUTHORIZATION_OLD) |
88
|
|
|
|
|
|
|
? $proxyAuthValue->encode($self->{asn}) |
89
|
0
|
0
|
0
|
|
|
0
|
: $self->{authzID} || ''; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
2
|
|
|
|
|
4
|
return $self->{value}; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
# make sure criticality remains TRUE |
96
|
|
|
|
|
|
|
sub critical { |
97
|
2
|
|
|
2
|
1
|
6
|
1; |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
1; |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
__END__ |