Samba 3: added Samba 3.0.24 sources
[tomato.git] / release / src / router / samba3 / examples / LDAP / smbldap-tools-0.9.2 / smbldap-usershow
blob23a4ed1421717c1ac4579c83cab6b9f14f8397ca
1 #!/usr/bin/perl -w
3 # $Id: smbldap-usershow,v 1.9 2005/10/31 15:05:22 jtournier Exp $
5 # This code was developped by IDEALX (http://IDEALX.org/) and
6 # contributors (their names can be found in the CONTRIBUTORS file).
8 # Copyright (C) 2001-2002 IDEALX
10 # This program is free software; you can redistribute it and/or
11 # modify it under the terms of the GNU General Public License
12 # as published by the Free Software Foundation; either version 2
13 # of the License, or (at your option) any later version.
15 # This program is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with this program; if not, write to the Free Software
22 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
23 # USA.
25 # Purpose of smbldap-userdisplay : user (posix,shadow,samba) display
27 use strict;
28 use FindBin;
29 use FindBin qw($RealBin);
30 use lib "$RealBin/";
31 use smbldap_tools;
33 use Getopt::Std;
34 my %Options;
36 my $ok = getopts('?', \%Options);
38 if ( (!$ok) || (@ARGV < 1) || ($Options{'?'}) ) {
39 print_banner;
40 print "Usage: $0 [-?] username\n";
41 print " -? show this help message\n";
42 exit (1);
45 # Read only first @ARGV
46 my $user = $ARGV[0];
48 my $ldap_slave=connect_ldap_slave();
50 my $lines = utf8Decode(read_user($user));
52 if ($lines) {
53 print "$lines\n";
54 } else {
55 print "user $user doesn't exist\n";
56 exit (1);
59 # take down session
60 $ldap_slave->unbind;
62 exit(0);
64 ############################################################
66 =head1 NAME
68 smbldap-usershow - Show a user account informations
70 =head1 SYNOPSIS
72 smbldap-usershow login
74 =head1 DESCRIPTION
76 The smbldap-usershow command displays the informations associated with the login. The named user must exist.
78 =cut