tiny_tds 0.5.2.rc1 → 0.5.2.rc2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,6 +1,12 @@
1
1
 
2
2
  * 0.5.2 *
3
3
 
4
+ * Compile windows with `--enable-sspi`.
5
+
6
+ * Allow MiniPortile to build any FreeTDS version we need. Fixes #76.
7
+
8
+ * Always convert password option to string. Fixes #92.
9
+
4
10
  * Move test system to real MiniTest::Spec. All tests pass on Azure too.
5
11
 
6
12
  * Raise and handle encoding errors on DB writes. Fixes #89.
data/README.md CHANGED
@@ -11,13 +11,6 @@ The API is simple and consists of these classes:
11
11
  * TinyTds::Error - A wrapper for all FreeTDS exceptions.
12
12
 
13
13
 
14
- ## New & Noteworthy
15
-
16
- * Works with FreeTDS 0.91
17
- * Tested on Windows using MiniPortile & RailsInstaller.
18
- * New :host/:port connection options. Removes need for freetds.conf file.
19
-
20
-
21
14
  ## Install
22
15
 
23
16
  Installing with rubygems should just work. TinyTDS is tested on ruby version 1.8.6, 1.8.7, 1.9.1, 1.9.2, 1.9.3 as well as REE & JRuby.
@@ -31,7 +24,7 @@ Although we search for FreeTDS's libraries and headers, you may have to specify
31
24
 
32
25
  ## FreeTDS Compatibility & Configuration
33
26
 
34
- TinyTDS is developed against FreeTDS 0.82 & 0.91, the latest is recommended. It is tested with SQL Server 2000, 2005, 2008 and Azure. Below are a few QA style notes about installing FreeTDS.
27
+ TinyTDS is developed against FreeTDS 0.82 & 0.91, and 0.92 currents, the latest is recommended. It is tested with SQL Server 2000, 2005, 2008 and Azure. Below are a few QA style notes about installing FreeTDS.
35
28
 
36
29
  * **Do I need to install FreeTDS?** Yes! Somehow, someway, you are going to need FreeTDS for TinyTDS to compile against. You can avoid installing FreeTDS on your system by using our projects usage of rake-compiler and mini_portile to compile and package a native gem just for you. See the "Using MiniPortile" section below.
37
30
 
@@ -296,6 +289,18 @@ $ gem install pkg/tiny_tds-X.X.X-#{platform}.gem
296
289
 
297
290
  **Important:** You must use rubygems version 1.7.2 or higher. You will almost certainly hit a *Don't know how to build task...* error when running the `rake native gem` command if you do not. Please update rubygems! Here is a link on [how to upgrade or downgrade rubygems](http://rubygems.rubyforge.org/rubygems-update/UPGRADING_rdoc.html).
298
291
 
