summaryrefslogtreecommitdiffstats
path: root/main/openldap/openldap-back-sql-fix-64bit.patch
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2011-06-13 14:12:11 +0300
committerTimo Teräs <timo.teras@iki.fi>2011-06-13 14:13:54 +0300
commitcf252e67066e7093a3f032f9449022987a1e810b (patch)
tree4775166193469b8fc3ada02a309d34145a8fdc08 /main/openldap/openldap-back-sql-fix-64bit.patch
parenta8829e6940a257c1cb1214dd05ae2058169f3799 (diff)
downloadaports-cf252e67066e7093a3f032f9449022987a1e810b.tar.bz2
aports-cf252e67066e7093a3f032f9449022987a1e810b.tar.xz
main/openldap: fix sql backend on 64-bit architectures
Diffstat (limited to 'main/openldap/openldap-back-sql-fix-64bit.patch')
-rw-r--r--main/openldap/openldap-back-sql-fix-64bit.patch82
1 files changed, 82 insertions, 0 deletions
diff --git a/main/openldap/openldap-back-sql-fix-64bit.patch b/main/openldap/openldap-back-sql-fix-64bit.patch
new file mode 100644
index 000000000..82707d4e7
--- /dev/null
+++ b/main/openldap/openldap-back-sql-fix-64bit.patch
@@ -0,0 +1,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;
+ }