File Coverage

blib/lib/Plugtools/Plugins/Samba/setPass.pm
Criterion Covered Total %
statement 9 32 28.1
branch 0 8 0.0
condition n/a
subroutine 3 4 75.0
pod 1 1 100.0
total 13 45 28.8


line stmt bran cond sub pod time code
1             package Plugtools::Plugins::Samba::setPass;
2              
3 1     1   27909 use warnings;
  1         2  
  1         43  
4 1     1   7 use strict;
  1         3  
  1         40  
5 1     1   703 use Plugtools::Plugins::Samba;
  1         4  
  1         212  
6              
7             =head1 NAME
8              
9             Plugtools::Plugins::Samba::setPass - A Samba password setting plugin for Plugtools.
10              
11             =head1 VERSION
12              
13             Version 0.0.0
14              
15             =cut
16              
17             our $VERSION = '0.0.0';
18              
19              
20             =head1 SYNOPSIS
21              
22             This sets the required password attributes for use with Samba.
23              
24             This is for use with userSetPass.
25              
26             =head1 FUNCTIONS
27              
28             =head2 plugin
29              
30             The function that will be called by Plugtools.
31              
32             use Plugtools::Plugins::Samba::setPass;
33             %returned=Plugtools::Plugins::Samba::setPass->plugin(\%opts, \%args);
34            
35             if($returned{error}){
36             print "Error!\n";
37             }
38              
39             =cut
40              
41             sub plugin{
42 0     0 1   my %opts;
43 0 0         if(defined($_[1])){
44 0           %opts= %{$_[1]};
  0            
45 0           }; my %args;
46 0 0         if(defined($_[2])){
47 0           %args= %{$_[2]};
  0            
48             };
49            
50 0           my %returned;
51 0           $returned{error}=undef;
52              
53 0           my $pts = Plugtools::Plugins::Samba->new({
54             pt=>$opts{self},
55             ldap=>$opts{ldap}
56             });
57 0 0         if ($pts->{error}) {
58 0           $returned{error}=1;
59 0           $returned{errorString}='Unable to create new Plugtools::Plugins::Samba object. $pts->{error}="'.
60             $pts->{error}.'" $pts->{errorString}="'.$pts->{errorString}.'"';
61 0           warn('Plugtools-Plugins-Samba-setPass plugin:1: '.$returned{errorString});
62 0           return %returned;
63             }
64              
65             $pts->setPassEntry({
66 0           entry=>$opts{entry},
67             pass=>$args{pass},
68             });
69 0 0         if ($pts->{error}) {
70 0           $returned{error}=1;
71 0           $returned{errorString}='Plugtools::Plugins::Samba->setPassEntry errored. $pts->{error}="'.
72             $pts->{error}.'" $pts->{errorString}="'.$pts->{errorString}.'"';
73 0           warn('Plugtools-Plugins-Samba-setPass plugin:1: '.$returned{errorString});
74 0           return %returned;
75             }
76              
77 0           return %returned;
78             }
79              
80             =head1 ERROR CODES
81              
82             =head2 1
83              
84             Unable to create new Plugtools::Plugins::Samba object.
85              
86             =head2 2
87              
88             setPassEntry errored
89              
90             =head1 AUTHOR
91              
92             Zane C. Bowers, C<< >>
93              
94             =head1 BUGS
95              
96             Please report any bugs or feature requests to C, or through
97             the web interface at L. I will be notified, and then you'll
98             automatically be notified of progress on your bug as I make changes.
99              
100              
101              
102              
103             =head1 SUPPORT
104              
105             You can find documentation for this module with the perldoc command.
106              
107             perldoc Plugtools::Plugins::Samba::setPass
108              
109              
110             You can also look for information at:
111              
112             =over 4
113              
114             =item * RT: CPAN's request tracker
115              
116             L
117              
118             =item * AnnoCPAN: Annotated CPAN documentation
119              
120             L
121              
122             =item * CPAN Ratings
123              
124             L
125              
126             =item * Search CPAN
127              
128             L
129              
130             =back
131              
132              
133             =head1 ACKNOWLEDGEMENTS
134              
135              
136             =head1 COPYRIGHT & LICENSE
137              
138             Copyright 2009 Zane C. Bowers, all rights reserved.
139              
140             This program is free software; you can redistribute it and/or modify it
141             under the same terms as Perl itself.
142              
143              
144             =cut
145              
146             1; # End of Plugtools::Plugins::Samba::setPass