#!/bin/bash

if dpkg-query -s eole-horus-backend > /dev/null 2>&1;then
    python -c """import sys
from horus import backend
from ldap import INVALID_CREDENTIALS
try:
    for user in backend.ldapsearch('(&%s(sambaLogonScript=*))' % backend.user_filters):
        print 'correction du compte %s' % user[1]['uid'][0]
        backend.ldapmodify(user[0], 'sambaLogonScript', '')
except INVALID_CREDENTIALS:
    print
    print 'Erreur le mot de passe ldap est désynchronisé'
    print 'Relancer un reconfigure pour corriger'
    print
    sys.exit(1)
"""
fi

# Sauvegarde des fichiers Interbase (#11070)
if [ -f /opt/interbase/isc4.gdb ];then
    mkdir -p /tmp/interbase
    cp -f /opt/interbase/isc4.gdb /tmp/interbase
    cp -f /opt/interbase/ib_license.dat /tmp/interbase 2>/dev/null
fi

exit 0