3958 Commits

Author SHA1 Message Date
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
Andrew Ruthven
974d7d3924 Check that all UI pages load without PHP warnings or deprecation messages 2024-02-29 00:43:49 +13:00
Andrew Ruthven
a102105f27 Hide many sections unless the user can modify the principal
There is potential to leak information when viewing the principal
page for another principal. I think it makes more sense to just
not include all of this information unles the user can change the
principal.
2024-02-29 00:43:49 +13:00
Andrew Ruthven
5347680642 Hide change password fields if the user can't change the principal
There is no need to show these fields as they do nothing.
2024-02-29 00:43:49 +13:00
Andrew Ruthven
15e9231ae3 Unescape URLs passed in as external bindings.
Previously PHP was escaping things like ampersands, which then caused
us to have broken URLs.

These aren't displayed anywhere in the UI, so no need to encode them anywhere.

Closes #314.
2024-02-29 00:43:49 +13:00
Andrew Ruthven
59e4f2c929 If a test fails, bail out, the state will be indeterminate 2024-02-29 00:43:49 +13:00
Andrew Ruthven
8c378387c8 For consistency allow BEGIN for the SQL commands 2024-02-29 00:43:49 +13:00
Andrew Ruthven
57ae239a75 Support using this script to test AWL as well 2024-02-29 00:43:49 +13:00
Andrew Ruthven
c2a054d28e Add initial tests for the web UI
Use Test::WWW::Mechanize to test the UI.

Closes #310
2024-02-29 00:43:47 +13:00
Stonewall Jackson
3a08e80d5a Fix scope=onelevel in LDAP driver
When `scope` is set to 'onelevel', the LDAP driver actually does a full
subtree search instead.

Should be `ldap_list` instead. Fixed.
2024-02-27 13:32:15 -05:00
Andrew Ruthven
5bd6d70383 Support using this script to test AWL as well 2024-02-25 23:04:17 +13:00
Andrew Ruthven
d7d7dd2ade Move the CI prep from repeated lines in the YML to a shell script
Oh, this is much easier to work with.

We can now detect the version of PostgreSQL installed and shouldn't
need to update CI just because PostgreSQL has been updated in Debian
Unstable.
2024-02-18 22:30:52 +13:00
Andrew Ruthven
4ae36c132d Have a sensible default setting for the UserAgent 2024-02-18 01:51:56 +13:00
Andrew Ruthven
28d9105810 Update database result results in tests. 2024-02-18 01:51:56 +13:00
Andrew Ruthven
e989e1cf97 Fix PROPFIND with Depth 1 if external bind is included
Previously something like this would be logged if debugging is enabled:

davical: LOG: Principal: Query: DBGQ: SELECT * FROM collection WHERE user_no= :user_no
davical: LOG: Principal: Query: DBGQ:  ":user_no" => ""
davical: BUG: :DAViCal Fatal Error: [42883] SQLSTATE[42883]: Undefined function: 7 ERROR:  operator does not exist: integer = boolean\nLINE 1: SELECT * FROM collection WHERE user_no= FALSE\n                                              ^\nHINT:  No operator matches the given name and argument types. You might need to add explicit type casts. at /home/puck/work/Calendar/awl/inc/AwlDatabase.php:94

And this would be returned as a response:

DAViCal Fatal Error

user_no doesn't get set when construction the Collection for the external
bind, so, just handle that instead of sending the empty string to the
database as a user_no.

Modify the tests from ccc7e182ba4cbfba66a4fe96e1c0620e46390b95 to tickle the
bug.

Closes #175.
2024-02-18 01:51:56 +13:00
Andrew Ruthven
d7d19b906f Set external_refresh by default
Let's just set a sane default of 60 minutes.
2024-02-18 00:04:37 +13:00
Andrew Ruthven
a065435a99 Create tests for 'external' calendars 2024-02-18 00:04:29 +13:00
Andrew Ruthven
eb4d120bbf Honour do_not_sync_from_ldap when sync'ing group members
This had been working as a side effect of the way the SQL insert
statement was working, but better to be explict about skipping them.
2024-02-17 02:25:25 +00:00
Andrew Ruthven
9494256f03 Extend LDAP sync tests, test for DNs in member fields. 2024-02-17 02:25:25 +00:00
Andrew Ruthven
8a6274e6cf Rather than look for a flag, if a member is a DN, modify/fetch the record.
This changes 48c6512a70740c403027b66e9d609e9b871d29c0, in Eric's commit it
needs a flag to go fetch the record and apply the mapping to find the
username field. This approach looks for a telltale that this is DN (naively
an "=") and then either grabs the first element from the DN if the username
attr matches or fetches the entry from LDAP.

There have also been attempts in the past to special case uniqueMember and
to add a group_member_dnfix config option.

This should handle the cases where people use uid/cn/whatever for the
username.
2024-02-17 02:25:25 +00:00
Andrew Ruthven
03d0e66b39 Handle there being no one in the group in the database 2024-02-17 02:25:25 +00:00
Andrew Ruthven
ef6bd9a7e9 fullname is a better default than group 2024-02-17 02:25:25 +00:00
Andrew Ruthven
98d9925241 Always update groups from LDAP
The logic actually handled updated group details, but only new groups were
being passed in. This will cause changes to what is being used for the
fullname to flow through.
2024-02-17 02:25:25 +00:00
Andrew Ruthven
b77b2640f8 The displayname can be unset, test for that 2024-02-17 02:25:25 +00:00
Andrew Ruthven
cb287c5abf Use filterUsers from the config 2024-02-17 02:25:25 +00:00
Andrew Ruthven
b0d01264e0 Various tidyups, show some more defaults, make a bit more current. 2024-02-17 02:25:25 +00:00
Andrew Ruthven
146ab4d068 Update test results for database creation.
I've rebased onto master which has a new DB version.
2024-02-17 02:25:25 +00:00