Changeset 1919 for alternc/trunk/src/basedir_prot.sh
- Timestamp:
- 09/09/07 20:18:19 (6 years ago)
- File:
-
- 1 edited
-
alternc/trunk/src/basedir_prot.sh (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
alternc/trunk/src/basedir_prot.sh
r1772 r1919 17 17 18 18 . /etc/alternc/local.sh 19 . /usr/lib/alternc/functions.sh 20 19 21 if [ -z "$MYSQL_HOST" ] 20 22 then 21 23 MYSQL_HOST="localhost" 22 24 fi 23 24 # imprime le nom d'usager associé au domaine25 get_account_by_domain() {26 # les admintools ne sont peut-être pas là27 if [ -x "/usr/bin/get_account_by_domain" ]28 then29 # only first field, only first line30 /usr/bin/get_account_by_domain "$1" | cut -d\ -f1 | cut -d'31 ' -f 132 else33 # implantons localement ce que nous avons besoin, puisque admintools34 # n'est pas là35 mysql -h$MYSQL_HOST -u$MYSQL_USER -p$MYSQL_PASS -D$MYSQL_DATABASE -B -N -e \36 'SELECT a.login FROM membres a, sub_domaines b WHERE a.uid = b.compte AND \37 CONCAT(IF(sub="", "", CONCAT(sub, ".")), domaine) = "'"$1"'" LIMIT 1;'38 fi39 }40 41 # add the standard input to a given file, only if not already present42 append_no_dupe() {43 realfile="$1"44 tmpfile=`mktemp`45 trap "rm -f $tmpfile; exit 1" 1 2 1546 cat > $tmpfile47 if [ -r "$realfile" ] &&48 (diff -q "$tmpfile" "$realfile" > /dev/null || \49 diff -u "$tmpfile" "$realfile" | grep '^ ' | sed 's/^ //' | diff -q - "$tmpfile" > /dev/null)50 then51 ret=052 else53 ret=154 cat "$tmpfile" >> "$realfile"55 fi56 rm -f "$tmpfile"57 return "$ret"58 }59 60 add_dom_entry() {61 # protect ourselves from interrupts62 trap "rm -f ${override_f}.new; exit 1" 1 2 1563 # ajouter une entrée, seulement s'il n'y en pas déjà, pour ce domaine64 (echo "$1"; [ -r $override_f ] && cat $override_f) | \65 sort -u > ${override_f}.new && \66 cp ${override_f}.new ${override_f} && \67 rm ${override_f}.new68 }69 70 # la première lettre de l'avant-dernière partie du domaine (e.g.71 # www.alternc.org -> a)72 #73 # argument: le domaine74 # imprime: la lettre75 init_dom_letter() {76 echo "$1" | awk '{z=split($NF, a, ".") ; print substr(a[z-1], 1, 1)}'77 }78 25 79 26 echo -n "adding open_base_dir protection for:"
Note: See TracChangeset
for help on using the changeset viewer.
