Rev 642 | Rev 4613 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
20 | reyssat | 1 | |
2 | # Input variables: authdef=def file. |
||
3 | # Parameters: auth_user, auth_password. |
||
4 | |||
468 | bpr | 5 | auth_test=ERROR |
6 | auth_real_login=ERROR |
||
7 | |||
8 | |||
20 | reyssat | 9 | ldap_find=!sh which ldapsearch |
10 | !if $ldap_find issametext $empty |
||
11 | auth_test=ERROR no_ldap |
||
12 | !exit |
||
13 | !endif |
||
14 | |||
15 | ldap_host=!defof class_ldap_host in $authdef |
||
468 | bpr | 16 | !!default ldap_host=ldap.u-psud.fr |
17 | |||
20 | reyssat | 18 | ldap_port=!defof class_ldap_port in $authdef |
19 | !default ldap_port=389 |
||
468 | bpr | 20 | |
20 | reyssat | 21 | ldap_version=!defof class_ldap_version in $authdef |
22 | !default ldap_version=3 |
||
468 | bpr | 23 | |
20 | reyssat | 24 | ldap_base=!defof class_ldap_base in $authdef |
468 | bpr | 25 | !!default ldap_base=ou=people,dc=u-psud,dc=fr |
26 | |||
20 | reyssat | 27 | ldap_branch=!defof class_ldap_branch in $authdef |
468 | bpr | 28 | !!default ldap_branch=ou=people,dc=u-psud,dc=fr |
29 | |||
20 | reyssat | 30 | ldap_uid=!defof class_ldap_uid in $authdef |
468 | bpr | 31 | !!default ldap_uid=uid |
20 | reyssat | 32 | |
468 | bpr | 33 | #ldap_id=!replace internal " by in $ldap_uid=$(wims_read_parm[1]),$ldap_branch,$ldap_base |
34 | ldap_id=!replace internal " by in $ldap_uid=$(wims_read_parm[1]) |
||
20 | reyssat | 35 | |
468 | bpr | 36 | ldap_login=!defof class_ldap_login in $authdef |
37 | !default ldap_login=supannAliasLogin |
||
20 | reyssat | 38 | |
468 | bpr | 39 | !if $ldap_login=$empty or $ldap_uid=$empty or $ldap_base=$empty \ |
40 | or $ldap_branch=$empty or $ldap_host=$empty |
||
41 | auth_test=ERROR no_ldap_config |
||
42 | !exit |
||
43 | !endif |
||
44 | |||
45 | ldap_search=!sh ldapsearch -x -h $ldap_host -p $ldap_port -b "$ldap_base" '$ldap_id' -D "$ldap_id , $ldap_base" -w '$(wims_read_parm[2])' |
||
46 | |||
20 | reyssat | 47 | ldap_cnt=!linecnt $ldap_search |
48 | !for i=1 to $ldap_cnt |
||
49 | l=!line $i of $ldap_search |
||
468 | bpr | 50 | field=!word 1 of $l |
51 | |||
52 | !if $field iswordof $ldap_login: |
||
53 | auth_real_login=!word 2 of $l |
||
54 | !endif |
||
55 | |||
20 | reyssat | 56 | !if $l issametext result: 0 Success |
468 | bpr | 57 | auth_test=$auth_real_login |
20 | reyssat | 58 | !endif |
468 | bpr | 59 | |
20 | reyssat | 60 | !next i |
633 | bpr | 61 | |
20 | reyssat | 62 | |
809 | bpr | 63 | cnt_=!charcnt $auth_test |
64 | !if $cnt_=3 |
||
65 | auth_test=!nospace $auth_test 0 |
||
66 | !endif |
||
20 | reyssat | 67 | auth_error=$wims_exec_error |
68 | wims_exec_error= |