98 Commits

Author SHA1 Message Date
Lukas Fleischer
80cd8af956 calcurse-caldav: use isinstance() instead of comparing types
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2023-11-06 15:45:08 -05:00
Max
d4eb9f85d0 Remove new line character from result of password command
For example, using `pass caldav` as `PasswordCommand` returns the
password for the account including a newline character at the end
because the whole output is captured. This fix removes the new line
character at the end of the line while keeping other whitespace
character should the password contain any at the end.

Signed-off-by: Max <max@mxzero.net>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2023-11-06 15:42:59 -05:00
Ryan Lue
e772c4b6d5 calcurse-caldav: Support PasswordCommand option
This commit adds a new `Auth/PasswordCommand` option
to support security best practices re: handling secrets
in CLI program configuration.

Prior to this commit, the two available options
for specifying a password were:

  1. via the `Auth/Password` config parameter, or
  2. via a `$CALCURSE_CALDAV_PASSWORD` environment variable.

The former is unsafe for obvious reasons;
the latter is unsafe because as long as the script is running,
its environment can be accessed via

    $ cat /proc/<pid>/environ

and is thus visible to anyone with access to the system.

This commit preserves preexisting behavior (for backward compatibility)
but removes all mention of option 2 from the README.
Since the README example for option 2 used a password command anyway,
there is little reason to continue its use,
and this commit recommends it be deprecated.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2023-04-11 15:22:03 -04:00
Lukas Fleischer
0ccd68bec6 calcurse-caldav: fix InsecureSSL
Pass disable_ssl_certificate_validation as keyword argument to
httplib2.Http().

Fixes a regression introduced in 1e1d615 (Refactor calcurse-caldav to
use httplib2, 2017-09-06).

Fixes GitHub issue #420.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2022-04-16 17:49:19 -04:00
Joseph Turner
459a018e90 Fix typo in caldav post-sync hook git commit message
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2021-10-16 11:54:45 -04:00
Max Deineko
cb6b3340f8 calcurse-caldav: always request href from server
Apparently, while some CalDAV servers return href values as is in their
response, some might return them URL-quoted (which, if I am not
mistaken, was the reason for e943b06).

Assuming either behaviour when pushing local objects will lead to
discrepancy with events dictionary retrieved from the server and thus
bugs, hence we always want to use whatever form of href the server
returns.

Addresses GitHub issues #337 and #356.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2021-04-04 18:35:03 -04:00
Lukas Fleischer
f41955e491 calcurse-caldav: document Hostname and Path better
Add some clarification on the expected format for the Hostname and Path
options in the sample configuration file.

Addresses GitHub issues #95, #138, and #354.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2021-04-03 18:12:31 -04:00
Lukas Fleischer
f1e84bd18b Fix flake8 and isort warnings
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2021-04-03 17:55:46 -04:00
Lukas Fleischer
594bd62378 calcurse-caldav: improve config file error handling
The previous implementation allowed sections and keys other than those
used by the script which led to a variety of bug reports due to typos in
the configuration. Disallow entries other than those explicitly used and
make both section and key names case-sensitive (previously, only section
names where case-sensitive).

Check that Hostname and Path are set before using them.

Addresses GitHub issues #327 and #350.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2021-04-03 17:55:08 -04:00
Henrik Grimler
e44613411a calcurse-caldav: allow non-ascii characters in username and password
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2020-12-19 13:50:46 -05:00
Lars Henriksen
fb0ebe0b8a Icalendar templates for recurrence rules
To provide a starting point for advanced repeating items.

Signed-off-by: Lars Henriksen <LarsHenriksen@get2net.dk>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2020-06-13 10:56:15 -04:00
Nitroretro
8fffc9dc8e calcurse-caldav: Ensure config and data dirs exist
Fixes #283.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2020-05-01 22:35:48 -04:00
Nitroretro
9fb532abe4 calcurse-caldav: Make check_dir create directories
This patch makes check_dir(dir) create directories if they don't exist,
and it will fail if the path at dir is not a directory. It acts in a
similar fashion to io_check_dir from io.c.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2020-05-01 22:32:23 -04:00
Nitroretro
ada0d98bde caldav: Fix XDG_CONFIG_HOME not defaulting to ~/.config
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2020-02-04 22:46:19 +01:00
Nitroretro
992cf45dc9 Use $XDG_{CONFIG,DATA}_HOME in hooks
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-12-23 13:16:39 -05:00
Nitroretro
c7faa1f61f calcurse-vdirsyncer: use $XDG_DATA_HOME
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-12-23 13:16:39 -05:00
Nitroretro
d85691ebee calcurse-caldav: use $XDG_{CONFIG,DATA}_HOME
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-12-23 13:16:39 -05:00
Nitroretro
19d2d9229e Change documentation to reflect the new file structure
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-12-23 13:16:39 -05:00
Lukas Fleischer
41143c5a83 calcurse-caldav: Document configuration for Yahoo
Suggested-by: Tony Barganski <tonybarganski@outlook.com>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-11-09 12:49:32 -05:00
Si Yong Kim
b293b1829d calcurse-caldav: handle objects with status code 404
Display a warning if any of the events reported by the server cannot be
found instead of bailing out.

