Index: trunk/extensions/OpenStackManager/special/SpecialNovaAddress.php |
— | — | @@ -265,7 +265,7 @@ |
266 | 266 | $addressInfo['hostname'] = array( |
267 | 267 | 'type' => 'text', |
268 | 268 | 'default' => '', |
269 | | - 'validation-callback' => array( $this, 'validateText' ), |
| 269 | + 'validation-callback' => array( $this, 'validateDomain' ), |
270 | 270 | 'label-message' => 'openstackmanager-hostname', |
271 | 271 | 'name' => 'hostname', |
272 | 272 | ); |
— | — | @@ -432,7 +432,7 @@ |
433 | 433 | $actions .= Html::rawElement( 'li', array(), $link ); |
434 | 434 | $actions = Html::rawElement( 'ul', array(), $actions ); |
435 | 435 | $addressOut .= Html::rawElement( 'td', array(), $actions ); |
436 | | - $projectArr["$project"] = Html::rawElement( 'tr', array(), $addressOut ); |
| 436 | + $projectArr["$project"] .= Html::rawElement( 'tr', array(), $addressOut ); |
437 | 437 | } |
438 | 438 | foreach ( $userProjects as $project ) { |
439 | 439 | $out .= Html::element( 'h2', array(), $project ); |
— | — | @@ -498,7 +498,7 @@ |
499 | 499 | if ( $success ) { |
500 | 500 | $wgOut->addWikiMsg( 'openstackmanager-releasedaddress', $ip ); |
501 | 501 | } else { |
502 | | - $wgOut->addWikiMsg( 'openstackmanager-releasedaddressfailed', $ip ); |
| 502 | + $wgOut->addWikiMsg( 'openstackmanager-cannotreleaseaddress', $ip ); |
503 | 503 | } |
504 | 504 | $sk = $wgOut->getSkin(); |
505 | 505 | $out = '<br />'; |
Index: trunk/extensions/OpenStackManager/special/SpecialNova.php |
— | — | @@ -69,4 +69,18 @@ |
70 | 70 | } |
71 | 71 | } |
72 | 72 | |
| 73 | + /** |
| 74 | + * @param $resourcename |
| 75 | + * @param $error |
| 76 | + * @param $alldata |
| 77 | + * @return bool|string |
| 78 | + */ |
| 79 | + function validateDomain( $resourcename, $alldata ) { |
| 80 | + if ( ! preg_match( "/^[a-z\*][a-z0-9\-]*$/", $resourcename ) ) { |
| 81 | + return Xml::element( 'span', array( 'class' => 'error' ), wfMsg( 'openstackmanager-badresourcename' ) ); |
| 82 | + } else { |
| 83 | + return true; |
| 84 | + } |
| 85 | + } |
| 86 | + |
73 | 87 | } |
Index: trunk/extensions/OpenStackManager/OpenStackNovaHost.php |
— | — | @@ -55,6 +55,7 @@ |
56 | 56 | function fetchHostInfo() { |
57 | 57 | global $wgAuth; |
58 | 58 | |
| 59 | + $this->searchvalue = $wgAuth->getLdapEscapedString( $this->searchvalue ); |
59 | 60 | $fqdn = $this->searchvalue . '.' . $this->domain->getFullyQualifiedDomainName(); |
60 | 61 | wfSuppressWarnings(); |
61 | 62 | $result = ldap_search( $wgAuth->ldapconn, $this->domain->domainDN, '(|(associateddomain=' . $fqdn . ')(cnamerecord=' . $fqdn . ')(dc=' . $this->searchvalue . '))' ); |