From 3f414aec63257f7e9e6aa19671502794f9c1d524 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 11 Jul 2012 16:54:18 -0700 Subject: get rid of special "short salmon key" for statusnet --- include/delivery.php | 2 +- include/network.php | 8 +++----- include/notifier.php | 2 +- include/salmon.php | 10 +++++----- include/user.php | 21 ++------------------- 5 files changed, 12 insertions(+), 31 deletions(-) (limited to 'include') diff --git a/include/delivery.php b/include/delivery.php index 1328771a6..595c5279d 100644 --- a/include/delivery.php +++ b/include/delivery.php @@ -155,7 +155,7 @@ function delivery_run($argv, $argc){ } $r = q("SELECT `contact`.*, `user`.`pubkey` AS `upubkey`, `user`.`prvkey` AS `uprvkey`, - `user`.`timezone`, `user`.`nickname`, `user`.`sprvkey`, `user`.`spubkey`, + `user`.`timezone`, `user`.`nickname`, `user`.`page-flags`, `user`.`prvnets` FROM `contact` LEFT JOIN `user` ON `user`.`uid` = `contact`.`uid` WHERE `contact`.`uid` = %d AND `contact`.`self` = 1 LIMIT 1", diff --git a/include/network.php b/include/network.php index 9e6f8355b..221906296 100644 --- a/include/network.php +++ b/include/network.php @@ -537,7 +537,7 @@ function fetch_xrd_links($url) { $xrd_timeout = intval(get_config('system','xrd_timeout')); $redirects = 0; - $xml = fetch_url($url,false,$redirects,(($xrd_timeout) ? $xrd_timeout : 20)); + $xml = fetch_url($url,false,$redirects,(($xrd_timeout) ? $xrd_timeout : 30)); logger('fetch_xrd_links: ' . $xml, LOGGER_DATA); @@ -547,11 +547,9 @@ function fetch_xrd_links($url) { // fix diaspora's bad xml $xml = str_replace(array('href="','"/>'),array('href="','"/>'),$xml); - $h = parse_xml_string($xml); - if(! $h) - return array(); + $arr = xml2array($xml); - $arr = convert_xml_element_to_array($h); + logger('fetch_xrd_links: ' . print_r($arr,true), LOGGER_DATA); $links = array(); diff --git a/include/notifier.php b/include/notifier.php index f54efba31..241587eea 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -153,7 +153,7 @@ function notifier_run($argv, $argc){ } $r = q("SELECT `contact`.*, `user`.`pubkey` AS `upubkey`, `user`.`prvkey` AS `uprvkey`, - `user`.`timezone`, `user`.`nickname`, `user`.`sprvkey`, `user`.`spubkey`, + `user`.`timezone`, `user`.`nickname`, `user`.`page-flags`, `user`.`prvnets` FROM `contact` LEFT JOIN `user` ON `user`.`uid` = `contact`.`uid` WHERE `contact`.`uid` = %d AND `contact`.`self` = 1 LIMIT 1", diff --git a/include/salmon.php b/include/salmon.php index 3d525f51a..ae885dcab 100644 --- a/include/salmon.php +++ b/include/salmon.php @@ -74,7 +74,7 @@ function slapper($owner,$url,$slap) { return; - if(! $owner['sprvkey']) { + if(! $owner['prvkey']) { logger(sprintf("slapper: user '%s' (%d) does not have a salmon private key. Send failed.", $owner['username'],$owner['uid'])); return; @@ -103,17 +103,17 @@ EOT; $data_type = 'application/atom+xml'; $encoding = 'base64url'; $algorithm = 'RSA-SHA256'; - $keyhash = base64url_encode(hash('sha256',salmon_key($owner['spubkey'])),true); + $keyhash = base64url_encode(hash('sha256',salmon_key($owner['pubkey'])),true); // precomputed base64url encoding of data_type, encoding, algorithm concatenated with periods $precomputed = '.YXBwbGljYXRpb24vYXRvbSt4bWw=.YmFzZTY0dXJs.UlNBLVNIQTI1Ng=='; - $signature = base64url_encode(rsa_sign(str_replace('=','',$data . $precomputed),$owner['sprvkey'])); + $signature = base64url_encode(rsa_sign(str_replace('=','',$data . $precomputed),$owner['prvkey'])); - $signature2 = base64url_encode(rsa_sign($data . $precomputed,$owner['sprvkey'])); + $signature2 = base64url_encode(rsa_sign($data . $precomputed,$owner['prvkey'])); - $signature3 = base64url_encode(rsa_sign($data,$owner['sprvkey'])); + $signature3 = base64url_encode(rsa_sign($data,$owner['prvkey'])); $salmon_tpl = get_markup_template('magicsig.tpl'); diff --git a/include/user.php b/include/user.php index 039b30bbd..ba1b4a9ee 100644 --- a/include/user.php +++ b/include/user.php @@ -162,24 +162,9 @@ function create_user($arr) { $prvkey = $keys['prvkey']; $pubkey = $keys['pubkey']; - /** - * - * Create another keypair for signing/verifying - * salmon protocol messages. We have to use a slightly - * less robust key because this won't be using openssl - * but the phpseclib. Since it is PHP interpreted code - * it is not nearly as efficient, and the larger keys - * will take several minutes each to process. - * - */ - - $sres = new_keypair(512); - $sprvkey = $sres['prvkey']; - $spubkey = $sres['pubkey']; - $r = q("INSERT INTO `user` ( `guid`, `username`, `password`, `email`, `openid`, `nickname`, - `pubkey`, `prvkey`, `spubkey`, `sprvkey`, `register_date`, `verified`, `blocked`, `timezone`, `service_class` ) - VALUES ( '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, 'UTC', '%s' )", + `pubkey`, `prvkey`, `register_date`, `verified`, `blocked`, `timezone`, `service_class` ) + VALUES ( '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, 'UTC', '%s' )", dbesc(generate_user_guid()), dbesc($username), dbesc($new_password_encoded), @@ -188,8 +173,6 @@ function create_user($arr) { dbesc($nickname), dbesc($pubkey), dbesc($prvkey), - dbesc($spubkey), - dbesc($sprvkey), dbesc(datetime_convert()), intval($verified), intval($blocked), -- cgit v1.2.3