Commit 7a04996251ed2f13b8c5d1b5d1c0ec46142150d6

Authored by Perry Werneck
1 parent d8559cb7
Exists in master and in 2 other branches develop, macos

Fixing MAC build (#25)

locale/pt_BR.po
... ... @@ -5,7 +5,7 @@ msgid ""
5 5 msgstr ""
6 6 "Project-Id-Version: pw3270 5.0\n"
7 7 "Report-Msgid-Bugs-To: \n"
8   -"POT-Creation-Date: 2021-09-01 23:49-0300\n"
  8 +"POT-Creation-Date: 2021-12-02 21:59-0300\n"
9 9 "PO-Revision-Date: 2021-09-01 23:53-0300\n"
10 10 "Last-Translator: Perry Werneck <perry.werneck@gmail.com>\n"
11 11 "Language-Team: Português <perry.werneck@gmail.com>\n"
... ... @@ -179,10 +179,6 @@ msgstr &quot;Back space&quot;
179 179 msgid "Backspaces the cursor until it hits the front of a word"
180 180 msgstr "Volta o cursor até que atinga o início de uma palavra"
181 181  
182   -#: src/core/windows/connect.c:123
183   -msgid "Bad winsock version"
184   -msgstr "Versão winsock inválida"
185   -
186 182 #: src/core/toggles/table.c:257
187 183 msgid "Beep on errors"
188 184 msgstr "Emitir som nos erros"
... ... @@ -227,37 +223,25 @@ msgstr &quot;Arquivo CMS não encontrado, transferência cancelada&quot;
227 223 msgid "CRL signature failure"
228 224 msgstr "Erro na assinatura CRL"
229 225  
230   -#: src/core/toggles/init.c:83 src/core/windows/connect.c:372
  226 +#: src/core/toggles/init.c:83 src/core/macos/connect.c:334
231 227 #, c-format
232 228 msgid "Can't %s network keep-alive"
233 229 msgstr "Não foi possível %s opção \"keep-alive\""
234 230  
235   -#: src/core/windows/ldap.c:149
236   -msgid "Can't bind to LDAP server"
237   -msgstr "Não foi possível conectar ao servidor LDAP"
238   -
239   -#: src/core/windows/connect.c:232 src/core/windows/connect.c:276
  231 +#: src/core/macos/connect.c:215 src/core/macos/connect.c:269
240 232 #, c-format
241 233 msgid "Can't connect to %s:%s"
242 234 msgstr "Não foi possível conectar a %s:%s"
243 235  
244   -#: src/core/windows/http.c:110
245   -msgid "Can't connect to HTTP server."
246   -msgstr "Não foi possível conectar ao servidor HTTP"
247   -
248   -#: src/core/windows/connect.c:197
  236 +#: src/core/macos/connect.c:165
249 237 msgid "Can't connect to host"
250 238 msgstr "Não foi possível conectar no host"
251 239  
252   -#: src/core/windows/http.c:121
253   -msgid "Can't create HTTP request."
254   -msgstr "Não foi possível criar requisição HTTP"
255   -
256 240 #: src/network_modules/openssl/start.c:71
257 241 msgid "Can't decode CRL data"
258 242 msgstr "Não foi possível decodificar dados do CRL"
259 243  
260   -#: src/core/windows/ldap.c:204
  244 +#: src/core/macos/ldap.c:167
261 245 msgid "Can't decode certificate revocation list"
262 246 msgstr "Não foi possível decodificar a lista de certificados revogados"
263 247  
... ... @@ -269,42 +253,26 @@ msgstr &quot;Não foi possível determinar o estado TLS/SSL&quot;
269 253 msgid "Can't get file size"
270 254 msgstr "Não foi possível obter o tamanho do arquivo"
271 255  
272   -#: src/core/windows/ldap.c:133
273   -msgid "Can't initialize LDAP"
274   -msgstr "Erro ao inicializar LDAP"
  256 +#: src/core/macos/curl.c:171
  257 +msgid "Can't initialize curl operation"
  258 +msgstr "Erro ao inicializar operação CURL"
275 259  
276 260 #: src/network_modules/openssl/context.c:164
277 261 msgid "Can't initialize the TLS/SSL context."
278 262 msgstr "Erro ao inicializar contexto TLS/SSL"
279 263  
280   -#: src/core/session.c:198
  264 +#: src/core/session.c:205
281 265 msgid "Can't load"
282 266 msgstr "Não foi possível carregar"
283 267  
284   -#: src/core/windows/http.c:99
285   -msgid "Can't open HTTP session"
286   -msgstr "Não foi possível abrir sessão HTTP"
287   -
288   -#: src/core/session.c:186
  268 +#: src/core/session.c:193
289 269 msgid "Can't print"
290 270 msgstr "Não é possível imprimir"
291 271  
292   -#: src/core/windows/http.c:173
293   -msgid "Can't read HTTP response size."
294   -msgstr "Não posso obter tamanho da resposta HTTP"
295   -
296   -#: src/core/session.c:192
  272 +#: src/core/session.c:199
297 273 msgid "Can't save"
298 274 msgstr "Não é possível salvar"
299 275  
300   -#: src/core/windows/http.c:134
301   -msgid "Can't send HTTP request."
302   -msgstr "Não posso enviar requisição HTTP"
303   -
304   -#: src/core/windows/ldap.c:141
305   -msgid "Can't set LDAP protocol version"
306   -msgstr "Não é possível setar a versão do protocolo LDAP"
307   -
308 276 #: src/network_modules/tools.c:190
309 277 msgid "Can't set socket to blocking mode."
310 278 msgstr "Não foi possível mudar o socket para o modo blocante."
... ... @@ -317,10 +285,6 @@ msgstr &quot;Não foi possível setar o socket para o modo não blocante.&quot;
317 285 msgid "Can't start file transfer."
318 286 msgstr "Não foi possível iniciar transferência de arquivo."
319 287  
320   -#: src/core/windows/connect.c:124
321   -msgid "Can't use this system winsock"
322   -msgstr "Não posso usar a winsock do sistema"
323   -
324 288 #: src/core/ft/ft.c:151
325 289 msgid "Cancelled by user"
326 290 msgstr "Cancelado pelo usuário"
... ... @@ -407,8 +371,8 @@ msgstr &quot;Connected initial&quot;
407 371 msgid "Connecting"
408 372 msgstr "Conectando"
409 373  
410   -#: src/core/windows/connect.c:358 src/core/windows/connect.c:376
411   -#: src/network_modules/tools.c:160
  374 +#: src/core/macos/connect.c:230 src/core/macos/connect.c:321
  375 +#: src/core/macos/connect.c:338 src/network_modules/tools.c:160
412 376 msgid "Connection error"
413 377 msgstr "Erro de conexão"
414 378  
... ... @@ -512,8 +476,8 @@ msgstr &quot;Tipo de dispositivo rejeitado&quot;
512 476 msgid "Disconnect from host"
513 477 msgstr "Desconecta do servidor"
514 478  
515   -#: src/core/ft/ft.c:244 src/network_modules/openssl/main.c:99
516   -#: src/network_modules/openssl/main.c:147
  479 +#: src/core/ft/ft.c:244 src/network_modules/openssl/main.c:100
  480 +#: src/network_modules/openssl/main.c:148
517 481 msgid "Disconnected from host."
518 482 msgstr "Desconectado do servidor."
519 483  
... ... @@ -537,10 +501,6 @@ msgstr &quot;Dup&quot;
537 501 msgid "EOR received when not in 3270 mode, ignored."
538 502 msgstr "EOR recebido fora do modo 3270, ignorado."
539 503  
540   -#: src/core/windows/http.c:157
541   -msgid "Empty response from HTTP server."
542   -msgstr "Recebi resposta vazia do servidor HTTP"
543   -
544 504 #: src/core/toggles/table.c:298
545 505 msgid "Enable network in/out trace"
546 506 msgstr "Habilitar trace de entrada/saída de rede"
... ... @@ -593,12 +553,12 @@ msgstr &quot;Apagar campos&quot;
593 553 msgid "Erro sending data to host"
594 554 msgstr "Erro ao enviar dados para o servidor"
595 555  
596   -#: src/core/ft/ft_dft.c:413 src/core/ft/ft_cut.c:408
  556 +#: src/core/ft/ft_cut.c:408 src/core/ft/ft_dft.c:413
597 557 #, c-format
598 558 msgid "Error \"%s\" reading from local file (rc=%d)"
599 559 msgstr "Erro \"%s\" lendo arquivo local (rc=%d)"
600 560  
601   -#: src/core/ft/ft_dft.c:306 src/core/ft/ft_cut.c:504
  561 +#: src/core/ft/ft_cut.c:504 src/core/ft/ft_dft.c:306
602 562 #, c-format
603 563 msgid "Error \"%s\" writing to local file (rc=%d)"
604 564 msgstr "Erro \"%s\" gravando arquivo local (rc=%d)"
... ... @@ -611,14 +571,10 @@ msgstr &quot;Erro na transferência do arquivo, transferência cancelada&quot;
611 571 msgid "Error reading file from host: file transfer canceled"
612 572 msgstr "Erro ao ler arquivo do host: Transferência cancelada"
613 573  
614   -#: src/network_modules/openssl/main.c:169
  574 +#: src/network_modules/openssl/main.c:170
615 575 msgid "Error reading from host"
616 576 msgstr "Erro lendo do servidor"
617 577  
618   -#: src/core/windows/http.c:145
619   -msgid "Error receiving HTTP response."
620   -msgstr "Erro recebendo resposta HTTP."
621   -
622 578 #: src/network_modules/tools.c:66 src/network_modules/tools.c:82
623 579 msgid "Error receiving data from host"
624 580 msgstr "Erro recebendo dados do servidor"
... ... @@ -631,7 +587,7 @@ msgstr &quot;Erro ao ler ou gravar no host: Transferência cancelada&quot;
631 587 msgid "Error writing file to host: file transfer canceled"
632 588 msgstr "Erro ao gravar arquivo no host, transferência cancelada"
633 589  
634   -#: src/network_modules/openssl/main.c:122
  590 +#: src/network_modules/openssl/main.c:123
635 591 msgid "Error writing to host."
636 592 msgstr "Erro enviando para o servidor"
637 593  
... ... @@ -896,12 +852,14 @@ msgstr &quot;Teclado está bloqueado&quot;
896 852 msgid "Keyboard lock status"
897 853 msgstr "Estado de bloqueio do teclado"
898 854  
899   -#: src/core/windows/ldap.c:179
900   -msgid "LDAP Search did not produce any attributes."
  855 +#: src/core/macos/ldap.c:147
  856 +#, fuzzy
  857 +msgid "LDAP search did not produce any attributes."
901 858 msgstr "Pesquisa LDAP não produziu atributos."
902 859  
903   -#: src/core/windows/ldap.c:186
904   -msgid "LDAPSearch did not produce any values."
  860 +#: src/core/macos/ldap.c:157
  861 +#, fuzzy
  862 +msgid "LDAP search did not produce any values."
905 863 msgstr "Pesquisa LDAP não produziu valores."
906 864  
907 865 #: src/core/properties/signed.c:70
... ... @@ -989,8 +947,8 @@ msgstr &quot;Move para o próximo campo desprotegido&quot;
989 947 msgid "Move to the previous unprotected field on screen"
990 948 msgstr "Move para o campo desprotegido anterior"
991 949  
992   -#: src/core/telnet.c:304 src/core/windows/event_dispatcher.c:135
993   -#: src/core/windows/connect.c:223
  950 +#: src/core/telnet.c:304 src/core/macos/connect.c:200
  951 +#: src/core/macos/event_dispatcher.c:130
994 952 msgid "Network error"
995 953 msgstr "Erro de rede"
996 954  
... ... @@ -1018,7 +976,7 @@ msgstr &quot;Sem suporte LDAP&quot;
1018 976 msgid "No TLS/SSL support on this session"
1019 977 msgstr "Sem suporte TLS/SSL nessa sessão"
1020 978  
1021   -#: src/core/windows/download.c:62
  979 +#: src/core/macos/download.c:55
1022 980 msgid "No handler for URL scheme."
1023 981 msgstr "Nenhum manipulador para o esquema de URL"
1024 982  
... ... @@ -1046,10 +1004,6 @@ msgstr &quot;Diferente de zero se o host é AS400&quot;
1046 1004 msgid "Non zero if the host is TSO."
1047 1005 msgstr "Diferente de zero se o host é TSO"
1048 1006  
1049   -#: src/core/windows/connect.c:307
1050   -msgid "Not connected to host"
1051   -msgstr "Sem conexão com servidor"
1052   -
1053 1007 #: src/core/ft/ft.c:626
1054 1008 msgid "Not in 3270 mode, transfer cancelled"
1055 1009 msgstr "Não está no modo 3270, transferência cancelada"
... ... @@ -1313,7 +1267,7 @@ msgstr &quot;Seleciona a direita&quot;
1313 1267 msgid "Select word"
1314 1268 msgstr "Seleciona palavra"
1315 1269  
1316   -#: src/core/windows/event_dispatcher.c:136
  1270 +#: src/core/macos/event_dispatcher.c:131
1317 1271 msgid "Select() failed when processing for events."
1318 1272 msgstr "Select() falhou ao processar eventos."
1319 1273  
... ... @@ -1500,13 +1454,18 @@ msgstr &quot;&quot;
1500 1454 "A lista de revogação de certificados (CRL) de um certificado não pôde ser "
1501 1455 "encontrada."
1502 1456  
1503   -#: src/network_modules/openssl/main.c:123
1504   -#: src/network_modules/openssl/main.c:170
  1457 +#: src/network_modules/openssl/main.c:124
  1458 +#: src/network_modules/openssl/main.c:171
1505 1459 #, c-format
1506 1460 msgid "The SSL error message was %s"
1507 1461 msgstr "A mensagem de erro SSL foi \"%s\""
1508 1462  
1509   -#: src/core/windows/ldap.c:101 src/core/windows/ldap.c:110
  1463 +#: src/core/macos/connect.c:191
  1464 +#, fuzzy, c-format
  1465 +msgid "The System error was '%s' (rc=%d)"
  1466 +msgstr "O erro do sistema foi \"%s\" (rc=%d)"
  1467 +
  1468 +#: src/core/macos/ldap.c:82 src/core/macos/ldap.c:91
1510 1469 msgid "The URL argument should be in the format ldap://[HOST]/[DN]?attribute"
1511 1470 msgstr "A URL deve ser no formato ldap://[HOST]/[DN]?attribute"
1512 1471  
... ... @@ -1723,8 +1682,8 @@ msgstr &quot;&quot;
1723 1682 "O Certificado raiz não está marcado como confiável para os fins "
1724 1683 "especificados."
1725 1684  
1726   -#: src/network_modules/openssl/main.c:101
1727   -#: src/network_modules/openssl/main.c:149
  1685 +#: src/network_modules/openssl/main.c:102
  1686 +#: src/network_modules/openssl/main.c:150
1728 1687 msgid "The secure connection has been closed cleanly."
1729 1688 msgstr "A conexão segura foi fechada corretamente"
1730 1689  
... ... @@ -1757,24 +1716,12 @@ msgstr &quot;O erro do sistema operacional foi %d&quot;
1757 1716 msgid "The system error code was %d (%s)"
1758 1717 msgstr "O erro do sistema operacional foi \"%d\" (%s)"
1759 1718  
1760   -#: src/core/windows/connect.c:239
1761   -#, c-format
1762   -msgid "The system error was \"%s\""
1763   -msgstr "O erro do sistema operacional foi \"%s\""
1764   -
1765   -#: src/core/windows/connect.c:298 src/core/windows/connect.c:306
1766   -#: src/core/windows/connect.c:314 src/core/windows/connect.c:324
  1719 +#: src/core/macos/connect.c:222 src/core/macos/connect.c:282
1767 1720 #, c-format
1768 1721 msgid "The system error was \"%s\" (rc=%d)"
1769 1722 msgstr "O erro do sistema operacional foi \"%s\" (rc=%d)"
1770 1723  
1771   -#: src/core/windows/connect.c:225 src/core/windows/connect.c:360
1772   -#: src/core/windows/connect.c:378
1773   -#, c-format
1774   -msgid "The system error was %s"
1775   -msgstr "O erro do sistema operacional foi \"%s\""
1776   -
1777   -#: src/core/util.c:260
  1724 +#: src/core/util.c:266
1778 1725 #, c-format
1779 1726 msgid "The system error was '%s' (rc=%d)"
1780 1727 msgstr "O erro do sistema foi \"%s\" (rc=%d)"
... ... @@ -1805,10 +1752,6 @@ msgstr &quot;Este é um erro no programa do host.&quot;
1805 1752 msgid "Time for auto-reconnect"
1806 1753 msgstr "Tempo para reconexão automática"
1807 1754  
1808   -#: src/core/windows/connect.c:299
1809   -msgid "Timeout conneting to host"
1810   -msgstr "Timeout ao conectar com o host"
1811   -
1812 1755 #: src/core/toggles/table.c:93 src/core/toggles/table.c:94
1813 1756 msgid "Trace Data Stream"
1814 1757 msgstr "Trace Data Stream"
... ... @@ -1857,8 +1800,8 @@ msgstr &quot;Mostrar posição do cursor&quot;
1857 1800 msgid "Transfer cancelled by host"
1858 1801 msgstr "Transferência cancelada pelo host"
1859 1802  
1860   -#: src/core/ft/ft_dft.c:213 src/core/ft/ft_dft.c:344 src/core/ft/ft_cut.c:387
1861   -#: src/core/ft/ft_cut.c:475
  1803 +#: src/core/ft/ft_cut.c:387 src/core/ft/ft_cut.c:475 src/core/ft/ft_dft.c:213
  1804 +#: src/core/ft/ft_dft.c:344
1862 1805 msgid "Transfer cancelled by user"
1863 1806 msgstr "Transferência cancelada pelo usuário"
1864 1807  
... ... @@ -1874,7 +1817,7 @@ msgstr &quot;Transferência falhou&quot;
1874 1817 msgid "Transmission error"
1875 1818 msgstr "Erro de transmissão"
1876 1819  
1877   -#: src/core/windows/connect.c:198
  1820 +#: src/core/macos/connect.c:166
1878 1821 msgid "Try again"
1879 1822 msgstr "Tentar novamente"
1880 1823  
... ... @@ -1903,7 +1846,7 @@ msgstr &quot;Incapaz de decifrar a assinatura do certificado&quot;
1903 1846 msgid "Unable to get certificate CRL."
1904 1847 msgstr "Incapaz de obter o CRL de um certificado."
1905 1848  
1906   -#: src/core/windows/connect.c:224
  1849 +#: src/core/macos/connect.c:201
1907 1850 msgid "Unable to get connection state."
1908 1851 msgstr "Não foi possível obter o estado da conexão."
1909 1852  
... ... @@ -1915,7 +1858,7 @@ msgstr &quot;Não foi possível obter emissor do certificado&quot;
1915 1858 msgid "Unable to get local issuer certificate"
1916 1859 msgstr "Unable to get local issuer certificate"
1917 1860  
1918   -#: src/core/session.c:198
  1861 +#: src/core/session.c:205
1919 1862 msgid "Unable to load from file"
1920 1863 msgstr "Não foi possível ler do arquivo"
1921 1864  
... ... @@ -1927,11 +1870,11 @@ msgstr &quot;Incapaz de negociar uma conexão segura com o host&quot;
1927 1870 msgid "Unable to paste text"
1928 1871 msgstr "Incapaz de colar texto"
1929 1872  
1930   -#: src/core/session.c:186
  1873 +#: src/core/session.c:193
1931 1874 msgid "Unable to print"
1932 1875 msgstr "Incapaz de imprimir"
1933 1876  
1934   -#: src/core/session.c:192
  1877 +#: src/core/session.c:199
1935 1878 msgid "Unable to save"
1936 1879 msgstr "Incapaz de salvar"
1937 1880  
... ... @@ -2023,10 +1966,6 @@ msgstr &quot;Usar teclas +/- para navegar por campos&quot;
2023 1966 msgid "Use the keys +/- from keypad to select editable fields"
2024 1967 msgstr "Use the keys +/- from keypad to select editable fields"
2025 1968  
2026   -#: src/core/windows/connect.c:111
2027   -msgid "WSAStartup failed"
2028   -msgstr "WSAStartup falhou"
2029   -
2030 1969 #: src/core/ft/ft.c:487
2031 1970 msgid "Waiting for GET response"
2032 1971 msgstr "Aguardando resposta do pedido de download"
... ... @@ -2039,11 +1978,6 @@ msgstr &quot;Aguardando resposta do pedido de upload&quot;
2039 1978 msgid "Warning"
2040 1979 msgstr "Alerta"
2041 1980  
2042   -#: src/core/windows/util.c:126 src/core/windows/util.c:169
2043   -#, c-format
2044   -msgid "Windows error %d"
2045   -msgstr "Erro windows foi %d"
2046   -
2047 1981 #: src/core/toggles/table.c:103 src/core/toggles/table.c:104
2048 1982 msgid "Wrap around"
2049 1983 msgstr "Wrap around"
... ... @@ -2131,15 +2065,15 @@ msgstr &quot;_Desconectar&quot;
2131 2065 msgid "_Reconnect"
2132 2066 msgstr "_Reconectar"
2133 2067  
2134   -#: src/core/windows/connect.c:340
  2068 +#: src/core/macos/connect.c:233 src/core/macos/connect.c:302
2135 2069 msgid "_Retry"
2136 2070 msgstr "_Repetir"
2137 2071  
2138   -#: src/core/toggles/init.c:83 src/core/windows/connect.c:372
  2072 +#: src/core/toggles/init.c:83 src/core/macos/connect.c:334
2139 2073 msgid "disable"
2140 2074 msgstr "desabilitar"
2141 2075  
2142   -#: src/core/toggles/init.c:83 src/core/windows/connect.c:372
  2076 +#: src/core/toggles/init.c:83 src/core/macos/connect.c:334
2143 2077 msgid "enable"
2144 2078 msgstr "habilitar"
2145 2079  
... ... @@ -2163,7 +2097,7 @@ msgstr &quot;Versão da lib3270&quot;
2163 2097 msgid "numeric lock"
2164 2098 msgstr "numeric lock"
2165 2099  
2166   -#: src/core/windows/connect.c:359
  2100 +#: src/core/macos/connect.c:322
2167 2101 msgid "setsockopt(SO_OOBINLINE) has failed"
2168 2102 msgstr "setsockopt(SO_OOBINLINE) has failed"
2169 2103  
... ... @@ -2386,6 +2320,9 @@ msgstr &quot;setsockopt(SO_OOBINLINE) has failed&quot;
2386 2320 #~ msgid "Background"
2387 2321 #~ msgstr "Fundo"
2388 2322  
  2323 +#~ msgid "Bad winsock version"
  2324 +#~ msgstr "Versão winsock inválida"
  2325 +
2389 2326 #~ msgid "Black"
2390 2327 #~ msgstr "Preto"
2391 2328  
... ... @@ -2428,9 +2365,18 @@ msgstr &quot;setsockopt(SO_OOBINLINE) has failed&quot;
2428 2365 #~ msgid "Can't add activity"
2429 2366 #~ msgstr "Não é possível adicionar atividade"
2430 2367  
  2368 +#~ msgid "Can't bind to LDAP server"
  2369 +#~ msgstr "Não foi possível conectar ao servidor LDAP"
  2370 +
  2371 +#~ msgid "Can't connect to HTTP server."
  2372 +#~ msgstr "Não foi possível conectar ao servidor HTTP"
  2373 +
2431 2374 #~ msgid "Can't convert line %lu from %s to %s"
2432 2375 #~ msgstr "Não foi possível converter a linha %lu de %s para %s"
2433 2376  
  2377 +#~ msgid "Can't create HTTP request."
  2378 +#~ msgstr "Não foi possível criar requisição HTTP"
  2379 +
2434 2380 #~ msgid "Can't cut rectangular regions"
2435 2381 #~ msgstr "Recortar não permitido em seleção retangular"
2436 2382  
... ... @@ -2456,8 +2402,8 @@ msgstr &quot;setsockopt(SO_OOBINLINE) has failed&quot;
2456 2402 #~ msgid "Can't get screen contents"
2457 2403 #~ msgstr "Não foi possível obter o conteúdo da tela"
2458 2404  
2459   -#~ msgid "Can't initialize curl operation"
2460   -#~ msgstr "Erro ao inicializar operação CURL"
  2405 +#~ msgid "Can't initialize LDAP"
  2406 +#~ msgstr "Erro ao inicializar LDAP"
2461 2407  
2462 2408 #~ msgid "Can't load \"%s\": %s"
2463 2409 #~ msgstr "Não foi possível carregar \"%s\": %s"
... ... @@ -2483,6 +2429,9 @@ msgstr &quot;setsockopt(SO_OOBINLINE) has failed&quot;
2483 2429 #~ msgid "Can't open CRL File"
2484 2430 #~ msgstr "Não foi possível abrir arquivo CRL"
2485 2431  
  2432 +#~ msgid "Can't open HTTP session"
  2433 +#~ msgstr "Não foi possível abrir sessão HTTP"
  2434 +
2486 2435 #~ msgid "Can't open file"
2487 2436 #~ msgstr "Não foi possível abrir arquivo"
2488 2437  
... ... @@ -2513,6 +2462,9 @@ msgstr &quot;setsockopt(SO_OOBINLINE) has failed&quot;
2513 2462 #~ msgid "Can't read \"%s\": %s"
2514 2463 #~ msgstr "Não foi possível ler \"%s\": %s"
2515 2464  
  2465 +#~ msgid "Can't read HTTP response size."
  2466 +#~ msgstr "Não posso obter tamanho da resposta HTTP"
  2467 +
2516 2468 #~ msgid "Can't recognize \"%s\" as a valid host type"
2517 2469 #~ msgstr "Não reconheço \"%s\" como um tipo de host válido"
2518 2470  
... ... @@ -2549,6 +2501,12 @@ msgstr &quot;setsockopt(SO_OOBINLINE) has failed&quot;
2549 2501 #~ msgid "Can't search LDAP server"
2550 2502 #~ msgstr "Não foi possível conectar ao servidor LDAP"
2551 2503  
  2504 +#~ msgid "Can't send HTTP request."
  2505 +#~ msgstr "Não posso enviar requisição HTTP"
  2506 +
  2507 +#~ msgid "Can't set LDAP protocol version"
  2508 +#~ msgstr "Não é possível setar a versão do protocolo LDAP"
  2509 +
2552 2510 #~ msgid "Can't set callback table"
2553 2511 #~ msgstr "Não foi possível setar a tabela de retornos"
2554 2512  
... ... @@ -2567,6 +2525,9 @@ msgstr &quot;setsockopt(SO_OOBINLINE) has failed&quot;
2567 2525 #~ msgid "Can't start upload."
2568 2526 #~ msgstr "Não foi possível iniciar upload."
2569 2527  
  2528 +#~ msgid "Can't use this system winsock"
  2529 +#~ msgstr "Não posso usar a winsock do sistema"
  2530 +
2570 2531 #~ msgid "Can't use winsock version %d.%d"
2571 2532 #~ msgstr "Não posso usar versão winsock %d.%d"
2572 2533  
... ... @@ -2763,6 +2724,9 @@ msgstr &quot;setsockopt(SO_OOBINLINE) has failed&quot;
2763 2724 #~ msgid "Empty port name"
2764 2725 #~ msgstr "Porta em branco"
2765 2726  
  2727 +#~ msgid "Empty response from HTTP server."
  2728 +#~ msgstr "Recebi resposta vazia do servidor HTTP"
  2729 +
2766 2730 #~ msgid ""
2767 2731 #~ "Erase\n"
2768 2732 #~ "Input"
... ... @@ -2794,6 +2758,9 @@ msgstr &quot;setsockopt(SO_OOBINLINE) has failed&quot;
2794 2758 #~ msgid "Error loading CRL"
2795 2759 #~ msgstr "Erro lendo CRL"
2796 2760  
  2761 +#~ msgid "Error receiving HTTP response."
  2762 +#~ msgstr "Erro recebendo resposta HTTP."
  2763 +
2797 2764 #~ msgid "Error resolving %s: %s"
2798 2765 #~ msgstr "Erro ao resolver %s: %s"
2799 2766  
... ... @@ -3121,6 +3088,9 @@ msgstr &quot;setsockopt(SO_OOBINLINE) has failed&quot;
3121 3088 #~ msgid "Not available"
3122 3089 #~ msgstr "Não disponível"
3123 3090  
  3091 +#~ msgid "Not connected to host"
  3092 +#~ msgstr "Sem conexão com servidor"
  3093 +
3124 3094 #~ msgid "Not the same terminal type"
3125 3095 #~ msgstr "O tipo de terminal é diferente"
3126 3096  
... ... @@ -3886,6 +3856,14 @@ msgstr &quot;setsockopt(SO_OOBINLINE) has failed&quot;
3886 3856 #~ "O certificado de segurança apresentado pelo servidor não foi assinado por "
3887 3857 #~ "uma autoridade certificadora confiável."
3888 3858  
  3859 +#, c-format
  3860 +#~ msgid "The system error was \"%s\""
  3861 +#~ msgstr "O erro do sistema operacional foi \"%s\""
  3862 +
  3863 +#, c-format
  3864 +#~ msgid "The system error was %s"
  3865 +#~ msgstr "O erro do sistema operacional foi \"%s\""
  3866 +
3889 3867 #~ msgid "The system error was %s (%d)"
3890 3868 #~ msgstr "O erro do sistema operacional foi \"%s\" (%d)"
3891 3869  
... ... @@ -3932,6 +3910,9 @@ msgstr &quot;setsockopt(SO_OOBINLINE) has failed&quot;
3932 3910 #~ msgstr ""
3933 3911 #~ "Esta versão do %s foi gerada sem suporte para conexões seguras (SSL)."
3934 3912  
  3913 +#~ msgid "Timeout conneting to host"
  3914 +#~ msgstr "Timeout ao conectar com o host"
  3915 +
3935 3916 #~ msgid "To"
3936 3917 #~ msgstr "Para"
3937 3918  
... ... @@ -4088,6 +4069,9 @@ msgstr &quot;setsockopt(SO_OOBINLINE) has failed&quot;
4088 4069 #~ msgid "WSAEventSelect failed"
4089 4070 #~ msgstr "WSAEventSelect falhou"
4090 4071  
  4072 +#~ msgid "WSAStartup failed"
  4073 +#~ msgstr "WSAStartup falhou"
  4074 +
4091 4075 #~ msgid "WaitForMultipleObjects() failed when processing for events."
4092 4076 #~ msgstr "WaitForMultipleObjects() falhou ao processar eventos"
4093 4077  
... ... @@ -4106,6 +4090,10 @@ msgstr &quot;setsockopt(SO_OOBINLINE) has failed&quot;
4106 4090 #~ msgid "Windows Western languages (CP1252)"
4107 4091 #~ msgstr "Windows ocidental (CP1252)"
4108 4092  
  4093 +#, c-format
  4094 +#~ msgid "Windows error %d"
  4095 +#~ msgstr "Erro windows foi %d"
  4096 +
4109 4097 #~ msgid "Windows error was \"%s\" (%u)"
4110 4098 #~ msgstr "Erro windows foi \"%s\" (%u)"
4111 4099  
... ...
src/core/macos/connect.c
... ... @@ -39,86 +39,80 @@
39 39 #include <sys/ioctl.h>
40 40 #include <netinet/in.h>
41 41 #include <netdb.h>
42   -#include <unistd.h>
43 42 #include <fcntl.h>
44 43  
45   -#define SOCK_CLOSE(s) close(s->connection.sock); s->connection.sock = -1;
46   -
47 44 #include <stdlib.h>
48 45  
49 46 #include "hostc.h"
50 47 #include "trace_dsc.h"
51 48 #include "telnetc.h"
52 49 #include "screen.h"
  50 +#include "utilc.h"
53 51  
54 52 #include <lib3270/internals.h>
55 53 #include <lib3270/log.h>
56 54 #include <lib3270/trace.h>
  55 +#include <lib3270/os.h>
  56 +#include <networking.h>
  57 +//#include <fcntl.h>
  58 +#include <poll.h>
57 59  
58 60 /*---[ Implement ]-------------------------------------------------------------------------------*/
59 61  
  62 +static int sock_connect(H3270 *hSession, int sock, const struct sockaddr *address, socklen_t address_len) {
60 63  
61   -static void net_connected(H3270 *hSession, int GNUC_UNUSED(fd), LIB3270_IO_FLAG GNUC_UNUSED(flag), void GNUC_UNUSED(*dunno)) {
62   - int err;
63   - socklen_t len = sizeof(err);
  64 + lib3270_socket_set_non_blocking(hSession, sock, 1);
64 65  
65   - if(hSession->xio.write) {
66   - trace("%s write=%p",__FUNCTION__,hSession->xio.write);
67   - lib3270_remove_poll(hSession, hSession->xio.write);
68   - hSession->xio.write = NULL;
69   - }
  66 + if(!connect(sock,address,address_len))
  67 + return 0;
70 68  
71   - if(getsockopt(hSession->connection.sock, SOL_SOCKET, SO_ERROR, (char *) &err, &len) < 0) {
72   - lib3270_disconnect(hSession);
73   - lib3270_popup_dialog(
74   - hSession,
75   - LIB3270_NOTIFY_ERROR,
76   - _( "Network error" ),
77   - _( "Unable to get connection state." ),
78   - _( "%s" ), strerror(errno)
79   - );
80   - return;
81   - } else if(err) {
82   - char buffer[4096];
  69 + if(errno != EINPROGRESS)
  70 + return errno;
83 71  
84   - snprintf(buffer,4095,_( "Can't connect to %s" ), lib3270_get_url(hSession) );
  72 + unsigned int timer;
  73 + for(timer = 0; timer < hSession->connection.timeout; timer += 10) {
85 74  
86   - lib3270_disconnect(hSession);
87   - lib3270_popup_dialog(
88   - hSession,
89   - LIB3270_NOTIFY_ERROR,
90   - _( "Connection failed" ),
91   - buffer,
92   - _( "%s" ), strerror(err)
93   - );
94   - return;
95   - }
  75 + if(lib3270_get_connection_state(hSession) != LIB3270_CONNECTING)
  76 + return errno = ECANCELED;
96 77  
97   - hSession->xio.except = lib3270_add_poll_fd(hSession,hSession->connection.sock,LIB3270_IO_FLAG_EXCEPTION,net_exception,0);
98   - hSession->xio.read = lib3270_add_poll_fd(hSession,hSession->connection.sock,LIB3270_IO_FLAG_READ,net_input,0);
  78 + struct pollfd pfd = {
  79 + .fd = sock,
  80 + .events = POLLOUT
  81 + };
  82 +
  83 + switch(poll(&pfd,1,10)) {
  84 + case -1: // Poll error
  85 + return errno;
  86 +
  87 + case 0:
  88 + break;
  89 +
  90 + case 1:
  91 + // Got response.
  92 + if(pfd.revents & POLLOUT) {
  93 + debug("%s: Connection complete",__FUNCTION__);
  94 + return 0;
  95 + }
  96 + break;
  97 + }
99 98  
100   -#if defined(HAVE_LIBSSL)
101   - if(hSession->ssl.con && hSession->ssl.state == LIB3270_SSL_UNDEFINED) {
102   - if(ssl_negotiate(hSession))
103   - return;
104 99 }
105   -#endif
106 100  
107   - lib3270_setup_session(hSession);
108   - lib3270_set_connected_initial(hSession);
  101 + return errno = ETIMEDOUT;
109 102  
110 103 }
111 104  
112   -struct resolver {
113   - const char * message;
114   -};
115 105  
116   -static int background_connect(H3270 *hSession, void *host) {
  106 +int lib3270_network_connect(H3270 *hSession, LIB3270_NETWORK_STATE *state) {
  107 +
  108 + // Reset state
  109 + set_ssl_state(hSession,LIB3270_SSL_UNDEFINED);
117 110  
  111 + //
  112 + // Resolve hostname
  113 + //
118 114 struct addrinfo hints;
119 115 struct addrinfo * result = NULL;
120   - struct addrinfo * rp = NULL;
121   -
122 116 memset(&hints,0,sizeof(hints));
123 117 hints.ai_family = AF_UNSPEC; // Allow IPv4 or IPv6
124 118 hints.ai_socktype = SOCK_STREAM; // Stream socket
... ... @@ -128,74 +122,199 @@ static int background_connect(H3270 *hSession, void *host) {
128 122 status_resolving(hSession);
129 123  
130 124 int rc = getaddrinfo(hSession->host.current, hSession->host.srvc, &hints, &result);
131   - if(rc != 0) {
132   - ((struct resolver *) host)->message = gai_strerror(rc);
  125 + if(rc) {
  126 + state->error_message = gai_strerror(rc);
133 127 return -1;
134 128 }
135 129  
  130 + //
  131 + // Try connecting to hosts.
  132 + //
  133 + int sock = -1;
  134 + struct addrinfo * rp = NULL;
  135 +
136 136 status_connecting(hSession);
137 137  
138   - for(rp = result; hSession->connection.sock < 0 && rp != NULL; rp = rp->ai_next) {
139   - hSession->connection.sock = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol);
140   - if(hSession->connection.sock < 0) {
141   - ((struct resolver *) host)->message = strerror(errno);
  138 + for(rp = result; sock < 0 && rp != NULL && state->syserror != ECANCELED; rp = rp->ai_next) {
  139 + // Got socket from host definition.
  140 + sock = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol);
  141 + if(sock < 0) {
  142 + // Can't get socket.
  143 + state->syserror = errno;
142 144 continue;
143 145 }
144 146  
145   - // Connected!
146   - if(connect(hSession->connection.sock, rp->ai_addr, rp->ai_addrlen)) {
147   - SOCK_CLOSE(hSession);
148   - ((struct resolver *) host)->message = strerror(errno);
  147 + // Try connect.
  148 + if(sock_connect(hSession, sock, rp->ai_addr, rp->ai_addrlen)) {
  149 + // Can't connect to host
  150 + state->syserror = errno;
  151 + close(sock);
  152 + sock = -1;
149 153 continue;
150 154 }
151 155  
  156 + lib3270_socket_set_non_blocking(hSession,sock,0);
152 157 }
153 158  
154 159 freeaddrinfo(result);
155 160  
156   - return 0;
  161 + if(sock < 0) {
  162 + static const LIB3270_POPUP popup = {
  163 + .name = "CantConnect",
  164 + .type = LIB3270_NOTIFY_ERROR,
  165 + .summary = N_("Can't connect to host"),
  166 + .label = N_("Try again")
  167 + };
  168 +
  169 + state->popup = &popup;
  170 + return sock;
  171 + }
  172 +
  173 + // don't share the socket with our children
  174 + (void) fcntl(sock, F_SETFD, 1);
157 175  
  176 + return sock;
158 177 }
159 178  
160   -int net_reconnect(H3270 *hSession, int seconds) {
161   - struct resolver host;
162   - memset(&host,0,sizeof(host));
  179 +static void net_connected(H3270 *hSession, int GNUC_UNUSED(fd), LIB3270_IO_FLAG GNUC_UNUSED(flag), void GNUC_UNUSED(*dunno)) {
  180 + int err = 0;
  181 + socklen_t len = sizeof(err);
163 182  
164   - // Connect to host
165   - if(lib3270_run_task(hSession, background_connect, &host) || hSession->connection.sock < 0) {
166   - char buffer[4096];
167   - snprintf(buffer,4095,_( "Can't connect to %s:%s"), hSession->host.current, hSession->host.srvc);
  183 + if(hSession->xio.write) {
  184 + trace("%s write=%p",__FUNCTION__,hSession->xio.write);
  185 + lib3270_remove_poll(hSession, hSession->xio.write);
  186 + hSession->xio.write = NULL;
  187 + }
168 188  
169   - lib3270_popup_dialog( hSession,
170   - LIB3270_NOTIFY_ERROR,
171   - _( "Connection error" ),
172   - buffer,
173   - "%s",
174   - host.message);
  189 + if(hSession->network.module->getsockopt(hSession, SOL_SOCKET, SO_ERROR, (char *) &err, &len) < 0) {
  190 + lib3270_autoptr(char) body = lib3270_strdup_printf(
  191 + _("The System error was '%s' (rc=%d)"),
  192 + strerror(errno),
  193 + errno
  194 + );
175 195  
176   - lib3270_set_disconnected(hSession);
177   - return errno = ENOTCONN;
  196 + lib3270_disconnect(hSession);
  197 +
  198 + LIB3270_POPUP popup = {
  199 + .type = LIB3270_NOTIFY_ERROR,
  200 + .title = _( "Network error" ),
  201 + .summary = _( "Unable to get connection state." ),
  202 + .body = body
  203 + };
  204 +
  205 + lib3270_popup(hSession,&popup,0);
  206 +
  207 + return;
  208 +
  209 + } else if(err) {
  210 +
  211 + lib3270_disconnect(hSession);
  212 +
  213 + lib3270_autoptr(char) summary =
  214 + lib3270_strdup_printf(
  215 + _( "Can't connect to %s:%s"),
  216 + hSession->host.current,
  217 + hSession->host.srvc
  218 + );
  219 +
  220 + lib3270_autoptr(char) body =
  221 + lib3270_strdup_printf(
  222 + _("The system error was \"%s\" (rc=%d)"),
  223 + strerror(err),
  224 + err
  225 + );
  226 +
  227 +
  228 + LIB3270_POPUP popup = {
  229 + .type = LIB3270_NOTIFY_ERROR,
  230 + .title = _( "Connection error" ),
  231 + .summary = summary,
  232 + .body = body,
  233 + .label = _("_Retry")
  234 + };
  235 +
  236 + if(lib3270_popup(hSession,&popup,!hSession->auto_reconnect_inprogress) == 0)
  237 + lib3270_activate_auto_reconnect(hSession,1000);
  238 +
  239 + return;
178 240 }
179 241  
180   - /* don't share the socket with our children */
181   - (void) fcntl(hSession->connection.sock, F_SETFD, 1);
  242 + if(lib3270_start_tls(hSession)) {
  243 + lib3270_disconnect(hSession);
  244 + return;
  245 + }
182 246  
183   - hSession->ever_3270 = False;
  247 + hSession->xio.except = hSession->network.module->add_poll(hSession,LIB3270_IO_FLAG_EXCEPTION,net_exception,0);
  248 + hSession->xio.read = hSession->network.module->add_poll(hSession,LIB3270_IO_FLAG_READ,net_input,0);
  249 +
  250 + lib3270_setup_session(hSession);
  251 + lib3270_set_connected_initial(hSession);
184 252  
185   -#if defined(HAVE_LIBSSL)
186   - debug("%s: TLS/SSL is %s",__FUNCTION__,hSession->ssl.enabled ? "ENABLED" : "DISABLED")
187   - trace_dsn(hSession,"TLS/SSL is %s\n", hSession->ssl.enabled ? "enabled" : "disabled" );
188   - if(hSession->ssl.enabled) {
189   - hSession->ssl.host = 1;
190   - if(ssl_init(hSession))
191   - return errno = ENOTCONN;
  253 + lib3270_notify_tls(hSession);
192 254  
  255 +}
  256 +
  257 +int net_reconnect(H3270 *hSession, int seconds) {
  258 + LIB3270_NETWORK_STATE state;
  259 + memset(&state,0,sizeof(state));
  260 +
  261 + // Initialize and connect to host
  262 + set_ssl_state(hSession,LIB3270_SSL_UNDEFINED);
  263 + lib3270_set_cstate(hSession,LIB3270_CONNECTING);
  264 +
  265 + if(lib3270_run_task(hSession, (int(*)(H3270 *, void *)) hSession->network.module->connect, &state)) {
  266 + lib3270_autoptr(LIB3270_POPUP) popup =
  267 + lib3270_popup_clone_printf(
  268 + NULL,
  269 + _( "Can't connect to %s:%s"),
  270 + hSession->host.current,
  271 + hSession->host.srvc
  272 + );
  273 +
  274 + if(!popup->summary) {
  275 + popup->summary = popup->body;
  276 + popup->body = NULL;
  277 + }
  278 +
  279 + lib3270_autoptr(char) syserror = NULL;
  280 + if(state.syserror) {
  281 + syserror = lib3270_strdup_printf(
  282 + _("The system error was \"%s\" (rc=%d)"),
  283 + strerror(state.syserror),
  284 + state.syserror
  285 + );
  286 + }
  287 +#ifdef _WIN32
  288 + else if(state.winerror) {
  289 +#error TODO
  290 + }
  291 +#endif // _WIN32
  292 +
  293 + if(!popup->body) {
  294 + if(state.error_message)
  295 + popup->body = state.error_message;
  296 + else
  297 + popup->body = syserror;
  298 + }
  299 +
  300 + lib3270_disconnect(hSession); // To cleanup states.
  301 +
  302 + popup->label = _("_Retry");
  303 + if(lib3270_popup(hSession,popup,!hSession->auto_reconnect_inprogress) == 0)
  304 + lib3270_activate_auto_reconnect(hSession,1000);
  305 +
  306 + return errno = ENOTCONN;
193 307 }
194   -#endif // HAVE_LIBSSL
  308 +
  309 +
  310 + //
  311 + // Connected
  312 + //
  313 + hSession->ever_3270 = False;
195 314  
196 315 // set options for inline out-of-band data and keepalives
197 316 int optval = 1;
198   - if (setsockopt(hSession->connection.sock, SOL_SOCKET, SO_OOBINLINE, (char *)&optval,sizeof(optval)) < 0) {
  317 + if(hSession->network.module->setsockopt(hSession, SOL_SOCKET, SO_OOBINLINE, &optval, sizeof(optval)) < 0) {
199 318 int rc = errno;
200 319 lib3270_popup_dialog( hSession,
201 320 LIB3270_NOTIFY_ERROR,
... ... @@ -203,12 +322,12 @@ int net_reconnect(H3270 *hSession, int seconds) {
203 322 _( "setsockopt(SO_OOBINLINE) has failed" ),
204 323 "%s",
205 324 strerror(rc));
206   - SOCK_CLOSE(hSession);
  325 + hSession->network.module->disconnect(hSession);
207 326 return rc;
208 327 }
209 328  
210 329 optval = lib3270_get_toggle(hSession,LIB3270_TOGGLE_KEEP_ALIVE) ? 1 : 0;
211   - if (setsockopt(hSession->connection.sock, SOL_SOCKET, SO_KEEPALIVE, (char *)&optval, sizeof(optval)) < 0) {
  330 + if (hSession->network.module->setsockopt(hSession, SOL_SOCKET, SO_KEEPALIVE, &optval, sizeof(optval)) < 0) {
212 331 int rc = errno;
213 332  
214 333 char buffer[4096];
... ... @@ -220,7 +339,8 @@ int net_reconnect(H3270 *hSession, int seconds) {
220 339 buffer,
221 340 "%s",
222 341 strerror(rc));
223   - SOCK_CLOSE(hSession);
  342 +
  343 + hSession->network.module->disconnect(hSession);
224 344 return rc;
225 345 } else {
226 346 trace_dsn(hSession,"Network keep-alive is %s\n",optval ? "enabled" : "disabled" );
... ... @@ -242,18 +362,27 @@ int net_reconnect(H3270 *hSession, int seconds) {
242 362 lib3270_set_cstate(hSession, LIB3270_PENDING);
243 363 lib3270_st_changed(hSession, LIB3270_STATE_HALF_CONNECT, True);
244 364  
245   - hSession->xio.write = lib3270_add_poll_fd(hSession,hSession->connection.sock,LIB3270_IO_FLAG_WRITE,net_connected,0);
246   - // hSession->ns_write_id = AddOutput(hSession->sock, hSession, net_connected);
  365 + hSession->xio.write = hSession->network.module->add_poll(hSession,LIB3270_IO_FLAG_WRITE,net_connected,0);
247 366  
248 367 trace("%s: Connection in progress",__FUNCTION__);
249 368  
250 369 if(seconds) {
  370 + int rc = lib3270_wait_for_cstate(hSession,LIB3270_CONNECTED_TN3270E,seconds);
  371 + if(rc) {
  372 + lib3270_disconnect(hSession);
  373 + lib3270_write_log(hSession,"connect", "%s: %s",__FUNCTION__,strerror(ETIMEDOUT));
  374 + return errno = rc;
  375 + }
  376 +
  377 + /*
251 378 time_t end = time(0)+seconds;
252 379  
253   - while(time(0) < end) {
  380 + while(time(0) < end)
  381 + {
254 382 lib3270_main_iterate(hSession,1);
255 383  
256   - switch(hSession->connection.state) {
  384 + switch(hSession->connection.state)
  385 + {
257 386 case LIB3270_PENDING:
258 387 case LIB3270_CONNECTED_INITIAL:
259 388 case LIB3270_CONNECTED_ANSI:
... ... @@ -261,7 +390,7 @@ int net_reconnect(H3270 *hSession, int seconds) {
261 390 case LIB3270_CONNECTED_INITIAL_E:
262 391 case LIB3270_CONNECTED_NVT:
263 392 case LIB3270_CONNECTED_SSCP:
264   - case LIB3270_RESOLVING:
  393 + case LIB3270_CONNECTING:
265 394 break;
266 395  
267 396 case LIB3270_NOT_CONNECTED:
... ... @@ -283,6 +412,7 @@ int net_reconnect(H3270 *hSession, int seconds) {
283 412 lib3270_write_log(hSession,"connect", "%s: %s",__FUNCTION__,strerror(ETIMEDOUT));
284 413  
285 414 return errno = ETIMEDOUT;
  415 + */
286 416 }
287 417  
288 418 return 0;
... ...
src/core/macos/curl.c
... ... @@ -155,21 +155,20 @@ static int internal_curl_trace_callback(CURL GNUC_UNUSED(*handle), curl_infotype
155 155 return 0;
156 156 }
157 157  
158   -char * lib3270_get_from_url(H3270 *hSession, const char *url, size_t *length, const char **error_message) {
  158 +char * lib3270_url_get_using_curl(H3270 *hSession, const char *url, const char **error) {
159 159 lib3270_write_event_trace(hSession,"Getting data from %s",url);
160 160  
161 161 // Use CURL to download the CRL
162   - lib3270_autoptr(CURLDATA) crl_data = lib3270_malloc(sizeof(CURLDATA));
  162 + lib3270_autoptr(CURLDATA) curl_data = lib3270_malloc(sizeof(CURLDATA));
163 163 lib3270_autoptr(CURL) hCurl = curl_easy_init();
164 164  
165   - memset(crl_data,0,sizeof(CURLDATA));
166   - crl_data->hSession = hSession;
167   - crl_data->data.length = CRL_DATA_LENGTH;
168   - crl_data->data.contents = lib3270_malloc(crl_data->data.length);
  165 + memset(curl_data,0,sizeof(CURLDATA));
  166 + curl_data->hSession = hSession;
  167 + curl_data->data.length = CRL_DATA_LENGTH;
  168 + curl_data->data.contents = lib3270_malloc(curl_data->data.length);
169 169  
170 170 if(!hCurl) {
171   - *error_message= _( "Can't initialize curl operation" );
172   - errno = EINVAL;
  171 + *error = _( "Can't initialize curl operation" );
173 172 return NULL;
174 173 }
175 174  
... ... @@ -178,39 +177,36 @@ char * lib3270_get_from_url(H3270 *hSession, const char *url, size_t *length, co
178 177 curl_easy_setopt(hCurl, CURLOPT_URL, url);
179 178 curl_easy_setopt(hCurl, CURLOPT_FOLLOWLOCATION, 1L);
180 179  
181   - curl_easy_setopt(hCurl, CURLOPT_ERRORBUFFER, crl_data->errbuf);
  180 + curl_easy_setopt(hCurl, CURLOPT_ERRORBUFFER, curl_data->errbuf);
182 181  
183 182 curl_easy_setopt(hCurl, CURLOPT_WRITEFUNCTION, internal_curl_write_callback);
184   - curl_easy_setopt(hCurl, CURLOPT_WRITEDATA, (void *) crl_data);
  183 + curl_easy_setopt(hCurl, CURLOPT_WRITEDATA, (void *) curl_data);
185 184  
186 185 curl_easy_setopt(hCurl, CURLOPT_USERNAME, "");
187 186  
188 187 if(lib3270_get_toggle(hSession,LIB3270_TOGGLE_SSL_TRACE)) {
189 188 curl_easy_setopt(hCurl, CURLOPT_VERBOSE, 1L);
190 189 curl_easy_setopt(hCurl, CURLOPT_DEBUGFUNCTION, internal_curl_trace_callback);
191   - curl_easy_setopt(hCurl, CURLOPT_DEBUGDATA, (void *) crl_data);
  190 + curl_easy_setopt(hCurl, CURLOPT_DEBUGDATA, (void *) curl_data);
192 191 }
193 192  
194 193 res = curl_easy_perform(hCurl);
195 194  
196 195 if(res != CURLE_OK) {
197   - if(crl_data->errbuf[0])
198   - lib3270_write_log(hSession,"curl","%s: %s",url, crl_data->errbuf);
  196 + if(curl_data->errbuf[0])
  197 + lib3270_write_log(hSession,"curl","%s: %s",url, curl_data->errbuf);
199 198  
200   - *error_message = curl_easy_strerror(res);
  199 + *error = curl_easy_strerror(res);
201 200  
202   - lib3270_write_log(hSession,"curl","%s: %s",url, *error_message);
  201 + lib3270_write_log(hSession,"curl","%s: %s",url, *error);
203 202 errno = EINVAL;
204 203 return NULL;
205 204  
206 205 }
207 206  
208   - if(length)
209   - *length = (size_t) crl_data->length;
210   -
211   - char * httpText = lib3270_malloc(crl_data->length+1);
212   - memset(httpText,0,crl_data->length+1);
213   - memcpy(httpText,crl_data->data.contents,crl_data->length);
  207 + char * httpText = lib3270_malloc(curl_data->length+1);
  208 + memset(httpText,0,curl_data->length+1);
  209 + memcpy(httpText,curl_data->data.contents,curl_data->length);
214 210  
215 211 return httpText;
216 212  
... ...
src/core/macos/download.c 0 → 100644
... ... @@ -0,0 +1,63 @@
  1 +/*
  2 + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
  3 + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
  4 + * aplicativos mainframe. Registro no INPI sob o nome G3270.
  5 + *
  6 + * Copyright (C) <2008> <Banco do Brasil S.A.>
  7 + *
  8 + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
  9 + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
  10 + * Free Software Foundation.
  11 + *
  12 + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
  13 + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
  14 + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
  15 + * obter mais detalhes.
  16 + *
  17 + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
  18 + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
  19 + * St, Fifth Floor, Boston, MA 02110-1301 USA
  20 + *
  21 + * Este programa está nomeado como - e possui - linhas de código.
  22 + *
  23 + * Contatos:
  24 + *
  25 + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
  26 + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
  27 + *
  28 + */
  29 +
  30 +#include "private.h"
  31 +#include <utilc.h>
  32 +
  33 +/*--[ Implement ]------------------------------------------------------------------------------------*/
  34 +
  35 +char * lib3270_url_get(H3270 *hSession, const char *u, const char **error) {
  36 +
  37 + lib3270_autoptr(char) url = lib3270_unescape(u);
  38 +
  39 + if(strncasecmp(url,"file://",7) == 0) {
  40 +
  41 + // Load local file contents.
  42 + char *rc = lib3270_file_get_contents(hSession,url+7);
  43 + if(!rc)
  44 + *error = strerror(errno);
  45 + return rc;
  46 + }
  47 +
  48 +#if defined(HAVE_LIBCURL)
  49 +
  50 + return lib3270_url_get_using_curl(hSession,url,error);
  51 +
  52 +#else
  53 +
  54 + // Can't get contents
  55 + *error = _("No handler for URL scheme.");
  56 + errno = EINVAL;
  57 + return NULL;
  58 +
  59 +
  60 +#endif // HAVE_LIBCURL
  61 +
  62 +
  63 +}
... ...
src/core/macos/event_dispatcher.c
... ... @@ -166,11 +166,13 @@ retry:
166 166  
167 167 if (t->tv.tv_sec < now.tv_sec ||(t->tv.tv_sec == now.tv_sec && t->tv.tv_usec < now.tv_usec)) {
168 168 t->in_play = True;
169   - (*t->proc)(hSession);
170   - processed_any = True;
171 169  
  170 + (*t->proc)(hSession,t->userdata);
172 171 lib3270_linked_list_delete_node(&hSession->timeouts,t);
173 172  
  173 + processed_any = True;
  174 +
  175 +
174 176 } else {
175 177 break;
176 178 }
... ...
src/core/macos/ldap.c 0 → 100644
... ... @@ -0,0 +1,176 @@
  1 +/*
  2 + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
  3 + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
  4 + * aplicativos mainframe. Registro no INPI sob o nome G3270.
  5 + *
  6 + * Copyright (C) <2008> <Banco do Brasil S.A.>
  7 + *
  8 + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
  9 + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
  10 + * Free Software Foundation.
  11 + *
  12 + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
  13 + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
  14 + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
  15 + * obter mais detalhes.
  16 + *
  17 + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
  18 + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
  19 + * St, Fifth Floor, Boston, MA 02110-1301 USA
  20 + *
  21 + * Este programa está nomeado como - e possui - linhas de código.
  22 + *
  23 + * Contatos:
  24 + *
  25 + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
  26 + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
  27 + *
  28 + */
  29 +
  30 +#include <config.h>
  31 +
  32 +#if defined(HAVE_LDAP) && defined(HAVE_LIBSSL)
  33 +
  34 +#include <internals.h>
  35 +#include <lib3270.h>
  36 +#include <lib3270/log.h>
  37 +#include <lib3270/trace.h>
  38 +#include <openssl/x509.h>
  39 +#include <networking.h>
  40 +
  41 +#define LDAP_DEPRECATED 1
  42 +#include <ldap.h>
  43 +
  44 +typedef char LDAPPTR;
  45 +
  46 +//--[ Implement ]------------------------------------------------------------------------------------
  47 +
  48 +static inline void lib3270_autoptr_cleanup_LDAPMessage(LDAPMessage **message) {
  49 + debug("%s(%p)",__FUNCTION__,*message);
  50 + if(message)
  51 + ldap_msgfree(*message);
  52 + *message = NULL;
  53 +}
  54 +
  55 +static inline void lib3270_autoptr_cleanup_LDAP(LDAP **ld) {
  56 + debug("%s(%p)",__FUNCTION__,*ld);
  57 + if(*ld)
  58 + ldap_unbind_ext(*ld, NULL, NULL);
  59 + *ld = NULL;
  60 +}
  61 +
  62 +static inline void lib3270_autoptr_cleanup_BerElement(BerElement **ber) {
  63 + debug("%s(%p)",__FUNCTION__,*ber);
  64 + if(*ber)
  65 + ber_free(*ber, 0);
  66 + *ber = NULL;
  67 +}
  68 +
  69 +static inline void lib3270_autoptr_cleanup_LDAPPTR(char **ptr) {
  70 + debug("%s(%p)",__FUNCTION__,*ptr);
  71 + if(*ptr)
  72 + ldap_memfree(*ptr);
  73 + *ptr = NULL;
  74 +}
  75 +
  76 +X509_CRL * lib3270_crl_get_using_ldap(H3270 *hSession, const char *url, const char **error) {
  77 +
  78 + // Get attributes
  79 + char * attrs[] = { NULL, NULL };
  80 + char * base = strchr(url+7,'/');
  81 + if(!base) {
  82 + *error = _( "The URL argument should be in the format ldap://[HOST]/[DN]?attribute" );
  83 + errno = EINVAL;
  84 + return NULL;
  85 + }
  86 +
  87 + *(base++) = 0;
  88 + attrs[0] = strchr(base,'?');
  89 +
  90 + if(!base) {
  91 + *error = _( "The URL argument should be in the format ldap://[HOST]/[DN]?attribute" );
  92 + errno = EINVAL;
  93 + return NULL;
  94 + }
  95 +
  96 + *(attrs[0]++) = 0;
  97 +
  98 + debug("host: \"%s\"",url);
  99 + debug("Base: \"%s\"",base);
  100 + debug("Attr: \"%s\"",attrs[0]);
  101 +
  102 + // Do LDAP Query
  103 + lib3270_autoptr(LDAP) ld = NULL;
  104 + lib3270_autoptr(BerElement) ber = NULL;
  105 +
  106 + int rc = ldap_initialize(&ld, url);
  107 + if(rc != LDAP_SUCCESS) {
  108 + *error = ldap_err2string(rc);
  109 + return NULL;
  110 + }
  111 +
  112 + unsigned long version = LDAP_VERSION3;
  113 + rc = ldap_set_option(ld, LDAP_OPT_PROTOCOL_VERSION,(void *) &version);
  114 + if(rc != LDAP_SUCCESS) {
  115 + *error = ldap_err2string(rc);
  116 + return NULL;
  117 + }
  118 +
  119 + rc = ldap_simple_bind_s(ld, "", "");
  120 + if(rc != LDAP_SUCCESS) {
  121 + *error = ldap_err2string(rc);
  122 + return NULL;
  123 + }
  124 +
  125 + lib3270_autoptr(LDAPMessage) results = NULL;
  126 + rc = ldap_search_ext_s(
  127 + ld, // Specifies the LDAP pointer returned by a previous call to ldap_init(), ldap_ssl_init(), or ldap_open().
  128 + base, // Specifies the DN of the entry at which to start the search.
  129 + LDAP_SCOPE_BASE, // Specifies the scope of the search.
  130 + NULL, // Specifies a string representation of the filter to apply in the search.
  131 + (char **) &attrs, // Specifies a null-terminated array of character string attribute types to return from entries that match filter.
  132 + 0, // Should be set to 1 to request attribute types only. Set to 0 to request both attributes types and attribute values.
  133 + NULL,
  134 + NULL,
  135 + NULL,
  136 + 0,
  137 + &results
  138 + );
  139 +
  140 + if(rc != LDAP_SUCCESS) {
  141 + *error = ldap_err2string(rc);
  142 + return NULL;
  143 + }
  144 +
  145 + lib3270_autoptr(LDAPPTR) attr = ldap_first_attribute(ld, results, &ber);
  146 + if(!attr) {
  147 + *error = _("LDAP search did not produce any attributes.");
  148 + errno = ENOENT;
  149 + return NULL;
  150 + }
  151 +
  152 + //
  153 + // Load CRL
  154 + //
  155 + struct berval ** value = ldap_get_values_len(ld, results, attr);
  156 + if(!value) {
  157 + *error =_("LDAP search did not produce any values.");
  158 + errno = ENOENT;
  159 + return NULL;
  160 + }
  161 +
  162 + X509_CRL * crl = NULL;
  163 +
  164 + const unsigned char *crl_data = (const unsigned char *) value[0]->bv_val;
  165 +
  166 + if(!d2i_X509_CRL(&crl, &crl_data, value[0]->bv_len)) {
  167 + *error = _( "Can't decode certificate revocation list" );
  168 + }
  169 +
  170 + ldap_value_free_len(value);
  171 +
  172 + return crl;
  173 +
  174 +}
  175 +
  176 +#endif // HAVE_LDAP
... ...
src/core/macos/log.c
... ... @@ -42,22 +42,19 @@
42 42  
43 43 int use_syslog = 0;
44 44  
45   -void default_log_writer(H3270 GNUC_UNUSED(*session), const char *module, int GNUC_UNUSED(rc), const char *fmt, va_list arg_ptr) {
  45 +int default_loghandler(const H3270 GNUC_UNUSED(*session), void GNUC_UNUSED(*userdata), const char *module, int GNUC_UNUSED(rc), const char *message) {
46 46 #ifdef HAVE_SYSLOG
47 47 if(use_syslog) {
48   - vsyslog(LOG_INFO, fmt, arg_ptr);
  48 + syslog(LOG_INFO, "%s: %s", module, message);
49 49 } else {
50   - printf("%s:\t",module);
51   - vprintf(fmt,arg_ptr);
52   - printf("\n");
  50 + printf("%s %s\n", module, message);
53 51 fflush(stdout);
54 52 }
55 53 #else
56   - printf("%s:\t",module);
57   - vprintf(fmt,arg_ptr);
58   - printf("\n");
  54 + printf("%s %s\n", module, message);
59 55 fflush(stdout);
60 56 #endif
  57 + return 0;
61 58 }
62 59  
63 60 LIB3270_EXPORT int lib3270_set_syslog(int flag) {
... ...
src/core/macos/private.h 0 → 100644
... ... @@ -0,0 +1,48 @@
  1 +/*
  2 + * "Software G3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
  3 + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
  4 + * aplicativos mainframe. Registro no INPI sob o nome G3270.
  5 + *
  6 + * Copyright (C) <2008> <Banco do Brasil S.A.>
  7 + *
  8 + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
  9 + * os termos da GPL v.2 - Licença Pública Geral ', conforme publicado pela
  10 + * Free Software Foundation.
  11 + *
  12 + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
  13 + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
  14 + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
  15 + * obter mais detalhes.
  16 + *
  17 + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
  18 + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
  19 + * St, Fifth Floor, Boston, MA 02110-1301 USA
  20 + *
  21 + * Este programa está nomeado como private.h e possui - linhas de código.
  22 + *
  23 + * Contatos:
  24 + *
  25 + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
  26 + * erico.mendonca@gmail.com (Erico Mascarenhas de Mendonça)
  27 + *
  28 + */
  29 +
  30 +#ifndef PRIVATE_H_INCLUDED
  31 +
  32 +#define PRIVATE_H_INCLUDED
  33 +
  34 +#include <config.h>
  35 +#include <internals.h>
  36 +
  37 +#include <lib3270.h>
  38 +#include <lib3270/log.h>
  39 +
  40 +#if defined(HAVE_LIBCURL)
  41 +LIB3270_INTERNAL char * lib3270_url_get_using_curl(H3270 *hSession, const char *u, const char **error);
  42 +#endif // HAVE_LIBCURL
  43 +
  44 +#if defined(HAVE_LDAP)
  45 +LIB3270_INTERNAL char * lib3270_url_get_using_ldap(H3270 *hSession, const char *u, const char **error);
  46 +#endif // HAVE_LDAP
  47 +
  48 +#endif // !PRIVATE_H_INCLUDED
... ...
src/core/macos/util.c
... ... @@ -36,10 +36,7 @@
36 36 #include <config.h>
37 37 #include <stdarg.h>
38 38 #include <internals.h>
39   -#include <unistd.h>
40   -#include <CoreFoundation/CFBundle.h>
41   -#include <CoreFoundation/CFURL.h>
42   -#include <sys/syslimits.h>
  39 +#include <lib3270/os.h>
43 40  
44 41 static char * concat(char *path, const char *name, size_t *length) {
45 42 size_t szCurrent = strlen(path);
... ... @@ -77,24 +74,7 @@ char * lib3270_build_data_filename(const char *str, ...) {
77 74 va_list args;
78 75 va_start (args, str);
79 76  
80   - char *filename;
81   - CFBundleRef mainBundle = CFBundleGetMainBundle();
82   - if (mainBundle) {
83   - CFURLRef url = CFBundleCopyBundleURL(mainBundle);
84   - if (url) {
85   - size_t szPath = PATH_MAX;
86   - char *path = (char *) lib3270_malloc(szPath);
87   - CFURLGetFileSystemRepresentation(url, true, path, szPath);
88   - CFRelease(url);
89   - path = concat(path, "Contents/Resources", &szPath);
90   - filename = build_filename(path, str, args);
91   - lib3270_free(path);
92   - } else {
93   - filename = build_filename(LIB3270_STRINGIZE_VALUE_OF(DATADIR), str, args);
94   - }
95   - } else {
96   - filename = build_filename(LIB3270_STRINGIZE_VALUE_OF(DATADIR), str, args);
97   - }
  77 + char *filename = build_filename(LIB3270_STRINGIZE_VALUE_OF(DATADIR), str, args);
98 78  
99 79 va_end (args);
100 80  
... ...
src/core/util.c
... ... @@ -50,6 +50,8 @@
50 50 #include <malloc.h>
51 51 #endif // defined
52 52  
  53 +#include <stdlib.h>
  54 +
53 55 #define my_isspace(c) isspace((unsigned char)c)
54 56  
55 57 /// @brief Cheesy internal version of sprintf that allocates its own memory.
... ...
src/mkfb/mkfb.c
... ... @@ -41,6 +41,7 @@
41 41 #define tmpfile w32_tmpfile
42 42 #elif defined( __APPLE__ )
43 43 #define tmpfile osx_tmpfile
  44 +#include <unistd.h>
44 45 #endif // OS
45 46  
46 47 #include <sys/stat.h>
... ...