rstyx 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
data/COPYING CHANGED
@@ -1,3 +1,66 @@
1
+ RStyx is copyrighted free software owned by Rafael Sevilla (dido
2
+ ... imperium.ph). The Owner of this software permits you to
3
+ redistribute and/or modify the software under either the terms of the
4
+ LGPL version 3 (see further below), or the conditions below ("Ruby
5
+ License"):
6
+
7
+ 1. You may make and give away verbatim copies of the source form of this
8
+ software without restriction, provided that you retain ALL of the
9
+ original copyright notices and associated disclaimers.
10
+
11
+ 2. You may modify your copy of the software in any way, provided that
12
+ you do at least ONE of the following:
13
+
14
+ a) place your modifications in the Public Domain or otherwise
15
+ make them Freely Available, such as by posting said
16
+ modifications to Usenet or an equivalent medium, or by allowing
17
+ the author to include your modifications in the software.
18
+
19
+ b) use the modified software only within your corporation or
20
+ organization.
21
+
22
+ c) give non-standard binaries non-standard names, with
23
+ instructions on where to get the original software distribution.
24
+
25
+ d) make other distribution arrangements with the Owner.
26
+
27
+ 3. You may distribute the software in object code or binary form,
28
+ provided that you do at least ONE of the following:
29
+
30
+ a) distribute the binaries and library files of the software,
31
+ together with instructions (in a manual page or equivalent)
32
+ on where to get the original distribution.
33
+
34
+ b) accompany the distribution with the machine-readable source of
35
+ the software.
36
+
37
+ c) give non-standard binaries non-standard names, with
38
+ instructions on where to get the original software distribution.
39
+
40
+ d) make other distribution arrangements with the Owner.
41
+
42
+ 4. You may modify and include parts of the software into any other
43
+ software (possibly commercial), provided you comply with the terms in
44
+ Sections 1, 2, and 3 above. But some files in the distribution
45
+ are not written by the Owner, so they may be made available to you
46
+ under different terms.
47
+
48
+ For the list of those files and their copying conditions, see the
49
+ file LEGAL.
50
+
51
+ 5. The scripts and library files supplied as input to or produced as
52
+ output from the software do not automatically fall under the
53
+ copyright of the software, but belong to whoever generated them,
54
+ and may be sold commercially, and may be aggregated with this
55
+ software.
56
+
57
+ 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
58
+ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
59
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
60
+ PURPOSE.
61
+
62
+ ---------------------------------------------------------------------
63
+
1
64
  GNU LESSER GENERAL PUBLIC LICENSE
2
65
  Version 3, 29 June 2007
3
66
 
data/History.txt CHANGED
@@ -1,4 +1,12 @@
1
1
 
2
+ == 0.4.1
3
+
4
+ Clarified licensing issues to LGPLv3 and Ruby License. Set up some
5
+ basic support for server-side Inferno authentication, and do some form
6
+ of correct permission checks on file requests. There's bound to be
7
+ lots of security bugs in this release, but we'll find them and fix
8
+ them someday...
9
+
2
10
  == 0.4.0
3
11
 
4
12
  Added some basic support for the Inferno authentication protocol. At
data/Manifest.txt CHANGED
@@ -9,7 +9,6 @@ examples/testserver.rb
9
9
  examples/writestyxfile.rb
10
10
  keyring.txt
11
11
  lib/rstyx.rb
12
- lib/rstyx/authmodules.rb
13
12
  lib/rstyx/client.rb
14
13
  lib/rstyx/common.rb
15
14
  lib/rstyx/errors.rb
data/Rakefile CHANGED
@@ -1,23 +1,25 @@
1
1
  # -*- Ruby -*-
2
- # Copyright (C) 2005,2006 Rafael Sevilla
3
- # This file is part of RStyx
4
2
  #
