Fonction d'échapement
This commit is contained in:
parent
5d9c732197
commit
9963e7cf4c
1 changed files with 6 additions and 0 deletions
|
@ -32,6 +32,7 @@
|
|||
|
||||
from __future__ import with_statement
|
||||
import os, sys, ldap, re, netaddr, datetime, copy, time, random
|
||||
import ldap.filter
|
||||
from ldap.modlist import addModlist, modifyModlist
|
||||
try:
|
||||
from Levenshtein import jaro
|
||||
|
@ -57,6 +58,11 @@ def import_secrets():
|
|||
# Champs à ignorer dans l'historique
|
||||
HIST_IGNORE_FIELDS = ["modifiersName", "entryCSN", "modifyTimestamp", "historique"]
|
||||
|
||||
def escape(chaine):
|
||||
"""Renvoie une chaîne échapée pour pouvoir la mettre en toute sécurité
|
||||
dans une requête ldap."""
|
||||
return ldap.filter.escape_filter_chars(chaine)
|
||||
|
||||
def ldif_to_uldif(ldif):
|
||||
uldif = {}
|
||||
for attr, vals in ldif.items():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue