added a wbtest program that shows how to access winbindd extended nss
[bbaumbach/samba-autobuild/.git] / examples / LDAP / smbldap-tools / smbldap-usershow.pl
1 #!/usr/bin/perl -w
2
3 #  This code was developped by IDEALX (http://IDEALX.org/) and
4 #  contributors (their names can be found in the CONTRIBUTORS file).
5 #
6 #                 Copyright (C) 2001-2002 IDEALX
7 #
8 #  This program is free software; you can redistribute it and/or
9 #  modify it under the terms of the GNU General Public License
10 #  as published by the Free Software Foundation; either version 2
11 #  of the License, or (at your option) any later version.
12 #
13 #  This program is distributed in the hope that it will be useful,
14 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
15 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 #  GNU General Public License for more details.
17 #
18 #  You should have received a copy of the GNU General Public License
19 #  along with this program; if not, write to the Free Software
20 #  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
21 #  USA.
22
23 # Purpose of smbldap-userdisplay : user (posix,shadow,samba) display
24
25 use strict;
26 use FindBin;
27 use FindBin qw($RealBin);
28 use lib "$RealBin/";
29 use smbldap_tools;
30
31 use Getopt::Std;
32 my %Options;
33
34 my $ok = getopts('?', \%Options);
35
36 if ( (!$ok) || (@ARGV < 1) || ($Options{'?'}) ) {
37         print "Usage: $0 [-?] username\n";
38         print "  -?     show this help message\n";
39         exit (1);
40 }
41
42 # Read only first @ARGV
43 my $user = $ARGV[0];
44
45 my $lines = read_user($user);
46 if (!defined($lines)) {
47     print "$0: user $user doesn't exist\n";
48     exit (1);
49 }
50
51 print "$lines\n";
52
53 exit(0);
54
55 ############################################################
56
57 =head1 NAME
58
59        smbldap-usershow.pl - Show a user account informations
60
61 =head1 SYNOPSIS
62
63        smbldap-usershow.pl login
64
65 =head1 DESCRIPTION
66
67        The smbldap-usershow.pl command displays the informations
68        associated with the login. The named user must exist.
69
70 =cut
71
72 #'