turn down the log noise a bit

This commit is contained in:
friendica 2013-01-24 19:45:08 -08:00
parent 33b22338dc
commit 566dd55146
2 changed files with 31 additions and 24 deletions

View File

@ -109,7 +109,7 @@ function zot_build_packet($channel,$type = 'notify',$recipients = null, $remote_
$data['secret_sig'] = base64url_encode(rsa_sign($secret,$channel['channel_prvkey'])); $data['secret_sig'] = base64url_encode(rsa_sign($secret,$channel['channel_prvkey']));
} }
logger('zot_build_packet: ' . print_r($data,true)); logger('zot_build_packet: ' . print_r($data,true), LOGGER_DATA);
// Hush-hush ultra top-secret mode // Hush-hush ultra top-secret mode
@ -223,7 +223,7 @@ function zot_refresh($them,$channel = null) {
$result = z_post_url($url . $rhs,$postvars); $result = z_post_url($url . $rhs,$postvars);
logger('zot_refresh: zot-info: ' . print_r($result,true)); logger('zot_refresh: zot-info: ' . print_r($result,true), LOGGER_DATA);
if($result['success']) { if($result['success']) {
@ -372,11 +372,11 @@ function zot_register_hub($arr) {
$url = $arr['url'] . '/.well-known/zot-info/?f=&guid_hash=' . $guid_hash; $url = $arr['url'] . '/.well-known/zot-info/?f=&guid_hash=' . $guid_hash;
logger('zot_register_hub: ' . $url); logger('zot_register_hub: ' . $url, LOGGER_DEBUG);
$x = z_fetch_url($url); $x = z_fetch_url($url);
logger('zot_register_hub: ' . print_r($x,true)); logger('zot_register_hub: ' . print_r($x,true), LOGGER_DATA);
if($x['success']) { if($x['success']) {
$record = json_decode($x['body'],true); $record = json_decode($x['body'],true);
@ -747,7 +747,7 @@ function zot_import($arr) {
$i['notify'] = json_decode(aes_unencapsulate($i['notify'],get_config('system','prvkey')),true); $i['notify'] = json_decode(aes_unencapsulate($i['notify'],get_config('system','prvkey')),true);
} }
logger('zot_import: notify: ' . print_r($i['notify'],true)); logger('zot_import: notify: ' . print_r($i['notify'],true), LOGGER_DATA);
$i['notify']['sender']['hash'] = base64url_encode(hash('whirlpool',$i['notify']['sender']['guid'] . $i['notify']['sender']['guid_sig'], true)); $i['notify']['sender']['hash'] = base64url_encode(hash('whirlpool',$i['notify']['sender']['guid'] . $i['notify']['sender']['guid_sig'], true));
$deliveries = null; $deliveries = null;
@ -758,11 +758,8 @@ function zot_import($arr) {
foreach($i['notify']['recipients'] as $recip) { foreach($i['notify']['recipients'] as $recip) {
$recip_arr[] = base64url_encode(hash('whirlpool',$recip['guid'] . $recip['guid_sig'], true)); $recip_arr[] = base64url_encode(hash('whirlpool',$recip['guid'] . $recip['guid_sig'], true));
} }
logger('recip_arr: ' . print_r($recip_arr,true));
stringify_array_elms($recip_arr); stringify_array_elms($recip_arr);
logger('recip_arr: ' . print_r($recip_arr,true));
$recips = implode(',',$recip_arr); $recips = implode(',',$recip_arr);
logger('recips: ' . $recips);
$r = q("select channel_hash as hash from channel where channel_hash in ( " . $recips . " ) "); $r = q("select channel_hash as hash from channel where channel_hash in ( " . $recips . " ) ");
if(! $r) { if(! $r) {
logger('recips: no recipients on this site'); logger('recips: no recipients on this site');
@ -790,8 +787,8 @@ function zot_import($arr) {
if($i['message']['type'] === 'activity') { if($i['message']['type'] === 'activity') {
$arr = get_item_elements($i['message']); $arr = get_item_elements($i['message']);
logger('Activity received: ' . print_r($arr,true)); logger('Activity received: ' . print_r($arr,true), LOGGER_DATA);
logger('Activity recipients: ' . print_r($deliveries,true)); logger('Activity recipients: ' . print_r($deliveries,true), LOGGER_DATA);
$relay = ((array_key_exists('flags',$i['message']) && in_array('relay',$i['message']['flags'])) ? true : false); $relay = ((array_key_exists('flags',$i['message']) && in_array('relay',$i['message']['flags'])) ? true : false);
$result = process_delivery($i['notify']['sender'],$arr,$deliveries,$relay); $result = process_delivery($i['notify']['sender'],$arr,$deliveries,$relay);
@ -800,8 +797,8 @@ function zot_import($arr) {
elseif($i['message']['type'] === 'mail') { elseif($i['message']['type'] === 'mail') {
$arr = get_mail_elements($i['message']); $arr = get_mail_elements($i['message']);
logger('Mail received: ' . print_r($arr,true)); logger('Mail received: ' . print_r($arr,true), LOGGER_DATA);
logger('Mail recipients: ' . print_r($deliveries,true)); logger('Mail recipients: ' . print_r($deliveries,true), LOGGER_DATA);
$result = process_mail_delivery($i['notify']['sender'],$arr,$deliveries); $result = process_mail_delivery($i['notify']['sender'],$arr,$deliveries);
@ -810,8 +807,8 @@ function zot_import($arr) {
elseif($i['message']['type'] === 'profile') { elseif($i['message']['type'] === 'profile') {
$arr = get_profile_elements($i['message']); $arr = get_profile_elements($i['message']);
logger('Profile received: ' . print_r($arr,true)); logger('Profile received: ' . print_r($arr,true), LOGGER_DATA);
logger('Profile recipients: ' . print_r($deliveries,true)); logger('Profile recipients: ' . print_r($deliveries,true), LOGGER_DATA);
$result = process_profile_delivery($i['notify']['sender'],$arr,$deliveries); $result = process_profile_delivery($i['notify']['sender'],$arr,$deliveries);
@ -935,9 +932,9 @@ function process_delivery($sender,$arr,$deliveries,$relay) {
if($r) { if($r) {
$ev['event_hash'] = $r[0]['resource_id']; $ev['event_hash'] = $r[0]['resource_id'];
} }
dbg(1);
$xyz = event_store($ev); $xyz = event_store($ev);
dbg(0);
$result = array($d['hash'],'event processed'); $result = array($d['hash'],'event processed');
continue; continue;
} }
@ -972,7 +969,7 @@ function process_delivery($sender,$arr,$deliveries,$relay) {
if(! $deliveries) if(! $deliveries)
$result[] = array('','no recipients'); $result[] = array('','no recipients');
logger('process_delivery: local results: ' . print_r($result,true)); logger('process_delivery: local results: ' . print_r($result,true), LOGGER_DEBUG);
return $result; return $result;
} }
@ -1039,13 +1036,14 @@ function process_mail_delivery($sender,$arr,$deliveries) {
function process_profile_delivery($sender,$arr,$deliveries) { function process_profile_delivery($sender,$arr,$deliveries) {
// deliveries is irrelevant, what to do about birthday notification....? // deliveries is irrelevant, what to do about birthday notification....?
logger('process_profile_delivery');
logger('process_profile_delivery', LOGGER_DEBUG);
import_directory_profile($sender['hash'],$arr); import_directory_profile($sender['hash'],$arr);
} }
function import_directory_profile($hash,$profile) { function import_directory_profile($hash,$profile) {
logger('import_directory_profile'); logger('import_directory_profile', LOGGER_DEBUG);
if(! $hash) if(! $hash)
return; return;

View File

@ -65,8 +65,12 @@ function post_init(&$a) {
); );
} }
} }
if(! $x) if(! $x) {
logger('mod_zot: auth: unable to finger ' . $addr);
goaway($desturl); goaway($desturl);
}
logger('mod_zot: auth request received from ' . $x[0]['xchan_addr'] . ' for ' . $webbie);
// check credentials and access // check credentials and access
@ -84,15 +88,17 @@ function post_init(&$a) {
array(array('guid' => $x[0]['hubloc_guid'],'guid_sig' => $x[0]['hubloc_guid_sig'])), array(array('guid' => $x[0]['hubloc_guid'],'guid_sig' => $x[0]['hubloc_guid_sig'])),
$x[0]['hubloc_sitekey'], $sec); $x[0]['hubloc_sitekey'], $sec);
$result = zot_zot($x[0]['hubloc_callback'],$p); $result = zot_zot($x[0]['hubloc_callback'],$p);
if(! $result['success']) if(! $result['success']) {
logger('mod_zot: auth_check callback failed.');
goaway($desturl); goaway($desturl);
}
$j = json_decode($result['body'],true); $j = json_decode($result['body'],true);
} }
if($already_authed || $j['result']) { if($already_authed || $j['result']) {
// everything is good... maybe // everything is good... maybe
if(local_user()) { if(local_user()) {
notice( t('Remote authentication blocked. You are logged into this site locally. Please logout and retry') . EOL); notice( t('Remote authentication blocked. You are logged into this site locally. Please logout and retry.') . EOL);
goaway($desturl); goaway($desturl);
} }
// log them in // log them in
@ -102,6 +108,8 @@ function post_init(&$a) {
require_once('include/security.php'); require_once('include/security.php');
$a->set_groups(init_groups_visitor($_SESSION['visitor_id'])); $a->set_groups(init_groups_visitor($_SESSION['visitor_id']));
info(sprintf( t('Welcome %s. Remote authentication successful.'),$x[0]['xchan_name'])); info(sprintf( t('Welcome %s. Remote authentication successful.'),$x[0]['xchan_name']));
logger('mod_zot: auth success from ' . $x[0]['xchan_addr'] . ' for ' . $webbie);
} }
goaway($desturl); goaway($desturl);
@ -130,7 +138,7 @@ function post_post(&$a) {
if(array_key_exists('iv',$data)) { if(array_key_exists('iv',$data)) {
$data = aes_unencapsulate($data,get_config('system','prvkey')); $data = aes_unencapsulate($data,get_config('system','prvkey'));
logger('mod_zot: decrypt1: ' . $data); logger('mod_zot: decrypt1: ' . $data, LOGGER_DATA);
$data = json_decode($data,true); $data = json_decode($data,true);
} }
@ -143,7 +151,7 @@ function post_post(&$a) {
if((! $data['secret']) || (! $data['secret_sig'])) { if((! $data['secret']) || (! $data['secret_sig'])) {
$ret['message'] = 'no verification signature'; $ret['message'] = 'no verification signature';
logger('mod_zot: pickup: ' . $ret['message']); logger('mod_zot: pickup: ' . $ret['message'], LOGGER_DEBUG);
json_return_and_die($ret); json_return_and_die($ret);
} }
$r = q("select hubloc_sitekey from hubloc where hubloc_url = '%s' and hubloc_callback = '%s' and hubloc_sitekey != '' limit 1", $r = q("select hubloc_sitekey from hubloc where hubloc_url = '%s' and hubloc_callback = '%s' and hubloc_sitekey != '' limit 1",
@ -324,6 +332,7 @@ function post_post(&$a) {
intval($z[0]['id']) intval($z[0]['id'])
); );
logger('mod_zot: auth_check: success', LOGGER_DEBUG);
$ret['result'] = true; $ret['result'] = true;
json_return_and_die($ret); json_return_and_die($ret);