3984 Commits

Author SHA1 Message Date
mutesplash
237fda57b0 Actually set a variable before checking isset() 2024-04-16 19:29:18 +00:00
mutesplash
34b3c7c7a6 Merge branch davical:master into mutesplash-master-patch-85583 2024-04-16 19:21:35 +00:00
Andrew Ruthven
0c2bb61891 Add missing ChangeLog and CREDITS entries 2024-04-14 23:48:16 +12:00
mutesplash
3701931c21 Fixes warning similar to to 27ff697d 2024-04-14 11:13:48 +00:00
Andrew Ruthven
2ce32a3ac7 Add info on how to use i_use_mode_kerberos 2024-04-14 23:12:40 +12:00
Andrew Ruthven
781ecff224 Update for stonewall's contribution 2024-04-14 22:42:18 +12:00
Stonewall Jackson
d3a0c89eca Retain original i_use_mode_kerberos behavior, add fallback option
Add a new value for i_use_mode_kerberos: "allow_fallback_ldap_auth",
which will fallback to username/password authentication when the
REMOTE_USER value is unset.
2024-04-10 14:25:23 -04:00
Stonewall Jackson
0ba94e91de Support fallback to LDAP password with i_use_mode_kerberos
Currently, when `i_use_mode_kerberos` is enabled in the LDAP driver,
Davical checks the `REMOTE_USER` server variable, followed by the
`REDIRECT_REMOTE_USER` variable, for a matching username. If a matching
username is not found, authentication fails immediately.

This commit modifies the LDAP driver to fallback to standard LDAP
password authentication when `i_use_mode_kerberos` is enabled and
neither of these server variables are set. This allows
non-kerberos-enabled clients to authenticate as well.

Fixes #323
2024-04-10 14:25:23 -04:00
Andrew Ruthven
786a9f5591 Remove the IMAP auth drivers
The PHP imap module is being retired. Closes #324.
2024-04-02 21:41:26 +13:00
Andrew Ruthven
e900dff28e If a URL test fails, display the Apache Request ID to aid debugging
This helps with #311.
2024-04-02 00:11:30 +13:00
Andrew Ruthven
7c47658bee Make the curl and SQL requests when we see them
This allows us to have more complex test files where an action is taken, then
we test something, then another action is taken, etc.

Changes to test files are required so that URL is defined after all the
required settings are set.

Changes to the result files are either whitespace changes due to above logic
changes, or printing out a SQL Result header before each result. I figured it
was useful.
2024-04-01 22:57:10 +13:00
Andrew Ruthven
7f2cccb94a Use isset when checking that the key exists
To resolve errors like this:

Warning:  Undefined array key "example.net" in /usr/share/davical/inc/iSchedule.php on line 207
2024-04-01 20:46:15 +13:00
Andrew Ruthven
901d82a293 Fix creation of dynamic properties
Add some properties to classes to fix errors like:

Creation of dynamic property iSchedule::$body_cannon is deprecated in /usr/share/davical/inc/iSchedule.php on line 533
Creation of dynamic property FakeSession::$user_active is deprecated in /usr/share/davical/inc/iSchedule-POST.php on line 23
2024-04-01 20:43:45 +13:00
Andrew Ruthven
452b9fa2ef regression-suite/2701-generate-date-tests.pl needs Perl modules
f
2024-04-01 20:29:20 +13:00
Andrew Ruthven
bdc65cc777 iSchedule tests now work, test in CI 2024-04-01 18:58:33 +13:00
Andrew Ruthven
d67c43790a Fix Free/Busy tests for iSchedule
We need to have some events in the time period being checked.

Note in the tests what they're trying to check.
2024-04-01 18:53:12 +13:00
Andrew Ruthven
c97a0719ff Slight wrapping change to lines in a test result, and now have ^M returned 2024-04-01 18:34:33 +13:00
Andrew Ruthven
7459a68b76 We need the sample data for tests for the test files to run 2024-04-01 18:34:33 +13:00
Andrew Ruthven
d2d36399d3 Create the Timezone if we need to
Detected now due to a change from a few years ago to use a clean database
for each set of tests.
2024-04-01 18:34:33 +13:00
Andrew Ruthven
ec9159fd69 Fix some warnings about using undefined keys, simplify dns strings
Fixes:
- PHP Warning:  Trying to access array offset on value of type null in inc/iSchedule.php on line 83
- PHP Warning:  Undefined array key "t" in inc/iSchedule.php on line 165
- PHP Warning:  Undefined array key "t" in inc/iSchedule.php on line 167
- PHP Warning:  Undefined array key "p" in inc/iSchedule.php on line 184

