Permalink
Browse files

mnet: try to stop trailing slashes in urls from getting through, bett…

…er error msg if we dont like the SSL cert
  • Loading branch information...
1 parent 8d13ed1 commit a4d967a463db587ac23eebee7b2208517ccd9734 martinlanghoff committed Jan 18, 2007
Showing with 12 additions and 1 deletion.
  1. +9 −1 admin/mnet/peers.php
  2. +3 −0 mnet/lib.php
View
@@ -47,6 +47,10 @@
/// If data submitted, process and store
if (($form = data_submitted()) && confirm_sesskey()) {
+ if (!empty($form->wwwroot)) {
+ // ensure we remove trailing slashes
+ $form->wwwroot = preg_replace(':/$:', '', $form->wwwroot);
+ }
if (!empty($form->updateregisterall)) {
if (!empty($form->registerallhosts)) {
set_config('mnet_register_allhosts',1);
@@ -93,7 +97,11 @@
$mnet_peer->public_key_expires = $mnet_peer->check_common_name($form->public_key);
if ($mnet_peer->public_key_expires == false) {
$mnet_peer->public_key == $oldkey;
- error(get_string("invalidpubkey", 'mnet'),'peers.php?step=update&hostid='.$mnet_peer->id);
+ $errmsg = '<br />';
+ foreach ($mnet_peer->error as $err) {
+ $errmsg .= $err['code'] . ': ' . $err['text'].'<br />';
+ }
+ error(get_string("invalidpubkey", 'mnet') . $errmsg ,'peers.php?step=update&amp;hostid='.$mnet_peer->id);
exit;
}
}
View
@@ -309,6 +309,9 @@ function mnet_generate_keypair($dn = null, $days=28) {
);
}
+ // ensure we remove trailing slashes
+ $dn["commonName"] = preg_replace(':/$:', '', $dn["commonName"]);
+
$new_key = openssl_pkey_new();
$csr_rsc = openssl_csr_new($dn, $new_key, array('private_key_bits',2048));
$selfSignedCert = openssl_csr_sign($csr_rsc, null, $new_key, $days);

0 comments on commit a4d967a

Please sign in to comment.