[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 #!/bin/bash 2 3 # 4 ## $Id: convertsambaschema.sh 7723 2013-03-18 23:57:26Z keyser $ ## 5 # 6 ##### Convertion de l'annuaire LDAP du format Samba 2 au format samba 3 ##### 7 # 8 9 if [ "$1" = "--help" -o "$1" = "-h" ] 10 then 11 echo "Convertion de l'annuaire du format Samba2 au format Samba 3" 12 echo "Usage : Pas d'option" 13 exit 14 fi 15 16 # 17 # Récupération des paramètres mysql 18 # 19 if [ -e /var/www/se3/includes/config.inc.php ]; then 20 dbhost=`cat /var/www/se3/includes/config.inc.php | grep "dbhost=" | cut -d = -f 2 |cut -d \" -f 2` 21 dbname=`cat /var/www/se3/includes/config.inc.php | grep "dbname=" | cut -d = -f 2 |cut -d \" -f 2` 22 dbuser=`cat /var/www/se3/includes/config.inc.php | grep "dbuser=" | cut -d = -f 2 |cut -d \" -f 2` 23 dbpass=`cat /var/www/se3/includes/config.inc.php | grep "dbpass=" | cut -d = -f 2 |cut -d \" -f 2` 24 else 25 echo "Fichier de conf inaccessible" >> $SE3LOG 26 echo "sauve.sh: Status FAILED" >> $SE3LOG 27 exit 1 28 fi 29 30 # 31 # Recuperation des params LDAP 32 # 33 34 BASEDN=`echo "SELECT value FROM params WHERE name='ldap_base_dn'" | mysql -h $dbhost $dbname -u $dbuser -p$dbpass -N` 35 if [ -z "$BASEDN" ]; then 36 echo "Impossible d'accéder au paramètre BASEDN" 37 exit 1 38 fi 39 ADMINRDN=`echo "SELECT value FROM params WHERE name='adminRdn'" | mysql -h $dbhost $dbname -u $dbuser -p$dbpass -N` 40 if [ -z "$ADMINRDN" ]; then 41 echo "Impossible d'accéder au paramètre ADMINRDN" 42 exit 1 43 fi 44 ADMINPW=`echo "SELECT value FROM params WHERE name='adminPw'" | mysql -h $dbhost $dbname -u $dbuser -p$dbpass -N` 45 if [ -z "$ADMINPW" ]; then 46 echo "Impossible d'accéder au paramètre ADMINPW" 47 exit 1 48 fi 49 DOMAINSID=`echo "SELECT value FROM params WHERE name='domainsid'" | mysql -h $dbhost $dbname -u $dbuser -p$dbpass -N` 50 if [ -z "$DOMAINSID" ]; then 51 echo "Impossible d'accéder au paramètre DOMAINSID" 52 exit 1 53 fi 54 SMBVERSION=`echo "SELECT value FROM params WHERE name='smbversion'" | mysql -h $dbhost $dbname -u $dbuser -p$dbpass -N` 55 if [ -z "$SMBVERSION" ]; then 56 echo "Impossible d'accéder au paramètre smbversion" 57 exit 1 58 fi 59 if [ ! "$SMBVERSION" = "samba3" ]; then 60 echo "Version de samba incorrecte." 61 exit 1 62 fi 63 64 # 65 # Conversion de schema 66 # 67 68 # On recupere les anciennes entrees 69 70 ldapsearch -xLLL -D $ADMINRDN,$BASEDN -w $ADMINPW objectCLass=sambaAccount > /tmp/cnvrt_old.ldif 71 72 # On convertit le ldif 73 /usr/share/se3/sbin/convertSambaAccount --input /tmp/cnvrt_old.ldif --output /tmp/cnvrt_mod.ldif --sid $DOMAINSID --changetype modify 74 75 # On supprime les anciennes entrees 76 #cat /tmp/cnvrt_old.ldif |grep dn: |cut -c 5- >/tmp/cnvrt_del.ldif 77 #ldapdelete -x -D $ADMINRDN,$BASEDN -w $ADMINPW -f /tmp/cnvrt_del.ldif 78 79 # On modifie les nouvelles entrees 80 ldapmodify -x -c -D $ADMINRDN,$BASEDN -w $ADMINPW -f /tmp/cnvrt_mod.ldif
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Tue Mar 17 22:47:18 2015 | Cross-referenced by PHPXref 0.7.1 |