handle right=%any case in strongSwan manager

This commit is contained in:
Andreas Steffen
2007-11-17 23:08:16 +00:00
parent b3b379e044
commit 3a19f38d15
3 changed files with 19 additions and 9 deletions
@@ -91,6 +91,9 @@ static void write_id(xmlTextWriterPtr writer, char *element, identification_t *i
char *type = ""; char *type = "";
while (TRUE) while (TRUE)
{ {
case ID_ANY:
type = "any";
break;
case ID_IPV4_ADDR: case ID_IPV4_ADDR:
type = "ipv4"; type = "ipv4";
break; break;
@@ -114,9 +117,6 @@ static void write_id(xmlTextWriterPtr writer, char *element, identification_t *i
xmlTextWriterWriteFormatString(writer, "%D", id); xmlTextWriterWriteFormatString(writer, "%D", id);
break; break;
} }
case ID_ANY:
xmlTextWriterWriteAttribute(writer, "type", "any");
break;
default: default:
/* TODO: base64 keyid */ /* TODO: base64 keyid */
xmlTextWriterWriteAttribute(writer, "type", "keyid"); xmlTextWriterWriteAttribute(writer, "type", "keyid");
@@ -70,6 +70,10 @@ static void process_peerconfig(private_config_controller_t *this,
{ {
if (streq(name, "local") || streq(name, "remote")) 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); r->setf(r, "peercfgs.%s.ikecfg.%s=%s", config, name, value);
} }
} }
+12 -6
View File
@@ -6,9 +6,13 @@
<span><?cs var:peercfg.remote ?></span> <span><?cs var:peercfg.remote ?></span>
</h1> </h1>
<div class="controls"> <div class="controls">
<a title="initiate SA" href="<?cs var:base ?>/control/initiateike/<?cs name:peercfg ?>"> <?cs if:peercfg.remote != "%any" ?>
<img src="<?cs var:base ?>/static/initiate.png"/> <a title="initiate SA" href="<?cs var:base ?>/control/initiateike/<?cs name:peercfg ?>">
</a> <img src="<?cs var:base ?>/static/initiate.png"/>
</a>
<?cs else ?>
&nbsp;
<?cs /if ?>
</div> </div>
<div class="expander"> <div class="expander">
<hr/> <hr/>
@@ -17,9 +21,11 @@
<div class="expand"> <div class="expand">
<h1><?cs name:childcfg ?>:</h1> <h1><?cs name:childcfg ?>:</h1>
<div class="controls"> <div class="controls">
<a title="initiate SA" href="<?cs var:base ?>/control/initiatechild/<?cs name:childcfg ?>"> <?cs if:peercfg.remote != "%any" ?>
<img src="<?cs var:base ?>/static/initiate.png"/> <a title="initiate SA" href="<?cs var:base ?>/control/initiatechild/<?cs name:childcfg ?>">
</a> <img src="<?cs var:base ?>/static/initiate.png"/>
</a>
<?cs /if ?>
</div> </div>
<div class="expander"> <div class="expander">
<table> <table>