ktpd_session.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656
  1. #include <stdlib.h>
  2. #include <stdio.h>
  3. #include <string.h>
  4. #include <assert.h>
  5. #include <unistd.h>
  6. #include <errno.h>
  7. #include <sys/types.h>
  8. #include <sys/stat.h>
  9. #include <fcntl.h>
  10. #include <sys/socket.h>
  11. #include <sys/un.h>
  12. #include <syslog.h>
  13. #include <poll.h>
  14. #include <sys/wait.h>
  15. #include <faux/str.h>
  16. #include <faux/async.h>
  17. #include <faux/msg.h>
  18. #include <faux/eloop.h>
  19. #include <klish/ksession.h>
  20. #include <klish/ksession_parse.h>
  21. #include <klish/ktp.h>
  22. #include <klish/ktp_session.h>
  23. typedef enum {
  24. KTPD_SESSION_STATE_DISCONNECTED = 'd',
  25. KTPD_SESSION_STATE_UNAUTHORIZED = 'a',
  26. KTPD_SESSION_STATE_IDLE = 'i',
  27. KTPD_SESSION_STATE_WAIT_FOR_PROCESS = 'p',
  28. } ktpd_session_state_e;
  29. struct ktpd_session_s {
  30. ksession_t *session;
  31. ktpd_session_state_e state;
  32. uid_t uid;
  33. gid_t gid;
  34. char *user;
  35. faux_async_t *async;
  36. faux_hdr_t *hdr; // Engine will receive header and then msg
  37. faux_eloop_t *eloop; // External link, dont's free()
  38. kexec_t *exec;
  39. };
  40. // Static declarations
  41. static bool_t ktpd_session_read_cb(faux_async_t *async,
  42. faux_buf_t *buf, size_t len, void *user_data);
  43. static bool_t wait_for_actions_ev(faux_eloop_t *eloop, faux_eloop_type_e type,
  44. void *associated_data, void *user_data);
  45. bool_t client_ev(faux_eloop_t *eloop, faux_eloop_type_e type,
  46. void *associated_data, void *user_data);
  47. static bool_t ktpd_session_exec(ktpd_session_t *ktpd, const char *line,
  48. int *retcode, faux_error_t *error, bool_t dry_run);
  49. ktpd_session_t *ktpd_session_new(int sock, kscheme_t *scheme,
  50. const char *start_entry, faux_eloop_t *eloop)
  51. {
  52. ktpd_session_t *ktpd = NULL;
  53. if (sock < 0)
  54. return NULL;
  55. if (!eloop)
  56. return NULL;
  57. ktpd = faux_zmalloc(sizeof(*ktpd));
  58. assert(ktpd);
  59. if (!ktpd)
  60. return NULL;
  61. // Init
  62. ktpd->state = KTPD_SESSION_STATE_IDLE;
  63. ktpd->eloop = eloop;
  64. ktpd->session = ksession_new(scheme, start_entry);
  65. assert(ktpd->session);
  66. // Async object
  67. ktpd->async = faux_async_new(sock);
  68. assert(ktpd->async);
  69. // Receive message header first
  70. faux_async_set_read_limits(ktpd->async,
  71. sizeof(faux_hdr_t), sizeof(faux_hdr_t));
  72. faux_async_set_read_cb(ktpd->async, ktpd_session_read_cb, ktpd);
  73. ktpd->hdr = NULL;
  74. faux_async_set_stall_cb(ktpd->async, ktp_stall_cb, ktpd->eloop);
  75. // Eloop callbacks
  76. faux_eloop_add_fd(ktpd->eloop, ktpd_session_fd(ktpd), POLLIN,
  77. client_ev, ktpd);
  78. faux_eloop_add_signal(ktpd->eloop, SIGCHLD, wait_for_actions_ev, ktpd);
  79. return ktpd;
  80. }
  81. void ktpd_session_free(ktpd_session_t *ktpd)
  82. {
  83. if (!ktpd)
  84. return;
  85. kexec_free(ktpd->exec);
  86. ksession_free(ktpd->session);
  87. faux_free(ktpd->hdr);
  88. close(ktpd_session_fd(ktpd));
  89. faux_async_free(ktpd->async);
  90. faux_free(ktpd);
  91. }
  92. static bool_t ktpd_session_process_cmd(ktpd_session_t *ktpd, faux_msg_t *msg)
  93. {
  94. char *line = NULL;
  95. int retcode = -1;
  96. ktp_cmd_e cmd = KTP_CMD_ACK;
  97. faux_error_t *error = NULL;
  98. bool_t rc = BOOL_FALSE;
  99. bool_t dry_run = BOOL_FALSE;
  100. assert(ktpd);
  101. assert(msg);
  102. // Get line from message
  103. if (!(line = faux_msg_get_str_param_by_type(msg, KTP_PARAM_LINE))) {
  104. ktp_send_error(ktpd->async, cmd, "The line is not specified");
  105. return BOOL_FALSE;
  106. }
  107. // Get dry-run flag from message
  108. if (KTP_STATUS_IS_DRY_RUN(faux_msg_get_status(msg)))
  109. dry_run = BOOL_TRUE;
  110. error = faux_error_new();
  111. rc = ktpd_session_exec(ktpd, line, &retcode, error, dry_run);
  112. faux_str_free(line);
  113. // Command is scheduled. Eloop will wait for ACTION completion.
  114. // So inform client about it and about command features like
  115. // interactive/non-interactive.
  116. if (ktpd->exec) {
  117. faux_msg_t *ack = NULL;
  118. ktp_status_e status = KTP_STATUS_INCOMPLETED;
  119. ack = ktp_msg_preform(cmd, status);
  120. faux_msg_send_async(ack, ktpd->async);
  121. faux_msg_free(ack);
  122. faux_error_free(error);
  123. return BOOL_TRUE; // Continue and wait for ACTION
  124. }
  125. // Session status can be changed while parsing
  126. if (ksession_done(ktpd->session)) {
  127. ktp_send_error(ktpd->async, cmd, "Interrupted by system");
  128. faux_error_free(error);
  129. return BOOL_FALSE;
  130. }
  131. if (rc) {
  132. uint8_t retcode8bit = 0;
  133. faux_msg_t *ack = ktp_msg_preform(cmd, KTP_STATUS_NONE);
  134. retcode8bit = (uint8_t)(retcode & 0xff);
  135. faux_msg_add_param(ack, KTP_PARAM_RETCODE, &retcode8bit, 1);
  136. faux_msg_send_async(ack, ktpd->async);
  137. faux_msg_free(ack);
  138. } else {
  139. char *err = faux_error_cstr(error);
  140. ktp_send_error(ktpd->async, cmd, err);
  141. faux_str_free(err);
  142. return BOOL_FALSE;
  143. }
  144. faux_error_free(error);
  145. return BOOL_TRUE;
  146. }
  147. static bool_t ktpd_session_process_completion(ktpd_session_t *ktpd, faux_msg_t *msg)
  148. {
  149. char *line = NULL;
  150. faux_msg_t *ack = NULL;
  151. kpargv_t *pargv = NULL;
  152. ktp_cmd_e cmd = KTP_COMPLETION_ACK;
  153. assert(ktpd);
  154. assert(msg);
  155. // Get line from message
  156. if (!(line = faux_msg_get_str_param_by_type(msg, KTP_PARAM_LINE))) {
  157. ktp_send_error(ktpd->async, cmd, NULL);
  158. return BOOL_FALSE;
  159. }
  160. // Parsing
  161. pargv = ksession_parse_for_completion(ktpd->session, line);
  162. faux_str_free(line);
  163. if (!pargv) {
  164. ktp_send_error(ktpd->async, cmd, NULL);
  165. return BOOL_FALSE;
  166. }
  167. kpargv_debug(pargv);
  168. kpargv_free(pargv);
  169. // Send ACK message
  170. ack = ktp_msg_preform(cmd, KTP_STATUS_NONE);
  171. faux_msg_send_async(ack, ktpd->async);
  172. faux_msg_free(ack);
  173. return BOOL_TRUE;
  174. }
  175. static bool_t ktpd_session_process_help(ktpd_session_t *ktpd, faux_msg_t *msg)
  176. {
  177. char *line = NULL;
  178. faux_msg_t *ack = NULL;
  179. // kpargv_t *pargv = NULL;
  180. ktp_cmd_e cmd = KTP_HELP_ACK;
  181. assert(ktpd);
  182. assert(msg);
  183. // Get line from message
  184. if (!(line = faux_msg_get_str_param_by_type(msg, KTP_PARAM_LINE))) {
  185. ktp_send_error(ktpd->async, cmd, NULL);
  186. return BOOL_FALSE;
  187. }
  188. /* // Parsing
  189. pargv = ksession_parse_line(ktpd->session, line, KPURPOSE_HELP);
  190. faux_str_free(line);
  191. kpargv_free(pargv);
  192. */
  193. // Send ACK message
  194. ack = ktp_msg_preform(cmd, KTP_STATUS_NONE);
  195. faux_msg_send_async(ack, ktpd->async);
  196. faux_msg_free(ack);
  197. return BOOL_TRUE;
  198. }
  199. static bool_t ktpd_session_dispatch(ktpd_session_t *ktpd, faux_msg_t *msg)
  200. {
  201. uint16_t cmd = 0;
  202. assert(ktpd);
  203. if (!ktpd)
  204. return BOOL_FALSE;
  205. assert(msg);
  206. if (!msg)
  207. return BOOL_FALSE;
  208. cmd = faux_msg_get_cmd(msg);
  209. switch (cmd) {
  210. case KTP_CMD:
  211. ktpd_session_process_cmd(ktpd, msg);
  212. break;
  213. case KTP_COMPLETION:
  214. ktpd_session_process_completion(ktpd, msg);
  215. break;
  216. case KTP_HELP:
  217. ktpd_session_process_help(ktpd, msg);
  218. break;
  219. default:
  220. syslog(LOG_WARNING, "Unsupported command: 0x%04u\n", cmd);
  221. break;
  222. }
  223. return BOOL_TRUE;
  224. }
  225. /** @brief Low-level function to receive KTP message.
  226. *
  227. * Firstly function gets the header of message. Then it checks and parses
  228. * header and find out the length of whole message. Then it receives the rest
  229. * of message.
  230. */
  231. static bool_t ktpd_session_read_cb(faux_async_t *async,
  232. faux_buf_t *buf, size_t len, void *user_data)
  233. {
  234. ktpd_session_t *ktpd = (ktpd_session_t *)user_data;
  235. faux_msg_t *completed_msg = NULL;
  236. char *data = NULL;
  237. assert(async);
  238. assert(buf);
  239. assert(ktpd);
  240. // Linearize buffer
  241. data = malloc(len);
  242. faux_buf_read(buf, data, len);
  243. // Receive header
  244. if (!ktpd->hdr) {
  245. size_t whole_len = 0;
  246. size_t msg_wo_hdr = 0;
  247. ktpd->hdr = (faux_hdr_t *)data;
  248. // Check for broken header
  249. if (!ktp_check_header(ktpd->hdr)) {
  250. faux_free(ktpd->hdr);
  251. ktpd->hdr = NULL;
  252. return BOOL_FALSE;
  253. }
  254. whole_len = faux_hdr_len(ktpd->hdr);
  255. // msg_wo_hdr >= 0 because ktp_check_header() validates whole_len
  256. msg_wo_hdr = whole_len - sizeof(faux_hdr_t);
  257. // Plan to receive message body
  258. if (msg_wo_hdr > 0) {
  259. faux_async_set_read_limits(async,
  260. msg_wo_hdr, msg_wo_hdr);
  261. return BOOL_TRUE;
  262. }
  263. // Here message is completed (msg body has zero length)
  264. completed_msg = faux_msg_deserialize_parts(ktpd->hdr, NULL, 0);
  265. // Receive message body
  266. } else {
  267. completed_msg = faux_msg_deserialize_parts(ktpd->hdr, data, len);
  268. faux_free(data);
  269. }
  270. // Plan to receive msg header
  271. faux_async_set_read_limits(ktpd->async,
  272. sizeof(faux_hdr_t), sizeof(faux_hdr_t));
  273. faux_free(ktpd->hdr);
  274. ktpd->hdr = NULL; // Ready to recv new header
  275. // Here message is completed
  276. ktpd_session_dispatch(ktpd, completed_msg);
  277. faux_msg_free(completed_msg);
  278. // Session status can be changed while parsing
  279. if (ksession_done(ktpd->session))
  280. return BOOL_FALSE;
  281. return BOOL_TRUE;
  282. }
  283. bool_t ktpd_session_connected(ktpd_session_t *ktpd)
  284. {
  285. assert(ktpd);
  286. if (!ktpd)
  287. return BOOL_FALSE;
  288. if (KTPD_SESSION_STATE_DISCONNECTED == ktpd->state)
  289. return BOOL_FALSE;
  290. return BOOL_TRUE;
  291. }
  292. int ktpd_session_fd(const ktpd_session_t *ktpd)
  293. {
  294. assert(ktpd);
  295. if (!ktpd)
  296. return BOOL_FALSE;
  297. return faux_async_fd(ktpd->async);
  298. }
  299. static bool_t wait_for_actions_ev(faux_eloop_t *eloop, faux_eloop_type_e type,
  300. void *associated_data, void *user_data)
  301. {
  302. int wstatus = 0;
  303. pid_t child_pid = -1;
  304. ktpd_session_t *ktpd = (ktpd_session_t *)user_data;
  305. int retcode = -1;
  306. uint8_t retcode8bit = 0;
  307. faux_msg_t *ack = NULL;
  308. ktp_cmd_e cmd = KTP_CMD_ACK;
  309. if (!ktpd)
  310. return BOOL_FALSE;
  311. // Wait for any child process. Doesn't block.
  312. while ((child_pid = waitpid(-1, &wstatus, WNOHANG)) > 0) {
  313. if (ktpd->exec)
  314. kexec_continue_command_execution(ktpd->exec, child_pid,
  315. wstatus);
  316. }
  317. if (!ktpd->exec)
  318. return BOOL_TRUE;
  319. // Check if kexec is done now
  320. if (!kexec_retcode(ktpd->exec, &retcode))
  321. return BOOL_TRUE; // Continue
  322. faux_eloop_del_fd(eloop, kexec_stdout(ktpd->exec));
  323. faux_eloop_del_fd(eloop, kexec_stderr(ktpd->exec));
  324. kexec_free(ktpd->exec);
  325. ktpd->exec = NULL;
  326. ktpd->state = KTPD_SESSION_STATE_IDLE;
  327. // Send ACK message
  328. ack = ktp_msg_preform(cmd, KTP_STATUS_NONE);
  329. retcode8bit = (uint8_t)(retcode & 0xff);
  330. faux_msg_add_param(ack, KTP_PARAM_RETCODE, &retcode8bit, 1);
  331. faux_msg_send_async(ack, ktpd->async);
  332. faux_msg_free(ack);
  333. type = type; // Happy compiler
  334. associated_data = associated_data; // Happy compiler
  335. return BOOL_TRUE;
  336. }
  337. static bool_t action_stdout_ev(faux_eloop_t *eloop, faux_eloop_type_e type,
  338. void *associated_data, void *user_data)
  339. {
  340. faux_eloop_info_fd_t *info = (faux_eloop_info_fd_t *)associated_data;
  341. ktpd_session_t *ktpd = (ktpd_session_t *)user_data;
  342. ssize_t r = -1;
  343. faux_buf_t *faux_buf = NULL;
  344. char *buf = NULL;
  345. ssize_t len = 0;
  346. faux_msg_t *ack = NULL;
  347. // Some errors or fd is closed so remove it from polling
  348. if (!(info->revents & POLLIN)) {
  349. faux_eloop_del_fd(eloop, info->fd);
  350. return BOOL_TRUE;
  351. }
  352. if (!ktpd)
  353. return BOOL_TRUE;
  354. if (!ktpd->exec)
  355. return BOOL_TRUE;
  356. faux_buf = kexec_bufout(ktpd->exec);
  357. assert(faux_buf);
  358. do {
  359. void *linear_buf = NULL;
  360. ssize_t really_readed = 0;
  361. ssize_t linear_len =
  362. faux_buf_dwrite_lock_easy(faux_buf, &linear_buf);
  363. // Non-blocked read. The fd became non-blocked while
  364. // kexec_prepare().
  365. r = read(info->fd, linear_buf, linear_len);
  366. if (r > 0)
  367. really_readed = r;
  368. faux_buf_dwrite_unlock_easy(faux_buf, really_readed);
  369. } while (r > 0);
  370. len = faux_buf_len(faux_buf);
  371. if (0 == len)
  372. return BOOL_TRUE;
  373. buf = malloc(len);
  374. faux_buf_read(faux_buf, buf, len);
  375. // Create KTP_STDOUT message to send to client
  376. ack = ktp_msg_preform(KTP_STDOUT, KTP_STATUS_NONE);
  377. faux_msg_add_param(ack, KTP_PARAM_LINE, buf, len);
  378. faux_msg_send_async(ack, ktpd->async);
  379. faux_msg_free(ack);
  380. free(buf);
  381. // Happy compiler
  382. eloop = eloop;
  383. type = type;
  384. return BOOL_TRUE;
  385. }
  386. static bool_t action_stderr_ev(faux_eloop_t *eloop, faux_eloop_type_e type,
  387. void *associated_data, void *user_data)
  388. {
  389. faux_eloop_info_fd_t *info = (faux_eloop_info_fd_t *)associated_data;
  390. ktpd_session_t *ktpd = (ktpd_session_t *)user_data;
  391. ssize_t r = -1;
  392. faux_buf_t *faux_buf = NULL;
  393. char *buf = NULL;
  394. ssize_t len = 0;
  395. faux_msg_t *ack = NULL;
  396. // Some errors or fd is closed so remove it from polling
  397. if (!(info->revents & POLLIN)) {
  398. faux_eloop_del_fd(eloop, info->fd);
  399. return BOOL_TRUE;
  400. }
  401. if (!ktpd)
  402. return BOOL_TRUE;
  403. if (!ktpd->exec)
  404. return BOOL_TRUE;
  405. faux_buf = kexec_buferr(ktpd->exec);
  406. assert(faux_buf);
  407. do {
  408. void *linear_buf = NULL;
  409. ssize_t really_readed = 0;
  410. ssize_t linear_len =
  411. faux_buf_dwrite_lock_easy(faux_buf, &linear_buf);
  412. // Non-blocked read. The fd became non-blocked while
  413. // kexec_prepare().
  414. r = read(info->fd, linear_buf, linear_len);
  415. if (r > 0)
  416. really_readed = r;
  417. faux_buf_dwrite_unlock_easy(faux_buf, really_readed);
  418. } while (r > 0);
  419. len = faux_buf_len(faux_buf);
  420. if (0 == len)
  421. return BOOL_TRUE;
  422. buf = malloc(len);
  423. faux_buf_read(faux_buf, buf, len);
  424. // Create KTP_STDERR message to send to client
  425. ack = ktp_msg_preform(KTP_STDERR, KTP_STATUS_NONE);
  426. faux_msg_add_param(ack, KTP_PARAM_LINE, buf, len);
  427. faux_msg_send_async(ack, ktpd->async);
  428. faux_msg_free(ack);
  429. free(buf);
  430. // Happy compiler
  431. eloop = eloop;
  432. type = type;
  433. return BOOL_TRUE;
  434. }
  435. static bool_t ktpd_session_exec(ktpd_session_t *ktpd, const char *line,
  436. int *retcode, faux_error_t *error, bool_t dry_run)
  437. {
  438. kexec_t *exec = NULL;
  439. assert(ktpd);
  440. if (!ktpd)
  441. return BOOL_FALSE;
  442. // Parsing
  443. exec = ksession_parse_for_exec(ktpd->session, line, error);
  444. if (!exec)
  445. return BOOL_FALSE;
  446. // Set dry-run flag
  447. kexec_set_dry_run(exec, dry_run);
  448. // Session status can be changed while parsing
  449. if (ksession_done(ktpd->session)) {
  450. kexec_free(exec);
  451. return BOOL_FALSE; // Because action is not completed
  452. }
  453. // Execute kexec and then wait for completion using global Eloop
  454. if (!kexec_exec(exec)) {
  455. kexec_free(exec);
  456. return BOOL_FALSE; // Something went wrong
  457. }
  458. // If kexec contains only non-exec (for example dry-run) ACTIONs then
  459. // we don't need event loop and can return here.
  460. if (kexec_retcode(exec, retcode)) {
  461. kexec_free(exec);
  462. return BOOL_TRUE;
  463. }
  464. // Save kexec pointer to use later
  465. ktpd->state = KTPD_SESSION_STATE_WAIT_FOR_PROCESS;
  466. ktpd->exec = exec;
  467. faux_eloop_add_fd(ktpd->eloop, kexec_stdout(exec), POLLIN,
  468. action_stdout_ev, ktpd);
  469. faux_eloop_add_fd(ktpd->eloop, kexec_stderr(exec), POLLIN,
  470. action_stderr_ev, ktpd);
  471. return BOOL_TRUE;
  472. }
  473. bool_t client_ev(faux_eloop_t *eloop, faux_eloop_type_e type,
  474. void *associated_data, void *user_data)
  475. {
  476. faux_eloop_info_fd_t *info = (faux_eloop_info_fd_t *)associated_data;
  477. ktpd_session_t *ktpd = (ktpd_session_t *)user_data;
  478. faux_async_t *async = ktpd->async;
  479. assert(async);
  480. // Write data
  481. if (info->revents & POLLOUT) {
  482. faux_eloop_exclude_fd_event(eloop, info->fd, POLLOUT);
  483. if (faux_async_out(async) < 0) {
  484. // Someting went wrong
  485. faux_eloop_del_fd(eloop, info->fd);
  486. syslog(LOG_ERR, "Problem with async output");
  487. return BOOL_FALSE; // Stop event loop
  488. }
  489. }
  490. // Read data
  491. if (info->revents & POLLIN) {
  492. if (faux_async_in(async) < 0) {
  493. // Someting went wrong
  494. faux_eloop_del_fd(eloop, info->fd);
  495. syslog(LOG_ERR, "Problem with async input");
  496. return BOOL_FALSE; // Stop event loop
  497. }
  498. }
  499. // EOF
  500. if (info->revents & POLLHUP) {
  501. faux_eloop_del_fd(eloop, info->fd);
  502. syslog(LOG_DEBUG, "Close connection %d", info->fd);
  503. return BOOL_FALSE; // Stop event loop
  504. }
  505. // POLLERR
  506. if (info->revents & POLLERR) {
  507. faux_eloop_del_fd(eloop, info->fd);
  508. syslog(LOG_DEBUG, "POLLERR received %d", info->fd);
  509. return BOOL_FALSE; // Stop event loop
  510. }
  511. // POLLNVAL
  512. if (info->revents & POLLNVAL) {
  513. faux_eloop_del_fd(eloop, info->fd);
  514. syslog(LOG_DEBUG, "POLLNVAL received %d", info->fd);
  515. return BOOL_FALSE; // Stop event loop
  516. }
  517. type = type; // Happy compiler
  518. // Session status can be finished here
  519. if (ksession_done(ktpd->session))
  520. return BOOL_FALSE;
  521. return BOOL_TRUE;
  522. }
  523. #if 0
  524. static void ktpd_session_bad_socket(ktpd_session_t *ktpd)
  525. {
  526. assert(ktpd);
  527. if (!ktpd)
  528. return;
  529. ktpd->state = KTPD_SESSION_STATE_DISCONNECTED;
  530. }
  531. #endif