File: fhs_paths.patch

package info (click to toggle)
stompserver 0.9.9gem-4.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 388 kB
  • sloc: ruby: 2,765; sh: 162; makefile: 3
file content (30 lines) | stat: -rw-r--r-- 1,526 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Description: Check for absolute paths so we can enforce FHS in config.
# No upstream patch/URL yet, will update package when one is open.
# Author: Joshua Timberman <joshua@opscode.com>
--- a/lib/stomp_server.rb
+++ b/lib/stomp_server.rb
@@ -27,6 +27,7 @@
         :working_dir => Dir.getwd,
         :storage => ".stompserver",
         :logdir => 'log',
+        :etcdir => 'etc',
         :configfile => 'stompserver.conf',
         :logfile => 'stompserver.log',
         :pidfile => 'stompserver.pid',
@@ -62,11 +63,11 @@
         opts = @defaults
       end
 
-      opts[:etcdir] = File.join(opts[:working_dir],'etc')
-      opts[:storage] = File.join(opts[:working_dir],opts[:storage])
-      opts[:logdir] = File.join(opts[:working_dir],opts[:logdir])
-      opts[:logfile] = File.join(opts[:logdir],opts[:logfile])
-      opts[:pidfile] = File.join(opts[:logdir],opts[:pidfile])
+      opts[:etcdir] = opts[:etcdir] =~ /^\// ? opts[:etcdir] : File.join(opts[:working_dir],opts[:etcdir])
+      opts[:storage] = opts[:storage] =~ /^\// ? opts[:storage] : File.join(opts[:working_dir],opts[:storage])
+      opts[:logdir] = opts[:logdir] =~ /^\// ? opts[:logdir] : File.join(opts[:working_dir],opts[:logdir])
+      opts[:logfile] = opts[:logfile] =~ /^\// ? opts[:logfile] : File.join(opts[:logdir],opts[:logfile])
+      opts[:pidfile] = opts[:pidfile] =~ /^\// ? opts[:pidfile] : File.join(opts[:logdir],opts[:pidfile])
       if opts[:auth]
         opts[:passwd] = File.join(opts[:etcdir],'.passwd')
       end