changeset 1378:af4a70461709

upgrade package freetds to cvs
author Mark Brand <mabrand@mabrand.nl>
date Tue, 16 Nov 2010 19:51:34 +0100
parents 3f57ce7e5871
children 5daa178344e4
files src/freetds-1-fastforward.patch
diffstat 1 files changed, 156 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/freetds-1-fastforward.patch	Tue Nov 16 17:17:08 2010 +0100
+++ b/src/freetds-1-fastforward.patch	Tue Nov 16 19:51:34 2010 +0100
@@ -158218,3 +158218,159 @@
  		return NULL;
  
  # elif defined(HAVE_FUNC_GETPWUID_R_4_PW)
+
+commit b4a1ed3da7c58fefd692a0ca36621c975dae4441
+Author: freddy77 <freddy77>
+Date:   Tue Nov 16 13:25:15 2010 +0000
+
+    fix NTLMv2 on 64-bit machine
+
+diff --git a/ChangeLog b/ChangeLog
+index cde099a..6e8dea1 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,6 @@
++Tue Nov 16 14:25:04 CET 2010    Frediano Ziglio <freddy77_A_gmail_D_com>
++	* configure.ac src/tds/challenge.c: fix NTLMv2 on 64-bit machine
++
+ Tue Nov 16 11:29:37 CET 2010    Frediano Ziglio <freddy77_A_gmail_D_com>
+ 	* src/tds/threadsafe.c:
+ 	- fix possible core (patch from Peter C. Norton)
+@@ -3000,4 +3003,4 @@ Wed Jan  9 19:54:43 EST 2008	JK Lowden <jklowden@freetds.org>
+ 	* ChangeLog-0.82 added because of release
+ 	
+ $FreeTDS$
+-$Id: ChangeLog,v 1.3155 2010/11/16 10:29:56 freddy77 Exp $
++$Id: ChangeLog,v 1.3156 2010/11/16 13:25:15 freddy77 Exp $
+diff --git a/configure.ac b/configure.ac
+index b3b2633..1898af9 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1,7 +1,7 @@
+ dnl Process this file with autoconf to produce a configure script.
+ 
+ dnl ------------------------------------------------------------
+-dnl $Id: configure.ac,v 1.58 2010/11/04 19:38:33 freddy77 Exp $
++dnl $Id: configure.ac,v 1.59 2010/11/16 13:25:15 freddy77 Exp $
+ dnl If you're trying to create a new configure test, try
+ dnl
+ dnl 	http://autogen.sourceforge.net/conftest.html
+@@ -15,7 +15,7 @@ dnl ------------------------------------------------------------
+ AC_INIT(FreeTDS, 0.83.dev.esyscmd(printf $(date +"%Y%m%d")))
+ AC_CONFIG_SRCDIR(src/dblib/dblib.c)
+ AC_PREREQ(2.53)
+-AC_REVISION($Revision: 1.58 $)
++AC_REVISION($Revision: 1.59 $)
+ 
+ AM_INIT_AUTOMAKE([dist-bzip2])
+ AC_CONFIG_HEADERS(include/config.h)
+@@ -276,6 +276,7 @@ AC_CHECK_HEADERS([	errno.h \
+ 			poll.h \
+ 			readpassphrase.h \
+ 			signal.h \
++			stddef.h \
+ 			sys/param.h \
+ 			sys/select.h \
+ 			sys/stat.h \
+diff --git a/src/tds/challenge.c b/src/tds/challenge.c
+index cea3307..0951f13 100644
+--- a/src/tds/challenge.c
++++ b/src/tds/challenge.c
+@@ -26,6 +26,10 @@
+ #include <stdlib.h>
+ #endif /* HAVE_STDLIB_H */
+ 
++#if HAVE_STDDEF_H
++#include <stddef.h>
++#endif /* HAVE_STDDEF_H */
++
+ #include <ctype.h>
+ 
+ #if HAVE_STRING_H
+@@ -45,7 +49,7 @@
+ #include <dmalloc.h>
+ #endif
+ 
+-TDS_RCSID(var, "$Id: challenge.c,v 1.45 2010/11/09 15:46:42 freddy77 Exp $");
++TDS_RCSID(var, "$Id: challenge.c,v 1.46 2010/11/16 13:25:15 freddy77 Exp $");
+ 
+ /**
+  * \ingroup libtds
+@@ -62,6 +66,11 @@ TDS_RCSID(var, "$Id: challenge.c,v 1.45 2010/11/09 15:46:42 freddy77 Exp $");
+  * The following code is based on some psuedo-C code from ronald@innovation.ch
+  */
+ 
++#ifndef offsetof
++# define offsetof(st, m) \
++     ((size_t) ( (char *)&((st *)(0))->m - (char *)0 ))
++#endif
++
+ typedef struct tds_answer
+ {
+ 	unsigned char lm_resp[24];
+@@ -79,6 +88,7 @@ typedef struct
+ 	TDS_UCHAR       challenge[8];
+ 	TDS_UINT        unknown;
+ 	/* target info block - variable length */
++	TDS_UCHAR	target_info[4];
+ } names_blob_prefix_t;
+ 
+ static int
+@@ -96,7 +106,7 @@ convert_to_upper(char *buf, size_t len)
+ 	size_t i;
+ 
+ 	for (i = 0; i < len; i++)
+-		buf[i] = toupper(buf[i]);
++		buf[i] = toupper((unsigned char) buf[i]);
+ }
+ 
+ static size_t
+@@ -282,8 +292,10 @@ tds_answer_challenge_ntlmv2(TDSSOCKET * tds,
+ 	if (!*ntlm_v2_response)
+ 		return TDS_FAIL;
+ 
+-	/* local not supported, avoid NTLM2 */
+-	*flags &= ~(0x80000|0x4000);
++	memset(ntlm_v2_hash, 0, sizeof(ntlm_v2_hash));
++
++	/* local not supported */
++	*flags &= ~0x4000;
+ 	return TDS_SUCCEED;
+ }
+ 
+@@ -436,7 +448,7 @@ tds7_send_auth(TDSSOCKET * tds,
+ 
+ 	unsigned char *ntlm_v2_response = NULL;
+ 	unsigned int ntlm_response_len = 24;
+-	unsigned int lm_response_len = 24;
++	const unsigned int lm_response_len = 24;
+ 
+ 	TDSCONNECTION *connection = tds->connection;
+ 
+@@ -465,8 +477,6 @@ tds7_send_auth(TDSSOCKET * tds,
+ 		return rc;
+ 
+ 	ntlm_response_len = ntlm_v2_response ? 16 + names_blob_len : 24;
+-	lm_response_len = ntlm_v2_response ? 0 : 24;
+-	/* lm_response_len = 24; */
+ 	/* ntlm_response_len = 0; */
+ 
+ 	tds->out_flag = TDS7_AUTH;
+@@ -681,7 +691,7 @@ tds_ntlm_handle_next(TDSSOCKET * tds, struct tds_authentication * auth, size_t l
+ 		 * Search "davenport port"
+ 		 * (currently http://davenport.sourceforge.net/ntlm.html)
+ 		 */
+-		names_blob_len = sizeof(names_blob_prefix_t) + target_info_len + 4;
++		names_blob_len = offsetof(names_blob_prefix_t, target_info) + target_info_len + 4;
+ 
+ 		/* read Target Info */
+ 		names_blob = (unsigned char *) calloc(names_blob_len, 1);
+@@ -689,7 +699,7 @@ tds_ntlm_handle_next(TDSSOCKET * tds, struct tds_authentication * auth, size_t l
+ 			return TDS_FAIL;
+ 
+ 		fill_names_blob_prefix((names_blob_prefix_t *) names_blob);
+-		tds_get_n(tds, names_blob + sizeof(names_blob_prefix_t), target_info_len);
++		tds_get_n(tds, names_blob + offsetof(names_blob_prefix_t, target_info), target_info_len);
+ 		where += target_info_len;
+ 	} else {
+ 		names_blob = NULL;