#!/usr/bin/perl -w # This code was developped by Jerome Tournier (jtournier@gmail.com) and # contributors (their names can be found in the CONTRIBUTORS file). # This was first contributed by IDEALX (http://www.opentrust.com/) # 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 # of the License, 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. # Purpose of smbldap-usermod : user (posix,shadow,samba) modification use strict; use FindBin; use FindBin qw($RealBin); use lib "$RealBin/"; use smbldap_tools; use Time::Local; ##################### use Getopt::Std; use Getopt::Long; my %Options; my $nscd_status; Getopt::Long::Configure('bundling'); my $ok=GetOptions ( "A|sambaPwdCanChange=s" => \$Options{A}, "B|sambaPwdMustChange=s" => \$Options{B}, "C|sambaHomePath=s" => \$Options{C}, "D|sambaHomeDrive=s" => \$Options{D}, "E|sambaLogonScript=s" => \$Options{E}, "F|sambaProfilePath=s" => \$Options{F}, "G|group=s" => \$Options{G}, "H|sambaAcctFlags=s" => \$Options{H}, "I|sambaDisable" => \$Options{I}, "J|sambaEnable" => \$Options{J}, "L|shadowLock" => \$Options{L}, "M|mailAddresses=s" => \$Options{M}, "N|givenName=s" => \$Options{N}, "P=s" => \$Options{P}, "U|shadowUnlock" => \$Options{U}, "S|surname=s" => \$Options{S}, "T|mailToAddress=s" => \$Options{T}, "a|addsambaSAMAccount" => \$Options{a}, "c|gecos=s" => \$Options{c}, "d|homedir=s" => \$Options{d}, "e|sambaExpire=s" => \$Options{e}, "g|gid=s" => \$Options{g}, "h|help" => \$Options{h}, "o|canBeNotUnique" => \$Options{o}, "r|rename=s" => \$Options{r}, "s|shell=s" => \$Options{s}, "shadowExpire=s" => \$Options{shadowExpire}, "shadowMax=s" => \$Options{shadowMax}, "shadowMin=s" => \$Options{shadowMin}, "shadowInactive=s" => \$Options{shadowInactive}, "shadowWarning=s" => \$Options{shadowWarning}, "u|uid=s" => \$Options{u} ); #my $ok = getopts('A:B:C:D:E:F:H:IJM:N:S:PT:ame:f:u:g:G:d:l:r:s:c:ok:?h', \%Options); if ( (!$ok) || (@ARGV < 1) || ($Options{'h'}) ) { print_banner; print "Usage: $0 [options] username\n\n"; print "Available UNIX options are:\n"; print " -c|--gecos gecos\n"; print " -d|--homedir home directory\n"; print " -r|--rename username\n"; print " -u|--uid uid\n"; print " -o|--canBeNotUnique uid can be non unique\n"; print " -g|--gid supplementary groups (comma separated)\n"; print " -s|--shell shell\n"; print " -N|--givenName given name (first name)\n"; print " -S|--surname surname (family name)\n"; print " -P ends by invoking smbldap-passwd\n"; print " -M|--mailAddresses mailAddresses (comma seperated)\n"; print " -T|--mailToAddress mailToAddress (forward address) (comma seperated)\n"; print " --shadowExpire Shadow expiration date(like \"YYYY-MM-DD\")\n"; print " --shadowMax User must change the password, at least, every 'n' days\n"; print " --shadowMin user must wait 'n' days once the password has changed before changing it again\n"; print " --shadowInactive number of days of inactivity allowed for the specified user\n"; print " --shadowWarning User is warned that the password must be changed four days before the password expires\n"; print " -L|--shadowLock lock unix user's password\n"; print " -U|--shadowUnlock unlock unix user's password\n"; print "\n"; print "Available SAMBA options are:\n"; print " -a|--addsambaSAMAccount add sambaSAMAccount objectclass\n"; print " -e|--sambaExpire expire date (\"YYYY-MM-DD\")\n"; print " -A|--sambaPwdCanChange can change password ? 0 if no, 1 if yes\n"; print " -B|--sambaPwdMustChange must change password ? 0 if no, 1 if yes\n"; print " -C|--sambaHomePath sambaHomePath (SMB home share, like '\\\\PDC-SRV\\homes')\n"; print " -D|--sambaHomeDrive sambaHomeDrive (letter associated with home share, like 'H:')\n"; print " -E|--sambaLogonScript