This file is indexed.

/usr/bin/cipux_storage_client is in cipux-storage-tools 3.4.0.2-6.

This file is owned by root:root, with mode 0o755.

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
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
#!/usr/bin/perl -w -T

eval 'exec /usr/bin/perl -w -T -S $0 ${1+"$@"}'
    if 0; # not running under some shell
# +=======================================================================+
# || cipux_storage_client                                                ||
# ||                                                                     ||
# || Command line interface for CipUX Storage abstraction layer.         ||
# ||                                                                     ||
# || Copyright (C) 2008 - 2009 by Christian Kuelker.                     ||
# ||                                                                     ||
# || GNU GPL version 2 or any later version.                             ||
# ||                                                                     ||
# +=======================================================================+
#  ID:       $Id$
#  Revision: $Revision$
#  Head URL: $HeadURL$
#  Date:     $Date$
#  Source:   $Source$

package cipux_storage_client; ## no critic (Capitalization)

use 5.008001;
use strict;
use warnings;
use CipUX::Storage::Client;
use version; our $VERSION = qv('3.4.0.2');
delete @ENV{qw(PATH IFS CDPATH ENV BASH_ENV)};    # Make %ENV safer

# +=============================================================================+
# || MAIN                                                                      ||
# +=============================================================================+
my $client = CipUX::Storage::Client->new( { name => 'cipux_storage_client' } );

$client->run();

exit 0;

__END__


=pod

=head1 NAME

cipux_storage_client - Command line interface to CipUX storage abstraction layer

=head1 VERSION

version 3.4.0.2

=head1 USAGE

 (1) cipux_storage_client -h
 (2) cipux_storage_client [OPT] -t get_value      -s <TYPE> -o <OBJ> -y <ATTR> [-y <ATTR>]
 (3) cipux_storage_client [OPT] -t get_all_values -s <TYPE>          -y <ATTR> [-y <ATTR>]
 (4) cipux_storage_client [OPT] -t set_value [-r] -s <TYPE> -o <OBJ> -y <ATTR> -v <VAL>
     cipux_storage_client [OPT] -t set_value  -a  -s <TYPE> -o <OBJ> -y <ATTR> -v <VAL>
     cipux_storage_client [OPT] -t set_value [-r] -s <TYPE> -o <OBJ> -y <ATTR=VAL> [-y <ATTR=VAL>]
     cipux_storage_client [OPT] -t set_value  -a  -s <TYPE> -o <OBJ> -y <ATTR=VAL> [-y <ATTR=VAL>]
     cipux_storage_client [OPT] -t set_value  -d  -s <TYPE> -o <OBJ> -y <ATTR> [-y <ATTR>]
     cipux_storage_client [OPT] -t set_value  -e  -s <TYPE> -o <OBJ> -y <ATTR>
 (5) cipux_storage_client [OPT] -t set_all_values [-r] -s <TYPE> -y <ATTR> -v <VAL>
     cipux_storage_client [OPT] -t set_all_values  -a  -s <TYPE> -y <ATTR> -v <VAL>
     cipux_storage_client [OPT] -t set_all_values [-r] -s <TYPE> -y <ATTR=VAL> [-y <ATTR=VAL>]
     cipux_storage_client [OPT] -t set_all_values  -a  -s <TYPE> -y <ATTR=VAL> [-y <ATTR=VAL>]
     cipux_storage_client [OPT] -t set_all_values  -d  -s <TYPE> -y <ATTR> [-y <ATTR>]
 (6) cipux_storage_client [OPT] -t add_node -s <TYPE> -o <OBJ> -x <ATTR=VAL> [-x <ATTR=VAL>]
 (7) cipux_storage_client [OPT] -t delete_node -s <TYPE> -o <OBJ>
 (8) cipux_storage_client [OPT] -t rename_node -s <TYPE> -o <OBJ> -v <VAL>
 abbreviations: OBJ = OBJECT, ATTR = ATTRIBUTE, VAL = VALUE, OPT = OPTIONS

=head1 OPTIONS

        Options for all commands:

        -c | --cfg             : cipux-storage-access.conf
        -D | --debug [<LEVEL>] : print debug messages for developers
        -h | --help            : print help (this message + options)
        -p | --pretty          : nice boxed output
        -V | --version         : print only version
             --verbose         : print more messages

        Options for some commands:

        -a | --add            : rather add then replace a value
        -d | --del            : delete the value of the attribute
        -e | --erase          : delete the attribute
        -l | --list           : lists configuration scopes, can be used for --type
        -o | --object         : LDAP object leaf
        -r | --replace        : replace a value, default behaviour
        -s | --storage_type   : configuration type
        -t | --storage_task   : action to perform
        -v | --value          : value to be set
        -x | --mattrvalue     : multiple LDAP attributes, please see description
        -y | --attrvalue      : LDAP attribute, please see description

=head1 REQUIRED ARGUMENTS

cipux_storage_client

  -t or -h

cipux_storage_client -t get_value

 -s <TYPE>
 -o <OBJ>
 -y <ATTR>

cipux_storage_client -t get_all_values

 -s <TYPE>
 -y <ATTR>

cipux_storage_client -t set_value

 -s <TYPE>
 -o <OBJ>
 -y <ATTR>

cipux_storage_client -t set_all_values

 -s <TYPE>
 -y <ATTR>
 -v <VAL>

cipux_storage_client -t add_node

 -s <TYPE>
 -o <OBJ>
 -x <ATTR=VAL>

cipux_storage_client -t delete_node

 -s <TYPE>
 -o <OBJ>

cipux_storage_client -t rename_node

 -s <TYPE>
 -o <OBJ>
 -v <VAL>


=head1 DESCRIPTION OF OPTIONS

=over 4

=item I<-a>

Same as option --add.

=item I<--add>

This adds a value where possible rather then replace a value.

=item I<--attrvalue>

This can be used to specify the attribute by

 --attrvalue <ATTRIBUTE>

Or it can be used to specify the attribute and the value

 --attrvalue <ATTRIBUTE>=<VALUE>

Of course it can also be use together with --value option
to specify the attribute and the value like this:

 --attrvalue <ATTRIBUTE> --value <VALUE>

=item I<-D>

Same as option --debug.

=item I<-d>

Same as option --del.

=item I<--del>

This deletes the attribute from the object where possible.

=item I<-e>

Same as option --erase

=item I<--erase>

Deletes the LDAP attribute of a given object. This will delete also all content
of this attribute. If the an object has multible values for that attribute all
values will be removed. If this is option is set, it will trigger --delete
command line option automatically.

=item I<-h>

Same as option --help

=item I<--help>

Prints brief help message.

=item I<--mattrvalue>

This is option have to be use if a LDAP object has to be created. Unlike
--attrvalue this option requires always an attribute and a value. Therefore
only this syntax is possible:

  --mattrvalue <ATTRIBUTE>=<VALUE>

The reason for this is to be able to gave the user exact hints when he try to
create a object but forget the value.

The 'm' stands for multiple. So it is possible to give the option several
times.

=item I<-o>

Same as option --object

=item I<--object>

This option is used to specify the object on which the command is operating.
Make sure you choose the right object. Of course this will also fail when the
object is not fetchable with (in the objects list of) --storage_type.

=item I<-p>

Same as option --pretty.

=item I<--pretty>

On command which produce an output, this option can be used to draw a fancy box
around the output.

=item I<-r>

Same as option --replace.

=item I<--replace>

For some command this is the default option. It replace the value of a given
attribute with a new value.

=item I<-s>

Same as option --storage_type.

=item I<--storage_task>

Name fo the action that can be performed. Valid actions are:

 get_all_values
 set_all_values
 add_node
 get_value
 set_value
 list
 delete_node
 rename_node

=item I<--storage_type>

This option defines the 'type of the object' the command is operating with. A
'type of object' is a certain set of objects with common attributes. For
example all POSIX account objects. You can easily define new types of objects
in the configuration file. The default location of this file is
/etc/cipux/cipux-storage-structure.conf.

=item I<-t>

Same as --storage_task.

=item I<-V>

Same as option --version.

=item I<--version>

Prints the version and exits.

=item I<--verbose>

Not implemented jet.

=item I<-l>

Same as option --list

=item I<--list>

Lists all object scopes. The object scopes are red from the configuration file.
The default location of the configuration file is
/usr/share/cipux/etc/cipux-storage.perl. One object type is needed for the
--storage_type option.

=item I<-v>

Same as option --verbose.

=item I<--value>

On some commands this is use to provide a value for an object or an attribute.

=item I<-x>

Same as option --mattrvalue.

=item I<-y>

Same as option --attrvalue.

=back

=head1 DESCRIPTION

This is the command line client for CipUX::Storage. It can be used to get
modify or delete CipUX storage objects.


=head1 COMMANDS

  cipux_storage_client -t get_value
  cipux_storage_client -t set_value
  cipux_storage_client -t get_all_values
  cipux_storage_client -t set_all_values
  cipux_storage_client -t add_node
  cipux_storage_client -t rename_node
  cipux_storage_client -t delete_node

=head2 cipux_storage_client -t get_value

Retrieve one or more LDAP values for every given attribute of a given object.

=head2 cipux_storage_client -t get_all_values

Retrieve one or more LDAP values for every given attribute of all objects in a
given object type.

=head2 cipux_storage_client -t set_value

(1) You can add values with cipux_storage_client -t set_value.

 cipux_storage_client -t set_value -s all_group_node -e memberUid -o testgroup -v login -a

But this make only a difference for LDAP attributes which can be there more
then one time.

  cipux_storage_client -t set_value -s all_group_node -e memberUid -o testgroup -v login1 -a
  cipux_storage_client -t set_value -s all_group_node -e memberUid -o testgroup -v login2 -a

