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