]> git.mxchange.org Git - friendica.git/blob - mod/dfrn_poll.php
Improve goaway legibility
[friendica.git] / mod / dfrn_poll.php
1 <?php
2 /**
3  * @file mod/dfrn_poll.php
4  */
5 use Friendica\App;
6 use Friendica\Core\Config;
7 use Friendica\Core\System;
8 use Friendica\Database\DBM;
9 use Friendica\Module\Login;
10 use Friendica\Protocol\DFRN;
11 use Friendica\Protocol\OStatus;
12
13 require_once 'include/items.php';
14
15 function dfrn_poll_init(App $a) {
16         Login::sessionAuth();
17
18         $dfrn_id         = ((x($_GET,'dfrn_id'))         ? $_GET['dfrn_id']              : '');
19         $type            = ((x($_GET,'type'))            ? $_GET['type']                 : 'data');
20         $last_update     = ((x($_GET,'last_update'))     ? $_GET['last_update']          : '');
21         $destination_url = ((x($_GET,'destination_url')) ? $_GET['destination_url']      : '');
22         $challenge       = ((x($_GET,'challenge'))       ? $_GET['challenge']            : '');
23         $sec             = ((x($_GET,'sec'))             ? $_GET['sec']                  : '');
24         $dfrn_version    = ((x($_GET,'dfrn_version'))    ? (float) $_GET['dfrn_version'] : 2.0);
25         $perm            = ((x($_GET,'perm'))            ? $_GET['perm']                 : 'r');
26         $quiet                   = ((x($_GET,'quiet'))                   ? true                                                  : false);
27
28         // Possibly it is an OStatus compatible server that requests a user feed
29         if (($a->argc > 1) && ($dfrn_id == '') && !strstr($_SERVER["HTTP_USER_AGENT"], 'Friendica')) {
30                 $nickname = $a->argv[1];
31                 header("Content-type: application/atom+xml");
32                 echo OStatus::feed($a, $nickname, $last_update, 10);
33                 killme();
34         }
35
36         $direction = (-1);
37
38
39         if(strpos($dfrn_id,':') == 1) {
40                 $direction = intval(substr($dfrn_id,0,1));
41                 $dfrn_id   = substr($dfrn_id,2);
42         }
43
44         $hidewall = false;
45
46         if(($dfrn_id === '') && (! x($_POST,'dfrn_id'))) {
47                 if((Config::get('system','block_public')) && (! local_user()) && (! remote_user())) {
48                         http_status_exit(403);
49                 }
50
51                 $user = '';
52                 if($a->argc > 1) {
53                         $r = q("SELECT `hidewall`,`nickname` FROM `user` WHERE `user`.`nickname` = '%s' LIMIT 1",
54                                 dbesc($a->argv[1])
55                         );
56                         if (!$r)
57                                 http_status_exit(404);
58
59                         $hidewall = ($r[0]['hidewall'] && !local_user());
60
61                         $user = $r[0]['nickname'];
62                 }
63
64                 logger('dfrn_poll: public feed request from ' . $_SERVER['REMOTE_ADDR'] . ' for ' . $user);
65                 header("Content-type: application/atom+xml");
66                 echo DFRN::feed('', $user,$last_update, 0, $hidewall);
67                 killme();
68         }
69
70         if(($type === 'profile') && (! strlen($sec))) {
71
72                 $sql_extra = '';
73                 switch($direction) {
74                         case (-1):
75                                 $sql_extra = sprintf(" AND ( `dfrn-id` = '%s' OR `issued-id` = '%s' ) ", dbesc($dfrn_id),dbesc($dfrn_id));
76                                 $my_id = $dfrn_id;
77                                 break;
78                         case 0:
79                                 $sql_extra = sprintf(" AND `issued-id` = '%s' AND `duplex` = 1 ", dbesc($dfrn_id));
80                                 $my_id = '1:' . $dfrn_id;
81                                 break;
82                         case 1:
83                                 $sql_extra = sprintf(" AND `dfrn-id` = '%s' AND `duplex` = 1 ", dbesc($dfrn_id));
84                                 $my_id = '0:' . $dfrn_id;
85                                 break;
86                         default:
87                                 goaway(System::baseUrl());
88                                 break; // NOTREACHED
89                 }
90
91                 $r = q("SELECT `contact`.*, `user`.`username`, `user`.`nickname`
92                         FROM `contact` LEFT JOIN `user` ON `contact`.`uid` = `user`.`uid`
93                         WHERE `contact`.`blocked` = 0 AND `contact`.`pending` = 0
94                         AND `user`.`nickname` = '%s' $sql_extra LIMIT 1",
95                         dbesc($a->argv[1])
96                 );
97
98                 if (DBM::is_result($r)) {
99
100                         $s = fetch_url($r[0]['poll'] . '?dfrn_id=' . $my_id . '&type=profile-check');
101
102                         logger("dfrn_poll: old profile returns " . $s, LOGGER_DATA);
103
104                         if(strlen($s)) {
105
106                                 $xml = parse_xml_string($s);
107
108                                 if((int) $xml->status == 1) {
109                                         $_SESSION['authenticated'] = 1;
110                                         if(! x($_SESSION,'remote'))
111                                                 $_SESSION['remote'] = array();
112
113                                         $_SESSION['remote'][] = array('cid' => $r[0]['id'],'uid' => $r[0]['uid'],'url' => $r[0]['url']);
114
115                                         $_SESSION['visitor_id'] = $r[0]['id'];
116                                         $_SESSION['visitor_home'] = $r[0]['url'];
117                                         $_SESSION['visitor_handle'] = $r[0]['addr'];
118                                         $_SESSION['visitor_visiting'] = $r[0]['uid'];
119                                         if(!$quiet)
120                                                 info( sprintf(t('%1$s welcomes %2$s'), $r[0]['username'] , $r[0]['name']) . EOL);
121                                         // Visitors get 1 day session.
122                                         $session_id = session_id();
123                                         $expire = time() + 86400;
124                                         q("UPDATE `session` SET `expire` = '%s' WHERE `sid` = '%s'",
125                                                 dbesc($expire),
126                                                 dbesc($session_id)
127                                         );
128                                 }
129                         }
130                         $profile = $r[0]['nickname'];
131                         goaway((strlen($destination_url)) ? $destination_url : System::baseUrl() . '/profile/' . $profile);
132                 }
133                 goaway(System::baseUrl());
134
135         }
136
137         if($type === 'profile-check' && $dfrn_version < 2.2 ) {
138
139                 if((strlen($challenge)) && (strlen($sec))) {
140
141                         q("DELETE FROM `profile_check` WHERE `expire` < " . intval(time()));
142                         $r = q("SELECT * FROM `profile_check` WHERE `sec` = '%s' ORDER BY `expire` DESC LIMIT 1",
143                                 dbesc($sec)
144                         );
145                         if (! DBM::is_result($r)) {
146                                 xml_status(3, 'No ticket');
147                                 // NOTREACHED
148                         }
149                         $orig_id = $r[0]['dfrn_id'];
150                         if(strpos($orig_id, ':'))
151                                 $orig_id = substr($orig_id,2);
152
153                         $c = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1",
154                                 intval($r[0]['cid'])
155                         );
156                         if (! DBM::is_result($c)) {
157                                 xml_status(3, 'No profile');
158                         }
159                         $contact = $c[0];
160
161                         $sent_dfrn_id = hex2bin($dfrn_id);
162                         $challenge    = hex2bin($challenge);
163
164                         $final_dfrn_id = '';
165
166                         if(($contact['duplex']) && strlen($contact['prvkey'])) {
167                                 openssl_private_decrypt($sent_dfrn_id,$final_dfrn_id,$contact['prvkey']);
168                                 openssl_private_decrypt($challenge,$decoded_challenge,$contact['prvkey']);
169                         }
170                         else {
171                                 openssl_public_decrypt($sent_dfrn_id,$final_dfrn_id,$contact['pubkey']);
172                                 openssl_public_decrypt($challenge,$decoded_challenge,$contact['pubkey']);
173                         }
174
175                         $final_dfrn_id = substr($final_dfrn_id, 0, strpos($final_dfrn_id, '.'));
176
177                         if(strpos($final_dfrn_id,':') == 1)
178                                 $final_dfrn_id = substr($final_dfrn_id,2);
179
180                         if($final_dfrn_id != $orig_id) {
181                                 logger('profile_check: ' . $final_dfrn_id . ' != ' . $orig_id, LOGGER_DEBUG);
182                                 // did not decode properly - cannot trust this site
183                                 xml_status(3, 'Bad decryption');
184                         }
185
186                         header("Content-type: text/xml");
187                         echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?><dfrn_poll><status>0</status><challenge>$decoded_challenge</challenge><sec>$sec</sec></dfrn_poll>";
188                         killme();
189                         // NOTREACHED
190                 }
191                 else {
192                                 // old protocol
193
194                         switch($direction) {
195                                 case 1:
196                                         $dfrn_id = '0:' . $dfrn_id;
197                                         break;
198                                 case 0:
199                                         $dfrn_id = '1:' . $dfrn_id;
200                                         break;
201                                 default:
202                                         break;
203                         }
204
205
206                         q("DELETE FROM `profile_check` WHERE `expire` < " . intval(time()));
207                         $r = q("SELECT * FROM `profile_check` WHERE `dfrn_id` = '%s' ORDER BY `expire` DESC",
208                                 dbesc($dfrn_id));
209                         if (DBM::is_result($r)) {
210                                 xml_status(1);
211                                 return; // NOTREACHED
212                         }
213                         xml_status(0);
214                         return; // NOTREACHED
215                 }
216         }
217
218 }
219
220
221
222 function dfrn_poll_post(App $a) {
223
224         $dfrn_id      = ((x($_POST,'dfrn_id'))      ? $_POST['dfrn_id']              : '');
225         $challenge    = ((x($_POST,'challenge'))    ? $_POST['challenge']            : '');
226         $url          = ((x($_POST,'url'))          ? $_POST['url']                  : '');
227         $sec          = ((x($_POST,'sec'))          ? $_POST['sec']                  : '');
228         $ptype        = ((x($_POST,'type'))         ? $_POST['type']                 : '');
229         $dfrn_version = ((x($_POST,'dfrn_version')) ? (float) $_POST['dfrn_version'] : 2.0);
230         $perm         = ((x($_POST,'perm'))         ? $_POST['perm']                 : 'r');
231
232         if($ptype === 'profile-check') {
233
234                 if((strlen($challenge)) && (strlen($sec))) {
235
236                         logger('dfrn_poll: POST: profile-check');
237
238                         q("DELETE FROM `profile_check` WHERE `expire` < " . intval(time()));
239                         $r = q("SELECT * FROM `profile_check` WHERE `sec` = '%s' ORDER BY `expire` DESC LIMIT 1",
240                                 dbesc($sec)
241                         );
242                         if (! DBM::is_result($r)) {
243                                 xml_status(3, 'No ticket');
244                                 // NOTREACHED
245                         }
246                         $orig_id = $r[0]['dfrn_id'];
247                         if(strpos($orig_id, ':'))
248                                 $orig_id = substr($orig_id,2);
249
250                         $c = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1",
251                                 intval($r[0]['cid'])
252                         );
253                         if (! DBM::is_result($c)) {
254                                 xml_status(3, 'No profile');
255                         }
256                         $contact = $c[0];
257
258                         $sent_dfrn_id = hex2bin($dfrn_id);
259                         $challenge    = hex2bin($challenge);
260
261                         $final_dfrn_id = '';
262
263                         if(($contact['duplex']) && strlen($contact['prvkey'])) {
264                                 openssl_private_decrypt($sent_dfrn_id,$final_dfrn_id,$contact['prvkey']);
265                                 openssl_private_decrypt($challenge,$decoded_challenge,$contact['prvkey']);
266                         }
267                         else {
268                                 openssl_public_decrypt($sent_dfrn_id,$final_dfrn_id,$contact['pubkey']);
269                                 openssl_public_decrypt($challenge,$decoded_challenge,$contact['pubkey']);
270                         }
271
272                         $final_dfrn_id = substr($final_dfrn_id, 0, strpos($final_dfrn_id, '.'));
273
274                         if(strpos($final_dfrn_id,':') == 1)
275                                 $final_dfrn_id = substr($final_dfrn_id,2);
276
277                         if($final_dfrn_id != $orig_id) {
278                                 logger('profile_check: ' . $final_dfrn_id . ' != ' . $orig_id, LOGGER_DEBUG);
279                                 // did not decode properly - cannot trust this site
280                                 xml_status(3, 'Bad decryption');
281                         }
282
283                         header("Content-type: text/xml");
284                         echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?><dfrn_poll><status>0</status><challenge>$decoded_challenge</challenge><sec>$sec</sec></dfrn_poll>";
285                         killme();
286                         // NOTREACHED
287                 }
288
289         }
290
291         $direction    = (-1);
292         if(strpos($dfrn_id,':') == 1) {
293                 $direction = intval(substr($dfrn_id,0,1));
294                 $dfrn_id   = substr($dfrn_id,2);
295         }
296
297
298         $r = q("SELECT * FROM `challenge` WHERE `dfrn-id` = '%s' AND `challenge` = '%s' LIMIT 1",
299                 dbesc($dfrn_id),
300                 dbesc($challenge)
301         );
302
303         if (! DBM::is_result($r)) {
304                 killme();
305         }
306
307         $type = $r[0]['type'];
308         $last_update = $r[0]['last_update'];
309
310         $r = q("DELETE FROM `challenge` WHERE `dfrn-id` = '%s' AND `challenge` = '%s'",
311                 dbesc($dfrn_id),
312                 dbesc($challenge)
313         );
314
315
316         $sql_extra = '';
317         switch($direction) {
318                 case (-1):
319                         $sql_extra = sprintf(" AND `issued-id` = '%s' ", dbesc($dfrn_id));
320                         $my_id = $dfrn_id;
321                         break;
322                 case 0:
323                         $sql_extra = sprintf(" AND `issued-id` = '%s' AND `duplex` = 1 ", dbesc($dfrn_id));
324                         $my_id = '1:' . $dfrn_id;
325                         break;
326                 case 1:
327                         $sql_extra = sprintf(" AND `dfrn-id` = '%s' AND `duplex` = 1 ", dbesc($dfrn_id));
328                         $my_id = '0:' . $dfrn_id;
329                         break;
330                 default:
331                         goaway(System::baseUrl());
332                         break; // NOTREACHED
333         }
334
335
336         $r = q("SELECT * FROM `contact` WHERE `blocked` = 0 AND `pending` = 0 $sql_extra LIMIT 1");
337
338
339         if (! DBM::is_result($r)) {
340                 killme();
341         }
342
343         $contact = $r[0];
344         $owner_uid = $r[0]['uid'];
345         $contact_id = $r[0]['id'];
346
347
348         if($type === 'reputation' && strlen($url)) {
349                 $r = q("SELECT * FROM `contact` WHERE `url` = '%s' AND `uid` = %d LIMIT 1",
350                         dbesc($url),
351                         intval($owner_uid)
352                 );
353                 $reputation = 0;
354                 $text = '';
355
356                 if (DBM::is_result($r)) {
357                         $reputation = $r[0]['rating'];
358                         $text = $r[0]['reason'];
359
360                         if($r[0]['id'] == $contact_id) {        // inquiring about own reputation not allowed
361                                 $reputation = 0;
362                                 $text = '';
363                         }
364                 }
365
366                 echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
367                 <reputation>
368                         <url>$url</url>
369                         <rating>$reputation</rating>
370                         <description>$text</description>
371                 </reputation>
372                 ";
373                 killme();
374                 // NOTREACHED
375         }
376         else {
377
378                 // Update the writable flag if it changed
379                 logger('dfrn_poll: post request feed: ' . print_r($_POST,true),LOGGER_DATA);
380                 if($dfrn_version >= 2.21) {
381                         if($perm === 'rw')
382                                 $writable = 1;
383                         else
384                                 $writable = 0;
385
386                         if($writable !=  $contact['writable']) {
387                                 q("UPDATE `contact` SET `writable` = %d WHERE `id` = %d",
388                                         intval($writable),
389                                         intval($contact_id)
390                                 );
391                         }
392                 }
393
394                 header("Content-type: application/atom+xml");
395                 $o = DFRN::feed($dfrn_id, $a->argv[1], $last_update, $direction);
396                 echo $o;
397                 killme();
398
399         }
400 }
401
402 function dfrn_poll_content(App $a) {
403
404         $dfrn_id         = ((x($_GET,'dfrn_id'))         ? $_GET['dfrn_id']              : '');
405         $type            = ((x($_GET,'type'))            ? $_GET['type']                 : 'data');
406         $last_update     = ((x($_GET,'last_update'))     ? $_GET['last_update']          : '');
407         $destination_url = ((x($_GET,'destination_url')) ? $_GET['destination_url']      : '');
408         $sec             = ((x($_GET,'sec'))             ? $_GET['sec']                  : '');
409         $dfrn_version    = ((x($_GET,'dfrn_version'))    ? (float) $_GET['dfrn_version'] : 2.0);
410         $perm            = ((x($_GET,'perm'))            ? $_GET['perm']                 : 'r');
411         $quiet           = ((x($_GET,'quiet'))           ? true                          : false);
412
413         $direction = (-1);
414         if(strpos($dfrn_id,':') == 1) {
415                 $direction = intval(substr($dfrn_id,0,1));
416                 $dfrn_id = substr($dfrn_id,2);
417         }
418
419
420         if($dfrn_id != '') {
421                 // initial communication from external contact
422                 $hash = random_string();
423
424                 $status = 0;
425
426                 $r = q("DELETE FROM `challenge` WHERE `expire` < " . intval(time()));
427
428                 if($type !== 'profile') {
429                         $r = q("INSERT INTO `challenge` ( `challenge`, `dfrn-id`, `expire` , `type`, `last_update` )
430                                 VALUES( '%s', '%s', '%s', '%s', '%s' ) ",
431                                 dbesc($hash),
432                                 dbesc($dfrn_id),
433                                 intval(time() + 60 ),
434                                 dbesc($type),
435                                 dbesc($last_update)
436                         );
437                 }
438                 $sql_extra = '';
439                 switch($direction) {
440                         case (-1):
441                                 if($type === 'profile')
442                                         $sql_extra = sprintf(" AND ( `dfrn-id` = '%s' OR `issued-id` = '%s' ) ", dbesc($dfrn_id),dbesc($dfrn_id));
443                                 else
444                                         $sql_extra = sprintf(" AND `issued-id` = '%s' ", dbesc($dfrn_id));
445                                 $my_id = $dfrn_id;
446                                 break;
447                         case 0:
448                                 $sql_extra = sprintf(" AND `issued-id` = '%s' AND `duplex` = 1 ", dbesc($dfrn_id));
449                                 $my_id = '1:' . $dfrn_id;
450                                 break;
451                         case 1:
452                                 $sql_extra = sprintf(" AND `dfrn-id` = '%s' AND `duplex` = 1 ", dbesc($dfrn_id));
453                                 $my_id = '0:' . $dfrn_id;
454                                 break;
455                         default:
456                                 goaway(System::baseUrl());
457                                 break; // NOTREACHED
458                 }
459
460                 $nickname = $a->argv[1];
461
462                 $r = q("SELECT `contact`.*, `user`.`username`, `user`.`nickname`
463                         FROM `contact` LEFT JOIN `user` ON `contact`.`uid` = `user`.`uid`
464                         WHERE `contact`.`blocked` = 0 AND `contact`.`pending` = 0
465                         AND `user`.`nickname` = '%s' $sql_extra LIMIT 1",
466                         dbesc($nickname)
467                 );
468
469                 if (DBM::is_result($r)) {
470
471                         $challenge = '';
472                         $encrypted_id = '';
473                         $id_str = $my_id . '.' . mt_rand(1000,9999);
474
475                         if(($r[0]['duplex'] && strlen($r[0]['pubkey'])) || (! strlen($r[0]['prvkey']))) {
476                                 openssl_public_encrypt($hash,$challenge,$r[0]['pubkey']);
477                                 openssl_public_encrypt($id_str,$encrypted_id,$r[0]['pubkey']);
478                         }
479                         else {
480                                 openssl_private_encrypt($hash,$challenge,$r[0]['prvkey']);
481                                 openssl_private_encrypt($id_str,$encrypted_id,$r[0]['prvkey']);
482                         }
483
484                         $challenge = bin2hex($challenge);
485                         $encrypted_id = bin2hex($encrypted_id);
486                 }
487                 else {
488                         $status = 1;
489                         $challenge = '';
490                         $encrypted_id = '';
491                 }
492
493                 if(($type === 'profile') && (strlen($sec))) {
494
495                         // URL reply
496
497                         if($dfrn_version < 2.2) {
498                                 $s = fetch_url($r[0]['poll']
499                                         . '?dfrn_id=' . $encrypted_id
500                                         . '&type=profile-check'
501                                         . '&dfrn_version=' . DFRN_PROTOCOL_VERSION
502                                         . '&challenge=' . $challenge
503                                         . '&sec=' . $sec
504                                 );
505                         }
506                         else {
507                                 $s = post_url($r[0]['poll'], array(
508                                         'dfrn_id' => $encrypted_id,
509                                         'type' => 'profile-check',
510                                         'dfrn_version' => DFRN_PROTOCOL_VERSION,
511                                         'challenge' => $challenge,
512                                         'sec' => $sec
513                                 ));
514                         }
515
516                         $profile = ((DBM::is_result($r) && $r[0]['nickname']) ? $r[0]['nickname'] : $nickname);
517
518                         switch($destination_url) {
519                                 case 'profile':
520                                         $dest = System::baseUrl() . '/profile/' . $profile . '?f=&tab=profile';
521                                         break;
522                                 case 'photos':
523                                         $dest = System::baseUrl() . '/photos/' . $profile;
524                                         break;
525                                 case 'status':
526                                 case '':
527                                         $dest = System::baseUrl() . '/profile/' . $profile;
528                                         break;
529                                 default:
530                                         $appendix = (strstr($destination_url, '?') ? '&f=&redir=1' : '?f=&redir=1');
531                                         $dest = $destination_url . $appendix;
532                                         break;
533                         }
534
535                         logger("dfrn_poll: sec profile: " . $s, LOGGER_DATA);
536
537                         if(strlen($s) && strstr($s,'<?xml')) {
538
539                                 $xml = parse_xml_string($s);
540
541                                 logger('dfrn_poll: profile: parsed xml: ' . print_r($xml,true), LOGGER_DATA);
542
543                                 logger('dfrn_poll: secure profile: challenge: ' . $xml->challenge . ' expecting ' . $hash);
544                                 logger('dfrn_poll: secure profile: sec: ' . $xml->sec . ' expecting ' . $sec);
545
546
547                                 if(((int) $xml->status == 0) && ($xml->challenge == $hash)  && ($xml->sec == $sec)) {
548                                         $_SESSION['authenticated'] = 1;
549                                         if(! x($_SESSION,'remote'))
550                                                 $_SESSION['remote'] = array();
551                                         $_SESSION['remote'][] = array('cid' => $r[0]['id'],'uid' => $r[0]['uid'],'url' => $r[0]['url']);
552                                         $_SESSION['visitor_id'] = $r[0]['id'];
553                                         $_SESSION['visitor_home'] = $r[0]['url'];
554                                         $_SESSION['visitor_visiting'] = $r[0]['uid'];
555                                         if(!$quiet)
556                                                 info( sprintf(t('%1$s welcomes %2$s'), $r[0]['username'] , $r[0]['name']) . EOL);
557                                         // Visitors get 1 day session.
558                                         $session_id = session_id();
559                                         $expire = time() + 86400;
560                                         q("UPDATE `session` SET `expire` = '%s' WHERE `sid` = '%s'",
561                                                 dbesc($expire),
562                                                 dbesc($session_id)
563                                         );
564                                 }
565
566                                 goaway($dest);
567                         }
568                         goaway($dest);
569                         // NOTREACHED
570
571                 }
572                 else {
573                         // XML reply
574                         header("Content-type: text/xml");
575                         echo '<?xml version="1.0" encoding="UTF-8"?>' . "\r\n"
576                                 . '<dfrn_poll>' . "\r\n"
577                                 . "\t" . '<status>' . $status . '</status>' . "\r\n"
578                                 . "\t" . '<dfrn_version>' . DFRN_PROTOCOL_VERSION . '</dfrn_version>' . "\r\n"
579                                 . "\t" . '<dfrn_id>' . $encrypted_id . '</dfrn_id>' . "\r\n"
580                                 . "\t" . '<challenge>' . $challenge . '</challenge>' . "\r\n"
581                                 . '</dfrn_poll>' . "\r\n" ;
582                         killme();
583                         // NOTREACHED
584                 }
585         }
586 }