handle right=%any case in strongSwan manager
authorAndreas Steffen <andreas.steffen@strongswan.org>
Sat, 17 Nov 2007 23:08:16 +0000 (23:08 -0000)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Sat, 17 Nov 2007 23:08:16 +0000 (23:08 -0000)
src/charon/control/interfaces/xml_interface.c
src/manager/controller/config_controller.c
src/manager/templates/config/list.cs

index 8ec295f..aa2a554 100644 (file)
@@ -91,6 +91,9 @@ static void write_id(xmlTextWriterPtr writer, char *element, identification_t *i
                        char *type = "";
                        while (TRUE)
                        {
+                               case ID_ANY:
+                                       type = "any";
+                                       break;
                                case ID_IPV4_ADDR:
                                        type = "ipv4";
                                        break;
@@ -114,9 +117,6 @@ static void write_id(xmlTextWriterPtr writer, char *element, identification_t *i
                        xmlTextWriterWriteFormatString(writer, "%D", id);
                        break;
                }
-               case ID_ANY:
-                       xmlTextWriterWriteAttribute(writer, "type", "any");
-                       break;
                default:
                        /* TODO: base64 keyid */
                        xmlTextWriterWriteAttribute(writer, "type", "keyid");
index c5c96a0..e7941ad 100644 (file)
@@ -70,6 +70,10 @@ static void process_peerconfig(private_config_controller_t *this,
                        {
                                if (streq(name, "local") || streq(name, "remote"))
                                {
+                                       if (streq(value, "0.0.0.0") || streq(value, "::"))
+                                       {
+                                               value = "%any";
+                                       }
                                        r->setf(r, "peercfgs.%s.ikecfg.%s=%s", config, name, value);
                                }
                        }
index f944bd6..0a3dbd4 100644 (file)
@@ -6,9 +6,13 @@
        <span><?cs var:peercfg.remote ?></span>
   </h1>
   <div class="controls">
-    <a title="initiate SA" href="<?cs var:base ?>/control/initiateike/<?cs name:peercfg ?>">
-      <img src="<?cs var:base ?>/static/initiate.png"/>
-    </a>
+    <?cs if:peercfg.remote != "%any" ?>
+      <a title="initiate SA" href="<?cs var:base ?>/control/initiateike/<?cs name:peercfg ?>">
+        <img src="<?cs var:base ?>/static/initiate.png"/>
+      </a>
+       <?cs else ?>
+      &nbsp;    
+    <?cs /if ?>
   </div>
   <div class="expander">
     <hr/>
     <div class="expand">
     <h1><?cs name:childcfg ?>:</h1>
          <div class="controls">
-               <a title="initiate SA" href="<?cs var:base ?>/control/initiatechild/<?cs name:childcfg ?>">
-                 <img src="<?cs var:base ?>/static/initiate.png"/>
-               </a>
+        <?cs if:peercfg.remote != "%any" ?>
+                 <a title="initiate SA" href="<?cs var:base ?>/control/initiatechild/<?cs name:childcfg ?>">
+                   <img src="<?cs var:base ?>/static/initiate.png"/>
+                 </a>
+        <?cs /if ?>
          </div>
     <div class="expander">
     <table>