5
- # RStyx is free software; you can redistribute it and/or modify
6
- # it under the terms of the GNU Lesser General Public License as
7
- # published by the Free Software Foundation; either version 2.1
8
- # of the License, or (at your option) any later version.
3
+ # Author:: Rafael R. Sevilla (mailto:dido@imperium.ph)
4
+ # Copyright:: Copyright (c) 2005-2007 Rafael R. Sevilla
5
+ # Homepage:: http://rstyx.rubyforge.org/
6
+ # License:: GNU Lesser General Public License / Ruby License
7
+ #
8
+ # $Id: Rakefile 286 2007-09-19 07:33:59Z dido $
9
+ #
10
+ #----------------------------------------------------------------------------
11
+ #
12
+ # Copyright (C) 2005-2007 Rafael Sevilla
13
+ # This file is part of RStyx
9
14
  #
10
- # RStyx is distributed in the hope that it will be useful, but
11
- # WITHOUT ANY WARRANTY; without even the implied warranty of
12
- # MERCHANTIBILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- # GNU Lesser General Public License for more details.
15
+ # This program is free software; you can redistribute it and/or modify
16
+ # it under the terms of either 1) the GNU Lesser General Public License
17
+ # as published by the Free Software Foundation; either version 3 of the
18
+ # License, or (at your option) any later version; or 2) Ruby's license.
14
19
  #
15
- # You should have received a copy of the GNU Lesser General Public
16
- # License along with RStyx; if not, write to the Free Software
17
- # Foundation, Inc., 51 Franklin St., Fifth Floor, Boston, MA
18
- # 02110-1301 USA.
20
+ # See the file COPYING for complete licensing information
19
21
  #
20
- # $Id: Rakefile 257 2007-09-17 08:02:21Z dido $
22
+ #----------------------------------------------------------------------------
21
23
  #
22
24
  require 'rubygems'
23
25
  require 'hoe'
@@ -1,13 +1,41 @@
1
1
  #!/usr/bin/ruby
2
2
  #
3
- # $Id: fileondisk.rb 243 2007-09-13 08:21:09Z dido $
3
+ # Author:: Rafael R. Sevilla (mailto:dido@imperium.ph)
4
+ # Copyright:: Copyright (c) 2005-2007 Rafael R. Sevilla
5
+ # Homepage:: http://rstyx.rubyforge.org/
6
+ # License:: GNU Lesser General Public License / Ruby License
4
7
  #
5
- require 'rstyx/server'
8
+ # $Id: fileondisk.rb 292 2007-09-19 07:42:21Z dido $
9
+ #
10
+ #----------------------------------------------------------------------------
11
+ #
12
+ # Copyright (C) 2005-2007 Rafael Sevilla
13
+ # This file is part of RStyx
14
+ #
15
+ # This program is free software; you can redistribute it and/or modify
16
+ # it under the terms of either 1) the GNU Lesser General Public License
17
+ # as published by the Free Software Foundation; either version 3 of the
18
+ # License, or (at your option) any later version; or 2) Ruby's license.
19
+ #
20
+ # See the file COPYING for complete licensing information
21
+ #
22
+ #----------------------------------------------------------------------------
23
+ #
24
+ # Test server that serves up a file (or directory) on the host machine's
25
+ # filesystem.
26
+ #
27
+ require 'rstyx'
6
28
  require 'logger'
7
29
 
8
30
  log = Logger.new(STDOUT)
9
31
  sd = RStyx::Server::SDirectory.new("/")
10
32
  sf = RStyx::Server::FileOnDisk.new(ARGV[0])
33
+ authinfo = nil
34
+ unless ARGV[1].nil?
35
+ File.open(ARGV[1]) do |fp|
36
+ authinfo = RStyx::Keyring::Authinfo.readauthinfo(fp)
37
+ end
38
+ end
11
39
  sf.add_changelistener do |f|
12
40
  puts "File contents changed"
13
41
  end
@@ -16,7 +44,8 @@ serv = RStyx::Server::TCPServer.new(:bindaddr => "0.0.0.0",
16
44
  :port => 9876,
17
45
  :root => sd,
18
46
  :log => log,
19
- :debug => Logger::DEBUG)
47
+ :debug => Logger::DEBUG,
48
+ :auth => authinfo)
20
49
  Thread.abort_on_exception = true
21
50
  serv.run.join
22
51
 
@@ -1,30 +1,27 @@
1
1
  #!/usr/bin/ruby
2
2
  #
3
- # Copyright (C) 2005,2006 Rafael Sevilla
4
- # This file is part of RStyx
3
+ # Author:: Rafael R. Sevilla (mailto:dido@imperium.ph)
4
+ # Copyright:: Copyright (c) 2005-2007 Rafael R. Sevilla
5
+ # Homepage:: http://rstyx.rubyforge.org/
6
+ # License:: GNU Lesser General Public License / Ruby License
5
7
  #
6
- # RStyx is free software; you can redistribute it and/or modify
7
- # it under the terms of the GNU Lesser General Public License as
8
- # published by the Free Software Foundation; either version 2.1
9
- # of the License, or (at your option) any later version.
8
+ # $Id: readstyxfile.rb 290 2007-09-19 07:39:21Z dido $
10
9
  #
11
- # RStyx is distributed in the hope that it will be useful, but
12
- # WITHOUT ANY WARRANTY; without even the implied warranty of
13
- # MERCHANTIBILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- # GNU Lesser General Public License for more details.
10
+ #----------------------------------------------------------------------------
15
11
  #
16
- # You should have received a copy of the GNU Lesser General Public
17
- # License along with RStyx; if not, write to the Free Software
18
- # Foundation, Inc., 51 Franklin St., Fifth Floor, Boston, MA
19
- # 02110-1301 USA.
12
+ # Copyright (C) 2005-2007 Rafael Sevilla
13
+ # This file is part of RStyx
20
14
  #
21
- # Styx file reader
15
+ # This program is free software; you can redistribute it and/or modify
16
+ # it under the terms of either 1) the GNU Lesser General Public License
17
+ # as published by the Free Software Foundation; either version 3 of the
18
+ # License, or (at your option) any later version; or 2) Ruby's license.
22
19
  #
23
- # Author:: Rafael R. Sevilla (mailto:dido@imperium.ph)
24
- # Copyright:: Copyright (c) 2005,2006 Rafael R. Sevilla
25
- # License:: GNU Lesser General Public License
20
+ # See the file COPYING for complete licensing information
21
+ #
22
+ #----------------------------------------------------------------------------
26
23
  #
27
- # $Id: readstyxfile.rb 264 2007-09-18 05:24:26Z dido $
24
+ # Styx file reader
28
25
  #
29
26
  require 'rstyx'
30
27
 
@@ -1,13 +1,41 @@
1
1
  #!/usr/bin/ruby
2
2
  #
3
- # $Id: testserver.rb 237 2007-08-14 11:35:47Z dido $
3
+ # Author:: Rafael R. Sevilla (mailto:dido@imperium.ph)
4
+ # Copyright:: Copyright (c) 2005-2007 Rafael R. Sevilla
5
+ # Homepage:: http://rstyx.rubyforge.org/
6
+ # License:: GNU Lesser General Public License / Ruby License
4
7
  #
5
- require 'rstyx/server'
8
+ # $Id: testserver.rb 293 2007-09-19 07:43:41Z dido $
9
+ #
10
+ #----------------------------------------------------------------------------
11
+ #
12
+ # Copyright (C) 2005-2007 Rafael Sevilla
13
+ # This file is part of RStyx
14
+ #
15
+ # This program is free software; you can redistribute it and/or modify
16
+ # it under the terms of either 1) the GNU Lesser General Public License
17
+ # as published by the Free Software Foundation; either version 3 of the
18
+ # License, or (at your option) any later version; or 2) Ruby's license.
19
+ #
20
+ # See the file COPYING for complete licensing information
21
+ #
22
+ #----------------------------------------------------------------------------
23
+ #
24
+ # Test server that serves up a simple file named test.file that is
25
+ # an InMemoryFile.
26
+ #
27
+ require 'rstyx'
6
28
  require 'logger'
7
29
 
8
30
  log = Logger.new(STDOUT)
9
31
  sd = RStyx::Server::SDirectory.new("/")
10
32
  sf = RStyx::Server::InMemoryFile.new("test.file")
33
+ authinfo = nil
34
+ unless ARGV[0].nil?
35
+ File.open(ARGV[0]) do |fp|
36
+ authinfo = RStyx::Keyring::Authinfo.readauthinfo(fp)
37
+ end
38
+ end
11
39
  sf.contents = "hello"
12
40
  sf.add_changelistener do |f|
13
41
  puts "File contents changed to #{f.contents}"
@@ -17,7 +45,8 @@ serv = RStyx::Server::TCPServer.new(:bindaddr => "0.0.0.0",
17
45
  :port => 9876,
18
46
  :root => sd,
19
47
  :log => log,
20
- :debug => Logger::DEBUG)
48
+ :debug => Logger::DEBUG,
49
+ :auth => authinfo)
21
50
  Thread.abort_on_exception = true
22
51
  serv.run.join
23
52
 
@@ -1,30 +1,27 @@
1
1
  #!/usr/bin/ruby
2
2
  #
3
- # Copyright (C) 2005,2006 Rafael Sevilla
4
- # This file is part of RStyx
3
+ # Author:: Rafael R. Sevilla (mailto:dido@imperium.ph)
4
+ # Copyright:: Copyright (c) 2005-2007 Rafael R. Sevilla
5
+ # Homepage:: http://rstyx.rubyforge.org/
6
+ # License:: GNU Lesser General Public License / Ruby License
5
7
  #
6
- # RStyx is free software; you can redistribute it and/or modify
7
- # it under the terms of the GNU Lesser General Public License as
8
- # published by the Free Software Foundation; either version 2.1
9
- # of the License, or (at your option) any later version.
8
+ # $Id: readstyxfile.rb 290 2007-09-19 07:39:21Z dido $
10
9
  #
11
- # RStyx is distributed in the hope that it will be useful, but
12
- # WITHOUT ANY WARRANTY; without even the implied warranty of
13
- # MERCHANTIBILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- # GNU Lesser General Public License for more details.
10
+ #----------------------------------------------------------------------------
15
11
  #
16
- # You should have received a copy of the GNU Lesser General Public
17
- # License along with RStyx; if not, write to the Free Software
18
- # Foundation, Inc., 51 Franklin St., Fifth Floor, Boston, MA
19
- # 02110-1301 USA.
12
+ # Copyright (C) 2005-2007 Rafael Sevilla
13
+ # This file is part of RStyx
20
14
  #
21
- # Styx file reader
15
+ # This program is free software; you can redistribute it and/or modify
16
+ # it under the terms of either 1) the GNU Lesser General Public License
17
+ # as published by the Free Software Foundation; either version 3 of the
18
+ # License, or (at your option) any later version; or 2) Ruby's license.
22
19
  #
23
- # Author:: Rafael R. Sevilla (mailto:dido@imperium.ph)
24
- # Copyright:: Copyright (c) 2005,2006 Rafael R. Sevilla
25
- # License:: GNU Lesser General Public License
20
+ # See the file COPYING for complete licensing information
21
+ #
22
+ #----------------------------------------------------------------------------
26
23
  #
27
- # $Id: readstyxfile.rb 190 2007-06-04 06:53:54Z dido $
24
+ # Styx file writer, for test
28
25
  #
29
26
  require 'rstyx'
30
27
  require 'digest/sha1'
data/lib/rstyx/client.rb CHANGED
@@ -1,31 +1,28 @@
1
1
  #!/usr/bin/ruby
2
2
  #
3
+ # Author:: Rafael R. Sevilla (mailto:dido@imperium.ph)
4
+ # Copyright:: Copyright (c) 2005-2007 Rafael R. Sevilla
5
+ # Homepage:: http://rstyx.rubyforge.org/
6
+ # License:: GNU Lesser General Public License / Ruby License
7
+ #
8
+ # $Id: client.rb 279 2007-09-19 07:23:45Z dido $
9
+ #
10
+ #----------------------------------------------------------------------------
11
+ #
3
12
  # Copyright (C) 2005-2007 Rafael Sevilla
4
13
  # This file is part of RStyx
5
14
  #
6
- # RStyx is free software; you can redistribute it and/or modify
7
- # it under the terms of the GNU Lesser General Public License as
8
- # published by the Free Software Foundation; either version 2.1
9
- # of the License, or (at your option) any later version.
15
+ # This program is free software; you can redistribute it and/or modify
16
+ # it under the terms of either 1) the GNU Lesser General Public License
17
+ # as published by the Free Software Foundation; either version 3 of the
18
+ # License, or (at your option) any later version; or 2) Ruby's license.
10
19
  #
11
- # RStyx is distributed in the hope that it will be useful, but
12
- # WITHOUT ANY WARRANTY; without even the implied warranty of
13
- # MERCHANTIBILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- # GNU Lesser General Public License for more details.
20
+ # See the file COPYING for complete licensing information
15
21
  #
16
- # You should have received a copy of the GNU Lesser General Public
17
- # License along with RStyx; if not, write to the Free Software
18
- # Foundation, Inc., 51 Franklin St., Fifth Floor, Boston, MA
19
- # 02110-1301 USA.
22
+ #----------------------------------------------------------------------------
20
23
  #
21
24
  # Styx Client
22
25
  #
23
- # Author:: Rafael R. Sevilla (mailto:dido@imperium.ph)
24
- # Copyright:: Copyright (c) 2005-2007 Rafael R. Sevilla
25
- # License:: GNU Lesser General Public License
26
- #
27
- # $Id: client.rb 263 2007-09-18 05:23:24Z dido $
28
- #
29
26
 
30
27
  require 'thread'
31
28
  require 'timeout'
@@ -189,58 +186,6 @@ module RStyx
189
186
 
190
187
  end # module StyxClient
191
188
 
192
- ##
193
- # A connection wrapper, which provides read and write methods
194
- # just like a socket, given a connection object.
195
- #
196
- class KeyringAuthWrapper
197
- def initialize(conn)
198
- @conn = conn
199
- @data = ""
200
- @datalock = Mutex.new
201
- @dcondvar = ConditionVariable.new
202
- end
203
-
204
- ##
205
- # Write data to the connection
206
- #
207
- def write(data)
208
- @conn.send_data(data)
209
- end
210
-
211
- ##
212
- # Read data from the connection
213
- #
214
- def read(length)
215
- @datalock.synchronize do
216
- while @data.length < length
217
- @dcondvar.wait(@datalock)
218
- end
219
- retval, rest = @data.unpack("a#{length}a*")
220
- @data = rest
221
- return(retval)
222
- end
223
- end
224
-
225
- ##
226
- # Add data received from the connection here
227
- #
228
- def <<(str)
229
- @datalock.synchronize do
230
- @data << str
231
- @dcondvar.signal
232
- end
233
- end
234
-
235
- ##
236
- # Print data to the connection
237
- #
238
- def printf(str, *args)
239
- str = sprintf(str, *args)
240
- write(str)
241
- end
242
- end
243
-
244
189
  class Connection
245
190
  attr_accessor :usedfids, :pendingclunks, :umask
246
191
  attr_reader :connectstate, :msize, :version
@@ -311,7 +256,7 @@ module RStyx
311
256
  # Do Inferno authentication if the @authenticator object is a
312
257
  # keyring authinfo object
313
258
  if @authenticator.is_a?(Keyring::Authinfo)
314
- @conn.keyringauth = KeyringAuthWrapper.new(@conn)
259
+ @conn.keyringauth = Keyring::FileWrapper.new(@conn)
315
260
  @peerauth, secret = Keyring.auth(@conn.keyringauth,
316
261
  :client, @authenticator,
317
262
  ["none"])
data/lib/rstyx/common.rb CHANGED
@@ -1,31 +1,28 @@
1
1
  #!/usr/bin/ruby
2
2
  #
3
+ # Author:: Rafael R. Sevilla (mailto:dido@imperium.ph)
4
+ # Copyright:: Copyright (c) 2005-2007 Rafael R. Sevilla
5
+ # Homepage:: http://rstyx.rubyforge.org/
6
+ # License:: GNU Lesser General Public License / Ruby License
7
+ #
8
+ # $Id: common.rb 280 2007-09-19 07:24:51Z dido $
9
+ #
10
+ #----------------------------------------------------------------------------
11
+ #
3
12
  # Copyright (C) 2005-2007 Rafael Sevilla
