The deflect handler prefixed `sip:` and appended the profile address to any
target not starting with `sip:`. `tel:`, `sips:` and other URIs went out as
`sip:tel:...@<ip>`. A name-addr target, as a proxied `Refer-To` or
`${sip_refer_to}` passes it, went out as `sip:<sip:...>@<ip>`, or was not sent
at all when it carried a display name, URI params or `?Replaces=`.
`sofia_deflect_build_refer_to()` now builds the `Refer-To`:
- a target that has a URI scheme or contains `<` goes out as given
- `user@host`, with or without a host port, only gains the `sip:` scheme
- a bare user or number is addressed at the profile, as before
- an empty or `NULL` target, which the `deflect` app passes when run without
data, is rejected; the handler logs it and sends no REFER
Adds `test_sofia_deflect_build_refer_to` to `test_sofia_funcs`: rejected
targets, bare users with IPv4 and IPv6 profile addresses, `user@host` forms,
URIs with a scheme, name-addr forms, the known limitations and truncation.
Store `userVariables` sent in a `login` with a `verto_uvar_` prefix,
matching the `verto_dvar_` prefix per-call `dialogParams` userVariables
already carry, so the two scopes stay separate. Variables from the
user's directory `<variables>` block keep their names.
Dialplan that reads login variables by their unprefixed names needs
updating. The new per-profile `enable-uservars-namespace` turns the
prefix off for deployments that cannot do that yet; it defaults on.
`check_auth()` and `parse_user_vars()` copy the members of
`loginParams` and `userVariables` into events and channel variables,
but validated the member name on the string-value branch only. Check
it once at the top of each loop so every value type is handled the
same way.
`http_run()` left the form-urlencoded POST body buffer allocated when
`kws_raw_read()` failed or the peer closed mid-body, up to
`HTTP_POST_MAX_BODY` per connection. Free it there, and clear
`keepalive` so the unread rest of the body is not parsed as the next
request.
The `err:` exit also freed neither `request` nor `stream.param_event`:
a header parse failure leaked the event, and a non-Basic
`Authorization` header leaked both. It now releases both, which makes
`request_err:` redundant, so its two users jump to `err:` instead.
`switch_cut_path()` scanned for `/`, then restarted from the start of
the string for `\`, so whenever the last `\` came before the last `/`
the result still held `/`-separated components. Search for the last
`/` first, then for the last `\` in what follows it, so the result is
always what comes after the final separator, as documented.
Adds mixed-separator cases to
`test_switch_cut_path_strips_directory_components`.
When the remote side offers `a=setup:passive`, negotiation started the
MSRP client whether or not the offer carried an `a=path`, and the
client then asserted on the missing `remote_path`. Start the client
only when a path was negotiated. In `msrp_worker()`, also stop with an
error instead of asserting when there is no path, and when the path
gives no host or port.
- Reject a request with an empty transaction id, and a body that has
no end-line delimiter to frame it.
- Keep the receive buffer NUL-terminated after every read.
- Free the setup message when an outbound connection fails before
sending it.
- Refuse to send a message without a To-Path.
- Free MSRP messages and their headers on every path that drops
them, including `uuid_msrp_send` and `mod_sofia`'s filtered text
frames.
- Handle a failed `SSL_new()` and a call without an MSRP session by
closing the connection instead of asserting.
- Treat a zero-length TLS read as the peer closing the connection.
The request line and headers, the CRLF after the payload and the
end-line were written into the fixed stack buffer with `sprintf()`;
only the payload copy was checked, and the To-Path can be as long as
the remote SDP `a=path`. Build each part with `snprintf()` or a
checked copy, advance the length by what was written, and drop a
message that does not fit with an error log.
`msrp_parse_headers()` asserted that the received Byte-Range start was
above zero, so a range starting at 0 aborted the process. The payload
length derived from it is already checked against the declared total
and against the received data.
`msrp_find_uuid()` called `strlen()` on the To-Path before asserting
it was set, and a first SEND without a To-Path header passes NULL.
Return `SWITCH_FALSE` for it, so the worker handles it like any
To-Path that names no session.
`msrp_parse_header()` and `msrp_parse_headers()` passed the received
header value as the format argument of `switch_msrp_msg_add_header()`,
so `%` sequences in it were interpreted. Pass it through `"%s"`; header
values containing `%` are now stored unchanged.
`msrp_reply()` and `msrp_report()` formatted the To-Path, From-Path,
Message-ID and delimiter of the received request into a 2048-byte
stack buffer with an unbounded `sprintf()`. Use `snprintf()` and send
nothing when the result does not fit, since a truncated reply would
lack its end-line.
Without an explicit path, `msrp_recv_file_function()` joined the
`sip_msrp_file_name` channel variable, taken from the remote SDP
`a=file-selector` name, onto the base directory unchanged, so a name
with directory components opened a file outside it. Reduce the name
to its last path component with `switch_cut_path()` and reject an
empty name, `.` and `..`.
`test_switch_cut_path_strips_directory_components` covers the path
reduction the receive path relies on.
`amf0_data_read()` dispatched on the type byte into `amf0_object_read()`,
`amf0_associative_array_read()` and `amf0_array_read()`, each of which
called back into it for every contained element with nothing tracking
nesting depth. Chunk assembly admits up to `AMF_MAX_SIZE` bytes and a
nested object costs three of them per level, so one message can recurse
far deeper than `SWITCH_THREAD_STACKSIZE` holds.
Thread the depth through the dispatcher every arm funnels back into, so
one check covers any mix of them. A value past the cap is dropped, which
an object or ECMA array takes as its end and a strict array, having
declared an element count, takes as a failure. `amf0_data_read()` keeps
its signature and becomes a wrapper starting at depth 0. A cap of 32 sits
far above real traffic, where a `connect` command object nests two to
four levels.
A REFER with no call behind it is published as a `CALL_SETUP_REQ` event
whose `Request-Target` is `sofia/<profile>/<Refer-To URI>`, and
`mod_conference` hands that string to `switch_ivr_originate()` for
`rfc-4579` conferences. The URI was copied in unchanged, so a `,`, `|`
or `:_:` in it split the dial string into extra peers or legs, each of
which can start with its own `[...]` channel variables.
Answer such a REFER with `400 Bad Refer-To` before anything is
published. Both the serialized Refer-To and its user part are checked;
the user part is published separately as `Request-Target-Extension`,
which an `outcall-templ` expands. A Refer-To without these characters
is handled as before.
Also frees the subscription contact string an accepted REFER of this
kind allocated and never released.
`conference_event_adv_la()` gave every live array member's
`event_channel_cookie` permission on the conference moderator channel,
the same as the live array, chat and info channels. On mod_verto that
permission is what lets a client broadcast to `conference-mod.*` and
run conference commands through
`conference_event_mod_channel_handler()`. Grant and revoke it only for
members with `MFLAG_MOD`, which does not change during membership, so
a participant call leaving does not strip it from a moderator call on
the same WebSocket.
Adds three `test_member` cases covering the participant, moderator and
shared-cookie grants on a new `livearray` test profile.
Run the display name and number through the same
`switch_clean_string()` and `switch_var_clean_string()` pass that
`profile_dup_clean()` applies when the profile is built from the
initial request, so a `${` in either is stored as `%{` whichever
message carried it.
`switch_rtp_add_crypto_key()` allocated each MKI id buffer with
`sizeof(key_material->mki_size)`, a constant 4 bytes, then copied
`mki_size` bytes into it. That length comes from the remote `a=crypto`
attribute and was only checked against a lower bound. The same copy
read `mki_size` bytes starting at the 4-byte `mki_id` field.
Reject an MKI length outside 1..`SRTP_MAX_MKI_LEN`, allocate the id
buffer at that length, and copy no more than the width of `mki_id`,
leaving the remaining bytes zero. MKI lengths of 1 to 4 keep the bytes
they carry today.
`get_rtt_red_seq()` stored one entry per RFC 2198 redundancy header
in the fixed `pt[]` and `len[]` arrays without checking the count
against `MAX_RED_FRAMES`, so a packet with more headers wrote past
them. Reject the packet once the count reaches `MAX_RED_FRAMES`, and
reject a frame index at or above it, which a sequence number wrap
can produce.
`enum_app_function()` and `enum_api()` advanced their write cursor and
decremented the remaining space by `strlen(rp->route) + 1` rather than by
the bytes `switch_snprintf()` reported writing, so once a route no longer
fit the unsigned counter wrapped and the next iteration wrote past the end
of `rbuf` with no effective bound.
Both loops now share a `pack_routes()` helper that writes each route's
separator in front of it. Nothing points back into the buffer, so the
trailing-separator strip and its `rbuf[-1]` write are gone, along with the
write through a `char *` aimed at a string literal. A route that does not
fit whole, or that is empty, is skipped rather than clipped or ending the
loop.
`enum_app_function()` applies the same test when exporting `enum_route_N`,
so `enum_route_count` and the packed count describe the same routes: an
empty value would delete the variable rather than set it, leaving a gap in
the numbering. It also warns when the dial string ends up holding fewer
routes than were resolved, and `cnt`'s conversions are `%u` to match its
type.
`skinny_read_packet()` checked the declared length as `length + 8 >
2048` on a `uint32_t`, which wraps for lengths of `0xFFFFFFF8` and
above, and `skinny_check_data_length()` in the handlers only enforces a
minimum. Compare the length against the constant side instead, and
advance `ptr` on every read so a length field that arrives in pieces is
stored contiguously instead of being overwritten by later bytes.
- The message buffer gets one spare zero byte, so fixed-width string
fields of a full-size message terminate inside the allocation.
- The data and extended data handlers check `data_length` against the
bytes left after their header, with no addition on the wire value.
- Those two handlers and `skinny_handle_xml_alarm()` build the event
body with `%.*s` instead of an unchecked `malloc` copy.
- `skinny_handle_extended_data_message()` takes the body from the
`extended_data` member instead of `data`, so the event body no longer
starts with 20 bytes of header fields.
- `skinny_handle_updatecapabilities()` rejects an empty audio
capability list, as `skinny_handle_capabilities_response()` already
does.
On a profile with `extended-info-parsing` set, an inbound SIP INFO whose
content type is `freeswitch/api-request` puts an FSAPI command in the
request body and gets its output back in the 200 OK. The branch needs no
dialog, and no `mod_sofia` authentication or ACL setting covers an
out-of-dialog INFO. That same param also enables the in-dialog
`session-event` half, so there is no way to keep one and not the other.
The new per-profile `enable-info-api-request` param gates the api-request
branch alone and is off unless set, leaving `session-event` reachable
under `extended-info-parsing` as before. An INFO selecting the branch on a
profile without the new param is answered 403 and logged with the source
and the requested command; a permitted one is logged too, since the source
address appears in no event the API path fires. Both lines print the
body's first line, capped, rather than the whole body.
Use switch_rtp_hdr_t instead of srtp_hdr_t from srtp_priv.h, and srtp_shutdown() instead of srtp_crypto_kernel_shutdown(). Drop the rtp_hdr_t alias and add a compile-time check that switch_rtp_hdr_t is 12 bytes.
* [libvpx] Update to v1.17.0-97-gd3335af9e
* [libvpx] Fix pthread configure checks: "Null pointer passed as an argument to a 'nonnull' parameter"
* [libvpx] Fix threading.
* [libyuv] Update to hash 79ca9187e540faaaca47b34622e110d07f335d05 from https://chromium.googlesource.com/libyuv/libyuv/
* [libyuv] Build AArch64 dotprod/i8mm/SVE/SME kernels with per-file -march to fix arm64/macOS build
* [libyuv] Fix build with GCC
HammingDistance_AVX512VNNI clobbers k1 but lacks the
LIBYUV_TARGET_AVX512VNNI attribute that its siblings use, so GCC on
x86_64 fails with "the register 'k1' cannot be clobbered in 'asm' for
the current target".
ARGBAlphaBlendRow_SVE_SC uses "mov z25.s, #0x01010101", which the GNU
assembler rejects as an invalid replicated MOV immediate. Use the
equivalent "mov z25.b, #1", which sets the same value and is accepted
by both GNU as and LLVM.
* [libyuv] Fix function declaration without a prototype
* [libyuv] Disable scan-build warnings.
HammingDistance_AVX512VNNI clobbers k1 but lacks the
LIBYUV_TARGET_AVX512VNNI attribute that its siblings use, so GCC on
x86_64 fails with "the register 'k1' cannot be clobbered in 'asm' for
the current target".
ARGBAlphaBlendRow_SVE_SC uses "mov z25.s, #0x01010101", which the GNU
assembler rejects as an invalid replicated MOV immediate. Use the
equivalent "mov z25.b, #1", which sets the same value and is accepted
by both GNU as and LLVM.
Use the freeswitch-public-ci-base:trixie-amd64 image for unit-tests, D-in-D unit-tests and scan-build.
ci.sh: use scan-build-14 on bookworm and the default scan-build (clang 19) otherwise.