aboutsummaryrefslogtreecommitdiffstats
path: root/main/openldap/openldap-back-sql-fix-64bit.patch
blob: 82707d4e73194867a84104acdb691814b3e41212 (plain)
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
From: Timo Teräs <timo.teras@iki.fi>

Fix openldap memory corruption with back-sql on 64-bit architectures.

--- openldap-2.4.25/servers/slapd/back-sql/add.c
+++ openldap-2.4.25.patched/servers/slapd/back-sql/add.c
@@ -1217,7 +1217,7 @@
 
 	if ( !BACKSQL_IS_ADD( oc->bom_expect_return ) ) {
 		SWORD		ncols;
-		SQLINTEGER	value_len;
+		SQLLEN		value_len;
 
 		if ( BACKSQL_CREATE_NEEDS_SELECT( bi ) ) {
 			SQLFreeStmt( sth, SQL_DROP );
--- openldap-2.4.25/servers/slapd/back-sql/back-sql.h
+++ openldap-2.4.25.patched/servers/slapd/back-sql/back-sql.h
@@ -183,7 +183,7 @@
 	UDWORD		*col_prec;
 	SQLSMALLINT	*col_type;
 	char		**cols;
-	SQLINTEGER	*value_len;
+	SQLLEN		*value_len;
 } BACKSQL_ROW_NTS;
 
 /*
--- openldap-2.4.25/servers/slapd/back-sql/proto-sql.h
+++ openldap-2.4.25.patched/servers/slapd/back-sql/proto-sql.h
@@ -189,25 +189,25 @@
 #define backsql_BindParamStr( sth, par_ind, io, str, maxlen ) 		\
 	SQLBindParameter( (sth), (SQLUSMALLINT)(par_ind), 		\
 			(io), SQL_C_CHAR, SQL_VARCHAR,			\
-         		(SQLUINTEGER)(maxlen), 0, (SQLPOINTER)(str),	\
-			(SQLUINTEGER)(maxlen), NULL )
+         		(SQLULEN)(maxlen), 0, (SQLPOINTER)(str),	\
+			(SQLLEN)(maxlen), NULL )
 
 #define backsql_BindParamBerVal( sth, par_ind, io, bv ) 		\
 	SQLBindParameter( (sth), (SQLUSMALLINT)(par_ind), 		\
 			(io), SQL_C_CHAR, SQL_VARCHAR,			\
-         		(SQLUINTEGER)(bv)->bv_len, 0,			\
+         		(SQLULEN)(bv)->bv_len, 0,			\
 			(SQLPOINTER)(bv)->bv_val,			\
-			(SQLUINTEGER)(bv)->bv_len, NULL )
+			(SQLLEN)(bv)->bv_len, NULL )
 
 #define backsql_BindParamInt( sth, par_ind, io, val )			\
 	SQLBindParameter( (sth), (SQLUSMALLINT)(par_ind),		\
 			(io), SQL_C_ULONG, SQL_INTEGER,			\
-			0, 0, (SQLPOINTER)(val), 0, (SQLINTEGER*)NULL )
+			0, 0, (SQLPOINTER)(val), 0, (SQLLEN*)NULL )
 
 #define backsql_BindParamNumID( sth, par_ind, io, val )			\
 	SQLBindParameter( (sth), (SQLUSMALLINT)(par_ind),		\
 			(io), BACKSQL_C_NUMID, SQL_INTEGER,		\
-			0, 0, (SQLPOINTER)(val), 0, (SQLINTEGER*)NULL )
+			0, 0, (SQLPOINTER)(val), 0, (SQLLEN*)NULL )
 
 #ifdef BACKSQL_ARBITRARY_KEY
 #define backsql_BindParamID( sth, par_ind, io, id )			\
--- openldap-2.4.25/servers/slapd/back-sql/sql-wrap.c
+++ openldap-2.4.25.patched/servers/slapd/back-sql/sql-wrap.c
@@ -148,7 +148,7 @@
 	} else {
 		SQLCHAR		colname[ 64 ];
 		SQLSMALLINT	name_len, col_type, col_scale, col_null;
-		UDWORD		col_prec;
+		SQLLEN		col_prec;
 		int		i;
 
 #ifdef BACKSQL_TRACE
@@ -180,8 +180,8 @@
 			goto nomem;
 		}
 
-		row->value_len = (SQLINTEGER *)ber_memcalloc_x( row->ncols,
-				sizeof( SQLINTEGER ), ctx );
+		row->value_len = (SQLLEN *)ber_memcalloc_x( row->ncols,
+				sizeof( SQLLEN ), ctx );
 		if ( row->value_len == NULL ) {
 			goto nomem;
 		}