123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- #!/usr/bin/perl
- #####################################################
- # gdipuserget.pl
- #
- # This script dumps the data for a user in the GnuDIP
- # database.
- #
- # Return codes:
- # 0 - success
- # 1 - user does not exist
- # 2 - configuration problem
- #
- # See COPYING for licensing information.
- #
- #####################################################
- # PERL modules
- use strict;
- use Getopt::Std;
- # global variables
- use vars qw($conf $gnudipdir);
- # locate ourselves
- use FindBin;
- BEGIN {
- $gnudipdir = '';
- if ($FindBin::Bin =~ /(.*)\/.+?/) {
- $gnudipdir = $1;
- }
- }
- use lib "$gnudipdir/lib";
- # GnuDIP common subroutines
- use gdipmaint;
- use gdiplinemode;
- # process command line
- sub usage {
- print STDERR <<"EOQ";
- usage: gdipuserget.pl { -h | user domain }
- usage: Display GnuDIP user \"user\" within domain \"domain\".
- usage: -h: Print this usage message.
- EOQ
- }
- use vars qw/ $opt_h /;
- if (!getopts('h')) {
- usage();
- exit 2;
- }
- if ($opt_h) {
- usage();
- exit;
- }
- if (@ARGV ne 2) {
- usage();
- exit 2;
- }
- # hash reference for gdipmaint routine
- my %mainthash;
- my $maintinfo = \%mainthash;
- $$maintinfo{'username'} = $ARGV[0];
- $$maintinfo{'domain'} = $ARGV[1];
- # get preferences from config file
- $conf = getconf();
- # do it
- my $response = '';
- my $retcode = maintget($maintinfo, \$response);
- print STDOUT $response;
- exit $retcode;
|