2059 Commits

Author SHA1 Message Date
Andreas Ebner 90effffe86 feat(driver): close file handles without activity after a timeout
The activity-timeout parameter closes handles without a Method call like Close,
e.g. for the ActivityTimeout of a TrustList (Part 12 7.8.2.1).
2026-10-15 22:05:04 +02:00
Andreas Ebner 0c253ab297 feat(driver): report an unknown file size as Bad_NotSupported (Part 20 4.2.1)
A backend can mark the size in the FileInfo as unknown, e.g. for content that
is generated on Open like a TrustList (Part 12 7.8.2.1).
2026-10-15 22:05:04 +02:00
Andreas Ebner c1180cdb96 feat(driver): open file handles from FileType subtype Methods
UA_FileTransferDriver_openHandle creates a Session handle with the checks of
Open, e.g. for OpenWithMasks of a TrustList (Part 12). Its openContext reaches
the backend open.
2026-10-15 22:05:04 +02:00
Andreas Ebner 0503c8fd97 feat(driver): open files with the Session of the caller (Part 20 4.2.2)
The backend open gets the caller as a context: the Session of Open, CreateFile
and the copies of MoveOrCopy, NULL for direct calls. Its result reaches the
client.
2026-10-15 22:05:04 +02:00
Andreas Ebner a83ee91bf9 fix(driver): preserve Object contexts and reject incomplete file listings
Restore application contexts before subtree deletion and keep original ownership separate from explicit Delete/move operations. Preserve contexts allocated by constructors for driver-created Objects as well.

Propagate entry metadata errors so a cross-driver move cannot delete an uncopied source file. Add lifecycle and local filesystem regressions covering both findings.
2026-10-14 08:11:28 +02:00
Andreas Ebner 8d28921d72 fix(driver): reject wrongly typed parameters and document the Method ownership
A known parameter with another type was ignored silently, e.g. read-only as
Int32. The header states that the drivers own the shared Method nodes.
2026-10-14 08:11:28 +02:00
Daniel Opitz 4fc9c419f3 fix(server): properly separated sync shutdown from async shutdown (with externally managed eventloop) 2026-10-13 14:05:37 +02:00
Daniel Opitz e95223e142 fix(server): complete shutdown with an external EventLoop 2026-10-13 14:05:37 +02:00
Andreas Ebner 16a739a7c3 fix(server): fail startup when no transport can open a server socket
UA_Server_run_startup ignored the driver results and ran without
listening. It now fails if a transport cannot open its socket and
neither another transport nor a reverse connect reaches the server.
2026-10-13 08:55:20 +02:00
Julius Pfrommer 9bb9b345df fix(arch): give the default lwIP TAP interface process lifetime 2026-10-12 17:08:39 +02:00
Julius Pfrommer 7765769e5a test(plugin): verify and document shared event loop ownership 2026-10-12 17:08:39 +02:00
Andreas Ebner a109401823 feat(driver): resolve file handles for FileType subtype methods
Methods like CloseAndUpdate of the PubSubConfiguration (Part 14) map the
client FileHandle to the backend handle and close it as Close does.
2026-10-12 00:14:33 +02:00
Andreas Ebner edfbf9516e feat(driver): make the directory refresh optional and enforce the scan limits
refresh-interval 0 disables the timer, UA_FileTransferDriver_refresh() reconciles
on demand. The directory Methods respect max-scan-depth; skipped entries and cut
trees are logged at start and when they change.
2026-10-12 00:14:33 +02:00
Andreas Ebner 5514c756e6 feat(driver): add per-backend Part 20 file transfer drivers
Expose one file or directory backend through FileType and FileDirectoryType
Objects. Bind Objects to the driver lifetime, preserve reused application
nodes, and close session handles on stop or session cleanup.

Enforce file and directory access rights in Properties and Methods. Index
entries and handles with zip trees, reconcile storage changes, and retain
removed entries while their handles remain open. Include the reduced
namespace model and compile the driver with Method-call support in every
Namespace Zero configuration. Export the API unconditionally.

Co-authored-by: Julius Pfrommer <julius.pfrommer@o6-automation.com>
2026-10-12 00:14:33 +02:00
Julius Pfrommer 27dad4638f fix(server): reject duplicate driver registration
Reject registering the same driver twice, which would create a cycle in the
server's driver list. Permit multiple generic drivers and enforce a single
instance for each specialized driver type.
2026-10-12 00:14:33 +02:00
Julius Pfrommer 7a6aca9e54 fix(server): propagate driver startup errors when adding at runtime
Return the start callback's error when a driver is added to a running server.
Unlink a failed registration, retain its server pointer for cleanup, and leave
ownership with the caller. Cover failure, retry, and shutdown in server tests.
2026-10-12 00:14:33 +02:00
Julius Pfrommer 3d390d26b1 Merge remote-tracking branch 'origin/1.5' into merge_15_master
# Conflicts:
#	CHANGES.md
#	src/server/ua_services_attribute.c
#	src/server/ua_transport_tcp.c
#	tests/server/check_accesscontrol.c
2026-10-08 14:33:33 +02:00
Andreas Ebner 5aa2e35abe fix(server): reject an access control without its mandatory hooks
The services call six AccessControl callbacks without a NULL check, so a
plugin without one of them crashed the server on the first request.
UA_Server_run_startup now refuses such a plugin with BadConfigurationError.
2026-10-06 18:22:49 +02:00
Niels Beier d7dedf2750 fix(server): allow the owner to transfer a detached Subscription
Remember the identity of the Session on detach. Only a Session
with the same identity can transfer the Subscription.
2026-10-06 07:37:13 +02:00
Julius Pfrommer 6901aedc07 Merge remote-tracking branch 'origin/1.5' into merge_15_master
Port keyless certificate validation into the GDS receiver driver instead
of restoring the removed server implementation. Preserve master's timer
batching, PubSub lifecycle and client HTTP configuration handling.

Adapt Publish cancellation to response tokens and the HEL/fuzz harnesses
to the explicit TCP driver. Keep SKS policy history and custom datatype
ownership intact, including failed replacement configuration cleanup.
Retain TPM error cleanup while enforcing key-handle and nonce lengths.

Validation:
- Full mbedTLS unit-test build with full namespace, GDS, SKS and Query.
- 21 affected suites passed with ASan/UBSan, plus 9 isolated SKS ownership
  and lifecycle checks.
- OpenSSL certificate update, GDS information model and client encryption
  suites passed with sanitizers.
- OPN, MSG and binary-message fuzzers each completed 100 sanitizer runs.
- Both TPM PubSub policy sources passed compilation checks.

The full SKS client suite timed out after multicast UDP sends reported
"No route to host" on this machine; its affected ownership and lifecycle
cases passed separately. No live TPM hardware validation was performed.
2026-10-04 16:49:17 +02:00
Andreas Ebner f8a962278d fix(types): UA_Variant_setArray with length zero sets an empty array
A variant with length zero and a data pointer is a scalar. With an
array of length zero, UA_Variant_setArray kept the pointer, so the
variant became a scalar. Writing it to an array variable failed, and
clearing it freed the array as a single element.
UA_Variant_setArrayCopy already uses UA_EMPTY_ARRAY_SENTINEL in this
case. UA_Variant_setArray now does the same and does not take over the
array. NULL with length zero remains a null array.

The GDS Receiver writes its CertificateTypes with UA_Variant_setArray.
Since #8506 the list is empty on a server without an RSA endpoint. The
write failed, the receiver did not start and its methods were unbound.
2026-10-02 20:16:50 +02:00
Andreas Ebner 461e46182c fix(pubsub): clean up failed writer creation and deferred deletion
Roll back writers whose information model representation fails. A deferred
connection or WriterGroup delete asks the lifecycle callback only once,
retries vetoed writers, rejects new ones and completes a manager stop.
2026-09-30 23:55:58 +02:00
Andreas Ebner 2810e1ec1b fix(pubsub): never free a PublishedDataSet with connected writers
The removal freed the PDS even when removing a connected writer failed and left
a dangling connectedDataSet. Check the writer groups first and stop on a failed
writer removal, so the PDS is only freed without writers.
2026-09-30 23:55:58 +02:00
Andreas Ebner 918f2cfd4b fix(docs): typos in comments, docs and messages
Fix misspellings found with codespell across headers, sources, examples,
tests and the documentation, including "propably" in the nodeset
compiler docs. Identifiers, companion spec names and generated code are
left untouched.
2026-09-28 16:20:44 +02:00
Niels Beier a8c9c10f9d refactor(server): compute SecureChannel attributes on access, lock ns0
Namespace 0 is now restricted to the predefined set of SecureChannel
attributes, for both read and write; other namespaces stay free-form.
The built-in read-only keys are no longer cached in channel->attributes. UA_SecureChannel_getBuiltinAttribute computes them fresh from the
live channel on every access, and notifySecureChannel now reuses it
instead of duplicating the field mappings.
2026-09-25 13:30:13 +02:00
Niels Beier 17a4ea6e55 feat(server): expose SecureChannel background info as read-only attributes
notifySecureChannel now merges the same data it sends in the
SECURECHANNEL_OPENED notification into channel->attributes, so it's
readable via UA_Server_getSecureChannelAttribute and friends. These
keys are rejected by set/delete with BADNOTWRITABLE, only
maxMessageSize stays writable. Also fixes a null-pointer read on
connectionManager in notifySecureChannel and a misleading doc comment
on getSecureChannelAttribute_scalar.
2026-09-25 13:30:13 +02:00
Niels Beier 0ff9154572 feat(server): let applications tighten the message size limit on a channel
Adds a generic SecureChannel attribute map, mirroring the existing
per-Session attributes, with UA_Server_{get,set,delete}SecureChannel
Attribute. Writing the reserved "0:maxMessageSize" key caps
tcpMaxMsgSize for that one channel, it can only tighten, never
loosen, the configured ceiling. Reuses the existing
secureChannelNotificationCallback as the decision point instead of
adding a dedicated callback.
2026-09-25 13:30:13 +02:00
Julius Pfrommer e01e2310af Merge remote-tracking branch 'origin/1.4' into merge_14_15 2026-09-24 12:31:21 +02:00
Julius Pfrommer 07b632a6f7 fix(client): verify selected CreateSession endpoint
Compare the selected discovery endpoint with its authenticated counterpart
from CreateSession using only the seven fields specified by Part 4. Ignore
optional metadata and the duplicated endpoint certificate, which servers may
omit. Keep the separate certificate validation unchanged.

Reject mismatches by default, with configurable warning and acceptance modes.
Skip the comparison for directly configured endpoints. Cover omitted metadata,
endpoint reordering, mismatch handling and trusted endpoint configuration.
2026-09-23 17:07:09 +02:00
Julius Pfrommer ba094e2732 fix(pubsub): honor supported JSON masks and reject unsupported layouts 2026-09-22 14:54:34 +02:00
Julius Pfrommer f223658c6f fix(pubsub): compute and encode DataSetMessage status correctly 2026-09-18 07:39:51 +02:00
Julius Pfrommer 51550b0b23 fix(client): use QueryNext service metadata
UA_Client_Service_queryNext passed QueryFirst type descriptions for smaller QueryNext stack objects. Use the matching request and response metadata so encoding and decoding stay within the actual objects.
2026-09-14 14:14:00 +02:00
Andreas Ebner c39a4c589e feat(server): Add const option for generated UA_DataType (#7950)
* feat(core): make UA_DataTypeArray.types and UA_DataType.members const

Keep generated definitions read-only and populate dynamically allocated definitions through mutable pointers. Preserve self references when copying and registering runtime types.

* feat(nc): generate const DataType arrays for pinned namespace indices

NAMESPACE_MAP bakes in the indices; incomplete or invalid maps are rejected.

* test(nc): cover const DataType arrays and the namespace-order check

Pins DI at index 2 and asserts both outcomes of the generated runtime check.

* test(nodeset-loader): verify compatibility with const datatype arrays

Compare binary and XML encoding IDs with generated DI types. Verify that the in-tree loader reuses registered const types while adding runtime recursive types, including server cleanup.

* fix(nc): validate pinned namespaces independently of array names

Emit URI/index metadata for const type arrays and verify every contributing namespace before registering arrays or nodes. Support arrays spanning multiple namespaces and explicit TYPES_ARRAY names.

Keep datatype indices consecutive across namespaces and reject pins outside the UInt16 range. Add compiled regressions for matching, swapped, and individually shifted namespaces with conventional and independent nodeset names.

* fix(nc): reject conflicting pins for the same namespace
2026-09-10 20:15:26 +02:00
Julius Pfrommer 59cad090f7 fix(pubsub): preserve dataset contracts and update settings with immutable names 2026-09-09 07:29:51 +02:00
Julius Pfrommer 07606a27b8 fix(pubsub): make shared SKS state transactional 2026-09-05 20:57:32 +02:00
Julius Pfrommer 835516f207 feat(pubsub): complete group and reader configuration fields 2026-09-05 20:57:32 +02:00
Julius Pfrommer d2bc0bccb5 fix(pubsub): validate security policy contracts early 2026-09-05 20:57:32 +02:00
Julius Pfrommer 548bc703d6 fix(pubsub): harden SKS key lifecycle and policy contracts 2026-09-05 20:57:32 +02:00
Julius Pfrommer 8f6e6d2dc8 fix(pubsub): preserve complete file configuration 2026-09-05 20:57:32 +02:00
Julius Pfrommer d3e968d143 feat(nodeset-loader): move loader into core utility 2026-09-05 19:31:54 +02:00
Julius Pfrommer fb2f813b30 feat(server): allow unattached methods by rule 2026-09-05 19:31:54 +02:00
Julius Pfrommer f551d12cfc feat(types): support up to 511 datatype members 2026-09-05 19:31:54 +02:00
Julius Pfrommer 7ecd16ab06 fix(pubsub): harden transport and message encoding 2026-09-05 14:23:48 +02:00
Julius Pfrommer a476806541 Merge remote-tracking branch 'origin/1.5' into merge_15_master
# Conflicts:
#	.github/workflows/build_linux.yml
#	CHANGES.md
#	arch/common/eventloop_mqtt.c
#	examples/encryption/server_encryption_filestore.c
#	plugins/crypto/ua_certificategroup_filestore.c
#	src/pubsub/ua_pubsub_networkmessage_json.c
#	src/server/ua_discovery.h
#	src/server/ua_discovery_mdns.c
#	src/server/ua_discovery_mdns_avahi.c
#	src/server/ua_services_attribute.c
#	src/server/ua_services_discovery.c
#	src/server/ua_services_monitoreditem.c
#	src/server/ua_services_nodemanagement.c
#	src/server/ua_subscription.c
#	src/server/ua_subscription.h
#	src/server/ua_subscription_alarms_conditions.c
#	src/server/ua_subscription_event.c
#	src/ua_types_encoding_json_105.c
#	tests/client/check_activateSessionAsync.c
#	tests/server/check_local_monitored_item.c
#	tests/server/check_services_subscriptions.c
2026-09-03 14:33:21 +02:00
Julius Pfrommer 31009abdf5 fix(server): move monitored items on node replacement 2026-09-02 15:46:05 +02:00
Julius Pfrommer 7d17cd7909 fix(server): distinguish node copies from editable replacements 2026-09-02 08:43:08 +02:00
Julius Pfrommer 2e58975548 fix(server): treat zero session and channel limits as unlimited
Honor the established zero-as-unlimited convention when creating Sessions and SecureChannels.

Document the sentinel behavior and add regression coverage for both paths.
2026-08-28 19:09:35 +02:00
Julius Pfrommer a59a522de3 feat(pubsub): support fixed-size strings in offset tables 2026-08-25 18:37:18 +02:00
Julius Pfrommer c698eaf2eb refactor: add missing o6 Automation copyright headers 2026-08-17 22:17:22 +02:00
Julius Pfrommer 5226be28f5 fix(core): encode verbose JSON enum names 2026-08-17 15:19:52 +02:00