292
+ It is also possible to build a specific version of FreeTDS for your own gem or development and testing using the `TINYTDS_FREETDS_VERSION` environment variable. Here are some exampbles of possible values.
293
+
294
+ ```
295
+ $ rake TINYTDS_FREETDS_VERSION="0.82"
296
+ $ rake TINYTDS_FREETDS_VERSION="0.91"
297
+ $ rake TINYTDS_FREETDS_VERSION="0.91.49"
298
+ $ rake TINYTDS_FREETDS_VERSION="0.92.405"
299
+ $ rake TINYTDS_FREETDS_VERSION="current"
300
+ ```
301
+
302
+ To find out more about the FreeTDS release system [visit this thread](http://lists.ibiblio.org/pipermail/freetds/2012q1/027756.html) on their mailing list. You can also browse thier FTP server [ftp://ftp.astron.com/pub/freetds/](ftp://ftp.astron.com/pub/freetds/) for version number strings.
303
+
299
304
 
300
305
  ## Development & Testing
301
306
 
data/Rakefile CHANGED
@@ -1,21 +1,23 @@
1
1
  # encoding: UTF-8
2
2
  require 'rake'
3
- require "rake/clean"
3
+ require 'rake/clean'
4
4
  require 'rbconfig'
5
5
  require 'rake/testtask'
6
6
  require 'rake/extensiontask'
7
- require "rubygems/package_task"
7
+ require 'rubygems/package_task'
8
8
 
9
9
  # My notes for cross compile native Windows gem.
10
10
  #
11
11
  # $ rake-compiler cross-ruby VERSION=1.8.7-p352
12
12
  # $ rake-compiler cross-ruby VERSION=1.9.2-p290
13
13
  #
14
+ # $ rbenv shell 1.8.7
14
15
  # $ git clean -x -d -f
15
16
  # $ bundle install
16
- # $ ~/.rbenv/shims/rake compile
17
- # $ ~/.rbenv/shims/rake cross compile RUBY_CC_VERSION=1.8.7:1.9.2
18
- # $ ~/.rbenv/shims/rake cross native gem RUBY_CC_VERSION=1.8.7:1.9.2
17
+ # $ unalias rake-compiler && unalias rake
18
+ # $ rake compile
19
+ # $ rake cross compile RUBY_CC_VERSION=1.8.7:1.9.3
20
+ # $ rake cross native gem RUBY_CC_VERSION=1.8.7:1.9.3
19
21
 
20
22
  def test_libs
21
23
  ['lib','test']
@@ -0,0 +1,52 @@
1
+ commit cdf93abe5492ec706bca0db762be41526f343e92
2
+ Author: Frediano Ziglio <freddy77@gmail.com>
3
+ Date: Sun Nov 4 10:17:34 2012 +0000
4
+
5
+ Fix sspi if Kerberos is used
6
+
7
+ Authentication require more roud trips for Kerberos.
8
+
9
+ diff --git a/src/tds/sspi.c b/src/tds/sspi.c
10
+ index 680717a..077d58b 100644
11
+ --- a/src/tds/sspi.c
12
+ +++ b/src/tds/sspi.c
13
+ @@ -172,8 +172,19 @@ tds_sspi_handle_next(TDSSOCKET * tds, struct tds_authentication * tds_auth, size
14
+
15
+ free(auth_buf);
16
+
17
+ - if (status != SEC_E_OK)
18
+ + switch (status) {
19
+ + case SEC_I_COMPLETE_AND_CONTINUE:
20
+ + sec_fn->CompleteAuthToken(&auth->cred_ctx, &out_desc);
21
+ + break;
22
+ +
23
+ + case SEC_I_CONTINUE_NEEDED:
24
+ + case SEC_E_OK:
25
+ + break;
26
+ +
27
+ + default:
28
+ return TDS_FAIL;
29
+ + }
30
+ +
31
+ if (out_buf.cbBuffer == 0)
32
+ return TDS_SUCCEED;
33
+
34
+ @@ -275,9 +286,16 @@ tds_sspi_get_auth(TDSSOCKET * tds)
35
+ &auth->cred_ctx, &desc,
36
+ &attrs, &ts);
37
+
38
+ - if (status == SEC_I_COMPLETE_AND_CONTINUE || status == SEC_I_CONTINUE_NEEDED) {
39
+ + switch (status) {
40
+ + case SEC_I_COMPLETE_AND_CONTINUE:
41
+ sec_fn->CompleteAuthToken(&auth->cred_ctx, &desc);
42
+ - } else if(status != SEC_E_OK) {
43
+ + break;
44
+ +
45
+ + case SEC_I_CONTINUE_NEEDED:
46
+ + case SEC_E_OK:
47
+ + break;
48
+ +
49
+ + default:
50
+ free(auth->sname);
51
+ free(auth->tds_auth.packet);
52
+ sec_fn->FreeCredentialsHandle(&auth->cred);
@@ -54,7 +54,10 @@ module TinyTds
54
54
 
55
55
 
56
56
  def initialize(opts={})
57
- warn 'FreeTDS may have issues with passwords longer than 30 characters!' if opts[:password].to_s.length > 30
57
+ if opts[:password] && opts[:password].to_s.strip != ''
58
+ opts[:password].to_s!
59
+ warn 'FreeTDS may have issues with passwords longer than 30 characters!' if opts[:password].length > 30
60
+ end
58
61
  raise ArgumentError, 'missing :username option' if opts[:username].to_s.empty?
59
62
  raise ArgumentError, 'missing :host option if no :dataserver given' if opts[:dataserver].to_s.empty? && opts[:host].to_s.empty?
60
63
  @query_options = @@default_query_options.dup
@@ -1,3 +1,3 @@
1
1
  module TinyTds
2
- VERSION = '0.5.2.rc1'
2
+ VERSION = '0.5.2.rc2'
3
3
  end
data/tasks/ports.rake CHANGED
@@ -1,16 +1,19 @@
1
- require "mini_portile"
2
- require "rake/extensioncompiler"
1
+ require 'mini_portile'
2
+ require 'rake/extensioncompiler'
3
3
 
4
4
  namespace :ports do
5
5
 
6
6
  # If your using 0.82, you may have to make a conf file to get it to work. For example:
7
7
  # $ export FREETDSCONF='/opt/local/etc/freetds/freetds.conf'
8
8
  ICONV_VERSION = "1.13.1"
9
- FREETDS_VERSION = ENV['TINYTDS_FREETDS_082'] ? "0.82" : "0.91"
10
- FREETDS_VERSION_INFO = {
11
- "0.82" => {:files => "http://mirrors.ibiblio.org/freetds/old/0.82/freetds-0.82.tar.gz"},
12
- # "0.82" => {:files => "http://mirrors.ibiblio.org/freetds/old/0.82/freetds-patched.tgz"},
13
- "0.91" => {:files => "http://mirrors.ibiblio.org/freetds/stable/freetds-0.91.tar.gz"} }
9
+ FREETDS_VERSION = ENV['TINYTDS_FREETDS_VERSION'] || "0.91"
10
+ FREETDS_VERSION_INFO = Hash.new { |h,k|
11
+ h[k] = {:files => "ftp://ftp.astron.com/pub/freetds/stable/freetds-#{k}.tar.gz"}
12
+ }.merge({
13
+ "0.82" => {:files => "ftp://ftp.astron.com/pub/freetds/old/0.82/freetds-0.82.tar.gz"},
14
+ "0.91" => {:files => "ftp://ftp.astron.com/pub/freetds/stable/freetds-0.91.tar.gz"},
15
+ "current" => {:files => "ftp://ftp.astron.com/pub/freetds/current/freetds-current.tgz"}
16
+ })
14
17
 
15
18
  directory "ports"
16
19
 
@@ -20,6 +23,7 @@ namespace :ports do
20
23
 
21
24
  $recipes[:freetds] = MiniPortile.new "freetds", FREETDS_VERSION
22
25
  $recipes[:freetds].files << FREETDS_VERSION_INFO[FREETDS_VERSION][:files]
26
+ $recipes[:freetds].patch_files << File.expand_path(File.join('..', '..', 'ext', 'patch', 'sspi_w_kerberos.diff'), __FILE__) if $recipes[:freetds].respond_to?(:patch_files)
23
27
 
24
28
  desc "Compile libiconv support library"
25
29
  task :libiconv => ["ports"] do
@@ -38,13 +42,12 @@ namespace :ports do
38
42
  recipe = $recipes[:freetds]
39
43
  checkpoint = "ports/.#{recipe.name}.#{recipe.version}.#{recipe.host}.timestamp"
40
44
  unless File.exist?(checkpoint)
41
- recipe.configure_options << '--sysconfdir="C:/Sites"' if recipe.host =~ /mswin|mingw/i
45
+ with_tdsver = ENV['TINYTDS_FREETDS_VERSION'] =~ /0\.8/ ? "--with-tdsver=8.0" : "--with-tdsver=7.1"
46
+ for_windows = recipe.host =~ /mswin|mingw/i
47
+ recipe.configure_options << '--sysconfdir="C:/Sites"' if for_windows
48
+ recipe.configure_options << '--enable-sspi' if for_windows
42
49
  recipe.configure_options << "--disable-odbc"
43
- if ENV['TINYTDS_FREETDS_082']
44
- recipe.configure_options << "--with-tdsver=8.0"
45
- else
46
- recipe.configure_options << "--with-tdsver=7.1"
47
- end
50
+ recipe.configure_options << with_tdsver
48
51
  recipe.configure_options << "CFLAGS='-fPIC'"
49
52
  recipe.cook
50
53
  touch checkpoint
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tiny_tds
3
3
  version: !ruby/object:Gem::Version
4
- hash: 1037666241
4
+ hash: 3269045753
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 0
8
8
  - 5
9
9
  - 2
10
10
  - rc
11
- - 1
12
- version: 0.5.2.rc1
11
+ - 2
12
+ version: 0.5.2.rc2
13
13
  platform: ruby
14
14
  authors:
15
15
  - Ken Collins
@@ -18,7 +18,7 @@ autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
20
 
21
- date: 2012-09-23 00:00:00 -04:00
21
+ date: 2012-11-06 00:00:00 -05:00
22
22
  default_executable:
23
23
  dependencies:
24
24
  - !ruby/object:Gem::Dependency
@@ -43,14 +43,14 @@ dependencies:
43
43
  requirement: &id002 !ruby/object:Gem::Requirement
44
44
  none: false
45
45
  requirements:
46
- - - "="
46
+ - - ~>
47
47
  - !ruby/object:Gem::Version
48
- hash: 19
48
+ hash: 15
49
49
  segments:
50
50
  - 0
51
- - 3
51
+ - 4
52
52
  - 0
53
- version: 0.3.0
53
+ version: 0.4.0
54
54
  type: :development
55
55
  version_requirements: *id002
56
56
  - !ruby/object:Gem::Dependency
@@ -115,6 +115,7 @@ files:
115
115
  - NOTES
116
116
  - README.md
117
117
  - Rakefile
118
+ - ext/patch/sspi_w_kerberos.diff
118
119
  - ext/tiny_tds/client.c
119
120
  - ext/tiny_tds/client.h
120
121
  - ext/tiny_tds/extconf.rb