sbsm 1.3.9 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dd930d80bc37cb035451c6cd60025c07d93ecdd4
4
- data.tar.gz: a885ac42d48f711ed8d66a51d4a3d54032b0571b
3
+ metadata.gz: 5fe0cd3bee32abd6584a2ef5bee75193dc3f6628
4
+ data.tar.gz: dfae87daaf90a29b77aa63cd2d6383a38adac999
5
5
  SHA512:
6
- metadata.gz: 698df6a49ae0bb42eb7a11bba5b0277a35c29f17e1cfa396a61c1a08c4d047edeec0cbe5f3f10f2099b42c9c5262db5bb13dd8cd8b2bf044746668e665dd9bb8
7
- data.tar.gz: c5c8f01a38aeb00a104af5998bbc0ef0a48693461a5b404379fa67959d66dd16d9d2dd2fe8cfbffadcb04861e0c0778dde848155168a01ff250fa0bd89301926
6
+ metadata.gz: 11964b9621a5888a2cffd473d25d6df2187cdf47bfb325bc8d8625715e173e7ed3edafe326519fc24632ef5cef43beef225db0b37f33f42fb44f7c66ad247ebd
7
+ data.tar.gz: c824c1ee2f3915e65d7863c75d71e0a00df4221a454b124c04855171d8e9732892aabb4c69cd43d9e7d05106c1cf28dc32d238dcd31ad153124e79d7cda11524
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ === 1.4.0 / 17.05.2017
2
+
3
+ * Moved _admin to separate AdminServer class
4
+
1
5
  === 1.3.9 / 15.05.2017
2
6
 
3
7
  * Added SBSM.warn and SBSM.error to make lib/sbsm/state.rb happy
@@ -0,0 +1,69 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: utf-8
3
+ #--
4
+ #
5
+ # State Based Session Management
6
+ # Copyright (C) 2004 Hannes Wyss
7
+ #
8
+ # This library is free software; you can redistribute it and/or
9
+ # modify it under the terms of the GNU Lesser General Public
10
+ # License as published by the Free Software Foundation; either
11
+ # version 2.1 of the License, or (at your option) any later version.
12
+ #
13
+ # This library is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
+ # Lesser General Public License for more details.
17
+ #
18
+ # You should have received a copy of the GNU Lesser General Public
19
+ # License along with this library; if not, write to the Free Software
20
+ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
+ #
22
+ # ywesee - intellectual capital connected, Winterthurerstrasse 52, CH-8006 Zürich, Switzerland
23
+ # hwyss@ywesee.com
24
+ #
25
+ #++
26
+ # AdminServer -- sbsm -- niger@ywesee.com
27
+ # 2017: Moved the old _admin interface into a separate class for BBMB and Virbac
28
+
29
+ require 'delegate'
30
+ require 'sbsm/session'
31
+ require 'sbsm/user'
32
+ require 'thread'
33
+ require 'digest/md5'
34
+ require 'sbsm/logger'
35
+ require 'sbsm/session_store'
36
+
37
+ module SBSM
38
+ # AdminClass must be tied to an Rack app
39
+ class AdminServer
40
+ def initialize(app:)
41
+ @session = SBSM::SessionStore.new(app: app)
42
+ @admin_threads = ThreadGroup.new
43
+ end
44
+ def _admin(src, result, priority=0)
45
+ t = Thread.new {
46
+ Thread.current.abort_on_exception = false
47
+ result << begin
48
+ response = begin
49
+ instance_eval(src)
50
+ rescue NameError => e
51
+ e
52
+ end
53
+ str = response.to_s
54
+ if(str.length > 200)
55
+ response.class
56
+ else
57
+ str
58
+ end
59
+ rescue StandardError => e
60
+ e.message
61
+ end.to_s
62
+ }
63
+ t[:source] = src
64
+ t.priority = priority
65
+ @admin_threads.add(t)
66
+ t
67
+ end
68
+ end
69
+ end
@@ -43,7 +43,6 @@ module SBSM
43
43
  class SessionStore
44
44
  CLEANING_INTERVAL = 30
45
45
  CAP_MAX_THRESHOLD = 120
46
- ENABLE_ADMIN = false
47
46
  MAX_SESSIONS = 100
48
47
  RUN_CLEANER = true
49
48
  SESSION = Session
@@ -62,7 +61,6 @@ module SBSM
62
61
  @sessions = {}
63
62
  @mutex = Mutex.new
64
63
  @cleaner = run_cleaner if(self.class.const_get(:RUN_CLEANER))
65
- @admin_threads = ThreadGroup.new
66
64
  @async = ThreadGroup.new
67
65
  @app = app
68
66
  @system = persistence_layer
@@ -76,31 +74,6 @@ module SBSM
76
74
  @unknown_user ||= UNKNOWN_USER
77
75
  @validator = validator
78
76
  end
79
- def _admin(src, result, priority=0)
80
- raise "admin interface disabled" unless(self::class::ENABLE_ADMIN)
81
- t = Thread.new {
82
- Thread.current.abort_on_exception = false
83
- result << begin
84
- response = begin
85
- instance_eval(src)
86
- rescue NameError => e
87
- e
88
- end
89
- str = response.to_s
90
- if(str.length > 200)
91
- response.class
92
- else
93
- str
94
- end
95
- rescue StandardError => e
96
- e.message
97
- end.to_s
98
- }
99
- t[:source] = src
100
- t.priority = priority
101
- @admin_threads.add(t)
102
- t
103
- end
104
77
  def async(&block)
105
78
  @async.add(Thread.new(&block))
106
79
  end
data/lib/sbsm/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module SBSM
2
- VERSION = '1.3.9'
2
+ VERSION = '1.4.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sbsm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.9
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masaomi Hatakeyama, Zeno R.R. Davatz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-16 00:00:00.000000000 Z
11
+ date: 2017-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -270,6 +270,7 @@ files:
270
270
  - data/zone_uri.grammar
271
271
  - install.rb
272
272
  - lib/sbsm.rb
273
+ - lib/sbsm/admin_server.rb
273
274
  - lib/sbsm/app.rb
274
275
  - lib/sbsm/cgi.rb
275
276
  - lib/sbsm/exception.rb