amqp plugin: Use "service_name_to_port_number" to parse the "Port" config option.
authorFlorian Forster <octo@leeloo.lan.home.verplant.org>
Mon, 22 Mar 2010 18:58:33 +0000 (19:58 +0100)
committerFlorian Forster <octo@leeloo.lan.home.verplant.org>
Wed, 4 Aug 2010 13:13:50 +0000 (15:13 +0200)
src/amqp.c

index 23526e2..95cded7 100644 (file)
@@ -82,7 +82,17 @@ static int config(const char *key, const char *value)
         return (config_set(&host, value));
     else if(strcasecmp(key, "port") == 0)
     {
-        port = atoi(value);
+        int tmp;
+
+        tmp = service_name_to_port_number (value);
+        if (tmp <= 0)
+        {
+            ERROR ("AMQP plugin: Cannot parse `%s' as a "
+                    "service name (port number).", value);
+            return (1);
+        }
+
+        port = tmp;
         return (0);
     }
     else if (strcasecmp(key, "vhost") == 0)