1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
$NetBSD: patch-ap,v 1.1 2002/10/07 19:16:48 seb Exp $
--- plugins/digestmd5.c.orig Sat Mar 10 12:07:21 2001
+++ plugins/digestmd5.c
@@ -2714,7 +2714,7 @@ static int mechanism_db_filled(char *mec
int result;
sasl_server_getsecret_t *getsecret;
void *getsecret_context;
- long tmpversion = -1;
+ int32_t tmpversion = -1;
/* get callback so we can request the secret */
result = utils->getcallback(utils->conn,
@@ -2738,8 +2738,8 @@ static int mechanism_db_filled(char *mec
/* check version */
if (sec != NULL)
{
- if (sec->len >= 4) {
- memcpy(&tmpversion, sec->data, 4);
+ if (sec->len >= sizeof(int32_t)) {
+ memcpy(&tmpversion, sec->data, sizeof(int32_t));
tmpversion = ntohl(tmpversion);
}
free(sec);
@@ -2776,7 +2776,7 @@ static int mechanism_db_filled(char *mec
static int mechanism_fill_db(char *mech_name, sasl_server_params_t *sparams)
{
int result;
- long tmpversion;
+ int32_t tmpversion;
sasl_server_putsecret_t *putsecret;
void *putsecret_context;
sasl_secret_t *sec = NULL;
@@ -2798,18 +2798,18 @@ static int mechanism_fill_db(char *mech_
/* allocate a secret structure that we're going to save to disk */
sec=(sasl_secret_t *) sparams->utils->malloc(sizeof(sasl_secret_t)+
- 4);
+ sizeof(int32_t));
if (sec == NULL) {
result = SASL_NOMEM;
return result;
}
/* set the size */
- sec->len = 4;
+ sec->len = sizeof(int32_t);
/* and insert the data */
tmpversion = htonl(DIGEST_MD5_VERSION);
- memcpy(sec->data, &tmpversion, 4);
+ memcpy(sec->data, &tmpversion, sizeof(int32_t));
/* do the store */
result = putsecret(putsecret_context,
|