| 1 |
/*******************************************************/ |
/*******************************************************/ |
| 2 |
/* */ |
/* */ |
| 3 |
/* LeafOK Innbbsd */ |
/* LeafOK Innbbsd */ |
|
/* Copyright (C) LeafOK.com, 2003-2004 */ |
|
| 4 |
/* */ |
/* */ |
| 5 |
/* Programmed by Leaf */ |
/* Copyright (C) LeafOK.com, 2003-2008 */ |
|
/* E-mail:leaflet@leafok.com QQ:6049044 */ |
|
| 6 |
/* */ |
/* */ |
| 7 |
/* http://bbs.leafok.com */ |
/* http://www.leafok.com */ |
|
/* http://bbs.leafok.net */ |
|
|
/* http://bbs.fenglin.info */ |
|
| 8 |
/* */ |
/* */ |
| 9 |
/*******************************************************/ |
/*******************************************************/ |
| 10 |
|
|
| 85 |
} |
} |
| 86 |
|
|
| 87 |
this->s_send(result == 0 ? "OK" : "Failed"); |
this->s_send(result == 0 ? "OK" : "Failed"); |
| 88 |
|
|
| 89 |
|
syslog << logfile::log_head << "Begin " << cmd << " ... " << (result == 0 ? "OK" : "Failed") << endl; |
| 90 |
} |
} |
| 91 |
else |
else |
| 92 |
{ |
{ |
| 129 |
} |
} |
| 130 |
|
|
| 131 |
this->s_send(result == 0 ? "OK" : "Failed"); |
this->s_send(result == 0 ? "OK" : "Failed"); |
| 132 |
|
|
| 133 |
|
syslog << logfile::log_head << "End " << cmd << " ... " << (result == 0 ? "OK" : "Failed") << endl; |
| 134 |
} |
} |
| 135 |
else |
else |
| 136 |
{ |
{ |
| 139 |
} |
} |
| 140 |
else |
else |
| 141 |
{ |
{ |
| 142 |
this>s_send("501 service"); |
this->s_send("501 service"); |
| 143 |
} |
} |
| 144 |
contiinue; |
continue; |
| 145 |
} |
} |
| 146 |
|
|
| 147 |
if (cmd == "SHUTDOWN") |
if (cmd == "SHUTDOWN") |
| 231 |
} |
} |
| 232 |
catch(CException* e) |
catch(CException* e) |
| 233 |
{ |
{ |
| 234 |
syslog << logfile::log_head << "Error in accept()" << endl; |
char strErrMsg[1024]; |
| 235 |
|
e->GetErrorMessage(strErrMsg,1024); |
| 236 |
|
syslog << logfile::log_head << "Error in accept() [" << strErrMsg << "]" << endl; |
| 237 |
e->Delete(); |
e->Delete(); |
| 238 |
return -1; |
return -1; |
| 239 |
} |
} |
| 374 |
} |
} |
| 375 |
catch(CException* e) |
catch(CException* e) |
| 376 |
{ |
{ |
| 377 |
syslog << logfile::log_head << "Load configuration failed" << endl; |
char strErrMsg[1024]; |
| 378 |
|
e->GetErrorMessage(strErrMsg,1024); |
| 379 |
|
syslog << logfile::log_head << "Load configuration failed [" << strErrMsg << "]" << endl; |
| 380 |
e->Delete(); |
e->Delete(); |
| 381 |
return -1; |
return -1; |
| 382 |
} |
} |
| 430 |
|
|
| 431 |
void controld::StartupDelay(void) |
void controld::StartupDelay(void) |
| 432 |
{ |
{ |
| 433 |
|
syslog << logfile::log_head << "Startup delay for " << |
| 434 |
|
this->startup_delay << " seconds"<< endl; |
| 435 |
|
|
| 436 |
Sleep(this->startup_delay * 1000); |
Sleep(this->startup_delay * 1000); |
| 437 |
} |
} |
| 438 |
|
|
| 439 |
void controld::ShutdownChild(void) |
void controld::ShutdownChild(void) |
| 440 |
{ |
{ |
| 441 |
if (this->bbsd.end() == 0) |
if (this->bbsd.IsRunning()) |
|
{ |
|
|
syslog << logfile::log_head << "End BBSD ... OK" << endl; |
|
|
} |
|
|
else |
|
| 442 |
{ |
{ |
| 443 |
syslog << logfile::log_head << "End BBSD ... Failed" << endl; |
if (this->bbsd.end() == 0) |
| 444 |
|
{ |
| 445 |
|
syslog << logfile::log_head << "End BBSD ... OK" << endl; |
| 446 |
|
} |
| 447 |
|
else |
| 448 |
|
{ |
| 449 |
|
syslog << logfile::log_head << "End BBSD ... Failed" << endl; |
| 450 |
|
} |
| 451 |
} |
} |
| 452 |
|
|
| 453 |
if (this->innd.end() == 0) |
if (this->innd.IsRunning()) |
| 454 |
{ |
{ |
| 455 |
syslog << logfile::log_head << "End INND ... OK" << endl; |
if (this->innd.end() == 0) |
| 456 |
} |
{ |
| 457 |
else |
syslog << logfile::log_head << "End INND ... OK" << endl; |
| 458 |
{ |
} |
| 459 |
syslog << logfile::log_head << "End INND ... Failed" << endl; |
else |
| 460 |
|
{ |
| 461 |
|
syslog << logfile::log_head << "End INND ... Failed" << endl; |
| 462 |
|
} |
| 463 |
} |
} |
| 464 |
|
|
| 465 |
if (this->outd.end() == 0) |
if (this->outd.IsRunning()) |
| 466 |
{ |
{ |
| 467 |
syslog << logfile::log_head << "End OUTD ... OK" << endl; |
if (this->outd.end() == 0) |
| 468 |
} |
{ |
| 469 |
else |
syslog << logfile::log_head << "End OUTD ... OK" << endl; |
| 470 |
{ |
} |
| 471 |
syslog << logfile::log_head << "End OUTD ... Failed" << endl; |
else |
| 472 |
|
{ |
| 473 |
|
syslog << logfile::log_head << "End OUTD ... Failed" << endl; |
| 474 |
|
} |
| 475 |
} |
} |
| 476 |
} |
} |
| 477 |
|
|
| 502 |
|
|
| 503 |
return 0; |
return 0; |
| 504 |
} |
} |
| 505 |
|
|
| 506 |
|
bool controld::check_priv(void) |
| 507 |
|
{ |
| 508 |
|
return this->access.control; |
| 509 |
|
} |