Addresses GitHub issue #137 and #245.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-11-03 10:56:47 -05:00
k0ral
b0ba01d2a7 Document the HTTPS option in the sample configuration file
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-09-06 18:15:36 -04:00
Randy Ramos
f374737171 Add Troubleshooting section to calcurse-caldav README.md
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-06-12 19:27:26 -04:00
Lukas Fleischer
31b02513aa calcurse-caldav: replace readfp() by read_file()
Addresses GitHub issue #209.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-05-26 10:04:28 -04:00
Randy Ramos
62fe506e52 calcurse-caldav: update OAuth2 documentation for extracting auth code
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-05-26 10:04:28 -04:00
vxid
d26164fb72 Add support for vdir synchronization
Add a script to synchronize calcurse with a VDIR collection.

Add a wrapper script around vdirsyncer to automatically synchronize
calcurse data to a vdirsyncer collection.

Add script documentation and Makefile.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-03-14 21:21:46 +01:00
vxid
ccdd3391f3 calcurse-caldav: add custom data directory support
Added the --datadir flag to calcurse-caldav which enables to specify a
custom calcurse data directory similarly to the -D flag in calcurse.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-03-12 09:08:22 +01:00
Lukas Fleischer
1f74ad3357 calcurse-caldav: fix -x argument
The optional argument to -x must be given as "-xical" (without a space).

Partly addresses GitHub issue #177.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-02-10 21:33:35 +01:00
Lukas Fleischer
4eda8f6937 calcurse-caldav: drop misplaced filter argument
We cannot use the filter options when importing events.

This was noticed because the new calcurse argument parser catches
invalid input flag combinations and bails out.

Partly addresses GitHub issue #177.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2019-02-02 18:13:49 +01:00
Bram
6f22e99ad5 calcurse-caldav: fix authentication in debug mode
Objects are reference in python, ".pop" was modifying the original
dictionary and thus breaking authentication by removing auth headers.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2018-12-05 17:36:00 +01:00
Lukas Fleischer
37d8725e78 contrib/caldav/Makefile.am: add config.sample
Fixes GitHub issue #144.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2018-10-21 20:01:34 +02:00
Lukas Fleischer
c4960aaf93 calcurse-caldav: fix auth method check
Fixes a regression introduced in 6a6c711 (calcurse-caldav: fix basic
authentication, 2018-07-20).

Addresses GitHub issue #149.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2018-09-27 07:33:47 +02:00
Lukas Fleischer
8466717f06 calcurse-caldav: print executed commands in debug mode
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2018-08-25 08:54:03 +02:00
Lukas Fleischer
dd4d444c0c calcurse-caldav: print HTTP status codes in debug mode
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2018-08-21 05:51:35 +02:00
Dino Macri
6a6c7117de calcurse-caldav: fix basic authentication
Read whether basic authentication is used and add the credentials to
httplib2 when making a request.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2018-07-22 11:00:12 +02:00
Dino Macri
61dc7ab538 calcurse-caldav: add HTTP support
Introduce support for HTTP connections. Use "HTTPS" in the config file
to enable/disable (default is enabled). The option modifies the prefix
of the host name to "http://" when disabled, rather than always using
"https://" with no option to change.

httplib2 automatically handles URLs beginning with either http or https.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2018-07-22 10:58:33 +02:00
Lukas Fleischer
fda8c1a7e2 calcurse-caldav: remove authorization data from logs
The Authorization header contains the Base64-encoded user name and
password. Remove this information from debug logs, unless the user
explicitly requests to keep them by using the --debug-raw flag.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2018-05-23 17:59:50 +02:00
Lukas Fleischer
edc44d613b calcurse-caldav: Avoid corrupting the sync DB
When importing an iCal event via calcurse fails (i.e. does not return a
single object hash), do not write anything to the synchronization
database instead of blindly appending the entry, thereby potentially
corrupting the database.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2017-11-23 08:57:45 +01:00
Raf Czlonka
1f411c4d64 contrib/caldav/README.md: Fix localhost URI
Signed-off-by: Raf Czlonka <rczlonka@gmail.com>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2017-11-11 09:31:31 +01:00
Randy Ramos
fb26c8fdd0 calcurse-caldav: Document external password option
Add information about the CALCURSE_CALDAV_PASSWORD environment variable.

