source: npl/fileserver/smb-ldap-tool/modified/smbldap-usershow @ 1051986

perl-5.22
Last change on this file since 1051986 was c5c522c, checked in by Edwin Eefting <edwin@datux.nl>, 8 years ago

initial commit, transferred from cleaned syn3 svn tree

  • Property mode set to 100755
File size: 1.9 KB
Line 
1#!/usr/bin/perl -w
2
3# $Id: smbldap-usershow 4204 2008-10-17 13:17:15Z edwin $
4#
5#  This code was developped by IDEALX (http://IDEALX.org/) and
6#  contributors (their names can be found in the CONTRIBUTORS file).
7#
8#                 Copyright (C) 2001-2002 IDEALX
9#
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.
14#
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.
19#
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.
24
25# Purpose of smbldap-userdisplay : user (posix,shadow,samba) display
26
27use strict;
28use FindBin;
29use FindBin qw($RealBin);
30use lib "$RealBin/";
31use smbldap_tools;
32
33use Getopt::Std;
34my %Options;
35
36my $ok = getopts('?', \%Options);
37
38if ( (!$ok) || (@ARGV < 1) || ($Options{'?'}) ) {
39  print_banner;
40  print "Usage: $0 [-?] username\n";
41  print "  -?   show this help message\n";
42  exit (1);
43}
44
45# Read only first @ARGV
46my $user = $ARGV[0];
47
48my $ldap_slave=connect_ldap_master();
49
50my $lines = utf8Decode(read_user($user));
51
52if ($lines) {
53        print "$lines\n";
54} else {
55        print "user $user doesn't exist\n";
56        exit (1);
57}
58
59# take down session
60$ldap_slave->unbind;
61
62exit(0);
63
64############################################################
65
66=head1 NAME
67
68smbldap-usershow - Show a user account informations
69
70=head1 SYNOPSIS
71
72smbldap-usershow login
73
74=head1 DESCRIPTION
75
76The smbldap-usershow command displays the informations associated with the login. The named user must exist.
77
78=cut
79
80#'
Note: See TracBrowser for help on using the repository browser.