]> git.pld-linux.org Git - packages/xephem.git/blob - xephem-3.7.7_openssl_earthmenu.patch
- rediff patch, rebuild with openssl 3.0.0, rel 2
[packages/xephem.git] / xephem-3.7.7_openssl_earthmenu.patch
1 Here
2 (http://www.clearskyinstitute.com/xephem/contrib/xephem-3.7.7_openssl_earthmenu.patch)
3 is another patch from Mr. Mändl dated 2018 September. This one fixes the
4 weather map in the Earth view which also now requires https. 
5
6 diff -Naur ./orig/xephem-3.7.7/GUI/xephem/earthmenu.c ./patched/xephem-3.7.7/GUI/xephem/earthmenu.c\r
7 --- ./orig/xephem-3.7.7/GUI/xephem/earthmenu.c  2012-11-23 05:15:39.000000000 +0100\r
8 +++ ./patched/xephem-3.7.7/GUI/xephem/earthmenu.c       2018-09-24 01:17:34.248048815 +0200\r
9 @@ -4886,8 +4886,11 @@\r
10         int nrawgif;\r
11         char buf[1024];\r
12         int w, h;\r
13 +       XE_SSL_FD ssl_fd;\r
14         int fd;\r
15  \r
16 +       memset(&ssl_fd, 0, sizeof(ssl_fd));\r
17 +\r
18         /* open test case, else real network */\r
19         fd = openh ("/tmp/latest_cmoll.gif", O_RDONLY);\r
20         if (fd >= 0) {\r
21 @@ -4902,12 +4905,12 @@\r
22             stopd_up();\r
23  \r
24             /* make connection to server for the file */\r
25 -           xe_msg (0, "Getting\nhttp://%s%s", wxhost, wxfile);\r
26 -           (void) sprintf (buf, "GET http://%s%s HTTP/1.0\r\nUser-Agent: xephem/%s\r\n\r\n",\r
27 -                                               wxhost, wxfile, PATCHLEVEL);\r
28 -           fd = httpGET (wxhost, buf, buf);\r
29 +           xe_msg (0, "Getting\nhttps://%s%s", wxhost, wxfile);\r
30 +           (void) sprintf (buf, "GET %s HTTP/1.1\r\nHost: %s\r\nConnection: close\r\nUser-Agent: xephem/%s\r\n\r\n",\r
31 +                                               wxfile, wxhost, PATCHLEVEL);\r
32 +           fd = httpsGET (wxhost, buf, buf, &ssl_fd);\r
33             if (fd < 0) {\r
34 -               xe_msg (1, "http get:\n%s", buf);\r
35 +               xe_msg (1, "https get:\n%s", buf);\r
36                 stopd_down();\r
37                 return (-1);\r
38             }\r
39 @@ -4915,7 +4918,7 @@\r
40             /* read header, looking for some header info */\r
41             isgif = 0;\r
42             length = 0;\r
43 -           while (recvline (fd, buf, sizeof(buf)) > 1) {\r
44 +           while (ssl_recvline (&ssl_fd, buf, sizeof(buf)) > 1) {\r
45                 xe_msg (0, "Rcv: %s", buf);\r
46                 if (strstr (buf, "image/gif"))\r
47                     isgif = 1;\r
48 @@ -4923,9 +4926,10 @@\r
49                     length = atoi (buf+15);\r
50             }\r
51             if (!isgif) {\r
52 -               while (recvline (fd, buf, sizeof(buf)) > 1)\r
53 +               while (ssl_recvline (&ssl_fd, buf, sizeof(buf)) > 1)\r
54                     xe_msg (0, "Rcv: %s", buf);\r
55 -               close (fd);\r
56 +               SSL_free (ssl_fd.ssl);\r
57 +               close (ssl_fd.fd);\r
58                 stopd_down();\r
59                 return (-1);\r
60             }\r
61 @@ -4936,12 +4940,13 @@\r
62             pm_up();\r
63             for (nrawgif = 0; nrawgif < sizeof(rawgif); nrawgif += nr) {\r
64                 pm_set (100*nrawgif/length);\r
65 -               nr = readbytes (fd, rawgif+nrawgif, 4096);\r
66 +               nr = SSL_read (ssl_fd.ssl, rawgif+nrawgif, 4096);\r
67                 if (nr < 0) {\r
68 -                   xe_msg (1, "%s:\n%s", wxhost, syserrstr());\r
69 +                   xe_msg (1, "%s: ssl read error code: %d", wxhost, SSL_get_error(ssl_fd.ssl, nr));\r
70                     stopd_down();\r
71                     pm_down();\r
72 -                   close (fd);\r
73 +                   SSL_free (ssl_fd.ssl);\r
74 +                   close (ssl_fd.fd);\r
75                     return (-1);\r
76                 }\r
77                 if (nr == 0)\r
78 @@ -4949,7 +4954,8 @@\r
79             }\r
80             stopd_down();\r
81             pm_down();\r
82 -           close (fd);\r
83 +           SSL_free (ssl_fd.ssl);\r
84 +           close (ssl_fd.fd);\r
85             if (nr > 0) {\r
86                 xe_msg (1, "File too large");\r
87                 return (-1);\r
This page took 0.227037 seconds and 3 git commands to generate.