1
0
mirror of https://git.sr.ht/~sircmpwn/gmni synced 2024-11-23 00:42:15 +01:00
Commit Graph

144 Commits

Author SHA1 Message Date
Zach DeCook
a348eb906d gmnlm: Improve paging behavior on narrow terminals 2021-04-02 12:49:07 -04:00
Eyal Sawady
77b73efbcd all: use posix_dirname rather than dirname 2021-03-16 08:45:19 -04:00
Eyal Sawady
93f30522f0 gmnlm: create cert dir on 6x response
So that the OpenSSL command doesn't fail when the cert dir hasn't
already been created.
2021-03-09 08:08:45 -05:00
Ariadna Vigo
42d80229d4 Makefile: install libgmni.a with 644 perms
Hi!
Static libraries don't need execution perms. I know this is very minor,
but best practice is to give everything the least amount of necessary
privileges. Thus, I propose changing the install command to use 644
perms.

Yours,
Ariadna
2021-03-07 15:13:09 -05:00
Drew DeVault
31dfd38681 Always take the last cert, CA or not 2021-03-07 12:21:15 -05:00
Drew DeVault
925d9e321d Implement basic client certs for gmnlm 2021-03-05 08:50:57 -05:00
Drew DeVault
1ed4f09532 Initial support for client side certificates
This is only supported with gmni for now - gmnlm support will come
later. A limitation with BearSSL prevents us from doing automated
certificate generation for now, unfortunately.
2021-03-05 08:29:02 -05:00
Drew DeVault
2017d26c41 TOFU: more improvements to new cert handling logic 2021-03-04 16:22:14 -05:00
Drew DeVault
06df35d004 Remove useless variable cast 2021-03-04 13:00:07 -05:00
Drew DeVault
10aace0d20 Discard CA certs unless there's no other 2021-03-04 12:58:50 -05:00
Drew DeVault
ada6891e8f tofu: don't discard CA certs 2021-03-04 12:19:54 -05:00
Drew DeVault
57064dd01f all: rewrite with BearSSL rather than OpenSSL 2021-03-04 10:59:37 -05:00
René Wagner
863c41dba6 fix display of message on TOFU_FINGERPRINT_MISMATCH
Previously the message was never displayed to users
leaving them with a simple "Error: certificate is untrusted".

This also fixes the display of line numbers in the message.
2021-02-23 10:06:53 -05:00
René Wagner
529b1059af jump more than one entry back or forth in history
by giving an optional number to b & f commands.
The default behaviour of b & f commands has not
been changed.
2021-02-02 11:20:13 -05:00
Giuseppe Lumia
8796267c43 Fix incorrectly missing -g flag
On systems using dsymutil the check for the "-g" flag was failing not
because the compiler didn't provide it but because of `/dev/null`
being used as output file.
2021-01-18 15:29:51 -05:00
Giuseppe Lumia
4fbc632b22 Fix OpenBSD compilation errors
Those changes fix the following compilation errors on OpenBSD:

src/tofu.c:128:28: error: format specifies type 'long' but the argument has type
      'time_t' (aka 'long long') [-Werror,-Wformat]
                        "SHA-512", fingerprint, expires);

src/gmnlm.c:341:31: error: missing sentinel in function call
      [-Werror,-Wsentinel]
                execlp("sh", "sh", "-c", cmd);
                                            ^
                                            , NULL
2021-01-07 11:22:23 -05:00
René Wagner
ff8c869b5e preserve all bytes except spaces when wrapping
When wrapping the new line should not start with a space.
All other bytes must be preserved to avoid breaking unicode chars.

fix for ~sircmpwn/gmni#21
2021-01-05 11:24:38 -05:00
René Wagner
00f62ff578 fix premate line wrap
caused by mutlibyte unicode characters.
During column count unicode continuation bytes
are not counted as columns.
2021-01-05 08:11:08 -05:00
Eyal Sawady
f5d540bc5d Implement <n>| command 2020-12-02 11:50:51 -05:00
Alexey Yerin
d8f0870446 Refactor gmni to use Curl_URL
This also fixes relative redirects.

Signed-off-by: Alexey Yerin <yerinalexey98fd@gmail.com>
2020-11-22 13:02:20 -05:00
William Casarin
8a83030e5a Fix more strncpy bugs in gmnlm and tofu
>From gcc 9.3.0:

error: '__builtin_strncpy' specified bound 4097 equals destination size
[-Werror=stringop-truncation]

Signed-off-by: William Casarin <jb55@jb55.com>
2020-11-20 11:15:46 -05:00
Tommy Nguyen
8970adc23e Fix typo in error message. 2020-11-18 09:49:54 -05:00
Giuseppe Lumia
cb63b8ddf0 Fix bug on mkdirs calls
On some systems dirname uses a static string for its return value, so
we were calling mkdirs recursively on a string that was continuosly changing.

A check was also added after the `snprintf` to make sure there's no
information loss since there is no limit to the length of the string
returned by `get_data_pathfmt`.

Closes #48.
2020-11-17 10:00:53 -05:00
William Casarin
ec88f4558c gmnlm: fix a few strncpy compile errors on gcc 9.3
In file included from .../include/string.h:495,
                 from src/gmnlm.c:11:
