Project

General

Profile

Tâche #20738

Scénario #20629: Traitement express MEN (23-25)

Erreur à l'ouverture de session pour un utilisateur ayant une apostrophe dans son nom ou prénom

Added by Laurent Brillard almost 6 years ago. Updated almost 6 years ago.

Status:
Fermé
Priority:
Normal
Assigned To:
Start date:
06/06/2017
Due date:
% Done:

100%

Estimated time:
3.00 h
Spent time:
Remaining (hours):
0.0

Description

Bonjour,

Sur Scribe 2.5.2, avec une alimentation par fichiers AAF, les utilisateurs ayant une apostrophe dans leur nom ou leur prénom (2 cas vus en établissements) ont une erreur à l'ouverture de leur session Windows :

Logon.exe

Une erreur s'est produite lors de l'appel distant (remote_logon) :
(1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server...

Palliatif : supprimer l'apostrophe dans la fiche via l'EAD mais cela n'est pas durable.

Ce problème ne se produisait pas en Scribe 2.3.

Merci d'avance de ce que vous pourrez faire !
Laurent Brillard

login.py View - /usr/lib/python2.7/dist-packages/scribe/login.py (15.6 KB) Joël Cuissinat, 06/07/2017 05:15 PM


Related issues

Related to Scribe - Demande #21400: Problème à l'ouverture de session pour les logins contenant des caractères spéciaux Fermé 09/19/2017

Associated revisions

Revision e701f82e (diff)
Added by Joël Cuissinat almost 6 years ago

Gestion des utilisateurs avec apostrophe

  • scribe/login.py : utilisation de la syntaxe préconisée pour "db.cursor"

Ref: #20738

Revision 282abdc1 (diff)
Added by Daniel Dehennin almost 6 years ago

Correction de l’utilisation de l’API MySQLdb.cursors

Il faut toujours passer un tuple pour les substitutions même lorsqu’il
n’y en a qu’une.

  • scribe/login.py (log_connexion_db): Passage des valeurs uniques en
    tant que tuple.

Ref: #20738

History

#1 Updated by Joël Cuissinat almost 6 years ago

  • Tracker changed from Demande to Tâche
  • Project changed from Scribe to controle-vnc
  • Estimated time set to 3.00 h
  • Parent task set to #20629
  • Remaining (hours) set to 3.0

#2 Updated by Joël Cuissinat almost 6 years ago

  • Status changed from Nouveau to En cours
  • Assigned To set to Joël Cuissinat

#3 Updated by Joël Cuissinat almost 6 years ago

Le problème ayant visiblement été introduit par l'utilisation de MySQL en tant que backend du client Scribe, il faudrait vérifier et corriger à partir de la version 2.5.1 : http://eole.ac-dijon.fr/documentations/2.5/partielles/HTML/ModuleScribe/co/07-changements.html#qN193

#4 Updated by Joël Cuissinat almost 6 years ago

C'est bien lorsqu'on essaie d'enregistrer/mettre à jour le "displayName" de l'utilisateur dans la base :

      File "/usr/share/eole/controlevnc/controle_vnc_serveur.py", line 329, in remote_logon
        return gest_sessions.Logon().logon(self.ip, os_type, self.blocage)
      File "/usr/share/eole/controlevnc/gest_sessions.py", line 34, in logon
        Connexions().get_infos(self.ip, os_type)
      File "/usr/share/eole/controlevnc/connexions.py", line 421, in get_infos
        os_type, ip)
      File "/usr/lib/python2.7/dist-packages/scribe/login.py", line 249, in log_connexion_db
        c.execute("UPDATE log SET netbios='%s', user='%s', sid='%s', display_name='%s', prim_group='%s', os='%s' WHERE ip='%s'" % (netbios, user, sid, display_name,primgrp, ostype, ip))

On peut également simuler l'erreur avec le script dyn-logon :

root@scribe:~# /usr/share/eole/fichier/dyn-logon.py -u toto  -o Vista -m truc -i 55
Traceback (most recent call last):
  File "/usr/share/eole/fichier/dyn-logon.py", line 70, in main
    logon(user, ostype, machine, adresse_ip, pid)
  File "/usr/lib/python2.7/dist-packages/scribe/login.py", line 130, in logon
    ostype, adresse_ip)
  File "/usr/lib/python2.7/dist-packages/scribe/login.py", line 256, in log_connexion_db
    c.execute("INSERT INTO log (netbios, ip, user, sid, display_name, prim_group, os) VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s')" % (netbios, ip, user, sid, display_name, primgrp, ostype))
  File "/usr/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 174, in execute
    self.errorhandler(self, exc, value)
  File "/usr/lib/python2.7/dist-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Toro L'TOTO', 'eleves', 'Vista')' at line 1")
