~ubuntu-branches/ubuntu/trusty/ejabberd/trusty-proposed

« back to all changes in this revision

Viewing changes to src/ejabberd_auth_ldap.erl

  • Committer: Bazaar Package Importer
  • Author(s): Konstantin Khomoutov, Konstantin Khomoutov
  • Date: 2010-07-26 20:36:14 UTC
  • mfrom: (1.1.15 upstream)
  • Revision ID: james.westby@ubuntu.com-20100726203614-s3asj0k5ym3bxhdw
Tags: 2.1.4-1
[ Konstantin Khomoutov ]
* Do not prevent ejabberd_debug from being installed and used
  as this was implemented upstream as the default behavior.
* Add build dependency on erlang-parsetools.
* Add 'sharedscripts' option to logrotate config.
* Update VCS references in control file to point to git.deb.at.
* Add group sticky bit to permissions on the log directory --
  this should make log files owned by the group "adm".
* Explicitly set umask to 027 before starting erl.
* Add patch with fix for EJAB-953 (closes: #590389).
* Fix call to setup_ejabberd in postinst.
* Fix owner/permissions for log files when upgrading.
* Minor fixes and clarifications in ejabberdctl.8 manual page.
* Refresh reopen-log.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
66
66
                servers,
67
67
                backups,
68
68
                port,
69
 
                encrypt,
 
69
                tls_options,
70
70
                dn,
71
71
                password,
72
72
                base,
119
119
init(Host) ->
120
120
    State = parse_options(Host),
121
121
    eldap_pool:start_link(State#state.eldap_id,
122
 
                     State#state.servers,
123
 
                     State#state.backups,
124
 
                     State#state.port,
125
 
                     State#state.dn,
126
 
                     State#state.password,
127
 
                     State#state.encrypt),
 
122
                          State#state.servers,
 
123
                          State#state.backups,
 
124
                          State#state.port,
 
125
                          State#state.dn,
 
126
                          State#state.password,
 
127
                          State#state.tls_options),
128
128
    eldap_pool:start_link(State#state.bind_eldap_id,
129
 
                     State#state.servers,
130
 
                     State#state.backups,
131
 
                     State#state.port,
132
 
                     State#state.dn,
133
 
                     State#state.password,
134
 
                     State#state.encrypt),
 
129
                          State#state.servers,
 
130
                          State#state.backups,
 
131
                          State#state.port,
 
132
                          State#state.dn,
 
133
                          State#state.password,
 
134
                          State#state.tls_options),
135
135
    {ok, State}.
136
136
 
137
137
plain_password_required() ->
153
153
check_password(User, Server, Password, _Digest, _DigestGen) ->
154
154
    check_password(User, Server, Password).
155
155
 
156
 
set_password(_User, _Server, _Password) ->
157
 
    {error, not_allowed}.
 
156
set_password(User, Server, Password) ->
 
157
    {ok, State} = eldap_utils:get_state(Server, ?MODULE),
 
158
    case find_user_dn(User, State) of
 
159
        false ->
 
160
            {error, user_not_found};
 
161
        DN ->
 
162
            eldap_pool:modify_passwd(State#state.eldap_id, DN, Password)
 
163
    end.
158
164
 
159
165
%% @spec (User, Server, Password) -> {error, not_allowed}
160
166
try_register(_User, _Server, _Password) ->
367
373
                   Backups -> Backups
368
374
                   end,
369
375
    LDAPEncrypt = ejabberd_config:get_local_option({ldap_encrypt, Host}),
 
376
    LDAPTLSVerify = ejabberd_config:get_local_option({ldap_tls_verify, Host}),
370
377
    LDAPPort = case ejabberd_config:get_local_option({ldap_port, Host}) of
371
378
                   undefined -> case LDAPEncrypt of
372
379
                                    tls -> ?LDAPS_PORT;
411
418
           servers = LDAPServers,
412
419
           backups = LDAPBackups,
413
420
           port = LDAPPort,
414
 
           encrypt = LDAPEncrypt,
 
421
           tls_options = [{encrypt, LDAPEncrypt},
 
422
                          {tls_verify, LDAPTLSVerify}],
415
423
           dn = RootDN,
416
424
           password = Password,
417
425
           base = LDAPBase,