In function ‘strncpy’,
    inlined from ‘do_prompts’ at src/gmnlm.c:627:3:
...glibc-2.31-dev/include/bits/string_fortified.h:106:10:
error: ‘__builtin_strncpy’ specified bound 1024 equals
destination size [-Werror=stringop-truncation]
return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In function ‘strncpy’,
    inlined from ‘do_prompts’ at src/gmnlm.c:612:3:
...glibc-2.31-dev/include/bits/string_fortified.h:106:10:
error: ‘__builtin_strncpy’ specified bound 1024 equals destination size
[-Werror=stringop-truncation]
return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: William Casarin <jb55@jb55.com>
2020-11-17 09:30:56 -05:00
Giuseppe Lumia
ab66dd2be9 Simplify posix_dirname logic
dirname has two main problems:
1. It could change in place the string that is passed to it.
2. It uses a static string for its return value, so one should copy it
   somewhere else as soon as possible to avoid subsequent calls to
   dirname to corrupt his data (see #48).

We avoid 1. passing a copy of `path` to dirname and 2. copying it's
return value into `dname`.
2020-11-17 09:30:56 -05:00
Giuseppe Lumia
4a6172f1bf Remove -D option from install commands
The '-D' option of `install` is not implemented on some systems that
don't use GNU install. Its uses were replaced with `mkdir -p` commands
to eventually provide the missing folders.
2020-11-06 10:05:43 -05:00
Giuseppe Lumia
1a747cb6c2 Fix install in case of missing docs compilation
Install on systems without `scdoc` was broken because `make install` was
attempting to install missing files.
2020-11-06 10:05:43 -05:00
René Wagner
61af57e302 fix typo in PERMANENT FAILURE response 2020-11-06 10:05:43 -05:00
Jon Higgs
021d8f8fdf Improve the -j usage 2020-11-02 16:37:42 -05:00
Alexandre Oliveira
4134dc1b4a Check if pkg-config is valid before checking for libs 2020-11-02 14:11:39 -05:00
Connor Kuehl
c036a43801 Initialize result if res != GEMINI_OK
My compiler barks about this unitialized variable:

CC	src/gmnlm.o
src/gmnlm.c:629:7: error: variable 'result' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
                if (res != GEMINI_OK) {
                    ^~~~~~~~~~~~~~~~
src/gmnlm.c:673:9: note: uninitialized use occurs here
        return result;
               ^~~~~~
src/gmnlm.c:629:3: note: remove the 'if' if its condition is always false
                if (res != GEMINI_OK) {
                ^~~~~~~~~~~~~~~~~~~~~~~
src/gmnlm.c:482:2: note: variable 'result' is declared here
        enum prompt_result result;
        ^
1 error generated.
make: *** [src/gmnlm.o] Error 1
2020-10-31 19:00:28 -04:00
Joe Jenne
514cb37301 Fix const comparison Werror 2020-10-29 19:18:42 -04:00
Cédric Hannotier
75087ce65f {var//pattern/replacement} is not POSIX compliant 2020-10-29 18:55:22 -04:00
Cédric Hannotier
ac86b2f9fe Separate path and read buffers & use snprintf 2020-10-29 18:00:46 -04:00
Luna Nieves
b64d3d5ac9 Add uninstall target 2020-10-29 13:27:53 -04:00
Martijn Braam
ce1a524642 Added missing filename in install 2020-10-25 13:36:04 -04:00
Eyal Sawady
8d897e4a00 Remove -fPIC
Breaks compilation under cproc and isn't necessary for static libraries.
2020-10-24 14:06:14 -04:00
Eyal Sawady
f6643cf1b5 Re-add public headers 2020-10-24 13:56:50 -04:00
Martijn Braam
122fb0a9fd Add static library for gmni 2020-10-24 13:41:07 -04:00
Drew DeVault
49c0c523c6 Fix possibly uninitialized variable 2020-10-24 11:05:17 -04:00
Eyal Sawady
afab58cb64 Fix plaintext display 2020-10-21 10:15:24 -04:00
Eyal Sawady
fc6d4a6f69 Add '|' to pipe page into an external program 2020-10-21 10:12:52 -04:00
Eyal Sawady
fa78663748 Add 'd' to download page 2020-10-21 10:12:51 -04:00
Eyal Sawady
9ddd5c16da gmnlm: separate do_requests and display_response 2020-10-21 10:12:50 -04:00
Chris Vittal
e1d4e9a07e Remove gemlm with make clean 2020-10-07 08:53:44 -04:00
Callum Brown
40308b8b0b gmnlm: Fix segfault when local file does not exist 2020-10-06 17:14:59 -04:00
Eyal Sawady
7619edcd11 Display last line when it doesn't end in a newline 2020-10-05 14:43:25 -04:00
Eyal Sawady
a5eae7ea6b gmnlm: open_bookmarks: call mkdirs 2020-10-05 14:35:05 -04:00
Callum Brown
4b7fba261a Fix untrusted certificate message 2020-10-05 14:35:02 -04:00
Kevin Sangeelee
5d3ae7b7f5 Init known_hosts prior to fopen to avoid segfault. 2020-09-29 17:51:14 -04:00