Concatenate the DNS entry we're going to look up once rather than everytime
we need it.
2024-04-01 18:34:33 +13:00
Andrew Ruthven
aaf89bed66 Trust the DKIM key used for ischedule tests 2024-03-30 20:10:41 +13:00
Andrew Ruthven
ba4c1eb989 Skip the "text/calendar" record, so we don't run code that expects "="
Prevents this warning:
  PHP Warning:  Undefined array key 1 in inc/iSchedule-POST.php on line 96
2024-03-30 20:08:14 +13:00
Andrew Ruthven
b26d48fced Put a trailing newline on error messages 2024-03-30 19:03:39 +13:00
Andrew Ruthven
0fc1abd976 Drop datetime check as minimum PHP version is 5.4 2024-03-11 00:41:39 +13:00
Andrew Ruthven
ee16fbf6af Update the translation PO files. 2024-03-11 00:41:39 +13:00
Andrew Ruthven
4e03cb1343 Include the request ID used in logging in the Fatal Error message. 2024-03-11 00:41:37 +13:00
Andrew Ruthven
658bd4e786 Use request ID 2024-03-11 00:41:37 +13:00
Andrew Ruthven
f69480ce77 Test that deletion of a principal's items are secure
Test that other users can't delete:
 - collections
 - tickets
 - bindings

No significant change, just return an error message rather than assume that
things worked.
2024-03-10 00:37:11 +13:00
Andrew Ruthven
7e663b3a2b iSchedule should advertise the full date range that we support. 2024-03-04 00:44:12 +13:00
Andrew Ruthven
19ec65eb3f Add entry for extending date ranges 2024-03-04 00:44:12 +13:00
Andrew Ruthven
c5b3e385b3 Allow changing directory when running a script
This also involves changing scripts to be run at the time they're mentioned,
not accruing them to run at the end.
2024-03-03 21:30:22 +13:00
Andrew Ruthven
0c9e0d6a87 Test more dates in the past and future
There is now a Perl script that'll generate tests and result files to a
wide variety of dates. From this we currently don't support < 1 AD or >
9999 AD.

