Bug 41304 - Adjust package ucs-school-netlogon-user-logonscripts
Summary: Adjust package ucs-school-netlogon-user-logonscripts
Status: CLOSED FIXED
Alias: None
Product: UCS@school
Classification: Unclassified
Component: Netlogon scripts
Version: UCS@school 4.1 R2
Hardware: Other Linux
: P5 normal
Target Milestone: UCS@school 4.1 R2
Assignee: Florian Best
QA Contact: Daniel Tröder
URL:
Keywords:
: 41384 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-05-20 07:29 CEST by Florian Best
Modified: 2016-09-30 12:17 CEST (History)
1 user (show)

See Also:
What kind of report is it?: Development Internal
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional): API change
Customer ID:
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Best univentionstaff 2016-05-20 07:29:59 CEST
The package ucs-school-netlogon-user-logonscripts has to be adjusted to work with the new attributes/object classes.

The listener module ucs-school-user-logonscript.py uses a regex for a DN to check if the user is a teacher or staff.

Also all ldap filters in there aren't properly escaped.
Comment 1 Florian Best univentionstaff 2016-05-20 08:43:06 CEST
The DN is still checked (for backwards compatibility) (also via UCR variable ucsschool/userlogon/umclink/re).
The new UCR variable ucsschool/userlogon/umclink/filter defines the ldap filter which is used if the dn does not match. 
The filter defaults to (|(objectClass=ucsschoolTeacher)(objectClass=ucsschoolStaff)).

ucs-school-netlogon-user-logonscripts (12.0.1-1):
r69417 | Bug #41304: autopep8
r69416 | Bug #41304: use objectClass=ucsschoolTeacher / ucsschoolStaff for detection of teachers
Comment 2 Florian Best univentionstaff 2016-05-31 18:55:41 CEST
Please check if the order is okay: Currently first the DN is checked and then the LDAP search is done.
Comment 3 Daniel Tröder univentionstaff 2016-06-16 11:36:46 CEST
Code: OK
Manual test: OK:

# cp /usr/lib/univention-directory-listener/system/ucs-school-user-logonscript.py /tmp/logonscript.py

# python

import sys
sys.path.append("/tmp")
from logonscript import *

key = "Marktplatz"
server = listener.baseConfig.get('ucsschool/userlogon/commonshares/server/%s' % key)
letter = listener.baseConfig.get('ucsschool/userlogon/commonshares/letter/%s' % key, '').replace(':', '')
globalLinks = {key: {'server': server, 'letter': letter}}
desktopFolderName = "Eigene Shares"
mappings = globalLinks
links = {"Marktplatz": "sch-m"}

dn = "uid=g.krause1,cn=mitarbeiter,cn=users,ou=schule1,dc=uni,dc=dtr"
"Univention Management Console" in generateWindowsLinkScript(desktopFolderName, links, mappings, dn).replace('\n', '\r\n')
→ True

dn = "uid=d.lehmann1,cn=lehrer,cn=users,ou=gsmitte,dc=uni,dc=dtr"
"Univention Management Console" in generateWindowsLinkScript(desktopFolderName, links, mappings, dn).replace('\n', '\r\n')
→ True

dn = "uid=anton3,cn=schueler,cn=users,ou=gsmitte,dc=uni,dc=dtr"
"Univention Management Console" in generateWindowsLinkScript(desktopFolderName, links, mappings, dn).replace('\n', '\r\n')
→ False


Then the same was run after editing /tmp/logonscript.py:
---
#is_teacher = reTeacher.match(dn)
is_teacher = False
---
Thus forcing the detection to use LDAP queries and not RE on the dn.
→ same result

OK: distinguished Teachers, Staff and Students with both methods.
Comment 4 Daniel Tröder univentionstaff 2016-06-16 12:04:40 CEST
Please change the detection order: LDAP query first.
Comment 5 Florian Best univentionstaff 2016-06-16 12:05:25 CEST
(In reply to Daniel Tröder from comment #4)
> Please change the detection order: LDAP query first.

done

ucs-school-netlogon-user-logonscripts (12.0.2-1):
r70260 | Bug #41304: adjust order of detecting teachers
Comment 6 Florian Best univentionstaff 2016-06-16 12:12:53 CEST
ucs-school-netlogon-user-logonscripts.yaml:
r70261 | YAML Bug #41304
Comment 7 Florian Best univentionstaff 2016-06-16 12:46:17 CEST
*** Bug 41384 has been marked as a duplicate of this bug. ***
Comment 8 Daniel Tröder univentionstaff 2016-06-16 13:30:39 CEST
OK: order changed
OK: crash fixed
Comment 9 Florian Best univentionstaff 2016-06-28 18:24:51 CEST
UCS@school 4.1 R2 has been released:
http://docs.software-univention.de/release-notes-ucsschool-4.1R2v1-de.pdf

If this error occurs again, please use "Clone This Bug".