This file is indexed.

/usr/share/perl5/CipUX/Passwd.pm is in libcipux-passwd-perl 3.4.0.3-2.

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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
# +========================================================================+
# || module: CipUX::Passwd                                                ||
# ||                                                                      ||
# || Module for cipuxpasswd skript. XML-RPC client to change own          ||
# || password.                                                            ||
# ||                                                                      ||
# || Copyright (C) 2009 by Christian Kuelker                              ||
# ||                                                                      ||
# || License: GNU General Public License - GPL version 2                  ||
# ||          or (at you opinion) any later version.                      ||
# ||                                                                      ||
# +========================================================================+
#  ID:       $Id$
#  Revision: $Revision$
#  Head URL: $HeadURL$
#  Date:     $Date$
#  Source:   $Source$

package CipUX::Passwd;

use warnings;
use strict;
use CipUX::RPC::Client;
use Class::Std;
use English qw( -no_match_vars);
use Readonly;

use base qw(CipUX);

{    # BEGIN CLASS

    use version; our $VERSION = qv('3.4.0.3');
    use re 'taint';    # Keep data captured by parens tainted
    delete @ENV{qw(PATH IFS CDPATH ENV BASH_ENV)};    # Make %ENV safer

    # +======================================================================+
    # || CONST                                                              ||
    # +======================================================================+
    Readonly::Scalar my $EMPTY_STRING       => q{};
    Readonly::Scalar my $CIPUX_DEFAULT_PORT => 8001;

    # +======================================================================+
    # || OBJECT                                                             ||
    # +======================================================================+
    my %cipuxpasswd_cfg : ATTR( :get<cipuxpasswd_cfg> );
    my %name_of : ATTR( init_arg => 'name');

    # +======================================================================+
    # || GLOBAL                                                             ||
    # +======================================================================+
    my $debug = 0;
    my $url   = $EMPTY_STRING;
    my $host  = 'localhost';
    my $port  = $CIPUX_DEFAULT_PORT;
    my $ssl   = 0;

    # +======================================================================+
    # || CONSTRUCTOR                                                        ||
    # +======================================================================+
    sub BUILD {

        # +------------------------------------------------------------------+
        # | API
        my ( $self, $ident, $arg_r ) = @_;

        # add prefix for cfg, if needed
        my $pref
            = ( exists $arg_r->{pref} )
            ? $self->l( $arg_r->{pref} )
            : $EMPTY_STRING;

        # +------------------------------------------------------------------+
        # | main

        # Enable this lines, if you would like to use storage configuration
        # with cache.
        # (With cache you have to set rights for /var/cache/cipux accordingly
        #  if you would like to use this programm with other then root.
        #  Example: chown -R root:admin /var/cache/cipux &&
        #           chmod -R g+rX /var/cache/cipux )
        #$cipuxpasswd_cfg{$ident}
        #    = $self->cfg( { 'sub' => 'storage', pref => $pref } );

        # +------------------------------------------------------------------+
        # | API
        return;
    }

    # +======================================================================+
    # || DESTRUCTOR                                                         ||
    # +======================================================================+
    sub DEMOLISH {

        # +------------------------------------------------------------------+
        # | API
        my ( $self, $ident ) = @_;

        # +------------------------------------------------------------------+
        # | main
        delete $cipuxpasswd_cfg{$ident};
        delete $name_of{ ident $self};

        # +------------------------------------------------------------------+
        # | API
        return;

    }

    # +======================================================================+
    # || run                                                                ||
    # +======================================================================+
    sub run {

        # +------------------------------------------------------------------+
        # | API
        my ( $self, $arg_r ) = @_;

        # +------------------------------------------------------------------+
        # | prepare

        # config overwrites global variables:
        $host
            = ( exists $cipuxpasswd_cfg{ ident $self}->{host} )
            ? $cipuxpasswd_cfg{ ident $self}->{host}
            : 'localhost';

        $port
            = ( exists $cipuxpasswd_cfg{ ident $self}->{port} )
            ? $cipuxpasswd_cfg{ ident $self}->{port}
            : $CIPUX_DEFAULT_PORT;

        $ssl
            = ( exists $cipuxpasswd_cfg{ ident $self}->{ssl} )
            ? $cipuxpasswd_cfg{ ident $self}->{ssl}
            : 0;

        # url  = 'https://localhost:8000/RPC2';
        # url  = 'http://localhost:8001/RPC2';
        my $proto = 'http';
        if ($ssl) {
            $proto = 'https';
        }

        $url
            = $proto . q{://}
            . $self->l($host) . q{:}
            . $self->l($port)
            . q{/RPC2};

        my $prompt = "$name_of{ ident $self}:";

        # +------------------------------------------------------------------+
        # | main

        my $rpc = CipUX::RPC::Client->new(
            {
                url     => $url,
                client  => $name_of{ ident $self},
                version => "$VERSION"
            }
        );

        if ( $rpc->rpc_ping() ) {
            $self->out("$prompt Server [$url] is available.\n");
        }
        else {
            $self->out("$prompt Server [$url] is NOT available.\n");
            return 0;
        }

        if ( $rpc->rpc_login() ) {
            $self->out("$prompt Authentication sucessful.\n");
        }
        else {
            $self->out("$prompt Login or password wrong!\n");
            return 0;
        }
        my $login = $rpc->get_login();
        $self->out("$prompt Please type two times an identical password.\n");
        my $cipux   = CipUX->new();
        my $npwmsg1 = "$prompt New password: ";
        my $p1      = $cipux->password_prompt( { prompt => $npwmsg1 } );
        my $npwmsg2 = "$prompt Re-enter new password: ";
        my $p2      = $cipux->password_prompt( { prompt => $npwmsg2 } );

        my $error = "$prompt ERROR:";
        my $todo  = ' Please try again.';

        if (    defined $p1
            and $p1 ne $EMPTY_STRING
            and $p1 eq $p2
            and $rpc->rpc_selfpasswd( { password => $p1 } ) )
        {
            $self->out("$prompt Password information changed for $login.\n");
        }
        else {
            $self->out("$prompt Set password was not sucessful.\n");
        }

        if ( not defined $p1 or $p1 eq $EMPTY_STRING ) {
            $self->out("$error First input is not given!$todo\n");
        }
        if ( not defined $p2 or $p2 eq $EMPTY_STRING ) {
            $self->out("$error Second input is not given!$todo\n");
        }

        if ( $p1 ne $p2 ) {
            $self->out("$error The two inputs are not identical!$todo\n");
        }

        if ( $rpc->rpc_logout() ) {
            $self->out("$prompt Logout sucessful.\n");
        }

        # +------------------------------------------------------------------+
        # | API
        return 1;

    }

}    # END INSIDE OUT CLASS

1;   # Magic true value required at end of module

__END__

=pod

=for stopwords cipuxpasswd RPC XML-RPC CipUX Destructor webpage Kuelker

=head1 NAME

CipUX::Passwd - XML-RPC client to change own password


=head1 VERSION

This document describes CipUX::Passwd version 3.4.0.3


=head1 SYNOPSIS

 use warnings;
 use strict;
 use CipUX::Passwd;
 use version; our $VERSION = qv('3.4.0.0');

 my $cipux = CipUX::Passwd->new( { name=>'cipuxpasswd' } );

 $cipux->run();

 exit 0;

=head1 DESCRIPTION

Implements a XML-RPC client to change once own password using the CipUX XML-RPC
server.

=head1 SUBROUTINES/METHODS

=head2 BUILD

Constructor.


=head2 DEMOLISH

Destructor.

=head2 run

Main subroutine.


=head1 DIAGNOSTICS

=over

=item C<< First input is not given! Please try again >>

=item C<< Second input is not given! Please try again >>

=item C<< The two inputs are not identical! Please try again >>

=back

=head1 CONFIGURATION AND ENVIRONMENT

CipUX::Passwd requires no configuration files or environment
variables. However if there is a configuration file it will be used.


=head1 DEPENDENCIES

        CipUX
        CipUX::RPC::Client
        Class::Std
        English
        Readonly
        version


=head1 INCOMPATIBILITIES

None reported.


=head1 BUGS AND LIMITATIONS

No bugs have been reported.


=head1 SEE ALSO

See the CipUX webpage and the manual at L<http://www.cipux.org>

See the mailing list L<http://sympa.cipworx.org/wws/info/cipux-devel>


=head1 AUTHOR

Christian Kuelker  christian.kuelker@cipworx.org

=head1 LICENSE AND COPYRIGHT

Copyright (C) 2009, Christian Kuelker. All rights reserved.

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.

This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA

=head1 DISCLAIMER OF WARRANTY

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENSE, BE
LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL,
OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.

=cut