-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for crypt and plaintext authentication.
Modified tests and code to fully support ruby 1.8.7, too. Tests can now be run via rake, as well. Update readme to reflection that authentication works now. Renaming to get the markdown goodness. Adding rbx-require-relative to get the desired behaviors for require_relative when running on ruby 1.8.7. This ruby version is listed a supported platform in .travis.yml. Making both gem and tests happy on Ruby 1.8.7. Throwing in some tests that should allow testing of plain and crypt auth scenarios. Key did not get parsed on ruby 1.8.x because ruby 1.8.x is stupid. But sure, preserving compatibility.
- Loading branch information
1 parent
37a84c0
commit eb47d79
Showing
15 changed files
with
147 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ source 'https://rubygems.org' | |
gem 'hoe' | ||
gem 'rspec' | ||
gem 'rake' | ||
gem 'rbx-require-relative', :platforms => :ruby_18 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,7 +58,6 @@ Cons: | |
|
||
Implements | ||
|
||
* Authentification | ||
* Original test | ||
|
||
Spec | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
port 6313 | ||
auth required | ||
plaintext disable | ||
remote enable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
port 6312 | ||
auth required | ||
plaintext enable | ||
remote enable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
test password |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -230,4 +230,4 @@ def set_long(l, buf, o) | |
end | ||
end | ||
|
||
require 'rserve/protocol/rexpfactory' | ||
require_relative 'protocol/rexpfactory' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb") | ||
require 'tempfile' | ||
|
||
describe Rserve::Connection do | ||
before(:all) do | ||
lambda { system "killall Rserve" }.call #clean up any extra Rserves | ||
password_file = File.expand_path("./data/Rserv.passwords") | ||
|
||
plain_config = IO.read('./data/Rserv-plaintext.conf.example') | ||
plain_config = plain_config + "\npwdfile #{password_file}\n" | ||
@plain_config_file = Tempfile.new('Rserv-plaintext.conf') | ||
@plain_config_file.write(plain_config) | ||
@plain_config_file.flush | ||
crypt_config = IO.read('./data/Rserv-cryptonly.conf.example') | ||
crypt_config = crypt_config + "\npwdfile #{password_file}\n" | ||
@crypt_config_file = Tempfile.new('Rserv-cryptonly.conf') | ||
@crypt_config_file.write(crypt_config) | ||
@crypt_config_file.flush | ||
end | ||
describe "opening and closing plaintext" do | ||
before(:all) do | ||
@r=Rserve::Connection.new(:cmd_init => "R CMD Rserve --RS-conf #{@plain_config_file.path}", :username => "test", :password => "password", :port_number => 6312) | ||
end | ||
it "should be open a connection and receive ID-String" do | ||
@r.get_server_version.should==103 | ||
@r.protocol.should=="QAP1" | ||
@r.last_error.should=="OK" | ||
@r.rt.should be_instance_of(Rserve::Talk) | ||
end | ||
it "should eval something properly" do | ||
@r.void_eval("x<-1").should be true | ||
end | ||
it "should shut down correctly" do | ||
@r.should be_connected | ||
@r.close.should be true | ||
@r.should_not be_connected | ||
end | ||
end | ||
describe "opening and closing plaintext wrong password" do | ||
it "should fail to connect" do | ||
expect {@r=Rserve::Connection.new(:cmd_init => "R CMD Rserve --RS-conf #{@plain_config_file.path}", :username => "test", :password => "wrongpassword", :port_number => 6312)}.to raise_error(Rserve::Connection::IncorrectCredentialsError) | ||
lambda { system "killall Rserve" }.call #clean up any extra Rserves | ||
end | ||
end | ||
describe "opening and closing crypt" do | ||
before(:all) do | ||
@r=Rserve::Connection.new(:cmd_init => "R CMD Rserve --RS-conf #{@crypt_config_file.path}", :username => "test", :password => "password", :port_number => 6313) | ||
end | ||
it "should be open a connection and receive ID-String" do | ||
@r.get_server_version.should==103 | ||
@r.protocol.should=="QAP1" | ||
@r.last_error.should=="OK" | ||
@r.rt.should be_instance_of(Rserve::Talk) | ||
end | ||
it "should eval something properly" do | ||
@r.void_eval("x<-1").should be true | ||
end | ||
it "should shut down correctly" do | ||
@r.should be_connected | ||
@r.close.should be true | ||
@r.should_not be_connected | ||
end | ||
end | ||
describe "opening and closing crypt wrong password" do | ||
it "should fail to connect" do | ||
expect {@r=Rserve::Connection.new(:cmd_init => "R CMD Rserve --RS-conf #{@crypt_config_file.path}", :username => "test", :password => "wrongpassword", :port_number => 6313)}.to raise_error(Rserve::Connection::IncorrectCredentialsError) | ||
lambda { system "killall Rserve" }.call #clean up any extra Rserves | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters