rstyx 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/COPYING +63 -0
- data/History.txt +8 -0
- data/Manifest.txt +0 -1
- data/Rakefile +17 -15
- data/examples/fileondisk.rb +32 -3
- data/examples/readstyxfile.rb +16 -19
- data/examples/testserver.rb +32 -3
- data/examples/writestyxfile.rb +16 -19
- data/lib/rstyx/client.rb +16 -71
- data/lib/rstyx/common.rb +15 -18
- data/lib/rstyx/errors.rb +16 -19
- data/lib/rstyx/keyring.rb +79 -23
- data/lib/rstyx/messages.rb +16 -19
- data/lib/rstyx/server.rb +268 -66
- data/lib/rstyx/version.rb +17 -16
- data/lib/rstyx.rb +17 -15
- data/tests/tc_client.rb +16 -15
- data/tests/tc_message.rb +17 -15
- data/tests/tc_styxservproto.rb +16 -15
- metadata +2 -3
- data/lib/rstyx/authmodules.rb +0 -90
data/tests/tc_client.rb
CHANGED
@@ -1,24 +1,25 @@
|
|
1
1
|
#!/usr/bin/ruby
|
2
2
|
#
|
3
|
-
#
|
4
|
-
#
|
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: tc_client.rb 288 2007-09-19 07:36:50Z dido $
|
5
9
|
#
|
6
|
-
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
+
#----------------------------------------------------------------------------
|
11
|
+
#
|
12
|
+
# Copyright (C) 2005-2007 Rafael Sevilla
|
13
|
+
# This file is part of RStyx
|
10
14
|
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
#
|
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.
|
15
19
|
#
|
16
|
-
#
|
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.
|
20
|
+
# See the file COPYING for complete licensing information
|
20
21
|
#
|
21
|
-
|
22
|
+
#----------------------------------------------------------------------------
|
22
23
|
#
|
23
24
|
require 'test/unit'
|
24
25
|
require 'flexmock'
|
data/tests/tc_message.rb
CHANGED
@@ -1,26 +1,28 @@
|
|
1
|
-
|
1
|
+
#!/usr/bin/ruby
|
2
2
|
#
|
3
|
-
#
|
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: tc_message.rb 287 2007-09-19 07:35:47Z dido $
|
9
|
+
#
|
10
|
+
#----------------------------------------------------------------------------
|
11
|
+
#
|
12
|
+
# Copyright (C) 2005-2007 Rafael Sevilla
|
4
13
|
# This file is part of RStyx
|
5
14
|
#
|
6
|
-
#
|
7
|
-
# it under the terms of the GNU Lesser General Public License
|
8
|
-
# published by the Free Software Foundation; either version
|
9
|
-
#
|
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
|
-
#
|
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
|
-
|
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
|
# Unit tests for Styx messages
|
22
25
|
#
|
23
|
-
# $Id: tc_message.rb 177 2007-05-31 08:23:25Z dido $
|
24
26
|
#
|
25
27
|
require 'test/unit'
|
26
28
|
require 'rstyx/common'
|
data/tests/tc_styxservproto.rb
CHANGED
@@ -1,24 +1,25 @@
|
|
1
1
|
#!/usr/bin/ruby
|
2
2
|
#
|
3
|
-
#
|
4
|
-
#
|
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: tc_styxservproto.rb 289 2007-09-19 07:38:07Z dido $
|
5
9
|
#
|
6
|
-
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
+
#----------------------------------------------------------------------------
|
11
|
+
#
|
12
|
+
# Copyright (C) 2005-2007 Rafael Sevilla
|
13
|
+
# This file is part of RStyx
|
10
14
|
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
#
|
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.
|
15
19
|
#
|
16
|
-
#
|
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.
|
20
|
+
# See the file COPYING for complete licensing information
|
20
21
|
#
|
21
|
-
|
22
|
+
#----------------------------------------------------------------------------
|
22
23
|
#
|
23
24
|
require 'test/unit'
|
24
25
|
require 'flexmock'
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
|
|
3
3
|
specification_version: 1
|
4
4
|
name: rstyx
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.4.
|
7
|
-
date: 2007-09-
|
6
|
+
version: 0.4.1
|
7
|
+
date: 2007-09-19 00:00:00 +08:00
|
8
8
|
summary: RStyx is a Ruby implementation of the 9P2000/Styx distributed file protocol used on Plan 9 and Inferno.
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -40,7 +40,6 @@ files:
|
|
40
40
|
- examples/writestyxfile.rb
|
41
41
|
- keyring.txt
|
42
42
|
- lib/rstyx.rb
|
43
|
-
- lib/rstyx/authmodules.rb
|
44
43
|
- lib/rstyx/client.rb
|
45
44
|
- lib/rstyx/common.rb
|
46
45
|
- lib/rstyx/errors.rb
|
data/lib/rstyx/authmodules.rb
DELETED
@@ -1,90 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby
|
2
|
-
#
|
3
|
-
# Copyright (C) 2005-2007 Rafael Sevilla
|
4
|
-
# This file is part of RStyx
|
5
|
-
#
|
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.
|
10
|
-
#
|
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.
|
15
|
-
#
|
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.
|
20
|
-
#
|
21
|
-
# Authentication modules
|
22
|
-
#
|
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: authmodules.rb 190 2007-06-04 06:53:54Z dido $
|
28
|
-
#
|
29
|
-
|
30
|
-
module RStyx
|
31
|
-
|
32
|
-
module ClientAuth
|
33
|
-
|
34
|
-
class AuthModule
|
35
|
-
##
|
36
|
-
# Given a pre-authenticated Styx server connection, execute
|
37
|
-
# an authentication protocol on it, and return a working
|
38
|
-
# authenticated rfid.
|
39
|
-
#
|
40
|
-
def authenticate(conn)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
##
|
45
|
-
# Clear password authenticated connection. Frankly, this is a whole
|
46
|
-
# load of bunkum. I have nothing substantial to test this
|
47
|
-
# authentication code against but apparently it is what JStyx does
|
48
|
-
# and so perhaps it should work with a JStyx-based server and thus
|
49
|
-
# presumably some version of Plan 9, but apparently it's an
|
50
|
-
# authentication procedure not supported by any real version of
|
51
|
-
# Inferno I have. :-/ Oh, and it ought to work just fine with the
|
52
|
-
# server code, right?
|
53
|
-
#
|
54
|
-
class ClearPasswordAuth < AuthModule
|
55
|
-
def initialize(u, p)
|
56
|
-
@username = u
|
57
|
-
@password = p
|
58
|
-
end
|
59
|
-
|
60
|
-
def authenticate(conn)
|
61
|
-
afid = conn.get_free_fid
|
62
|
-
rauth = send_message(Message::Tauth.new(:uname => @username,
|
63
|
-
:afid => afid,
|
64
|
-
:aname => ""))
|
65
|
-
# We now have the fid to an authentication file. We write the
|
66
|
-
# password into this file.
|
67
|
-
authfile = Client::File.new(conn, "/auth")
|
68
|
-
authfile.fid = afid
|
69
|
-
authfile.qid = rauth.aqid
|
70
|
-
# suitable iounit
|
71
|
-
authfile.iounit = 8216
|
72
|
-
# If this write succeeds, the server accepted our password,
|
73
|
-
# otherwise, this call will throw an exception and
|
74
|
-
# authentication fails. XXX -- this ought to throw a properly
|
75
|
-
# formatted error rather than the normal write errors. It
|
76
|
-
# should be tested.
|
77
|
-
authfile._syswrite(@password, 0)
|
78
|
-
# If we get here without any errors we should be able to
|
79
|
-
# attach using the afid we got.
|
80
|
-
rfid = get_free_fid
|
81
|
-
rattach = send_message(Message::Tattach.new(:fid => rfid,
|
82
|
-
:afid => afid,
|
83
|
-
:uname => @username))
|
84
|
-
return(rfid)
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
end
|
89
|
-
|
90
|
-
end
|