diff -Nru ldapscripts-2.0.7/CHANGELOG ldapscripts-2.0.8/CHANGELOG --- ldapscripts-2.0.7/CHANGELOG 2016-06-20 09:55:03.000000000 +0000 +++ ldapscripts-2.0.8/CHANGELOG 2017-05-12 18:42:24.000000000 +0000 @@ -1,3 +1,9 @@ +2017/05/12 : ldapscripts 2.0.8 + - Honour LDAPSCRIPTS_CONF environment variable + => Reported by James Valleroy on Github (closes issue #6) + - Rename a user's group memberships when renaming a user + => Reported by Peter Walz on Github (closes issue #7) + 2016/06/20 : ldapscripts 2.0.7 - Fix Ubuntu bug #1292143 Remove a user from his secondary groups when deleting him diff -Nru ldapscripts-2.0.7/debian/changelog ldapscripts-2.0.8/debian/changelog --- ldapscripts-2.0.7/debian/changelog 2017-01-01 06:55:43.000000000 +0000 +++ ldapscripts-2.0.8/debian/changelog 2017-08-02 05:58:09.000000000 +0000 @@ -1,3 +1,18 @@ +ldapscripts (2.0.8-1ubuntu1) artful; urgency=medium + + * Merge from Debian unstable. Remaining changes: + - debian/runtime.debian: replaced /etc/libnss-ldap.conf references by + /etc/ldap.conf. + + -- Bhavani Shankar Wed, 02 Aug 2017 11:27:24 +0530 + +ldapscripts (2.0.8-1) unstable; urgency=medium + + * New upstream version 2.0.8 + * debian/patches refreshed. + + -- Alexander GQ Gerasiov Thu, 27 Jul 2017 18:12:35 +0300 + ldapscripts (2.0.7-2ubuntu1) zesty; urgency=medium * Merge from Debian unstable. Remaining changes: diff -Nru ldapscripts-2.0.7/debian/patches/02_debian_config.patch ldapscripts-2.0.8/debian/patches/02_debian_config.patch --- ldapscripts-2.0.7/debian/patches/02_debian_config.patch 2016-11-07 22:21:22.000000000 +0000 +++ ldapscripts-2.0.8/debian/patches/02_debian_config.patch 2017-07-27 22:18:36.000000000 +0000 @@ -102,13 +102,13 @@ # on your system. Leave blank or comment for auto-guess. --- a/lib/runtime +++ b/lib/runtime -@@ -720,6 +720,9 @@ +@@ -729,6 +729,9 @@ ### Source configuration file +_RUNTIME_DEBIAN="/usr/share/ldapscripts/runtime.debian" +. "$_RUNTIME_DEBIAN" || end_die "Unable to source runtime.debian, exiting..." + - _CONFIGFILE="/etc/ldapscripts/ldapscripts.conf" + _CONFIGFILE=${LDAPSCRIPTS_CONF:="/etc/ldapscripts/ldapscripts.conf"} . "$_CONFIGFILE" || end_die "Unable to source configuration file ($_CONFIGFILE), exiting..." diff -Nru ldapscripts-2.0.7/debian/patches/03_fix_manpages.patch ldapscripts-2.0.8/debian/patches/03_fix_manpages.patch --- ldapscripts-2.0.7/debian/patches/03_fix_manpages.patch 2016-11-07 22:21:22.000000000 +0000 +++ ldapscripts-2.0.8/debian/patches/03_fix_manpages.patch 2017-07-27 22:18:36.000000000 +0000 @@ -4,11 +4,9 @@ in filter example. Forwarded: not-needed -Index: ldapscripts/man/man5/ldapscripts.5 -=================================================================== ---- ldapscripts.orig/man/man5/ldapscripts.5 2011-03-21 16:32:22.000000000 +0300 -+++ ldapscripts/man/man5/ldapscripts.5 2011-03-21 16:40:46.000000000 +0300 -@@ -73,4 +73,4 @@ +--- a/man/man5/ldapscripts.5 ++++ b/man/man5/ldapscripts.5 +@@ -75,4 +75,4 @@ .B "Additional information: value does not conform to assertion syntax". Setting slapd's debug level to 32 shows additional details : .B "get_ava: illegal value for attributeType uidNumber". diff -Nru ldapscripts-2.0.7/etc/ldapscripts.conf ldapscripts-2.0.8/etc/ldapscripts.conf --- ldapscripts-2.0.7/etc/ldapscripts.conf 2016-06-20 07:11:00.000000000 +0000 +++ ldapscripts-2.0.8/etc/ldapscripts.conf 2017-03-22 16:16:38.000000000 +0000 @@ -1,5 +1,5 @@ # Copyright (C) 2005 Ganaël LAPLANCHE - Linagora -# Copyright (C) 2006-2016 Ganaël LAPLANCHE +# Copyright (C) 2006-2017 Ganaël LAPLANCHE # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff -Nru ldapscripts-2.0.7/lib/runtime ldapscripts-2.0.8/lib/runtime --- ldapscripts-2.0.7/lib/runtime 2016-06-20 07:11:00.000000000 +0000 +++ ldapscripts-2.0.8/lib/runtime 2017-03-22 16:16:38.000000000 +0000 @@ -1,7 +1,7 @@ # runtime : this file is used by the ldapscripts, it sould not be used independently # Copyright (C) 2005 Ganaël LAPLANCHE - Linagora -# Copyright (C) 2006-2016 Ganaël LAPLANCHE +# Copyright (C) 2006-2017 Ganaël LAPLANCHE # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -327,7 +327,9 @@ # User attributes s||$_USER|g s||$_UID|g +s||$_NEWUID|g s||$_UDN|g +s||$_NEWUDN|g s||$_GID|g s||$_HOMEDIR|g s||$USHELL|g @@ -727,7 +729,7 @@ ### Source configuration file -_CONFIGFILE="/etc/ldapscripts/ldapscripts.conf" +_CONFIGFILE=${LDAPSCRIPTS_CONF:="/etc/ldapscripts/ldapscripts.conf"} . "$_CONFIGFILE" || end_die "Unable to source configuration file ($_CONFIGFILE), exiting..." ### Checks and defaults ### diff -Nru ldapscripts-2.0.7/Makefile ldapscripts-2.0.8/Makefile --- ldapscripts-2.0.7/Makefile 2016-06-20 07:11:00.000000000 +0000 +++ ldapscripts-2.0.8/Makefile 2017-03-22 16:16:38.000000000 +0000 @@ -1,6 +1,6 @@ # Makefile for the lapscripts -# Copyright (C) 2007-2016 Ganaël LAPLANCHE +# Copyright (C) 2007-2017 Ganaël LAPLANCHE # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -25,7 +25,7 @@ SHELL= /bin/sh NAME = ldapscripts #SUFFIX = -devel -VERSION = 2.0.7 +VERSION = 2.0.8 # Default installation paths SBINDIR = $(PREFIX)/sbin @@ -83,10 +83,10 @@ # Configure target configure: @echo -n 'Configuring scripts... ' - @sed 's|^BINDPWDFILE=.*|BINDPWDFILE=\"$(ETCDIR)/$(PWDFILE)\"|g' 'etc/$(ETCFILE)' > 'etc/$(ETCFILE).patched' - @sed 's|^_CONFIGFILE=.*|_CONFIGFILE=\"$(ETCDIR)/$(ETCFILE)\"|g' 'lib/$(RUNFILE)' > 'lib/$(RUNFILE).patched' + @sed 's|^BINDPWDFILE=.*|BINDPWDFILE="$(ETCDIR)/$(PWDFILE)"|g' 'etc/$(ETCFILE)' > 'etc/$(ETCFILE).patched' + @sed '/^_CONFIGFILE=/s|^\(.*"\).*\(".*\)|\1$(ETCDIR)/$(ETCFILE)\2|g' 'lib/$(RUNFILE)' > 'lib/$(RUNFILE).patched' @for i in $(SBINFILES) ; do \ - sed 's|^_RUNTIMEFILE=.*|_RUNTIMEFILE=\"$(LIBDIR)/$(RUNFILE)\"|g' "sbin/$$i" > "sbin/$$i.patched" ; \ + sed 's|^_RUNTIMEFILE=.*|_RUNTIMEFILE="$(LIBDIR)/$(RUNFILE)"|g' "sbin/$$i" > "sbin/$$i.patched" ; \ done @echo 'ok.' diff -Nru ldapscripts-2.0.7/man/man1/ldapaddgroup.1 ldapscripts-2.0.8/man/man1/ldapaddgroup.1 --- ldapscripts-2.0.7/man/man1/ldapaddgroup.1 2016-06-20 07:11:00.000000000 +0000 +++ ldapscripts-2.0.8/man/man1/ldapaddgroup.1 2017-03-22 16:16:38.000000000 +0000 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2006-2016 Ganaël LAPLANCHE +.\" Copyright (C) 2006-2017 Ganaël LAPLANCHE .\" .\" This program is free software; you can redistribute it and/or .\" modify it under the terms of the GNU General Public License diff -Nru ldapscripts-2.0.7/man/man1/ldapaddmachine.1 ldapscripts-2.0.8/man/man1/ldapaddmachine.1 --- ldapscripts-2.0.7/man/man1/ldapaddmachine.1 2016-06-20 07:11:00.000000000 +0000 +++ ldapscripts-2.0.8/man/man1/ldapaddmachine.1 2017-03-22 16:16:38.000000000 +0000 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2006-2016 Ganaël LAPLANCHE +.\" Copyright (C) 2006-2017 Ganaël LAPLANCHE .\" .\" This program is free software; you can redistribute it and/or .\" modify it under the terms of the GNU General Public License diff -Nru ldapscripts-2.0.7/man/man1/ldapadduser.1 ldapscripts-2.0.8/man/man1/ldapadduser.1 --- ldapscripts-2.0.7/man/man1/ldapadduser.1 2016-06-20 07:11:00.000000000 +0000 +++ ldapscripts-2.0.8/man/man1/ldapadduser.1 2017-03-22 16:16:38.000000000 +0000 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2006-2016 Ganaël LAPLANCHE +.\" Copyright (C) 2006-2017 Ganaël LAPLANCHE .\" .\" This program is free software; you can redistribute it and/or .\" modify it under the terms of the GNU General Public License diff -Nru ldapscripts-2.0.7/man/man1/ldapaddusertogroup.1 ldapscripts-2.0.8/man/man1/ldapaddusertogroup.1 --- ldapscripts-2.0.7/man/man1/ldapaddusertogroup.1 2016-06-20 07:11:00.000000000 +0000 +++ ldapscripts-2.0.8/man/man1/ldapaddusertogroup.1 2017-03-22 16:16:38.000000000 +0000 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2006-2016 Ganaël LAPLANCHE +.\" Copyright (C) 2006-2017 Ganaël LAPLANCHE .\" .\" This program is free software; you can redistribute it and/or .\" modify it under the terms of the GNU General Public License diff -Nru ldapscripts-2.0.7/man/man1/ldapdeletegroup.1 ldapscripts-2.0.8/man/man1/ldapdeletegroup.1 --- ldapscripts-2.0.7/man/man1/ldapdeletegroup.1 2016-06-20 07:11:00.000000000 +0000 +++ ldapscripts-2.0.8/man/man1/ldapdeletegroup.1 2017-03-22 16:16:38.000000000 +0000 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2006-2016 Ganaël LAPLANCHE +.\" Copyright (C) 2006-2017 Ganaël LAPLANCHE .\" .\" This program is free software; you can redistribute it and/or .\" modify it under the terms of the GNU General Public License diff -Nru ldapscripts-2.0.7/man/man1/ldapdeletemachine.1 ldapscripts-2.0.8/man/man1/ldapdeletemachine.1 --- ldapscripts-2.0.7/man/man1/ldapdeletemachine.1 2016-06-20 07:11:00.000000000 +0000 +++ ldapscripts-2.0.8/man/man1/ldapdeletemachine.1 2017-03-22 16:16:38.000000000 +0000 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2006-2016 Ganaël LAPLANCHE +.\" Copyright (C) 2006-2017 Ganaël LAPLANCHE .\" .\" This program is free software; you can redistribute it and/or .\" modify it under the terms of the GNU General Public License diff -Nru ldapscripts-2.0.7/man/man1/ldapdeleteuser.1 ldapscripts-2.0.8/man/man1/ldapdeleteuser.1 --- ldapscripts-2.0.7/man/man1/ldapdeleteuser.1 2016-06-20 07:11:00.000000000 +0000 +++ ldapscripts-2.0.8/man/man1/ldapdeleteuser.1 2017-03-22 16:16:38.000000000 +0000 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2006-2016 Ganaël LAPLANCHE +.\" Copyright (C) 2006-2017 Ganaël LAPLANCHE .\" .\" This program is free software; you can redistribute it and/or .\" modify it under the terms of the GNU General Public License diff -Nru ldapscripts-2.0.7/man/man1/ldapdeleteuserfromgroup.1 ldapscripts-2.0.8/man/man1/ldapdeleteuserfromgroup.1 --- ldapscripts-2.0.7/man/man1/ldapdeleteuserfromgroup.1 2016-06-20 07:11:00.000000000 +0000 +++ ldapscripts-2.0.8/man/man1/ldapdeleteuserfromgroup.1 2017-03-22 16:16:38.000000000 +0000 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2006-2016 Ganaël LAPLANCHE +.\" Copyright (C) 2006-2017 Ganaël LAPLANCHE .\" .\" This program is free software; you can redistribute it and/or .\" modify it under the terms of the GNU General Public License diff -Nru ldapscripts-2.0.7/man/man1/ldapfinger.1 ldapscripts-2.0.8/man/man1/ldapfinger.1 --- ldapscripts-2.0.7/man/man1/ldapfinger.1 2016-06-20 07:11:00.000000000 +0000 +++ ldapscripts-2.0.8/man/man1/ldapfinger.1 2017-03-22 16:16:38.000000000 +0000 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2007-2016 Ganaël LAPLANCHE +.\" Copyright (C) 2007-2017 Ganaël LAPLANCHE .\" .\" This program is free software; you can redistribute it and/or .\" modify it under the terms of the GNU General Public License diff -Nru ldapscripts-2.0.7/man/man1/ldapgid.1 ldapscripts-2.0.8/man/man1/ldapgid.1 --- ldapscripts-2.0.7/man/man1/ldapgid.1 2016-06-20 07:11:00.000000000 +0000 +++ ldapscripts-2.0.8/man/man1/ldapgid.1 2017-03-22 16:16:38.000000000 +0000 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2009-2016 Ganaël LAPLANCHE +.\" Copyright (C) 2009-2017 Ganaël LAPLANCHE .\" .\" This program is free software; you can redistribute it and/or .\" modify it under the terms of the GNU General Public License diff -Nru ldapscripts-2.0.7/man/man1/ldapid.1 ldapscripts-2.0.8/man/man1/ldapid.1 --- ldapscripts-2.0.7/man/man1/ldapid.1 2016-06-20 07:11:00.000000000 +0000 +++ ldapscripts-2.0.8/man/man1/ldapid.1 2017-03-22 16:16:38.000000000 +0000 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2008-2016 Ganaël LAPLANCHE +.\" Copyright (C) 2008-2017 Ganaël LAPLANCHE .\" .\" This program is free software; you can redistribute it and/or .\" modify it under the terms of the GNU General Public License diff -Nru ldapscripts-2.0.7/man/man1/ldapinit.1 ldapscripts-2.0.8/man/man1/ldapinit.1 --- ldapscripts-2.0.7/man/man1/ldapinit.1 2016-06-20 07:11:00.000000000 +0000 +++ ldapscripts-2.0.8/man/man1/ldapinit.1 2017-03-22 16:16:38.000000000 +0000 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2006-2016 Ganaël LAPLANCHE +.\" Copyright (C) 2006-2017 Ganaël LAPLANCHE .\" .\" This program is free software; you can redistribute it and/or .\" modify it under the terms of the GNU General Public License diff -Nru ldapscripts-2.0.7/man/man1/ldapmodifygroup.1 ldapscripts-2.0.8/man/man1/ldapmodifygroup.1 --- ldapscripts-2.0.7/man/man1/ldapmodifygroup.1 2016-06-20 07:11:00.000000000 +0000 +++ ldapscripts-2.0.8/man/man1/ldapmodifygroup.1 2017-03-22 16:16:38.000000000 +0000 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2007-2016 Ganaël LAPLANCHE +.\" Copyright (C) 2007-2017 Ganaël LAPLANCHE .\" .\" This program is free software; you can redistribute it and/or .\" modify it under the terms of the GNU General Public License diff -Nru ldapscripts-2.0.7/man/man1/ldapmodifymachine.1 ldapscripts-2.0.8/man/man1/ldapmodifymachine.1 --- ldapscripts-2.0.7/man/man1/ldapmodifymachine.1 2016-06-20 07:11:00.000000000 +0000 +++ ldapscripts-2.0.8/man/man1/ldapmodifymachine.1 2017-03-22 16:16:38.000000000 +0000 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2007-2016 Ganaël LAPLANCHE +.\" Copyright (C) 2007-2017 Ganaël LAPLANCHE .\" .\" This program is free software; you can redistribute it and/or .\" modify it under the terms of the GNU General Public License diff -Nru ldapscripts-2.0.7/man/man1/ldapmodifyuser.1 ldapscripts-2.0.8/man/man1/ldapmodifyuser.1 --- ldapscripts-2.0.7/man/man1/ldapmodifyuser.1 2016-06-20 07:11:00.000000000 +0000 +++ ldapscripts-2.0.8/man/man1/ldapmodifyuser.1 2017-03-22 16:16:38.000000000 +0000 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2007-2016 Ganaël LAPLANCHE +.\" Copyright (C) 2007-2017 Ganaël LAPLANCHE .\" .\" This program is free software; you can redistribute it and/or .\" modify it under the terms of the GNU General Public License diff -Nru ldapscripts-2.0.7/man/man1/ldaprenamegroup.1 ldapscripts-2.0.8/man/man1/ldaprenamegroup.1 --- ldapscripts-2.0.7/man/man1/ldaprenamegroup.1 2016-06-20 07:11:00.000000000 +0000 +++ ldapscripts-2.0.8/man/man1/ldaprenamegroup.1 2017-03-22 16:16:38.000000000 +0000 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2006-2016 Ganaël LAPLANCHE +.\" Copyright (C) 2006-2017 Ganaël LAPLANCHE .\" .\" This program is free software; you can redistribute it and/or .\" modify it under the terms of the GNU General Public License diff -Nru ldapscripts-2.0.7/man/man1/ldaprenamemachine.1 ldapscripts-2.0.8/man/man1/ldaprenamemachine.1 --- ldapscripts-2.0.7/man/man1/ldaprenamemachine.1 2016-06-20 07:11:00.000000000 +0000 +++ ldapscripts-2.0.8/man/man1/ldaprenamemachine.1 2017-03-22 16:16:38.000000000 +0000 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2006-2016 Ganaël LAPLANCHE +.\" Copyright (C) 2006-2017 Ganaël LAPLANCHE .\" .\" This program is free software; you can redistribute it and/or .\" modify it under the terms of the GNU General Public License diff -Nru ldapscripts-2.0.7/man/man1/ldaprenameuser.1 ldapscripts-2.0.8/man/man1/ldaprenameuser.1 --- ldapscripts-2.0.7/man/man1/ldaprenameuser.1 2016-06-20 07:11:00.000000000 +0000 +++ ldapscripts-2.0.8/man/man1/ldaprenameuser.1 2017-03-22 16:16:38.000000000 +0000 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2006-2016 Ganaël LAPLANCHE +.\" Copyright (C) 2006-2017 Ganaël LAPLANCHE .\" .\" This program is free software; you can redistribute it and/or .\" modify it under the terms of the GNU General Public License diff -Nru ldapscripts-2.0.7/man/man1/ldapsetpasswd.1 ldapscripts-2.0.8/man/man1/ldapsetpasswd.1 --- ldapscripts-2.0.7/man/man1/ldapsetpasswd.1 2016-06-20 07:11:00.000000000 +0000 +++ ldapscripts-2.0.8/man/man1/ldapsetpasswd.1 2017-03-22 16:16:38.000000000 +0000 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2006-2016 Ganaël LAPLANCHE +.\" Copyright (C) 2006-2017 Ganaël LAPLANCHE .\" .\" This program is free software; you can redistribute it and/or .\" modify it under the terms of the GNU General Public License diff -Nru ldapscripts-2.0.7/man/man1/ldapsetprimarygroup.1 ldapscripts-2.0.8/man/man1/ldapsetprimarygroup.1 --- ldapscripts-2.0.7/man/man1/ldapsetprimarygroup.1 2016-06-20 07:11:00.000000000 +0000 +++ ldapscripts-2.0.8/man/man1/ldapsetprimarygroup.1 2017-03-22 16:16:38.000000000 +0000 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2006-2016 Ganaël LAPLANCHE +.\" Copyright (C) 2006-2017 Ganaël LAPLANCHE .\" .\" This program is free software; you can redistribute it and/or .\" modify it under the terms of the GNU General Public License diff -Nru ldapscripts-2.0.7/man/man1/lsldap.1 ldapscripts-2.0.8/man/man1/lsldap.1 --- ldapscripts-2.0.7/man/man1/lsldap.1 2016-06-20 07:11:00.000000000 +0000 +++ ldapscripts-2.0.8/man/man1/lsldap.1 2017-03-22 16:16:38.000000000 +0000 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2006-2016 Ganaël LAPLANCHE +.\" Copyright (C) 2006-2017 Ganaël LAPLANCHE .\" .\" This program is free software; you can redistribute it and/or .\" modify it under the terms of the GNU General Public License diff -Nru ldapscripts-2.0.7/man/man5/ldapscripts.5 ldapscripts-2.0.8/man/man5/ldapscripts.5 --- ldapscripts-2.0.7/man/man5/ldapscripts.5 2016-06-20 07:11:00.000000000 +0000 +++ ldapscripts-2.0.8/man/man5/ldapscripts.5 2017-03-22 16:16:38.000000000 +0000 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2006-2016 Ganaël LAPLANCHE +.\" Copyright (C) 2006-2017 Ganaël LAPLANCHE .\" .\" This program is free software; you can redistribute it and/or .\" modify it under the terms of the GNU General Public License @@ -31,7 +31,9 @@ The main requirements are the OpenLDAP client tools (ldapadd, ldapsearch, ldapdelete, ...). Other commands are called in the scripts but should come with your OS (sed, grep, cut, ...). .SH CONFIGURATION -The main configuration of the ldapscripts is usually the file /etc/ldapscripts/ldapscripts.conf (or /usr/local/etc/ldapscripts/ldapscripts.conf, depending on your system). Modify it to fit your needs before using the scripts. Each script also uses a "runtime" file, usually /usr/lib/ldapscripts/runtime (or /usr/local/lib/ldapscripts/runtime). You don't need to modify this file. +The main configuration of the ldapscripts is usually the file /etc/ldapscripts/ldapscripts.conf (or /usr/local/etc/ldapscripts/ldapscripts.conf, depending on your system). Modify it to fit your needs before using the scripts. You can override that default path by defining the LDAPSCRIPTS_CONF environment variable. + +Each script also uses a "runtime" file, usually /usr/lib/ldapscripts/runtime (or /usr/local/lib/ldapscripts/runtime). You don't need to modify this file. .SH TEMPLATES Each script that adds information to the directory uses a template. Templates are directly embedded at the end of the scripts but it is also possible to use external template files (see GTEMPLATE, UTEMPLATE and MTEMPLATE variables in the configuration file). Each template consists of a preformatted LDIF file using special keywords that will be replaced on-the-fly. Sample files are provided for your convenience : ldapaddgroup.template.sample, ldapadduser.template.sample and ldapaddmachine.template.sample. It is strongly advised to use those files instead of modifying the embedded (default) templates in the scripts. diff -Nru ldapscripts-2.0.7/README ldapscripts-2.0.8/README --- ldapscripts-2.0.7/README 2016-06-20 07:11:00.000000000 +0000 +++ ldapscripts-2.0.8/README 2017-03-22 16:16:38.000000000 +0000 @@ -130,6 +130,12 @@ sbin/ldapid : displays a user's list of IDs sbin/ldapgid : displays a group's list of IDs +Environment : +************* + +You can set the LDAPSCRIPTS_CONF environment variable to override default +configuration file's location. + Author / Licence : ****************** diff -Nru ldapscripts-2.0.7/sbin/ldapaddgroup ldapscripts-2.0.8/sbin/ldapaddgroup --- ldapscripts-2.0.7/sbin/ldapaddgroup 2016-06-20 07:11:00.000000000 +0000 +++ ldapscripts-2.0.8/sbin/ldapaddgroup 2017-03-22 16:16:38.000000000 +0000 @@ -3,7 +3,7 @@ # ldapaddgroup : adds a POSIX group entry to LDAP # Copyright (C) 2005 Ganaël LAPLANCHE - Linagora -# Copyright (C) 2006-2016 Ganaël LAPLANCHE +# Copyright (C) 2006-2017 Ganaël LAPLANCHE # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff -Nru ldapscripts-2.0.7/sbin/ldapaddmachine ldapscripts-2.0.8/sbin/ldapaddmachine --- ldapscripts-2.0.7/sbin/ldapaddmachine 2016-06-20 07:11:00.000000000 +0000 +++ ldapscripts-2.0.8/sbin/ldapaddmachine 2017-03-22 16:16:38.000000000 +0000 @@ -3,7 +3,7 @@ # ldapaddmachine : adds a POSIX machine (user$) account to LDAP # Copyright (C) 2005 Ganaël LAPLANCHE - Linagora -# Copyright (C) 2006-2016 Ganaël LAPLANCHE +# Copyright (C) 2006-2017 Ganaël LAPLANCHE # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff -Nru ldapscripts-2.0.7/sbin/ldapadduser ldapscripts-2.0.8/sbin/ldapadduser --- ldapscripts-2.0.7/sbin/ldapadduser 2016-06-20 07:11:00.000000000 +0000 +++ ldapscripts-2.0.8/sbin/ldapadduser 2017-03-22 16:16:38.000000000 +0000 @@ -3,7 +3,7 @@ # ldapadduser : adds a POSIX user account to LDAP # Copyright (C) 2005 Ganaël LAPLANCHE - Linagora -# Copyright (C) 2006-2016 Ganaël LAPLANCHE +# Copyright (C) 2006-2017 Ganaël LAPLANCHE # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff -Nru ldapscripts-2.0.7/sbin/ldapaddusertogroup ldapscripts-2.0.8/sbin/ldapaddusertogroup --- ldapscripts-2.0.7/sbin/ldapaddusertogroup 2016-06-20 07:11:00.000000000 +0000 +++ ldapscripts-2.0.8/sbin/ldapaddusertogroup 2017-03-22 16:16:38.000000000 +0000 @@ -3,7 +3,7 @@ # ldapaddusertogroup : adds a member to a group in LDAP # Copyright (C) 2005 Ganaël LAPLANCHE - Linagora -# Copyright (C) 2006-2016 Ganaël LAPLANCHE +# Copyright (C) 2006-2017 Ganaël LAPLANCHE # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff -Nru ldapscripts-2.0.7/sbin/ldapdeletegroup ldapscripts-2.0.8/sbin/ldapdeletegroup --- ldapscripts-2.0.7/sbin/ldapdeletegroup 2016-06-20 07:11:00.000000000 +0000 +++ ldapscripts-2.0.8/sbin/ldapdeletegroup 2017-03-22 16:16:38.000000000 +0000 @@ -3,7 +3,7 @@ # ldapdeletegroup : deletes a POSIX group account from LDAP # Copyright (C) 2005 Ganaël LAPLANCHE - Linagora -# Copyright (C) 2006-2016 Ganaël LAPLANCHE +# Copyright (C) 2006-2017 Ganaël LAPLANCHE # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff -Nru ldapscripts-2.0.7/sbin/ldapdeletemachine ldapscripts-2.0.8/sbin/ldapdeletemachine --- ldapscripts-2.0.7/sbin/ldapdeletemachine 2016-06-20 07:11:00.000000000 +0000 +++ ldapscripts-2.0.8/sbin/ldapdeletemachine 2017-03-22 16:16:38.000000000 +0000 @@ -3,7 +3,7 @@ # ldapdeletemachine : deletes a POSIX machine (user$) account from LDAP # Copyright (C) 2005 Ganaël LAPLANCHE - Linagora -# Copyright (C) 2006-2016 Ganaël LAPLANCHE +# Copyright (C) 2006-2017 Ganaël LAPLANCHE # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff -Nru ldapscripts-2.0.7/sbin/ldapdeleteuser ldapscripts-2.0.8/sbin/ldapdeleteuser --- ldapscripts-2.0.7/sbin/ldapdeleteuser 2016-06-20 07:11:00.000000000 +0000 +++ ldapscripts-2.0.8/sbin/ldapdeleteuser 2017-03-22 16:16:38.000000000 +0000 @@ -3,7 +3,7 @@ # ldapdeleteuser : deletes a POSIX user account from LDAP # Copyright (C) 2005 Ganaël LAPLANCHE - Linagora -# Copyright (C) 2006-2016 Ganaël LAPLANCHE +# Copyright (C) 2006-2017 Ganaël LAPLANCHE # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -50,7 +50,7 @@ case $GCLASS in posixGroup) _findentries "$GSUFFIX,$SUFFIX" "(&(objectClass=posixGroup)(memberUid=$_UID))" - echo "$_ENTRIES" | \ + [ -n "$_ENTRIES" ] && echo "$_ENTRIES" | \ while read _ENTRY do echo_log "Deleting user from secondary group: $_ENTRY" @@ -60,7 +60,7 @@ ;; *) _findentries "$GSUFFIX,$SUFFIX" "(&(objectClass=$GCLASS)($_GMEMBERATTR=$_UDN))" - echo "$_ENTRIES" | \ + [ -n "$_ENTRIES" ] && echo "$_ENTRIES" | \ while read _ENTRY do echo_log "Deleting user from secondary group: $_ENTRY" diff -Nru ldapscripts-2.0.7/sbin/ldapdeleteuserfromgroup ldapscripts-2.0.8/sbin/ldapdeleteuserfromgroup --- ldapscripts-2.0.7/sbin/ldapdeleteuserfromgroup 2016-06-20 07:11:00.000000000 +0000 +++ ldapscripts-2.0.8/sbin/ldapdeleteuserfromgroup 2017-03-22 16:16:38.000000000 +0000 @@ -3,7 +3,7 @@ # ldapdeleteuserfromgroup : deletes a member from a group in LDAP # Copyright (C) 2005 Ganaël LAPLANCHE - Linagora -# Copyright (C) 2006-2016 Ganaël LAPLANCHE +# Copyright (C) 2006-2017 Ganaël LAPLANCHE # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff -Nru ldapscripts-2.0.7/sbin/ldapfinger ldapscripts-2.0.8/sbin/ldapfinger --- ldapscripts-2.0.7/sbin/ldapfinger 2016-06-20 07:11:00.000000000 +0000 +++ ldapscripts-2.0.8/sbin/ldapfinger 2017-03-22 16:16:38.000000000 +0000 @@ -2,7 +2,7 @@ # ldapfinger : displays a user/machine/group POSIX account's details -# Copyright (C) 2006-2016 Ganaël LAPLANCHE +# Copyright (C) 2006-2017 Ganaël LAPLANCHE # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff -Nru ldapscripts-2.0.7/sbin/ldapgid ldapscripts-2.0.8/sbin/ldapgid --- ldapscripts-2.0.7/sbin/ldapgid 2016-06-20 07:11:00.000000000 +0000 +++ ldapscripts-2.0.8/sbin/ldapgid 2017-03-22 16:16:38.000000000 +0000 @@ -2,7 +2,7 @@ # ldapgid : displays a group's list of IDs -# Copyright (C) 2009-2016 Ganaël LAPLANCHE +# Copyright (C) 2009-2017 Ganaël LAPLANCHE # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff -Nru ldapscripts-2.0.7/sbin/ldapid ldapscripts-2.0.8/sbin/ldapid --- ldapscripts-2.0.7/sbin/ldapid 2016-06-20 07:11:00.000000000 +0000 +++ ldapscripts-2.0.8/sbin/ldapid 2017-03-22 16:16:38.000000000 +0000 @@ -2,7 +2,7 @@ # ldapid : displays a user's list of IDs -# Copyright (C) 2008-2016 Ganaël LAPLANCHE +# Copyright (C) 2008-2017 Ganaël LAPLANCHE # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff -Nru ldapscripts-2.0.7/sbin/ldapinit ldapscripts-2.0.8/sbin/ldapinit --- ldapscripts-2.0.7/sbin/ldapinit 2016-06-20 07:11:00.000000000 +0000 +++ ldapscripts-2.0.8/sbin/ldapinit 2017-03-22 16:16:38.000000000 +0000 @@ -3,7 +3,7 @@ # ldapinit : initializes the LDAP directory with a minimal tree # Copyright (C) 2005 Ganaël LAPLANCHE - Linagora -# Copyright (C) 2006-2016 Ganaël LAPLANCHE +# Copyright (C) 2006-2017 Ganaël LAPLANCHE # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff -Nru ldapscripts-2.0.7/sbin/ldapmodifygroup ldapscripts-2.0.8/sbin/ldapmodifygroup --- ldapscripts-2.0.7/sbin/ldapmodifygroup 2016-06-20 07:11:00.000000000 +0000 +++ ldapscripts-2.0.8/sbin/ldapmodifygroup 2017-03-22 16:16:38.000000000 +0000 @@ -2,7 +2,7 @@ # ldapmodifygroup : modifies a POSIX group account in LDAP interactively -# Copyright (C) 2007-2016 Ganaël LAPLANCHE +# Copyright (C) 2007-2017 Ganaël LAPLANCHE # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff -Nru ldapscripts-2.0.7/sbin/ldapmodifymachine ldapscripts-2.0.8/sbin/ldapmodifymachine --- ldapscripts-2.0.7/sbin/ldapmodifymachine 2016-06-20 07:11:00.000000000 +0000 +++ ldapscripts-2.0.8/sbin/ldapmodifymachine 2017-03-22 16:16:38.000000000 +0000 @@ -2,7 +2,7 @@ # ldapmodifymachine : modifies a POSIX machine account in LDAP interactively -# Copyright (C) 2007-2016 Ganaël LAPLANCHE +# Copyright (C) 2007-2017 Ganaël LAPLANCHE # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff -Nru ldapscripts-2.0.7/sbin/ldapmodifyuser ldapscripts-2.0.8/sbin/ldapmodifyuser --- ldapscripts-2.0.7/sbin/ldapmodifyuser 2016-06-20 07:11:00.000000000 +0000 +++ ldapscripts-2.0.8/sbin/ldapmodifyuser 2017-03-22 16:16:38.000000000 +0000 @@ -2,7 +2,7 @@ # ldapmodifyuser : modifies a POSIX user account in LDAP interactively -# Copyright (C) 2007-2016 Ganaël LAPLANCHE +# Copyright (C) 2007-2017 Ganaël LAPLANCHE # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff -Nru ldapscripts-2.0.7/sbin/ldaprenamegroup ldapscripts-2.0.8/sbin/ldaprenamegroup --- ldapscripts-2.0.7/sbin/ldaprenamegroup 2016-06-20 07:11:00.000000000 +0000 +++ ldapscripts-2.0.8/sbin/ldaprenamegroup 2017-03-22 16:16:38.000000000 +0000 @@ -2,7 +2,7 @@ # ldaprenamegroup : renames a POSIX group in LDAP -# Copyright (C) 2006-2016 Ganaël LAPLANCHE +# Copyright (C) 2006-2017 Ganaël LAPLANCHE # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff -Nru ldapscripts-2.0.7/sbin/ldaprenamemachine ldapscripts-2.0.8/sbin/ldaprenamemachine --- ldapscripts-2.0.7/sbin/ldaprenamemachine 2016-06-20 07:11:00.000000000 +0000 +++ ldapscripts-2.0.8/sbin/ldaprenamemachine 2017-03-22 16:16:38.000000000 +0000 @@ -2,7 +2,7 @@ # ldaprenamemachine : renames a POSIX machine account in LDAP -# Copyright (C) 2006-2016 Ganaël LAPLANCHE +# Copyright (C) 2006-2017 Ganaël LAPLANCHE # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff -Nru ldapscripts-2.0.7/sbin/ldaprenameuser ldapscripts-2.0.8/sbin/ldaprenameuser --- ldapscripts-2.0.7/sbin/ldaprenameuser 2016-06-20 07:11:00.000000000 +0000 +++ ldapscripts-2.0.8/sbin/ldaprenameuser 2017-03-22 16:16:38.000000000 +0000 @@ -2,7 +2,7 @@ # ldaprenameuser : renames a POSIX user account in LDAP -# Copyright (C) 2006-2016 Ganaël LAPLANCHE +# Copyright (C) 2006-2017 Ganaël LAPLANCHE # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -37,6 +37,66 @@ _findentry "$USUFFIX,$SUFFIX" "(&(objectClass=posixAccount)(|(uid=$1)(uidNumber=$1)))" [ -z "$_ENTRY" ] && end_die "User $1 not found in LDAP" +# Store _UID and _UDN for filters +if [ "$GCLASS" = "posixGroup" ] +then + _getattribute "$_ENTRY" "uid" + [ -z "$_ATTRIBUTE" ] && end_die "Error getting user attribute from LDAP (uid)" + _UID="$_ATTRIBUTE" +fi +_UDN="$_ENTRY" + # Rename entry _ldaprename "$_ENTRY" "uid=$2" || end_die "Error renaming user $_ENTRY to $2 in LDAP" -end_ok "Successfully renamed user $_ENTRY to $2 in LDAP" + +# Store _NEWUID and _NEWUDN for filters +_findentry "$USUFFIX,$SUFFIX" "(&(objectClass=posixAccount)(uid=$2))" +[ -z "$_ENTRY" ] && end_die "Renamed user $2 not found in LDAP" +_NEWUID="$2" +_NEWUDN="$_ENTRY" + +# Finally, rename this user in all his secondary groups +case $GCLASS in + posixGroup) + _findentries "$GSUFFIX,$SUFFIX" "(&(objectClass=posixGroup)(memberUid=$_UID))" + [ -n "$_ENTRIES" ] && echo "$_ENTRIES" | \ + while read _ENTRY + do + echo_log "Renaming user in secondary group: $_ENTRY" + # Modify group entry + _extractldif 2 | _filterldif | _utf8encode | _ldapmodify + done + ;; + *) + _findentries "$GSUFFIX,$SUFFIX" "(&(objectClass=$GCLASS)($_GMEMBERATTR=$_UDN))" + [ -n "$_ENTRIES" ] && echo "$_ENTRIES" | \ + while read _ENTRY + do + echo_log "Renaming user in secondary group: $_ENTRY" + # Modify group entry + _extractldif 3 | _filterldif | _utf8encode | _ldapmodify + done + ;; +esac + +end_ok "Successfully renamed user $_UDN to $_NEWUID in LDAP" + +# Ldif templates ################################# +# +# PosixGroup (level "2") : +##dn: +##changetype: modify +##delete: +##: +##- +##add: +##: +# +# Others (level "3") : +###dn: +###changetype: modify +###delete: +###: +###- +###add: +###: diff -Nru ldapscripts-2.0.7/sbin/ldapsetpasswd ldapscripts-2.0.8/sbin/ldapsetpasswd --- ldapscripts-2.0.7/sbin/ldapsetpasswd 2016-06-20 07:11:00.000000000 +0000 +++ ldapscripts-2.0.8/sbin/ldapsetpasswd 2017-03-22 16:16:38.000000000 +0000 @@ -2,7 +2,7 @@ # ldapsetpasswd : modifies a POSIX user account's password in LDAP -# Copyright (C) 2006-2016 Ganaël LAPLANCHE +# Copyright (C) 2006-2017 Ganaël LAPLANCHE # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff -Nru ldapscripts-2.0.7/sbin/ldapsetprimarygroup ldapscripts-2.0.8/sbin/ldapsetprimarygroup --- ldapscripts-2.0.7/sbin/ldapsetprimarygroup 2016-06-20 07:11:00.000000000 +0000 +++ ldapscripts-2.0.8/sbin/ldapsetprimarygroup 2017-03-22 16:16:38.000000000 +0000 @@ -3,7 +3,7 @@ # ldapsetprimarygroup : modifies the gidNumber of a POSIX user or machine account in LDAP # Copyright (C) 2005 Ganaël LAPLANCHE - Linagora -# Copyright (C) 2006-2016 Ganaël LAPLANCHE +# Copyright (C) 2006-2017 Ganaël LAPLANCHE # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff -Nru ldapscripts-2.0.7/sbin/lsldap ldapscripts-2.0.8/sbin/lsldap --- ldapscripts-2.0.7/sbin/lsldap 2016-06-20 07:11:00.000000000 +0000 +++ ldapscripts-2.0.8/sbin/lsldap 2017-03-22 16:16:38.000000000 +0000 @@ -3,7 +3,7 @@ # lsldap : performs a *big* query on the LDAP directory # Copyright (C) 2005 Ganaël LAPLANCHE - Linagora -# Copyright (C) 2006-2016 Ganaël LAPLANCHE +# Copyright (C) 2006-2017 Ganaël LAPLANCHE # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License diff -Nru ldapscripts-2.0.7/VERSION ldapscripts-2.0.8/VERSION --- ldapscripts-2.0.7/VERSION 2016-06-20 10:19:56.000000000 +0000 +++ ldapscripts-2.0.8/VERSION 2017-05-12 18:49:30.000000000 +0000 @@ -1 +1 @@ -2.0.7 +2.0.8