You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

transport_common.cc 17 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623
  1. /* Copyright (c) 2014, Google Inc.
  2. *
  3. * Permission to use, copy, modify, and/or distribute this software for any
  4. * purpose with or without fee is hereby granted, provided that the above
  5. * copyright notice and this permission notice appear in all copies.
  6. *
  7. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  8. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  9. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
  10. * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  11. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
  12. * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  13. * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
  14. #include <openssl/base.h>
  15. #include <string>
  16. #include <vector>
  17. #include <errno.h>
  18. #include <limits.h>
  19. #include <stddef.h>
  20. #include <stdlib.h>
  21. #include <string.h>
  22. #include <sys/types.h>
  23. #if !defined(OPENSSL_WINDOWS)
  24. #include <arpa/inet.h>
  25. #include <fcntl.h>
  26. #include <netdb.h>
  27. #include <netinet/in.h>
  28. #include <sys/select.h>
  29. #include <sys/socket.h>
  30. #include <unistd.h>
  31. #else
  32. #include <io.h>
  33. OPENSSL_MSVC_PRAGMA(warning(push, 3))
  34. #include <winsock2.h>
  35. #include <ws2tcpip.h>
  36. OPENSSL_MSVC_PRAGMA(warning(pop))
  37. typedef int ssize_t;
  38. OPENSSL_MSVC_PRAGMA(comment(lib, "Ws2_32.lib"))
  39. #endif
  40. #include <openssl/err.h>
  41. #include <openssl/ssl.h>
  42. #include <openssl/x509.h>
  43. #include "../crypto/internal.h"
  44. #include "internal.h"
  45. #include "transport_common.h"
  46. #if !defined(OPENSSL_WINDOWS)
  47. static int closesocket(int sock) {
  48. return close(sock);
  49. }
  50. #endif
  51. bool InitSocketLibrary() {
  52. #if defined(OPENSSL_WINDOWS)
  53. WSADATA wsaData;
  54. int err = WSAStartup(MAKEWORD(2, 2), &wsaData);
  55. if (err != 0) {
  56. fprintf(stderr, "WSAStartup failed with error %d\n", err);
  57. return false;
  58. }
  59. #endif
  60. return true;
  61. }
  62. // Connect sets |*out_sock| to be a socket connected to the destination given
  63. // in |hostname_and_port|, which should be of the form "www.example.com:123".
  64. // It returns true on success and false otherwise.
  65. bool Connect(int *out_sock, const std::string &hostname_and_port) {
  66. size_t colon_offset = hostname_and_port.find_last_of(':');
  67. const size_t bracket_offset = hostname_and_port.find_last_of(']');
  68. std::string hostname, port;
  69. // An IPv6 literal may have colons internally, guarded by square brackets.
  70. if (bracket_offset != std::string::npos &&
  71. colon_offset != std::string::npos && bracket_offset > colon_offset) {
  72. colon_offset = std::string::npos;
  73. }
  74. if (colon_offset == std::string::npos) {
  75. hostname = hostname_and_port;
  76. port = "443";
  77. } else {
  78. hostname = hostname_and_port.substr(0, colon_offset);
  79. port = hostname_and_port.substr(colon_offset + 1);
  80. }
  81. // Handle IPv6 literals.
  82. if (hostname.size() >= 2 && hostname[0] == '[' &&
  83. hostname[hostname.size() - 1] == ']') {
  84. hostname = hostname.substr(1, hostname.size() - 2);
  85. }
  86. struct addrinfo hint, *result;
  87. OPENSSL_memset(&hint, 0, sizeof(hint));
  88. hint.ai_family = AF_UNSPEC;
  89. hint.ai_socktype = SOCK_STREAM;
  90. int ret = getaddrinfo(hostname.c_str(), port.c_str(), &hint, &result);
  91. if (ret != 0) {
  92. fprintf(stderr, "getaddrinfo returned: %s\n", gai_strerror(ret));
  93. return false;
  94. }
  95. bool ok = false;
  96. char buf[256];
  97. *out_sock =
  98. socket(result->ai_family, result->ai_socktype, result->ai_protocol);
  99. if (*out_sock < 0) {
  100. perror("socket");
  101. goto out;
  102. }
  103. switch (result->ai_family) {
  104. case AF_INET: {
  105. struct sockaddr_in *sin =
  106. reinterpret_cast<struct sockaddr_in *>(result->ai_addr);
  107. fprintf(stderr, "Connecting to %s:%d\n",
  108. inet_ntop(result->ai_family, &sin->sin_addr, buf, sizeof(buf)),
  109. ntohs(sin->sin_port));
  110. break;
  111. }
  112. case AF_INET6: {
  113. struct sockaddr_in6 *sin6 =
  114. reinterpret_cast<struct sockaddr_in6 *>(result->ai_addr);
  115. fprintf(stderr, "Connecting to [%s]:%d\n",
  116. inet_ntop(result->ai_family, &sin6->sin6_addr, buf, sizeof(buf)),
  117. ntohs(sin6->sin6_port));
  118. break;
  119. }
  120. }
  121. if (connect(*out_sock, result->ai_addr, result->ai_addrlen) != 0) {
  122. perror("connect");
  123. goto out;
  124. }
  125. ok = true;
  126. out:
  127. freeaddrinfo(result);
  128. return ok;
  129. }
  130. bool Accept(int *out_sock, const std::string &port) {
  131. struct sockaddr_in6 addr, cli_addr;
  132. socklen_t cli_addr_len = sizeof(cli_addr);
  133. OPENSSL_memset(&addr, 0, sizeof(addr));
  134. addr.sin6_family = AF_INET6;
  135. addr.sin6_addr = IN6ADDR_ANY_INIT;
  136. addr.sin6_port = htons(atoi(port.c_str()));
  137. bool ok = false;
  138. #if defined(OPENSSL_WINDOWS)
  139. const BOOL enable = TRUE;
  140. #else
  141. const int enable = 1;
  142. #endif
  143. int server_sock = -1;
  144. server_sock =
  145. socket(addr.sin6_family, SOCK_STREAM, 0);
  146. if (server_sock < 0) {
  147. perror("socket");
  148. goto out;
  149. }
  150. if (setsockopt(server_sock, SOL_SOCKET, SO_REUSEADDR, (const char *)&enable,
  151. sizeof(enable)) < 0) {
  152. perror("setsockopt");
  153. goto out;
  154. }
  155. if (bind(server_sock, (struct sockaddr*)&addr, sizeof(addr)) != 0) {
  156. perror("connect");
  157. goto out;
  158. }
  159. listen(server_sock, 1);
  160. *out_sock = accept(server_sock, (struct sockaddr*)&cli_addr, &cli_addr_len);
  161. ok = true;
  162. out:
  163. closesocket(server_sock);
  164. return ok;
  165. }
  166. bool VersionFromString(uint16_t *out_version, const std::string &version) {
  167. if (version == "ssl3") {
  168. *out_version = SSL3_VERSION;
  169. return true;
  170. } else if (version == "tls1" || version == "tls1.0") {
  171. *out_version = TLS1_VERSION;
  172. return true;
  173. } else if (version == "tls1.1") {
  174. *out_version = TLS1_1_VERSION;
  175. return true;
  176. } else if (version == "tls1.2") {
  177. *out_version = TLS1_2_VERSION;
  178. return true;
  179. } else if (version == "tls1.3") {
  180. *out_version = TLS1_3_VERSION;
  181. return true;
  182. }
  183. return false;
  184. }
  185. static const char *SignatureAlgorithmToString(uint16_t version, uint16_t sigalg) {
  186. const bool is_tls12 = version == TLS1_2_VERSION || version == DTLS1_2_VERSION;
  187. switch (sigalg) {
  188. case SSL_SIGN_RSA_PKCS1_SHA1:
  189. return "rsa_pkcs1_sha1";
  190. case SSL_SIGN_RSA_PKCS1_SHA256:
  191. return "rsa_pkcs1_sha256";
  192. case SSL_SIGN_RSA_PKCS1_SHA384:
  193. return "rsa_pkcs1_sha384";
  194. case SSL_SIGN_RSA_PKCS1_SHA512:
  195. return "rsa_pkcs1_sha512";
  196. case SSL_SIGN_ECDSA_SHA1:
  197. return "ecdsa_sha1";
  198. case SSL_SIGN_ECDSA_SECP256R1_SHA256:
  199. return is_tls12 ? "ecdsa_sha256" : "ecdsa_secp256r1_sha256";
  200. case SSL_SIGN_ECDSA_SECP384R1_SHA384:
  201. return is_tls12 ? "ecdsa_sha384" : "ecdsa_secp384r1_sha384";
  202. case SSL_SIGN_ECDSA_SECP521R1_SHA512:
  203. return is_tls12 ? "ecdsa_sha512" : "ecdsa_secp521r1_sha512";
  204. case SSL_SIGN_RSA_PSS_SHA256:
  205. return "rsa_pss_sha256";
  206. case SSL_SIGN_RSA_PSS_SHA384:
  207. return "rsa_pss_sha384";
  208. case SSL_SIGN_RSA_PSS_SHA512:
  209. return "rsa_pss_sha512";
  210. default:
  211. return "(unknown)";
  212. }
  213. }
  214. void PrintConnectionInfo(const SSL *ssl) {
  215. const SSL_CIPHER *cipher = SSL_get_current_cipher(ssl);
  216. fprintf(stderr, " Version: %s\n", SSL_get_version(ssl));
  217. fprintf(stderr, " Resumed session: %s\n",
  218. SSL_session_reused(ssl) ? "yes" : "no");
  219. fprintf(stderr, " Cipher: %s\n", SSL_CIPHER_get_name(cipher));
  220. uint16_t curve = SSL_get_curve_id(ssl);
  221. if (curve != 0) {
  222. fprintf(stderr, " ECDHE curve: %s\n", SSL_get_curve_name(curve));
  223. }
  224. uint16_t sigalg = SSL_get_peer_signature_algorithm(ssl);
  225. if (sigalg != 0) {
  226. fprintf(stderr, " Signature algorithm: %s\n",
  227. SignatureAlgorithmToString(SSL_version(ssl), sigalg));
  228. }
  229. fprintf(stderr, " Secure renegotiation: %s\n",
  230. SSL_get_secure_renegotiation_support(ssl) ? "yes" : "no");
  231. fprintf(stderr, " Extended master secret: %s\n",
  232. SSL_get_extms_support(ssl) ? "yes" : "no");
  233. const uint8_t *next_proto;
  234. unsigned next_proto_len;
  235. SSL_get0_next_proto_negotiated(ssl, &next_proto, &next_proto_len);
  236. fprintf(stderr, " Next protocol negotiated: %.*s\n", next_proto_len,
  237. next_proto);
  238. const uint8_t *alpn;
  239. unsigned alpn_len;
  240. SSL_get0_alpn_selected(ssl, &alpn, &alpn_len);
  241. fprintf(stderr, " ALPN protocol: %.*s\n", alpn_len, alpn);
  242. const char *host_name = SSL_get_servername(ssl, TLSEXT_NAMETYPE_host_name);
  243. if (host_name != nullptr && SSL_is_server(ssl)) {
  244. fprintf(stderr, " Client sent SNI: %s\n", host_name);
  245. }
  246. if (!SSL_is_server(ssl)) {
  247. const uint8_t *ocsp_staple;
  248. size_t ocsp_staple_len;
  249. SSL_get0_ocsp_response(ssl, &ocsp_staple, &ocsp_staple_len);
  250. fprintf(stderr, " OCSP staple: %s\n", ocsp_staple_len > 0 ? "yes" : "no");
  251. const uint8_t *sct_list;
  252. size_t sct_list_len;
  253. SSL_get0_signed_cert_timestamp_list(ssl, &sct_list, &sct_list_len);
  254. fprintf(stderr, " SCT list: %s\n", sct_list_len > 0 ? "yes" : "no");
  255. }
  256. fprintf(stderr, " Early data: %s\n",
  257. SSL_early_data_accepted(ssl) ? "yes" : "no");
  258. // Print the server cert subject and issuer names.
  259. bssl::UniquePtr<X509> peer(SSL_get_peer_certificate(ssl));
  260. if (peer != nullptr) {
  261. fprintf(stderr, " Cert subject: ");
  262. X509_NAME_print_ex_fp(stderr, X509_get_subject_name(peer.get()), 0,
  263. XN_FLAG_ONELINE);
  264. fprintf(stderr, "\n Cert issuer: ");
  265. X509_NAME_print_ex_fp(stderr, X509_get_issuer_name(peer.get()), 0,
  266. XN_FLAG_ONELINE);
  267. fprintf(stderr, "\n");
  268. }
  269. }
  270. bool SocketSetNonBlocking(int sock, bool is_non_blocking) {
  271. bool ok;
  272. #if defined(OPENSSL_WINDOWS)
  273. u_long arg = is_non_blocking;
  274. ok = 0 == ioctlsocket(sock, FIONBIO, &arg);
  275. #else
  276. int flags = fcntl(sock, F_GETFL, 0);
  277. if (flags < 0) {
  278. return false;
  279. }
  280. if (is_non_blocking) {
  281. flags |= O_NONBLOCK;
  282. } else {
  283. flags &= ~O_NONBLOCK;
  284. }
  285. ok = 0 == fcntl(sock, F_SETFL, flags);
  286. #endif
  287. if (!ok) {
  288. fprintf(stderr, "Failed to set socket non-blocking.\n");
  289. }
  290. return ok;
  291. }
  292. // PrintErrorCallback is a callback function from OpenSSL's
  293. // |ERR_print_errors_cb| that writes errors to a given |FILE*|.
  294. int PrintErrorCallback(const char *str, size_t len, void *ctx) {
  295. fwrite(str, len, 1, reinterpret_cast<FILE*>(ctx));
  296. return 1;
  297. }
  298. bool TransferData(SSL *ssl, int sock) {
  299. bool stdin_open = true;
  300. fd_set read_fds;
  301. FD_ZERO(&read_fds);
  302. if (!SocketSetNonBlocking(sock, true)) {
  303. return false;
  304. }
  305. for (;;) {
  306. if (stdin_open) {
  307. FD_SET(0, &read_fds);
  308. }
  309. FD_SET(sock, &read_fds);
  310. int ret = select(sock + 1, &read_fds, NULL, NULL, NULL);
  311. if (ret <= 0) {
  312. perror("select");
  313. return false;
  314. }
  315. if (FD_ISSET(0, &read_fds)) {
  316. uint8_t buffer[512];
  317. ssize_t n;
  318. do {
  319. n = BORINGSSL_READ(0, buffer, sizeof(buffer));
  320. } while (n == -1 && errno == EINTR);
  321. if (n == 0) {
  322. FD_CLR(0, &read_fds);
  323. stdin_open = false;
  324. #if !defined(OPENSSL_WINDOWS)
  325. shutdown(sock, SHUT_WR);
  326. #else
  327. shutdown(sock, SD_SEND);
  328. #endif
  329. continue;
  330. } else if (n < 0) {
  331. perror("read from stdin");
  332. return false;
  333. }
  334. if (!SocketSetNonBlocking(sock, false)) {
  335. return false;
  336. }
  337. int ssl_ret = SSL_write(ssl, buffer, n);
  338. if (!SocketSetNonBlocking(sock, true)) {
  339. return false;
  340. }
  341. if (ssl_ret <= 0) {
  342. int ssl_err = SSL_get_error(ssl, ssl_ret);
  343. fprintf(stderr, "Error while writing: %d\n", ssl_err);
  344. ERR_print_errors_cb(PrintErrorCallback, stderr);
  345. return false;
  346. } else if (ssl_ret != n) {
  347. fprintf(stderr, "Short write from SSL_write.\n");
  348. return false;
  349. }
  350. }
  351. if (FD_ISSET(sock, &read_fds)) {
  352. uint8_t buffer[512];
  353. int ssl_ret = SSL_read(ssl, buffer, sizeof(buffer));
  354. if (ssl_ret < 0) {
  355. int ssl_err = SSL_get_error(ssl, ssl_ret);
  356. if (ssl_err == SSL_ERROR_WANT_READ) {
  357. continue;
  358. }
  359. fprintf(stderr, "Error while reading: %d\n", ssl_err);
  360. ERR_print_errors_cb(PrintErrorCallback, stderr);
  361. return false;
  362. } else if (ssl_ret == 0) {
  363. return true;
  364. }
  365. ssize_t n;
  366. do {
  367. n = BORINGSSL_WRITE(1, buffer, ssl_ret);
  368. } while (n == -1 && errno == EINTR);
  369. if (n != ssl_ret) {
  370. fprintf(stderr, "Short write to stderr.\n");
  371. return false;
  372. }
  373. }
  374. }
  375. }
  376. // SocketLineReader wraps a small buffer around a socket for line-orientated
  377. // protocols.
  378. class SocketLineReader {
  379. public:
  380. explicit SocketLineReader(int sock) : sock_(sock) {}
  381. // Next reads a '\n'- or '\r\n'-terminated line from the socket and, on
  382. // success, sets |*out_line| to it and returns true. Otherwise it returns
  383. // false.
  384. bool Next(std::string *out_line) {
  385. for (;;) {
  386. for (size_t i = 0; i < buf_len_; i++) {
  387. if (buf_[i] != '\n') {
  388. continue;
  389. }
  390. size_t length = i;
  391. if (i > 0 && buf_[i - 1] == '\r') {
  392. length--;
  393. }
  394. out_line->assign(buf_, length);
  395. buf_len_ -= i + 1;
  396. OPENSSL_memmove(buf_, &buf_[i + 1], buf_len_);
  397. return true;
  398. }
  399. if (buf_len_ == sizeof(buf_)) {
  400. fprintf(stderr, "Received line too long!\n");
  401. return false;
  402. }
  403. ssize_t n;
  404. do {
  405. n = recv(sock_, &buf_[buf_len_], sizeof(buf_) - buf_len_, 0);
  406. } while (n == -1 && errno == EINTR);
  407. if (n < 0) {
  408. fprintf(stderr, "Read error from socket\n");
  409. return false;
  410. }
  411. buf_len_ += n;
  412. }
  413. }
  414. // ReadSMTPReply reads one or more lines that make up an SMTP reply. On
  415. // success, it sets |*out_code| to the reply's code (e.g. 250) and
  416. // |*out_content| to the body of the reply (e.g. "OK") and returns true.
  417. // Otherwise it returns false.
  418. //
  419. // See https://tools.ietf.org/html/rfc821#page-48
  420. bool ReadSMTPReply(unsigned *out_code, std::string *out_content) {
  421. out_content->clear();
  422. // kMaxLines is the maximum number of lines that we'll accept in an SMTP
  423. // reply.
  424. static const unsigned kMaxLines = 512;
  425. for (unsigned i = 0; i < kMaxLines; i++) {
  426. std::string line;
  427. if (!Next(&line)) {
  428. return false;
  429. }
  430. if (line.size() < 4) {
  431. fprintf(stderr, "Short line from SMTP server: %s\n", line.c_str());
  432. return false;
  433. }
  434. const std::string code_str = line.substr(0, 3);
  435. char *endptr;
  436. const unsigned long code = strtoul(code_str.c_str(), &endptr, 10);
  437. if (*endptr || code > UINT_MAX) {
  438. fprintf(stderr, "Failed to parse code from line: %s\n", line.c_str());
  439. return false;
  440. }
  441. if (i == 0) {
  442. *out_code = code;
  443. } else if (code != *out_code) {
  444. fprintf(stderr,
  445. "Reply code varied within a single reply: was %u, now %u\n",
  446. *out_code, static_cast<unsigned>(code));
  447. return false;
  448. }
  449. if (line[3] == ' ') {
  450. // End of reply.
  451. *out_content += line.substr(4, std::string::npos);
  452. return true;
  453. } else if (line[3] == '-') {
  454. // Another line of reply will follow this one.
  455. *out_content += line.substr(4, std::string::npos);
  456. out_content->push_back('\n');
  457. } else {
  458. fprintf(stderr, "Bad character after code in SMTP reply: %s\n",
  459. line.c_str());
  460. return false;
  461. }
  462. }
  463. fprintf(stderr, "Rejected SMTP reply of more then %u lines\n", kMaxLines);
  464. return false;
  465. }
  466. private:
  467. const int sock_;
  468. char buf_[512];
  469. size_t buf_len_ = 0;
  470. };
  471. // SendAll writes |data_len| bytes from |data| to |sock|. It returns true on
  472. // success and false otherwise.
  473. static bool SendAll(int sock, const char *data, size_t data_len) {
  474. size_t done = 0;
  475. while (done < data_len) {
  476. ssize_t n;
  477. do {
  478. n = send(sock, &data[done], data_len - done, 0);
  479. } while (n == -1 && errno == EINTR);
  480. if (n < 0) {
  481. fprintf(stderr, "Error while writing to socket\n");
  482. return false;
  483. }
  484. done += n;
  485. }
  486. return true;
  487. }
  488. bool DoSMTPStartTLS(int sock) {
  489. SocketLineReader line_reader(sock);
  490. unsigned code_220 = 0;
  491. std::string reply_220;
  492. if (!line_reader.ReadSMTPReply(&code_220, &reply_220)) {
  493. return false;
  494. }
  495. if (code_220 != 220) {
  496. fprintf(stderr, "Expected 220 line from SMTP server but got code %u\n",
  497. code_220);
  498. return false;
  499. }
  500. static const char kHelloLine[] = "EHLO BoringSSL\r\n";
  501. if (!SendAll(sock, kHelloLine, sizeof(kHelloLine) - 1)) {
  502. return false;
  503. }
  504. unsigned code_250 = 0;
  505. std::string reply_250;
  506. if (!line_reader.ReadSMTPReply(&code_250, &reply_250)) {
  507. return false;
  508. }
  509. if (code_250 != 250) {
  510. fprintf(stderr, "Expected 250 line after EHLO but got code %u\n", code_250);
  511. return false;
  512. }
  513. // https://tools.ietf.org/html/rfc1869#section-4.3
  514. if (("\n" + reply_250 + "\n").find("\nSTARTTLS\n") == std::string::npos) {
  515. fprintf(stderr, "Server does not support STARTTLS\n");
  516. return false;
  517. }
  518. static const char kSTARTTLSLine[] = "STARTTLS\r\n";
  519. if (!SendAll(sock, kSTARTTLSLine, sizeof(kSTARTTLSLine) - 1)) {
  520. return false;
  521. }
  522. if (!line_reader.ReadSMTPReply(&code_220, &reply_220)) {
  523. return false;
  524. }
  525. if (code_220 != 220) {
  526. fprintf(
  527. stderr,
  528. "Expected 220 line from SMTP server after STARTTLS, but got code %u\n",
  529. code_220);
  530. return false;
  531. }
  532. return true;
  533. }