stephan: server/kolab/kolab/namespace/libexec adduser, NONE, 1.1 deluser, NONE, 1.1 listusers, NONE, 1.1 showlog, NONE, 1.1 showuser, NONE, 1.1 start, NONE, 1.1 stop, NONE, 1.1 newconfig, 1.1, 1.2 services, 1.1, 1.2
cvs at intevation.de
cvs at intevation.de
Wed Nov 3 12:27:18 CET 2004
Author: stephan
Update of /kolabrepository/server/kolab/kolab/namespace/libexec
In directory doto:/tmp/cvs-serv25137/kolab/namespace/libexec
Modified Files:
newconfig services
Added Files:
adduser deluser listusers showlog showuser start stop
Log Message:
Add utilities and further refinements for the namespace tool
--- NEW FILE: adduser ---
## Copyright (c) 2004 Code Fusion cc
##
## 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, 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 can view the GNU General Public License, online, at the GNU
## Project's homepage; see <http://www.gnu.org/licenses/gpl.html>.
##
if [ ".$1" = ".--showhelp" ]; then
echo "Add a user mailbox"
exit 0
HASHELP
fi
#Collect some vitals
SERVER=127.0.0.1
PREFIX=@l_prefix@
BINDDN=`cat $PREFIX/etc/kolab/kolab.conf | grep "bind_dn :" | sed -e "s;bind_dn : ;;"`
BINDPW=`cat $PREFIX/etc/kolab/kolab.conf | grep "bind_pw :" | sed -e "s;bind_pw : ;;"`
BASEDN=`cat $PREFIX/etc/kolab/kolab.conf | grep "base_dn :" | sed -e "s;base_dn : ;;"`
HOMESERV=`cat $PREFIX/etc/kolab/kolab.conf | grep "fqdnhostname :" | sed -e "s;fqdnhostname : ;;"`
echo "Please specify the firstname:"
read FIRSTNAME
echo "Please specify the lastname:"
read LASTNAME
echo "Please specify the email address:"
read EMAIL
echo "Please specify the password:"
read PASSWORD
echo "Please specify the quota (kb):"
read QUOTA
CN="$FIRSTNAME $LASTNAME"
SN="$LASTNAME"
#Sanity checks
if test "$FIRSTNAME" = ""; then
echo "You must specify a firstname"
exit 255
fi
if test "$LASTNAME" = ""; then
echo "You must specify a lastname"
exit 255
fi
if test "$EMAIL" = ""; then
echo "You must specify a valid mail address"
exit 255
fi
if test "$PASSWORD" = ""; then
echo "You must specify a password"
exit 255
fi
#Echo to user - last chance
echo "--"
echo "About to add the following user:"
echo "Name: $CN"
echo "Mail: $EMAIL"
echo "Password: $PASSWORD"
if test "$QUOTA" != ""; then
echo "Quota: ${QUOTA}kb"
fi
echo "--"
#Check if the user already exists
DN=`$PREFIX/bin/kolab showuser $EMAIL | grep dn`
if test "$DN" != ""; then
echo User already found! Or other error occurred.
exit 255
fi
echo "Are you sure you want to procede? (y/n)"
read ANS
if test "$ANS" != "y"; then
echo Aborted
exit 255
fi
#Create the ldif
LDIFFILE="/tmp/cfadduser.ldif"
trap "rm $LDIFFILE" 0 1 2 3 15
cat <<LDIF > $LDIFFILE
dn: cn=$CN,$BASEDN
objectClass: top
objectClass: inetOrgPerson
objectClass: kolabInetOrgPerson
mail: $EMAIL
uid: $EMAIL
sn: $LASTNAME
givenName: $FIRSTNAME
cn: $CN
userPassword: $PASSWORD
kolabHomeServer: $HOMESERV
LDIF
if test "$QUOTA" != ""; then
echo "userquota: $QUOTA" >> $LDIFFILE
fi
$PREFIX/bin/ldapadd -x -D "$BINDDN" -w $BINDPW -h $SERVER -f $LDIFFILE
--- NEW FILE: deluser ---
## Copyright (c) 2004 Code Fusion cc
##
## 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, 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 can view the GNU General Public License, online, at the GNU
## Project's homepage; see <http://www.gnu.org/licenses/gpl.html>.
##
if [ ".$1" = ".--showhelp" ]; then
echo "Delete a user mailbox"
exit 0
HASHELP
fi
#Collect some vitals
SERVER=127.0.0.1
PREFIX=@l_prefix@
BINDDN=`cat $PREFIX/etc/kolab/kolab.conf | grep "bind_dn :" | sed -e "s;bind_dn : ;;"`
BINDPW=`cat $PREFIX/etc/kolab/kolab.conf | grep "bind_pw :" | sed -e "s;bind_pw : ;;"`
BASEDN=`cat $PREFIX/etc/kolab/kolab.conf | grep "base_dn :" | sed -e "s;base_dn : ;;"`
HOMESERV=`cat $PREFIX/etc/kolab/kolab.conf | grep "fqdnhostname :" | sed -e "s;fqdnhostname : ;;"`
DN=`$PREFIX/bin/kolab showuser $1 | grep dn`
if test "$DN" = ""; then
echo User not found!
exit 255
else
echo $DN
echo Are you sure you want to delete this user?
read ANS
if test "$ANS" != "y"; then
exit 0
fi
fi
LDIFFILE="/tmp/cfdeluser.ldif"
trap "rm $LDIFFILE" 0 1 2 3 15
cat <<LDIF > $LDIFFILE
$DN
add: kolabdeleteflag
kolabdeleteflag: $HOMESERV
LDIF
$PREFIX/bin/ldapmodify -x -D "$BINDDN" -w $BINDPW -h $SERVER -f $LDIFFILE
--- NEW FILE: listusers ---
## Copyright (c) 2004 Code Fusion cc
##
## 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, 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 can view the GNU General Public License, online, at the GNU
## Project's homepage; see <http://www.gnu.org/licenses/gpl.html>.
##
prefix=@l_prefix@
if [ ".$1" = ".--showhelp" ]; then
echo "Display a list of mailboxes"
exit 0
HASHELP
fi
server=127.0.0.1
binddn=`cat ${prefix}/etc/kolab/kolab.conf | grep "bind_dn :" | sed -e "s;bind_dn : ;;"`
bindpw=`cat ${prefix}/etc/kolab/kolab.conf | grep "bind_pw :" | sed -e "s;bind_pw : ;;"`
basedn=`cat ${prefix}/etc/kolab/kolab.conf | grep "base_dn :" | sed -e "s;base_dn : ;;"`
${prefix}/bin/ldapsearch -x -LLL -b "$basedn" -D "$binddn" -w $bindpw -h $server "(&(objectClass=kolabInetOrgPerson)(mail=*))" mail | grep mail | sed -e "s;mail: ;;"
--- NEW FILE: showlog ---
## Copyright (c) 2004 Code Fusion cc
##
## 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, 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 can view the GNU General Public License, online, at the GNU
## Project's homepage; see <http://www.gnu.org/licenses/gpl.html>.
##
prefix=@l_prefix@
if [ ".$1" = ".--showhelp" ]; then
echo "Display the Kolab server logs"
exit 0
HASHELP
fi
#list of logfiles, maintainers please update
logfiles="
$prefix/var/proftpd/proftpd.log
$prefix/var/amavisd/amavis.log
$prefix/var/fsl/fsl.log
$prefix/var/sasl/log/saslauthd.log
$prefix/var/resmgr/resmgr.log
$prefix/var/resmgr/freebusy.log
$prefix/var/clamav/clamd.log
$prefix/var/imapd/log/master.log
$prefix/var/imapd/log/misc.log
$prefix/var/apache/log/apache-error.log
$prefix/var/apache/log/apache-access.log
$prefix/var/openldap/openldap.log
$prefix/var/postfix/log/postfix.log
"
if [ ".$PAGER" = "." ]; then
PAGER=less
fi
if [ ".$1" = "." ]; then
for log in $logfiles; do
echo $log
done
echo
echo "To view a log please specify the <logname> or \"-t <logname>\""
echo "It is also possible to abbreviate the logname, for example:"
echo "\"showlog postfix\" will display the postfix log."
else
if [ ".$1" = ".-t" ]; then
PAGER="tail -f "
if [ ".$2" = "." ]; then
exit 0;
else
showme=$2
fi
else
showme=$1
fi
for log in $logfiles; do
match=`echo $log | grep $showme`
if [ ".$match" != "." ]; then
$PAGER $log
fi
done
fi
--- NEW FILE: showuser ---
## Copyright (c) 2004 Code Fusion cc
##
## 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, 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 can view the GNU General Public License, online, at the GNU
## Project's homepage; see <http://www.gnu.org/licenses/gpl.html>.
##
prefix=@l_prefix@
if [ ".$1" = ".--showhelp" ]; then
echo "Display information on a user"
exit 0
HASHELP
fi
server=127.0.0.1
binddn=`cat ${prefix}/etc/kolab/kolab.conf | grep "bind_dn :" | sed -e "s;bind_dn : ;;"`
bindpw=`cat ${prefix}/etc/kolab/kolab.conf | grep "bind_pw :" | sed -e "s;bind_pw : ;;"`
basedn=`cat ${prefix}/etc/kolab/kolab.conf | grep "base_dn :" | sed -e "s;base_dn : ;;"`
if [ ".$1" = "." ]; then
echo "Please specify an email address"
exit 2
fi
${prefix}/bin/ldapsearch -x -LLL -b "$basedn" -D "$binddn" -w $bindpw -h $server "(&(objectClass=kolabInetOrgPerson)(mail=$1))"
--- NEW FILE: start ---
## Copyright (c) 2004 Code Fusion cc
##
## 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, 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 can view the GNU General Public License, online, at the GNU
## Project's homepage; see <http://www.gnu.org/licenses/gpl.html>.
##
prefix=@l_prefix@
if [ ".$1" = ".--showhelp" ]; then
echo "Start the server"
exit 0
HASHELP
fi
${prefix}/bin/openpkg rc all start
--- NEW FILE: stop ---
## Copyright (c) 2004 Code Fusion cc
##
## 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, 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 can view the GNU General Public License, online, at the GNU
## Project's homepage; see <http://www.gnu.org/licenses/gpl.html>.
##
prefix=@l_prefix@
if [ ".$1" = ".--showhelp" ]; then
echo "Stop the server"
exit 0
HASHELP
fi
${prefix}/bin/openpkg rc all stop
Index: newconfig
===================================================================
RCS file: /kolabrepository/server/kolab/kolab/namespace/libexec/newconfig,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- newconfig 2 Nov 2004 13:52:03 -0000 1.1
+++ newconfig 3 Nov 2004 11:27:16 -0000 1.2
@@ -1,3 +1,25 @@
+## Copyright (c) 2004 Code Fusion cc
+##
+## 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, 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 can view the GNU General Public License, online, at the GNU
+## Project's homepage; see <http://www.gnu.org/licenses/gpl.html>.
+##
+
prefix=@l_prefix@
+
+if [ ".$1" = ".--showhelp" ]; then
+ echo "Propogate changes made to Kolab templates"
+ exit 0
+ HASHELP
+fi
${prefix}/sbin/kolabconf
Index: services
===================================================================
RCS file: /kolabrepository/server/kolab/kolab/namespace/libexec/services,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- services 2 Nov 2004 13:52:03 -0000 1.1
+++ services 3 Nov 2004 11:27:16 -0000 1.2
@@ -1,4 +1,28 @@
+## Copyright (c) 2004 Code Fusion cc
+##
+## 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, 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 can view the GNU General Public License, online, at the GNU
+## Project's homepage; see <http://www.gnu.org/licenses/gpl.html>.
+##
+
+
prefix=@l_prefix@
+
+if [ ".$1" = ".--showhelp" ]; then
+ echo "Display a list of services"
+ exit 0
+ HASHELP
+fi
+
services=`ls ${prefix}/etc/rc.d`
echo "${services}" | sed -e 's/rc\.//'
More information about the commits
mailing list