None
(1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Toro L'TOTO', 'eleves', 'Vista')' at line 1")

#5 Updated by Joël Cuissinat almost 6 years ago

  • Project changed from controle-vnc to scribe-backend

#6 Updated by Joël Cuissinat almost 6 years ago

Il faut utiliser la syntaxe python préconisée pour MySQLdb : https://stackoverflow.com/questions/775296/python-mysql-parameterized-queries

#7 Updated by Joël Cuissinat almost 6 years ago

  • File login.py View added
  • % Done changed from 0 to 100
  • Remaining (hours) changed from 3.0 to 0.5

Correction de la librairie python /usr/lib/python2.7/dist-packages/scribe/login.py (fichier joint pour test/correction manuelle).

Compilation de paquets candidats et mise à jour des changelog pour 2.5.1, 2.5.2, 2.6.0, 2.6.1 + fusion dans master.

#8 Updated by Laurent Brillard almost 6 years ago

Merci Joël, je mets en test...

#9 Updated by Scrum Master almost 6 years ago

  • Project changed from scribe-backend to Distribution EOLE
  • Status changed from En cours to Résolu

#10 Updated by Laurent Brillard almost 6 years ago

Joël, j'ai mis en place le fichier logon.py et apparemment cela plantait les ouvertures de session...
Y a-t-il autre chose à faire que de copier le fichier au bon endroit ?

#11 Updated by Daniel Dehennin almost 6 years ago

  1. Intégration d’une machine au domaine du scribe
  2. Modification du displayName de prof.3a depuis l’EAD ⮕ Identité = prof D'l'a 3a
  3. Connexion avec le compte prof.3a

#12 Updated by Daniel Dehennin almost 6 years ago

  • Remaining (hours) changed from 0.5 to 0.25

Cela fonctionne pour moi avec mon correctif.

#13 Updated by Fabrice Barconnière almost 6 years ago

  • Description updated (diff)
  • Remaining (hours) changed from 0.25 to 0.0

#14 Updated by Fabrice Barconnière almost 6 years ago

Test sur Scribe 2.6.1 OK

#15 Updated by Scrum Master almost 6 years ago

  • Status changed from Résolu to Fermé

#16 Updated by Laurent Brillard almost 6 years ago

Bonjour,

Sur un Scribe 2.5.2 de test, OK, sur un Scribe d'établissement, j'ai l'erreur :

# service controle-vnc start
Unhandled Error
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/twisted/application/app.py", line 642, in run
    runApp(config)
  File "/usr/lib/python2.7/dist-packages/twisted/scripts/twistd.py", line 23, in runApp
    _SomeApplicationRunner(config).run()
  File "/usr/lib/python2.7/dist-packages/twisted/application/app.py", line 376, in run
    self.application = self.createOrGetApplication()
  File "/usr/lib/python2.7/dist-packages/twisted/application/app.py", line 441, in createOrGetApplication
    application = getApplication(self.config, passphrase)
--- <exception caught here> ---
  File "/usr/lib/python2.7/dist-packages/twisted/application/app.py", line 452, in getApplication
    application = service.loadApplication(filename, style, passphrase)
  File "/usr/lib/python2.7/dist-packages/twisted/application/service.py", line 405, in loadApplication
    application = sob.loadValueFromFile(filename, 'application', passphrase)
  File "/usr/lib/python2.7/dist-packages/twisted/persisted/sob.py", line 210, in loadValueFromFile
    exec fileObj in d, d
  File "/usr/share/eole/controlevnc/controle_vnc_serveur.py", line 35, in <module>
    from connexions import Connexions, Session
  File "/usr/share/eole/controlevnc/connexions.py", line 19, in <module>
    from scribe.login import Ldap, log_connexion_db
exceptions.SyntaxError: invalid syntax (login.py, line 1)

Failed to load application: invalid syntax (login.py, line 1)

 * already running
 * Starting controle VNC: controle-vnc                                   [fail] 

D'où peux venir le problème ?

#17 Updated by Laurent Brillard almost 6 years ago

Erreur de ma part, le fichier n'était pas correctement téléchargé. Je re-teste.
Désolé...

#18 Updated by Joël Cuissinat over 5 years ago

  • Related to Demande #21400: Problème à l'ouverture de session pour les logins contenant des caractères spéciaux added

Also available in: Atom PDF