Signed-off-by: Randy Ramos <rramos1295@gmail.com>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2017-11-10 16:01:07 +01:00
Randy Ramos
9be2c106e6 calcurse-caldav: Read password from env variable
Add the option to read the basic authentication password from the
CALCURSE_CALDAV_PASSWORD environment variable.

Signed-off-by: Randy Ramos <rramos1295@gmail.com>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2017-11-10 16:00:49 +01:00
Lukas Fleischer
5b94be2246 Revert "calcurse-caldav: Add --password command line argument"
This reverts commit efd76a0d995292e48f5466fccada4901618f7d97.

Passing passwords as command line arguments is not a good idea, since
they may appear in process listings which are potentially visible to
other users logged into the system.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2017-11-08 21:54:53 +01:00
Satvik Sharma
b96e175192 calcurse-caldav: Add SyncFilter config option
The SyncFilter option filters the types of items synced from/to a CalDAV
server by making use of the --filter-type command line argument.

Signed-off-by: Satvik Sharma <satvik.sharma2@gmail.com>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2017-11-05 20:14:30 +01:00
Stefan Hagen
2fa1511898 calcurse-caldav: Use /usr/bin/env in the shebang
It is best practice to use `/usr/bin/env python3` instead of a hard
coded path. This will search for "python3" in the PATH environment
variable.

Most Linux distributions install python to "/usr/bin". Most BSDs to
"/usr/local/bin".

Signed-off-by: Stefan Hagen <github@textmail.me>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2017-11-05 19:16:07 +01:00
Randy Ramos
efd76a0d99 calcurse-caldav: Add --password command line argument
The "--password" argument overrides the corresponding option in the
config file.

Signed-off-by: Randy Ramos <rramos1295@gmail.com>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2017-10-19 06:26:31 +02:00
Lukas Fleischer
8ee78c14af Add calcurse-dateutil
Add a script to iterate over a certain date range, performing operations
on each of the dates and printing the result. An additional string can
be appended to each of the printed lines.

The script can be used to create "extended recurrent events". For
example

    ./calcurse-dateutil.py --date 2017-01-01 --range 365 --unique \
        --append ' [1] Test event' bom next-weekday 3 skip-days 14

can be used to print an event for each third Thursday of each month in
2017.

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2017-09-08 22:35:36 +02:00
Randy Ramos
d3cc496e02 Update calcurse-caldav documentation for OAuth2
Append instructions and information on synchronization with OAuth2-based
services, specifically Google Calendar.

Signed-off-by: Randy Ramos <rramos1295@gmail.com>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2017-09-08 22:35:36 +02:00
Randy Ramos
0aa717c83d Rename README to README.md
This ensures that the Markdown syntax is properly displayed by Github
and other Markdown readers. Also added quotes to a couple of paths and a
flag.

Signed-off-by: Randy Ramos <rramos1295@gmail.com>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2017-09-08 22:35:36 +02:00
Randy Ramos
479e39fbb7 Add OAuth2 support for calcurse-caldav
OAuth2 authentication is completely optional. It is controlled by the
AuthMethod option in the config file. Other required options were
appended to config.sample.

Signed-off-by: Randy Ramos <rramos1295@gmail.com>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2017-09-08 22:35:36 +02:00
Randy Ramos
1e1d61585d Refactor calcurse-caldav to use httplib2
This will allow much more flexibility and less code duplication when
adding OAuth2 support. OAuth2 support will require this library as it is
a dependency of oauth2client. The documentation was updated to reflect
the new dependency.

Signed-off-by: Randy Ramos <rramos1295@gmail.com>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2017-09-08 22:35:36 +02:00
Randy Ramos
2d1e6e394d Change remote_wipe to delete objects individually
Certain CalDAV servers prohibit a single DELETE request to be sent to
the calendar collection root. Instead items need to be deleted one by
one.

Signed-off-by: Randy Ramos <rramos1295@gmail.com>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
2017-09-08 22:35:36 +02:00