Commit Graph

13616 Commits

Author SHA1 Message Date
Mike Gelfand bff188c2cf Fully cover `tr_metainfo_sanitize_path_component` 2019-06-24 06:32:38 +03:00
Mike Gelfand 99033b067d Sanitize suspicious path components instead of rejecting them
Apply the same rules on all the supported platforms to avoid issues
with network shares and alien file systems.

For future compatibility, explicitly mark adjusted paths as renamed.

Fixes: #294
2019-06-23 18:08:31 +03:00
Mike Gelfand 139f3a3f4b Add missing declaration for `tr_strcasestr` 2019-06-23 12:07:33 +03:00
Mike Gelfand f3968b7708 Load CA certs from system store on Windows / OpenSSL
Fixes: #446
2019-06-23 11:59:53 +03:00
Mike Gelfand 3538eb93c3 Update curl and openssl to those in 10.10 SDK (macOS) 2019-06-22 16:43:59 +03:00
Mike Gelfand c369f36867 Only add revision to filename for nightly builds (MSI package) 2019-06-20 04:55:30 +03:00
Mike Gelfand fc5857f0d8 Include Windows Vista Qt style, remove dbus revision suffix and expat (MSI package) 2019-06-20 04:55:30 +03:00
Mike Gelfand 1f756114a5 Support OpenSSL 1.1 x64 file names (MSI package) 2019-06-18 22:50:03 +03:00
Mike Gelfand af3d4639e2 Support OpenSSL 1.1 file names (MSI package) 2019-06-18 08:21:01 +03:00
Mike Gelfand a82c26642c Support MSVS 2017 VC CRT MSM file locations (MSI package) 2019-06-18 08:10:30 +03:00
C.W. Betts 77016edadd Xcode: Update/fix framework references. 2019-06-15 12:19:34 -06:00
C.W. Betts 2d4a53f2df Xcode: Fix development region. 2019-06-15 12:12:55 -06:00
C.W. Betts 3b1780982a Xcode: Add encoding info to strings files. 2019-06-15 09:37:14 -06:00
C.W. Betts 04c6885232 Xcode: Fix localization paths. 2019-06-15 09:23:17 -06:00
C.W. Betts 8911c9a839 Fix Xcode groups:
Make them actually point to the folders.
2019-06-15 09:15:10 -06:00
Mitch Livingston cff5a68814
Merge branch 'master' into dock_string_crash_fix 2019-04-27 21:43:10 -04:00
Mike Gelfand 3d9fd25269 Fixup invalid daemon foreground mode check (2cc996cb77) 2019-04-22 07:20:46 +03:00
Dmitry Serov 4d071deead Log attempts to open non-URL strings 2019-04-19 15:41:02 +07:00
Dmitry Serov 4331d9f0c7 Ignore non-URL strings when opening URLs 2019-04-19 02:28:45 +07:00
LaserEyess 750589101a Parse session-id header case-insensitively (#765)
RFC 2616 defines headers as case-insensitive, so if rpc is behind a
reverse proxy that lowers the case of headers, transmission will not
parse them correctly.

A new wrapper function, `tr_strcasestr` is added to
libtransmission/utils.c to allow for comparisons of headers case
insensitively, and checks in cmake and autogen are included.
2019-03-17 17:37:52 +03:00
Mike Gelfand e736604fc3 Mark a couple of MSI properties as secure
They are being discarded by server side with "ignoring disallowed
property" messages otherwise which leads to failed checks using those
properties.

Fixes: #451
2019-03-17 17:33:58 +03:00
Mike Gelfand c567588587 Remove useless parentheses 2019-03-17 09:18:27 +03:00
Mike Gelfand 5693e59256 Define each identifier in a dedicated statement
* MISRA C++:2008, 8-0-1 - An init-declarator-list or a member-declarator-list
  shall consist of a single init-declarator or member-declarator respectively
* CERT, DCL52-J. - Do not declare more than one variable per declaration
* CERT, DCL04-C. - Do not declare more than one variable per declaration
2019-03-17 09:15:35 +03:00
Mike Gelfand 97a0fed734 Remove side effects from right hand operands of && or ||
* MISRA C:2004, 12.4 - The right-hand operand of a logical && or || operator
  shall not contain side effects.
* MISRA C++:2008, 5-14-1 - The right hand operand of a logical && or ||
  operator shall not contain side effects.
* MISRA C:2012, 13.5 - The right hand operand of a logical && or || operator
  shall not contain persistent side effects
* CERT, EXP02-C. - Be aware of the short-circuit behavior of the logical AND
  and OR operators
2019-03-17 09:09:08 +03:00
Mike Gelfand 17307e7484 Extract assignments from expression
Assignments explicitly enclosed in parentheses are ignored.

* MISRA C:2004, 13.1 - Assignment operators shall not be used in expressions
  that yield a Boolean value
* MISRA C++:2008, 6-2-1 - Assignment operators shall not be used in
  sub-expressions
* MISRA C:2012, 13.4 - The result of an assignment operator should not be used
* MITRE, CWE-481 - Assigning instead of Comparing
* CERT, EXP45-C. - Do not perform assignments in selection statements
* CERT, EXP51-J. - Do not perform assignments in conditional expressions
2019-03-17 08:00:15 +03:00
Mike Gelfand d3b8982195 Uppercase the literal suffixes
* MISRA C++:2008, 2-13-4 - Literal suffixes shall be upper case
* MISRA C:2012, 7.3 - The lowercase character "l" shall not be used in a
  literal suffix
* CERT DCL16-C. - Use "L," not "l," to indicate a long value
* CERT, DCL50-J. - Use visually distinct identifiers
2019-03-17 07:07:48 +03:00
Mitch Livingston a2c42268dc
Merge pull request #859 from fishead/fix-typo
fix typo
2019-03-16 12:51:32 -04:00
Chuan Zhang 84f3ba606a
typo 2019-03-16 22:36:18 +08:00
Mike Gelfand 2cc996cb77 Refactor daemon startup a bit
Fix exit code to be zero when dumping settings along the way.

Closes: #487
2019-03-15 21:55:45 +03:00
Mike Gelfand f3951faf3d Actually add new languages to the build 2019-03-13 23:35:16 +03:00
Mike Gelfand 698bb2c418 Attempt to explain something to Coverity
I'm seeing 7 potentially false reported issues re. use of uninitialized buffer
data here. It seems that `read` function should be properly supported by
Coverity, but maybe it can't figure out the postconditions of it properly...
Walking in the dark here.
2019-03-13 05:32:35 +03:00
Mike Gelfand 10b0a280b1 Let compiler calculate static quark lenghts for us 2019-03-13 00:01:17 +03:00
Mike Gelfand 1442f8fded Fix build break from previous commit on old Clangs
Remove static assert altogether: it should have worked everywhere anyway,
otherwise there is no point.

Add a few casts here and there to ensure proper type for directory handle.
2019-03-10 19:52:27 +03:00
Mike Gelfand 36110e18c4 Fix build on E2K with LCC (patch by Michael Shigorin, ALT Linux) 2019-03-10 19:35:10 +03:00
Mike Gelfand 95dd630ed4 Add new translations from Transifex (95% and higher)
GTK client: Portuguese (Portugal).

Qt client: Afrikaans, Catalan, Danish, Greek, Norwegian Bokmål, Slovenian.

Mac client: none (there're suitable languages, but they're lacking XIB files
and we haven't switched to base localization yet).
2019-03-06 03:14:15 +03:00
Mike Gelfand 3debbc7cb8 Sync existing translations with Transifex 2019-03-06 03:12:51 +03:00
Mike Gelfand a440981571
Merge pull request #584 from userwithuid/rmintltool
cmake: replace intltool with gettext
2019-03-03 17:19:07 +03:00
Mike Gelfand 62e4e4a373
Merge pull request #850 from transmission/code-style-script
Add code style script and Dockerfile
2019-03-03 01:13:20 +03:00
Mike Gelfand 85dba8c70f Add code style script and Dockerfile 2019-02-28 03:19:24 +03:00
Mike Gelfand dab4857f90
Merge branch 'master' into rmintltool 2019-02-24 21:52:09 +03:00
Charles Kerr 3cf3d6a22a
widen the torrent-id column for cleaner formatting (#840)
Under the current code, if there are over 9,999 torrents the
format will shift over one space when bumping from 9999 to 10000.
2019-02-18 22:39:02 +00:00
Charles Kerr 309d97c578
fix: Coverity warnings (#842)
* Silence coverity CHECKED_RETURN on added.f load

The existing code behaved alright since added.f is optional.
However, by testing for success we can both silence the warning
and prevent a useless initialization of NULL/0 to added_f and
added_f_length.

* Silence coverity CHECKED_RETURN on added6.f load

ipv6 variant of previous commit.

* Silence coverity CHECKED_RETURN writing benc strs

saveStringFunc() gets the target string by calling tr_variantGetStr().
It previously didn't check to see if this function succeeded because
saveStringFunc() isn't reached without the type already being known.
However, checking the return value costs nothing and makes Coverity happy.

* Silence coverity CHECKED_RETURN on ut metadata

Like earlier few Coverity commits in this PR, we're handling optional
values by declaring stack locals set to the default (e.g. -1) and then
trying to read the variant.

Unlike the earlier commits, there is a two-part step to thise read:
checking for the metadata, then checking for the individual fields.
The earlier fixes' aproach -- e.g. initializing to -1 only if the reads
failed -- would involve new nested conditionals. I find the new complexity
to outweigh the benefit of removing the dead store, so in this case I'm
casting the return value to `(void)` to tell Coverity to shush.

* Silence coverity CHECKED_RETURN on scrape

Check the return value of tr_variantGetInt() when showing
seeder and leecher counts in transmission-show.

* Silence CHECKED_RETURN on rpc recently-active

When building a list of removed torrent IDs from variants, confirm that
we can read the IDs from the variants before adding them to the list.
I don't _think_ this would have failed before, but Coverity's right that
it's reasonable to add a safeguard here.

* fix: better fix to serializing benc strings

The approach in 33e2ece7e5 was
a little problematic: GetString() shouldn't fail here; but if
it somehow did, we still want to encode a zero-length benc string here.

* chore: make uncrustify happy
2019-02-18 22:38:24 +00:00
Mike Gelfand 3ba0b9df15 Fixup some formatting leftovers (JS) 2019-02-17 17:51:13 +03:00
qu1ck 7aa12a025d Add labels feature (#822)
* applied changes from https://github.com/Elbandi/transmission/tree/elbandi/labels to official transmission repo

* Fix compilation errors

* Address review comments

Changed `tr_ptrArray* labels` to `tr_ptrArray labels`;
Removed tr_ptrArrayNew() tr_ptrArrayDup() tr_ptrArrayFree()
Use tr_strsep() to split string by delimiters
Update transmission-remote.1
Update rpc-spec.txt

* Fix warning, address comments

* Rebase, fix formatting and address comments

Use uncrustify to format changed files
Fix "const <type>" -> "<type> const"
Fix small comments

* Lock torrent for setLabels, check for duplicates

* Check for empty labels in daemon

* Stop on first error
2019-02-17 04:33:57 -05:00
Charles Kerr 2013772aad
feat: make multiscrape limits adaptive (#837)
* feat: make multiscrape limits adaptive

Previously hardcoded by TR_MULTISCRAPE_MAX. This change makes
that the initial value, then incrementally lowers the value
when multiscrapes get "req too long" style errors.

* fix: don't log personal announce url

* chore: treat HTTP 400 as scrape-too-long

* chore: copyediting

* chore: copyediting

* move 'const' to the right of the type

* make conditional tests explicitly boolean

* make 'key' const

* don't lookup a value we already have

* make an array for known too-big scrape error messages

* improved multiscrape throttle logging

* fix: multiscraping of low numbers of torrents

Handle the case of getting a 'multiscrape too big' error message
back even if the user fewer than TR_MULTISCRAPE_MAX torrents.

* uncrustify

* fix oops

* refactor: remove TR_MULTISCRAPE_MIN

Is there any reason to have a minimum batch size?

* make test explicit boolean

Co-Authored-By: ckerr <ckerr@github.com>

* improve declaration of too_long_errors

Co-Authored-By: ckerr <ckerr@github.com>

* make test explicitly boolean

Co-Authored-By: ckerr <ckerr@github.com>

* make test explicitly boolean

Co-Authored-By: ckerr <ckerr@github.com>

* improve looping decl of too_long_errors
2019-02-16 15:19:38 -05:00
Mike Gelfand 1d6d946388 Fixup some formatting leftovers 2019-02-16 10:50:37 +03:00
Mike Gelfand 875fd654d8
Merge pull request #838 from transmission/uncrustify-update
Update to Uncrustify 0.68.1
2019-02-15 09:29:11 +03:00
Mike Gelfand 82df3a87f4 Update to Uncrustify 0.68.1
Tweak a few rules in the process. Now all code in cli, daemon, gtk,
libtransmission, qt, and utils is properly formatted with no manual
intervention.
2019-02-15 09:21:48 +03:00
Charles Kerr c019317548
Merge pull request #825 from transmission/update-resume-file-before-invoking-torrent-scripts
fix: update the resume file before running scripts
2019-02-10 12:27:00 -10:00
Mitch Livingston a89f33d7dc
Merge pull request #826 from Coeur/QuickLookPluginPath
Fix QuickLookPlugin reference path to be relative to group
2019-02-06 21:07:39 -05:00