This will result:

   memberUid: login1
   memberUid: login2

Where as the following lines have a different result:

 cipux_storage_client -t set_value -s all_group_node -e groupType -o testgruppe -v public -a

The resulting exception:

  attribute 'groupType' cannot have multiple values at ./cipux_storage_client -t set_value line 369

In this case you have to remove the -a option from your line or use -r.


(2) The default behavior is to replace values. Values can be replaces with:


 cipux_storage_client -t set_value -s all_group_node -e groupType -o testgruppe -v private

or

 cipux_storage_client -t set_value -s all_group_node -e groupType -o testgruppe -v private -r


This will replace the existing value with the new one.

But be aware (!), if you have 3 members in a group, for example:

   memberUid: login1
   memberUid: login2
   memberUid: login3

after command the command:

 cipux_storage_client -t set_value -s all_group_node -e memberUid -o testgroup -v login4

you will have only one member!

   memberUid: login4

Therefor the default behavior is to replace all but one value. The replace and
not the add is the default behavior, because it there are more single
attributes in LDAP and therefor the probability of failure will be less if
replace is the default behavior.

(3) Also LDAP attributes can be deleted. If you have 2 memberUid's for example
the delete operation will led to an exception:

 modify/delete: memberUid: no such value at ./cipux_storage_client -t set_value line 369

So to delete all (!) member you have to do two LDAP operations:

 cipux_storage_client -t set_value -s all_group_node -e memberUid -o testgroup -v login -r
 cipux_storage_client -t set_value -s all_group_node -e memberUid -o testgroup -v login -d

Where as the value from -v is not important.

=head2 cipux_storage_client -t set_all_values

Set all LDAP values of a given object and attribute.

=head2 cipux_storage_client -t add_node

Adds an LDAP node.

=head3 SYNOPIS

 cipux_storage_client -t add_node -s <TYPE> -o <NAME> -x <ATTR>=<VALUE> [-x <ATTR>=<VALUE> ...]

=head3 Usage example

 cipux_storage_client -t add_node -s cipux_room -o test1 -x objectClass=room -x objectClass=cipuxRoom -x cn=test1

If you do not provide cn=NAME for example, you will get the following exception:

 EXCEPTION mandatory attr [cn] is missing!
           Please provide -x or --mattrvalue command line option!
           Example: -x cn=<VALUE>

To add a user node (not a complete user account!) this will create a half
user account named testuser:

 cipux_storage_client -t add_node -s cipux_account.user -o testuser -x cipuxFirstname=test -x cipuxLastname=user -x objectClass=cipuxAccount -x objectClass=posixAccount -x objectClass=shadowAccount -x uid=testuser -x cn=testuser -x cipuxCreationDate=2007-10-26 -x uidNumber=20000 -x gidNumber=20000 -x homeDirectory=/home/testuser -x objectClass=imapUser -x mailMessageStore=/tmp -D 129

Of course this is just an example. It is not a good idea to give /tmp as mail
storage directory or use a static uidNumber. But this or a similar command can
be user to test the LDAP layer.

=head2 cipux_storage_client -t rename_node

The rename command sets upon the Net::LDAP command modrdn. And due to the fact
that simply rename a LDAP dn is not hole task of renaming an LDAP leaf the
command can rename only certain LDAP objects.

It can for example rename a cipuxConfiguration LDAP leaf. Before renaming it
looks basically like this:

 dn: cn=testconfig,ou=Configuration,ou=CipUX,dc=nodomain
 cipuxVariable: testvalue
 cn: testconfig
 objectClass: top
 objectClass: cipuxConfiguration

If you now issue the command:

 cipux_storage_client -t rename_node -s cipux_configuration -o testconfig -v myconfig

You will get

 dn: cn=myconfig,ou=Configuration,ou=CipUX,dc=nodomain
 cipuxVariable: testvalue
 cn: testconfig
 cn: myconfig
 objectClass: top
 objectClass: cipuxConfiguration

You noticed the 'cn' has doubled, since LDAP expect a corresponding 'cn' in
this LDAP object? There for this configuration has now two names. It should be
difficult to crate now a new 'testconfig'. You have to delete 'cn: testconfig'
attribute and value before you can create a new 'testconfig'.  Because this is
rather confusing, you should avoid renaming where possible.  Deleting an object
and recreate it is a safer way.


=head2 cipux_storage_client -t delete_node

Deletes a given LDAP node.

=head1 DIAGNOSTICS

TODO

=head1 EXIT STATUS

TODO

=head1 CONFIGURATION


 /usr/share/cipux/etc/cipux_storage.perl

=head1 DEPENDENCIES

CipUX::Storage::Client

=head1 INCOMPATIBILITIES

Not known.

=head1 BUGS AND LIMITATIONS

Not known.

=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  E<lt>christian.kuelker@cipworx.orgE<gt>

=head1 LICENSE AND COPYRIGHT

Copyright (C) 2008 - 2009 by Christian Kuelker

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

=cut