~ubuntu-branches/ubuntu/wily/dovecot/wily

« back to all changes in this revision

Viewing changes to src/auth/mech-otp-skey-common.c

  • Committer: Package Import Robot
  • Author(s): Jaldhar H. Vyas
  • Date: 2013-09-09 00:57:32 UTC
  • mfrom: (1.13.11)
  • mto: (4.8.5 experimental) (1.16.1)
  • mto: This revision was merged to the branch mainline in revision 97.
  • Revision ID: package-import@ubuntu.com-20130909005732-dn1eell8srqbhh0e
Tags: upstream-2.2.5
ImportĀ upstreamĀ versionĀ 2.2.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
#include "otp.h"
14
14
#include "mech-otp-skey-common.h"
15
15
 
16
 
static struct hash_table *otp_lock_table;
 
16
static HASH_TABLE(char *, struct auth_request *) otp_lock_table;
17
17
 
18
18
void otp_lock_init(void)
19
19
{
20
 
        if (otp_lock_table != NULL)
 
20
        if (hash_table_is_created(otp_lock_table))
21
21
                return;
22
22
 
23
 
        otp_lock_table = hash_table_create(system_pool, system_pool,
24
 
                                           128, strcase_hash,
25
 
                                           (hash_cmp_callback_t *)strcasecmp);
 
23
        hash_table_create(&otp_lock_table, default_pool, 128,
 
24
                          strcase_hash, strcasecmp);
26
25
}
27
26
 
28
27
int otp_try_lock(struct auth_request *auth_request)
31
30
                return FALSE;
32
31
 
33
32
        hash_table_insert(otp_lock_table, auth_request->user, auth_request);
34
 
 
35
33
        return TRUE;
36
34
}
37
35
 
51
49
                                  struct auth_request *auth_request)
52
50
{
53
51
        if (success)
54
 
                auth_request_success(auth_request, NULL, 0);
 
52
                auth_request_success(auth_request, "", 0);
55
53
        else {
56
54
                auth_request_internal_failure(auth_request);
57
55
                otp_unlock(auth_request);