[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/se3master/usr/share/se3/scripts/ -> modifPassAdmin.sh (source)

   1  #!/bin/bash
   2  
   3  #
   4  ## $Id: modifPassAdmin.sh 7061 2012-04-02 09:22:45Z dbo $ ##
   5  #
   6  ##### Change le mot de passe du cn=admin pour binder l'annuaire #####
   7  
   8  if [ "$1" = "--help" -o "$1" = "-h" -o "$1" = "" ]
   9  then
  10      echo "Change le mot de passe de l'admin LDAP"
  11      echo "Usage : modifPassLdap.sh nouveau_mot_de_passe"
  12      exit
  13  fi    
  14  
  15  WWWPATH="/var/www/"
  16  
  17  #
  18  ## recuperation des variables necessaires pour interoger mysql ###
  19  if [ -e $WWWPATH/se3/includes/config.inc.php ]; then
  20          dbhost=`cat $WWWPATH/se3/includes/config.inc.php | grep "dbhost=" | cut -d = -f 2 |cut -d \" -f 2`
  21          dbname=`cat $WWWPATH/se3/includes/config.inc.php | grep "dbname=" | cut -d = -f 2 |cut -d \" -f 2`
  22          dbuser=`cat $WWWPATH/se3/includes/config.inc.php | grep "dbuser=" | cut -d = -f 2 |cut -d \" -f 2`
  23          dbpass=`cat $WWWPATH/se3/includes/config.inc.php | grep "dbpass=" | cut -d = -f 2 |cut -d \" -f 2`
  24  else
  25          echo "Fichier de conf inaccessible désolé !!"
  26          echo "le script ne peut se poursuivre"
  27          exit 1
  28  fi
  29  /usr/bin/mysql -u $dbuser -p$dbpass -D $dbname -e "UPDATE params SET value='$1' WHERE name='adminPw'"
  30  
  31  # On controle
  32  
  33  pass_new=`/usr/bin/mysql -u $dbuser -p$dbpass -D $dbname -e "SELECT * from params WHERE name='adminPw' AND value='$1'"`
  34  if [ "$pass_new" = "" ]
  35  then
  36      echo "Erreur : Le mot de passe dans la base SQL n'est pas correct"
  37      exit 1
  38  fi    
  39  
  40  /usr/share/se3/scripts/mkSlapdConf.sh
  41  
  42  exit 0


Generated: Tue Mar 17 22:47:18 2015 Cross-referenced by PHPXref 0.7.1