1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00
Commit Graph

3328 Commits

Author SHA1 Message Date
Kalle Olavi Niemitalo
75e9367770 AUTHORS: Kamil Dudka has made two changes 2012-10-28 14:50:58 +02:00
Kamil Dudka
da18694ff7 http_negotiate: do not delegate GSSAPI credentials
CVE-2012-4545.  Reported by Marko Myllynen.
2012-10-28 14:50:58 +02:00
Kalle Olavi Niemitalo
89056e21fc NEWS: Mention GCC warnings and Guile, and rearrange 2012-10-28 14:42:30 +02:00
Kalle Olavi Niemitalo
c7602eb744 Unicode/gen-case: Upgrade ISC licence to July 2007 version
I had already done this to my other scripts on 2008-09-28 (commit
c67885d880) but missed Unicode/gen-case.
Update it, and list it in COPYING.

(Although Unicode/gen-case is part of the source tree, this version of
ELinks does not use that file for anything.)
2012-10-28 14:38:51 +02:00
Petr Baudis
15f422e91d Remove variables that were set but not used
Required to make new gcc with default warning settings happy.
(cherry picked from commit 9a001f051a)
2012-10-26 19:15:49 +03:00
Petr Baudis
bc254b6079 menu_keys(): Do not compare different enums
(cherry picked from commit b9fb1d3c7d)
2012-10-26 18:34:52 +03:00
Miciah Dashiel Butler Masters
8fafdcffba Drop unused local variable scriptlen and strlen call in execute_cgi
(cherry picked from commit e174b9b023)
2012-10-26 18:34:52 +03:00
Laurent MONIN
0f3d0d413d Drop unused variable @options from html_focusable().
(cherry picked from commit b1eaca1f1e)
2012-10-26 18:28:52 +03:00
witekfl
3b8e36dd10 Deleted remainders of SEE.
(cherry picked from commit fe83703714)
2011-05-15 14:28:17 +03:00
witekfl
a4d2cf5867 Deleted ecmascript code using SEE.
AFAIK SEE is no longer developped.
I see no reason to use SEE in ELinks.
(cherry picked from commit 81c9f462c2)
2011-05-15 14:26:33 +03:00
Kalle Olavi Niemitalo
408fdd9e79 HTML bug 1114: Don't doubly decode entities in attributes
The HTML parser decoded SGML entity references and numeric character
references in the following attributes, and then the renderer did the
same again:

link/@title
link/@hreflang
link/@type
link/@media
img/@alt
area/@alt
input[@type="image"]/@alt
input[@type="image"]/@name
input[@type="button"]/@value

The result was that e.g. title="A" displayed as "A"
even though it was supposed to display as "A".

Fix by making the HTML parser tell the renderer that the entities have
already been decoded.
(cherry picked from commit 715571a5d6)
2011-05-15 14:17:51 +03:00
Kalle Olavi Niemitalo
2853e53646 Compile xprop_to_string only #ifdef HAVE_X11
If ELinks was configured --without-x, the build failed at
xprop_to_string:

.../src/osdep/osdep.c:500: error: expected ‘)’ before ‘*’ token

Fix by moving xprop_to_string into the #ifdef HAVE_X11 section.
Reported by Thomas Adam.
(cherry picked from commit e3cb8d6a77)
2011-05-15 14:04:03 +03:00
Kalle Olavi Niemitalo
bd777335e0 Save X11 window title regardless of unconvertible characters
If Xutf8TextPropertyToTextList or XmbTextPropertyToTextList returns a
positive number, that means some characters were unconvertible and
have been replaced with XDefaultString().  Use the resulting string
even in that case, as if the function had returned Success.
The previous version ignored the string and didn't even free it.
(cherry picked from commit d2cf6912b9)
2011-05-15 14:03:53 +03:00
Kalle Olavi Niemitalo
b178ee6cb6 Recode X11 window title when saving and restoring
gnome-terminal 2.30.2 expects UTF-8 in the "OSC Ps ; Pt BEL" sequence
that sets the window title.  However, XGetWMName typically returns the
title in "STRING" (Latin-1) or "COMPOUND_TEXT" (escape sequences)
encoding.  Recode the title to restore it correctly.  This helps
especially in the fi_FI.UTF-8 locale, where gnome-terminal has "Pääte"
as the default title.

