From 8b055af834bb6de93519bbb0bff776ebb7fffe73 Mon Sep 17 00:00:00 2001
From: Christian Pointner <equinox@helsinki.at>
Date: Wed, 30 Mar 2011 17:21:51 +0000
Subject: fixed handling of invalid carts


diff --git a/rhnop-server/conf.lua b/rhnop-server/conf.lua
index 8e97650..4af34bb 100644
--- a/rhnop-server/conf.lua
+++ b/rhnop-server/conf.lua
@@ -32,4 +32,13 @@ for line in file:lines() do
 end
 file:close()
 
+if conf.music_carts_lo == nil then
+  conf.music_carts_lo = 400000
+end
+if conf.music_carts_hi == nil then
+  conf.music_carts_hi = 499999
+end
+conf.music_carts_lo = tonumber(conf.music_carts_lo)
+conf.music_carts_hi = tonumber(conf.music_carts_hi)
+
 return conf
diff --git a/rhnop-server/debian/changelog b/rhnop-server/debian/changelog
index 4ae6174..29e913f 100644
--- a/rhnop-server/debian/changelog
+++ b/rhnop-server/debian/changelog
@@ -1,3 +1,9 @@
+rhnop-server (0.6) unstable; urgency=low
+
+  * fixed handling of invalid carts.
+
+ -- Christian Pointner <equinox@helsinki>  Wed, 30 Mar 2011 19:36:22 +0200
+
 rhnop-server (0.5) unstable; urgency=low
 
   * better handling of invalid carts.
diff --git a/rhnop-server/qlistener.lua b/rhnop-server/qlistener.lua
index dcea7bb..6d18140 100644
--- a/rhnop-server/qlistener.lua
+++ b/rhnop-server/qlistener.lua
@@ -49,6 +49,8 @@ function handle_message(msg)
    if not timestamp or not nowcart or not nowlen or not nextcart or not nextlen then
       io.stderr:write("ignoring malformed message\n")
    else
+      nowcart = tonumber(nowcart)
+      nowlen = tonumber(nowlen)
       if last_cart ~= nowcart and nowcart >= conf.music_carts_lo and nowcart <= conf.music_carts_hi and nowlen > 0 then
          last_cart = nowcart
          handle_now(timestamp, nowcart, nowlen)
@@ -92,4 +94,4 @@ function main_loop()
       end
       handle_message(msg)
    end
-end
\ No newline at end of file
+end
-- 
cgit v0.10.2