diff --git a/admin/index.php b/admin/index.php
index fe54b03557fc3..181af4fc61d2b 100644
--- a/admin/index.php
+++ b/admin/index.php
@@ -439,7 +439,7 @@
$guest->lastname = " ";
$guest->email = "root@localhost";
$guest->description = addslashes(get_string("guestuserinfo"));
- $guest->mnethostid = $CFG->mnet_localhost_id;
+ $guest->mnethostid = $CFG->mnet_localhost_id;
$guest->confirmed = 1;
$guest->lang = $CFG->lang;
$guest->timemodified= time();
diff --git a/admin/mnet/index.html b/admin/mnet/index.html
index 6b0359f627ca9..c4e375402f708 100644
--- a/admin/mnet/index.html
+++ b/admin/mnet/index.html
@@ -12,7 +12,7 @@
Public Key: |
- |
+ public_key; ?> |
Networking: |
diff --git a/admin/mnet/index.php b/admin/mnet/index.php
index 5620141f254d1..9de415474de64 100644
--- a/admin/mnet/index.php
+++ b/admin/mnet/index.php
@@ -22,8 +22,6 @@
error('PHP Curl library is not installed');
}
- $keypair = unserialize($CFG->openssl);
-
if (!isset($CFG->mnet_dispatcher_mode)) set_config('mnet_dispatcher_mode', 'off');
/// If data submitted, process and store
diff --git a/admin/mnet/peers.php b/admin/mnet/peers.php
index 52c3793b6a113..8ed34d57bb104 100644
--- a/admin/mnet/peers.php
+++ b/admin/mnet/peers.php
@@ -35,8 +35,6 @@
$strmnetlog = get_string('mnetlog', 'mnet');
$strmnetedithost = get_string('reviewhostdetails', 'mnet');
-$keypair = unserialize($CFG->openssl);
-
if (!isset($CFG->mnet_dispatcher_mode)) set_config('mnet_dispatcher_mode', 'off');
/// If data submitted, process and store
diff --git a/mnet/lib.php b/mnet/lib.php
index b078db7383614..ced60f647f50f 100644
--- a/mnet/lib.php
+++ b/mnet/lib.php
@@ -152,6 +152,7 @@ function mnet_sign_message($message) {
'.$MNET->wwwroot.'
+ '.time().'
';
return $message;
}
@@ -274,37 +275,48 @@ function mnet_generate_keypair($dn = null) {
$break = strpos($host.'/' , '/');
$host = substr($host, 0, $break);
- if ($result = get_record_select('course'," id ='1' ")) {
+ if ($result = get_record_select('course'," id ='".SITEID."' ")) {
$organization = $result->fullname;
} else {
$organization = 'None';
}
$keypair = array();
- // TODO: fix this with a redirect, form, etc.
+
+ $country = 'NZ';
+ $province = 'Wellington';
+ $locality = 'Wellington';
+ $email = $CFG->noreplyaddress;
+
+ if(!empty($USER->country)) {
+ $country = $USER->country;
+ }
+ if(!empty($USER->city)) {
+ $province = $USER->city;
+ $locality = $USER->city;
+ }
+ if(!empty($USER->email)) {
+ $email = $USER->email;
+ }
if (is_null($dn)) {
$dn = array(
- "countryName" => 'NZ',
- "stateOrProvinceName" => 'Wellington',
- "localityName" => 'Wellington',
+ "countryName" => $country,
+ "stateOrProvinceName" => $province,
+ "localityName" => $locality,
"organizationName" => $organization,
"organizationalUnitName" => 'Moodle',
"commonName" => $CFG->wwwroot,
- "emailAddress" => $CFG->noreplyaddress
+ "emailAddress" => $email
);
}
$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, 365);
-
- // You'll want to keep your certificate signing request, so we'll
- // export that to a property - csr_txt.
- openssl_csr_export($csr_rsc, $csr_txt);
unset($csr_rsc); // Free up the resource
- // We export our self-signed certificate to a string as well.
+ // We export our self-signed certificate to a string.
openssl_x509_export($selfSignedCert, $keypair['certificate']);
openssl_x509_free($selfSignedCert);