run_regressions is modified to remove the UNTIL option as I want to use a
character after the test number to allow "subtests".
2024-03-03 21:30:22 +13:00
Andrew Ruthven
9c10ef5eb2 Support start or end missing from free-busy-query REPORT
Previously if either start or end were missing then the current time was
used. This would almost never be the expected behaviour.
2024-03-03 21:30:21 +13:00
Andrew Ruthven
014ee35372 Rename the ICS file to match the test name 2024-03-01 23:42:56 +13:00
Andrew Ruthven
dd1e75d23d Eh, etag changed.
It is tempting to exclude etag from test result checks.
2024-03-01 23:42:55 +13:00
Andrew Ruthven
88fee9f155 The use of quote_dt_param removes the need to append 'T000000Z'
All tests still pass.
2024-03-01 23:42:54 +13:00
Andrew Ruthven
435133adf5 We need to have dtstart_orig be what is passed in, possibly empty.
Using quote_dt_param resolves the error that Benedikt Spranger was
fixing in 3f326f2d3fcc429d7596a4ff59970217161f7930.
2024-03-01 23:42:54 +13:00
Andrew Ruthven
9421dbd7e3 Add an event in the year 500. 2024-03-01 23:42:53 +13:00
Andrew Ruthven
3defc7b266 Add test for an event in the far future 2024-03-01 23:42:50 +13:00
Andrew Ruthven
1c7954fc51 Enforce dates to be send as string (fixes #233)
Prevents AWL/PG from converting them magically.
2024-03-01 23:42:21 +13:00
Benedikt Spranger
ce67c2c839 Add events starting before 1900 test
postgresql is fussy about dates before 1900. Add a test with a recuring
event startting before 1900.

Signed-off-by: Benedikt Spranger <b.spranger@linutronix.de>
2024-03-01 23:26:26 +13:00
Benedikt Spranger
15f304ab1c Fix handling of events started before 1900
commit 15d01c8bed2d ("Store DTSTART and DTEND from user in shadow columns")
breaks handling of events started before 1900:

[19-Sep-2023 14:30:39 UTC] davical: BUG: :DAViCal Fatal Error: [42804] SQLSTATE[42804]: Datatype mismatch: 7 ERROR:  column "dtstart_orig" is of type timestamp with time zone but expression is of type integer
[19-Sep-2023 14:30:39 UTC] ================= Stack Trace ===================
[19-Sep-2023 14:30:39 UTC] davical: LOG: :Response status 500 for PUT /<user>/home/6bb3a62b-43ae-4a21-bb83-fca84d9ef050.ics
[19-Sep-2023 14:30:39 UTC] davical: LOG: :***************** Response Header ****************
[19-Sep-2023 14:30:39 UTC] davical: LOG: headers:-->Server: 1.1
[19-Sep-2023 14:30:39 UTC] davical: LOG: headers:-->DAV: 1, 2, 3, access-control, calendar-access, calendar-schedule
[19-Sep-2023 14:30:39 UTC] davical: LOG: headers:-->DAV: extended-mkcol, bind, addressbook, calendar-auto-schedule, calendar-proxy
[19-Sep-2023 14:30:39 UTC] davical: LOG: headers:-->X-DAViCal-Version: DAViCal/1.1.12; DB/1.3.5
[19-Sep-2023 14:30:39 UTC] davical: LOG: headers:-->Content-type: text/plain; charset="utf-8"
[19-Sep-2023 14:30:39 UTC] davical: LOG: :******************** Response ********************
[19-Sep-2023 14:30:39 UTC] davical: LOG: response:-->DAViCal Fatal Error

Update dtstart_orig in these cases to avoid the database failure.

Signed-off-by: Benedikt Spranger <b.spranger@linutronix.de>
2024-03-01 23:26:26 +13:00
Stonewall Jackson
fa44a257e9 allow specifying all sasl bind options in config.php 2024-02-28 16:29:56 -05:00
Stonewall Jackson
dc666e191f fix spelling in LDAP sasl example 2024-02-28 16:29:56 -05:00
Stonewall Jackson
c8424ae5d5 Update LDAP driver to support SASL binds
Add a new 'sasl' option to the LDAP driver, which invokes
ldap_sasl_bind() instead of ldap_bind().

This allows authenticating to LDAP using the GSSAPI (kerberos) or
EXTERNAL mechanisms, rather than a bindDN and password.

Note that for GSSAPI binds, PHP needs access to valid kerberos
credentials (for example, by setting the KRB5CCNAME environment variable
for the PHP process).

Tested with OpenLDAP/Heimdal kerberos, but should also work with Active
Directory.
2024-02-28 16:29:56 -05:00
Andrew Ruthven
27ff697d55 Ensure we give bindec a value
Resolves this warning in PHP 7.4.0:

Deprecated: bindec(): Passing null to parameter #1 ($binary_string) of type
string is deprecated in /usr/share/davical/inc/ui/principal-edit.php on line
412
2024-02-29 09:55:23 +13:00
Andrew Ruthven
62441f7705 Ensure we have an array, and there is a value.
Resolves this warning in PHP 8.2:

Warning:  Undefined array key 0 in /usr/share/davical/inc/iSchedule.php on
  line 218
Warning:  Trying to access array offset on null in
  /usr/share/davical/inc/iSchedule.php on line 218
2024-02-29 00:43:50 +13:00
Andrew Ruthven
cb2e4523f3 Add test for invalidating the CSRF token 2024-02-29 00:43:50 +13:00
Andrew Ruthven
0a0c0a77cc Explicitly declare all class properties
PHP 8.2.0 has deprecated dynamic creation of properties.

This kind of warning message is displayed:

Deprecated:  Creation of dynamic property DAViCalSession::$login_failed is
  deprecated in /usr/share/awl/inc/Session.php on line 153
2024-02-29 00:43:50 +13:00
Andrew Ruthven
0c28a4ffe6 Make CLI usage easier 2024-02-29 00:43:49 +13:00