Related to bugs 885 and 336.
(cherry picked from commit d1245c73a8)
2011-05-15 14:02:55 +03:00
Kalle Olavi Niemitalo
534bb38c8a mailcap bug 1113: Don't leak values of duplicate fields
If a mailcap entry has two test commands or two descriptions,
free the first one before replacing it with the second one.
2011-05-01 22:14:55 +03:00
Kalle Olavi Niemitalo
450f227ea1 I18N bug 1112: Use strange_chars[] for UTF-8 output too
Make u2cp_() map code points U+0080 to U+009F via strange_chars[] even
if the target codepage is UTF-8.  This helps with buggy web pages that
use ’ when they mean ’.  This change does not affect how
ELinks decodes raw bytes 0x80 to 0x9F in HTML.

u2cp_() is used only via the u2cp and u2cp_no_nbsp macros.
Possible side effects of this change at each use of these macros:

* get_translation_table(): Not affected because it does not call u2cp
  if the target codepage is UTF-8.
* get_entity_string(): Numeric character references are affected, as intended.
  Character entity references are not affected because entities[]
  does not define any entities in the U+0080...U+009F range.
* kbd_field(), term_send_ucs(), field_op(): Affected.  It is no longer
  possible to enter code points U+0080...U+009F from the terminal.
  This should not be a problem in practice because those would be
  control characters anyway and should therefore be filtered by the
  slave process (which doesn't yet recognize them; bug 777).
2011-05-01 22:14:55 +03:00
Kalle Olavi Niemitalo
17712f9cf3 NEWS: Debian bug 380347 is CVE-2008-7224 2009-10-06 08:14:34 +03:00
Kalle Olavi Niemitalo
cc5012db6b elinks.1: Link to GPL 2.0, not GPL 3.0. 2009-08-30 22:05:45 +03:00
Kalle Olavi Niemitalo
04388f4b48 elinks.conf.5: Refer to manual for MIME options 2009-08-22 17:35:37 +03:00
Kalle Olavi Niemitalo
17df9475ae NEWS: Sync from 0.11.7 2009-08-22 15:01:44 +03:00
Kalle Olavi Niemitalo
8ac10e00d4 bug 764: Convert sentinel to struct option
unregister_options() requires as a sentinel an instance of struct
option where option.name is NULL.  However, the NULL_OPTION_INFO macro
used for these sentinels actually initializes a struct option_init
instead.  Make register_options() overwrite the NULL_OPTION_INFO with
a sentinel in the correct format.  This probably makes a difference
only on platforms where null pointers don't have all bits zero.
2009-08-22 00:23:16 +03:00
Kalle Olavi Niemitalo
0797f04921 bug 764, LUA: option_types[OPT_INT].set needs long *
l_set_option() was passing the address of an int to
option_types[OPT_INT].set and option_types[OPT_BOOL].set.
That looks correct but is not: both function pointers
point to num_set(), which actually reads *(long *) str.
Change l_set_option() to pass the address of a long instead,
and add comments about this dependency.
(cherry picked from commit 8766e3829f)
2009-08-20 22:50:37 +03:00
Kalle Olavi Niemitalo
064ff3921d bug 1084: Allow '+' and '*' in names in option manager
ELinks already allowed '+' and '*' in the names of options when
reading a configuration file.  The option manager however didn't
let the user add such options.  Allow the characters there too.

These characters are needed especially in the mime.type tree,
where '*' is used as a replacement for '.'.  For example:

set mime.type.audio.prs*sid = "sid"
set mime.type.application.atom+xml = "atom"

This commit changes one gettextised string.
2009-08-20 10:27:22 +03:00
Miciah Dashiel Butler Masters
67ffde03ba Bug 983: Give precedence to HTTP Content-Type header over HTML meta tag
The Content-Type from the HTTP response header has
precedence over the Content-Type from a meta http-equiv tag.
http://www.w3.org/International/tutorials/tutorial-char-enc/en/all.html

This fixes bug 983.
(cherry picked from commit 6cf099a087)

Conflicts:

	NEWS
2009-08-20 09:57:50 +03:00
Kalle Olavi Niemitalo
9079106894 bug 1083: Distinguish EOF from errors in read_encoded
The 2009-08-15 fix for bug 1083 made read_encoded() return -1 of EOF,
like decompress_data() expects.  Unfortunately, read_file() too calls
read_encoded(), and it treated the -1 as an error and reporter
whatever error had been left in errno.  This made it impossible to
display local files, compressed or not.

Apparently then, read_encoded() needs to distinguish between decoded
bytes, EOF, EAGAIN, and true errors.  Make it return an enum.
2009-08-19 01:31:40 +03:00
Kalle Olavi Niemitalo
972afa1c26 config/options: More Doxygen markup
No changes in program logic or data layout.
2009-08-18 05:02:16 +03:00
Kalle Olavi Niemitalo
e5f6592ee2 bug 764: Initialize the right member of union option_value
INIT_OPTION used to initialize union option_value at compile time by
casting the default value to LIST_OF(struct option) *, which is the
type of the first member.  On sparc64 and other big-endian systems
where sizeof(int) < sizeof(struct list_head *), this tended to leave
option->value.number as zero, thus messing up OPT_INT and OPT_BOOL
at least.  OPT_LONG however tended to work right.

This would be easy to fix with C99 designated initializers,
but doc/hacking.txt says ELinks must be kept C89 compatible.
Another solution would be to make register_options() read the
value from option->value.tree (the first member), cast it back
to the right type, and write it to the appropriate member;
but that would still require somewhat dubious conversions
between integers, data pointers, and function pointers.

So here's a rather more invasive solution.  Add struct option_init,
which is somewhat similar to struct option but has non-overlapping
members for different types of values, to ensure nothing is lost
in compile-time conversions.  Move unsigned char *path from struct
option_info to struct option_init, and replace struct option_info
with a union that contains struct option_init and struct option.
Now, this union can be initialized with no portability problems,
and register_options() then moves the values from struct option_init
to their final places in struct option.

In my x86 ELinks build with plenty of options configured in, this
change bloated the text section by 340 bytes but compressed the data
section by 2784 bytes, presumably because union option_info is a
pointer smaller than struct option_info was.
2009-08-18 05:02:16 +03:00
Kalle Olavi Niemitalo
70ef4c8fdd chmod +x po/gen_translations_stats.sh
po/README suggests running the po/gen_translations_stats.sh script,
and it has a #! line, so it should be executable.
2009-08-16 00:37:11 +03:00
Kalle Olavi Niemitalo
cd2eeef5f7 bug 1083: Fix infinite loop in decompress_data
decompress_data() supposed that read_encoded() would return a positive
number if it decompressed something, 0 if no data is available yet but
may be later, or -1 if no more data will be available.  However,
several backends actually returned 0 if they had seen an EOF marker or
an error in the stream, causing decompress_data() to keep calling
them.  Make them return -1 in this situation.
2009-08-15 13:48:59 +03:00
Kalle Olavi Niemitalo
4369b052ef configure: Avoid two errors if TERM=unknown
http://buildd.debian-ports.org/fetch.php?pkg=elinks&arch=hurd-i386&ver=0.12%7Epre5-1&stamp=1247378205&file=log&as=raw
shows two unsightly errors, apparently triggered by TERM=unknown:

tput: unknown terminal "unknown"
/build/buildd/elinks-0.12~pre5/configure: line 25480: test: -ge: unary operator expected

Hide the first of them by redirecting to /dev/null,
and avoid the second one by substituting "0" if tput fails.

I'm not sure why `which tput` is used instead of plain tput,
but it doesn't seem to be causing any problems in practice.
(There are problems in theory if tput is not installed,
tput is found in a directory whose name contains spaces,
or tput is a shell function or builtin.)
2009-08-15 01:59:09 +03:00
Kalle Olavi Niemitalo
c9f487cdf4 Fix "parameter has incomplete type" on GCC 3.4.6
Fix this GCC 3.4.6 warning, which becomes an error
if configure --enable-debug adds -Werror to CFLAGS:

      [CC]   src/document/css/apply.o
In file included from /home/Kalle/src/elinks-0.12/src/document/html/internal.h:6,
                 from /home/Kalle/src/elinks-0.12/src/document/css/apply.c:35:
/home/Kalle/src/elinks-0.12/src/document/html/parser.h:149: warning: parameter has incomplete type
In file included from /home/Kalle/src/elinks-0.12/src/document/css/apply.c:35:
/home/Kalle/src/elinks-0.12/src/document/html/internal.h:125: warning: parameter has incomplete type

Even without this warning, "enum html_special_type;"
would not be standard C89.
2009-08-09 17:50:06 +03:00
Kalle Olavi Niemitalo
4a368ceb32 Share location_goto between SpiderMonkey and SEE
location_goto() was defined identically in
src/ecmascript/spidermonkey/location.c and
src/ecmascript/see/location.c, and declared in four other files.
Merge both definitions to the new src/ecmascript/location-goto.c
and all declarations to src/ecmascript/ecmascript.h.
2009-08-03 16:59:47 +03:00
Kalle Olavi Niemitalo
5d4beadc4b Don't retry get_window_title
Call get_window_title() at most once per terminal, even if it fails.
If ELinks is configured with X11 support, get_window_title() calls
XOpenDisplay(), which can sleep if $DISPLAY does not respond.
This delay was previously incurred every time ELinks changed the
title.  Besides, if ELinks had already changed the title, setting
ditrm->orig_title = get_window_title(); did not make sense anyway.
2009-07-25 16:04:17 +03:00
Kalle Olavi Niemitalo
51dc3beee7 Bug 943: Refuse user JS actions in unfocused tabs 2009-07-24 18:36:54 +03:00
Kalle Olavi Niemitalo
db128fecd9 download: Add DOWNLOAD_EXTERNAL flag
Like in ELinks 0.13.GIT commit b3cfede1c1
made on 2007-11-07, only with more comments and a bit different names.
2009-07-24 18:09:59 +03:00
Kalle Olavi Niemitalo
a2c8dc8c61 download: Rename download_resume to download_flags
Bring the code closer to ELinks 0.13.GIT commit
71ccbe0f8d made on 2007-11-07.
Don't define a separate download_flags_T typedef though,
because Doxygen generates nicer links if the enum is used directly.
2009-07-24 17:10:35 +03:00
Kalle Olavi Niemitalo
ab72415130 download: Make BitTorrent's tp_show_header static
There are two identical tp_show_header() functions: one in
src/session/download.c and one in src/protocol/bittorrent/dialogs.c.
Neither is declared in any header, but the latter was not static.
2009-07-23 22:57:41 +03:00
Kalle Olavi Niemitalo
1cca904ce6 download: Document the rest of struct type_query 2009-07-23 22:57:11 +03:00
Kalle Olavi Niemitalo
ce89947fcf download: Use add_dlg_checkbox 2009-07-23 21:25:48 +03:00
Kalle Olavi Niemitalo
53c19e5b66 Bug 770: Comment updates
Since commit b7d03f9b04 on 2009-07-19,
lun_resume() no longer assumes that data points to struct cdf_hop.
2009-07-21 03:28:29 +03:00
Kalle Olavi Niemitalo
4067e54727 lookup_unique_name: Handle NULL from msg_box
If msg_box() runs out of memory, it returns NULL.  In this case,
the done_handler_T callbacks of the buttons will not be called.  So
lookup_unique_name() must instead free the struct lun_hop on its own.
2009-07-21 02:07:10 +03:00
Kalle Olavi Niemitalo
b80c0e8a0d lookup_unique_name: Remove always true condition
Remove the stracpy(ofile) call that could never be executed.
This removes the need to handle errors from that call,
and makes it clear that lun_hop->file need not be separately freed
if an error occurs in lookup_unique_name().
2009-07-21 01:09:37 +03:00
Kalle Olavi Niemitalo
71dfd47dcb lookup_unique_name: Merge error handling 2009-07-21 00:57:17 +03:00
Kalle Olavi Niemitalo
f815d27835 lookup_unique_name: Handle NULL from expand_tilde
expand_tilde() returns NULL if out of memory.
Make lookup_unique_name() handle that.
2009-07-21 00:50:54 +03:00
Kalle Olavi Niemitalo
e6344340dd Doxyfile: Expand OBJECT_HEAD as defined
To stop Doxygen from parsing its uses as member functions.
2009-07-19 21:15:40 +03:00
Kalle Olavi Niemitalo
23fd2d58f4 Make struct action const
With GCC 4.3.1 on i686, this changes the sizes of sections as follows:

section            before       after   change
.text              682428      682492      +64
.rodata            212668      216352    +3684
.data               58092       54444    -3648
.debug_info       1482388     1482472      +84
.debug_abbrev      153714      153723       +9
.debug_line        272299      272319      +20
.debug_loc         540394      540372      -22
.debug_ranges      113784      113792       +8
Total             3917695     3917894     +199

The surprising .text change comes from src/config/dialogs.o.
Some of that is in get_keybinding_text(), where GCC changes the
order of basic blocks and apparently misses some optimizations.
2009-07-19 21:15:39 +03:00
Kalle Olavi Niemitalo
89c7e57890 Bug 770: Don't close fd when resuming download
I added this bug last night.  continue_download_do() passed the
file descriptor to transform_codw_to_cmdw(), which saved it, but
continue_download_do() then closed it.
2009-07-19 13:44:01 +03:00
Kalle Olavi Niemitalo
075171c2c8 Bug 770: Shorten lifetime of session.download_uri
In common_download(), move session.download_uri to the new member
cmdw_hop.download_uri, which common_download_do() then reads.  This
shields the download request against possible session.download_uri
changes made for other downloads.  And transform_codw_to_cmdw() no
longer needs to touch session.download_uri at all, solving a FIXME.
2009-07-19 04:06:32 +03:00
Kalle Olavi Niemitalo
b7d03f9b04 Bug 770: Move codw->cmdw transform to outer layer
Commit ff136e5116 on 2006-07-16 made
lun_resume() check if cdf_hop->data points to struct codw_hop,
and transform that to struct cmdw_hop if so.  Move the transform
into a separate function called from continue_download_do().
This way, the structures used with create_download_file() no longer
need to begin with int magic.
2009-07-19 04:06:32 +03:00
Kalle Olavi Niemitalo
2f04a38c6f Bug 770: Fix URI leak in lun_resume
To reproduce:
- Configure with --enable-debug.
- Go to http://elinks.cz/
- Set the cursor on the "About" link and press d to download,
- ELinks asks where to save the file.  Cancel that with Esc.
  This leaves session.download_uri != NULL.
- Go to /etc/passwd
- ELinks asks what to do with the file.  Choose to download.
- ELinks asks where to save the file.  Type the name of a new file
  and press Enter.
- Again go to /etc/passwd
- ELinks asks what to do with the file.  Choose to download.
- ELinks asks where to save the file.  Type the same name as before
  and press Enter.
- ELinks asks whether to resume or overwrite.  Choose to resume.
  This changes session.download_uri and leaks the original URI.
- Quit ELinks.  It reports memory leaks:

0x88936d8:28 @ alloc'd at /home/Kalle/src/elinks-0.12/src/util/hash.c:89
0x88dac00:95 @ alloc'd at /home/Kalle/src/elinks-0.12/src/protocol/uri.c:1551
0x88c33a8:4104 @ alloc'd at /home/Kalle/src/elinks-0.12/src/util/hash.c:41

This commit fixes the leak, but it's still a bug that lun_resume() can
replace the session.download_uri that will be used by another pending
download.  In particular, this might happen if the user first presses
d to download, and then while ELinks is asking for the file name, a
web script changes window.location to a different URI and that causes
ELinks to ask what to do with the file.  So I'm leaving the FIXME
comment in for now.
2009-07-19 04:06:32 +03:00