4
13
  # This file is part of RStyx
5
14
  #
6
- # RStyx is free software; you can redistribute it and/or modify
7
- # it under the terms of the GNU Lesser General Public License as
8
- # published by the Free Software Foundation; either version 2.1
9
- # of the License, or (at your option) any later version.
15
+ # This program is free software; you can redistribute it and/or modify
16
+ # it under the terms of either 1) the GNU Lesser General Public License
17
+ # as published by the Free Software Foundation; either version 3 of the
18
+ # License, or (at your option) any later version; or 2) Ruby's license.
10
19
  #
11
- # RStyx is distributed in the hope that it will be useful, but
12
- # WITHOUT ANY WARRANTY; without even the implied warranty of
13
- # MERCHANTIBILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- # GNU Lesser General Public License for more details.
20
+ # See the file COPYING for complete licensing information
15
21
  #
16
- # You should have received a copy of the GNU Lesser General Public
17
- # License along with RStyx; if not, write to the Free Software
18
- # Foundation, Inc., 51 Franklin St., Fifth Floor, Boston, MA
19
- # 02110-1301 USA.
22
+ #----------------------------------------------------------------------------
20
23
  #
21
24
  # Common code and defined constants
22
25
  #
23
- # Author:: Rafael R. Sevilla (mailto:dido@imperium.ph)
24
- # Copyright:: Copyright (c) 2005,2006 Rafael R. Sevilla
25
- # License:: GNU Lesser General Public License
26
- #
27
- # $Id: common.rb 218 2007-07-04 06:24:33Z dido $
28
- #
29
26
  module RStyx
30
27
  # File access modes in Styx
31
28
  OREAD = 0
data/lib/rstyx/errors.rb CHANGED
@@ -1,30 +1,27 @@
1
1
  #!/usr/bin/ruby
2
2
  #
3
- # Copyright (C) 2005 Rafael Sevilla
4
- # This file is part of RStyx
3
+ # Author:: Rafael R. Sevilla (mailto:dido@imperium.ph)
4
+ # Copyright:: Copyright (c) 2005-2007 Rafael R. Sevilla
5
+ # Homepage:: http://rstyx.rubyforge.org/
6
+ # License:: GNU Lesser General Public License / Ruby License
5
7
  #
6
- # RStyx is free software; you can redistribute it and/or modify
7
- # it under the terms of the GNU Lesser General Public License as
8
- # published by the Free Software Foundation; either version 2.1
9
- # of the License, or (at your option) any later version.
8
+ # $Id: errors.rb 281 2007-09-19 07:25:55Z dido $
10
9
  #
11
- # RStyx is distributed in the hope that it will be useful, but
12
- # WITHOUT ANY WARRANTY; without even the implied warranty of
13
- # MERCHANTIBILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- # GNU Lesser General Public License for more details.
10
+ #----------------------------------------------------------------------------
15
11
  #
16
- # You should have received a copy of the GNU Lesser General Public
17
- # License along with RStyx; if not, write to the Free Software
18
- # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19
- # 02111-1307 USA.
12
+ # Copyright (C) 2005-2007 Rafael Sevilla
13
+ # This file is part of RStyx
20
14
  #
21
- # Styx Exception classes.
15
+ # This program is free software; you can redistribute it and/or modify
16
+ # it under the terms of either 1) the GNU Lesser General Public License
17
+ # as published by the Free Software Foundation; either version 3 of the
18
+ # License, or (at your option) any later version; or 2) Ruby's license.
22
19
  #
23
- # Author:: Rafael R. Sevilla (mailto:dido@imperium.ph)
24
- # Copyright:: Copyright (c) 2005 Rafael R. Sevilla
25
- # License:: GNU Lesser General Public License
20
+ # See the file COPYING for complete licensing information
21
+ #
22
+ #----------------------------------------------------------------------------
26
23
  #
27
- # $Id: errors.rb 266 2007-09-18 05:27:07Z dido $
24
+ # Styx Exception classes.
28
25
  #
29
26
 
30
27
  module RStyx