Skip to content

Add cs_get_error - #194

Merged
adamdickmeiss merged 11 commits into
masterfrom
cs-get-error
Jul 24, 2026
Merged

Add cs_get_error#194
adamdickmeiss merged 11 commits into
masterfrom
cs-get-error

Conversation

@adamdickmeiss

Copy link
Copy Markdown
Contributor

Provides error details for COMSTACK failures. This is, especially, useful for SSL failures.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a mechanism to attach and retrieve detailed error information from COMSTACK instances (notably for SSL/TLS failures), and wires those details into higher-level logging paths to improve diagnostics across the toolkit.

Changes:

  • Introduces cs_get_error / cs_set_error and stores per-connection error details in COMSTACK.
  • Populates SSL/TLS-related error details in the TCP/IP COMSTACK implementation and emits details in URL/server/client logging.
  • Adds documentation and a unit test covering the new error-details behavior.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/yaz/comstack.h Adds error_details field to struct comstack and declares cs_get_error / cs_set_error.
src/comstack.c Implements cs_get_error and cs_set_error.
src/tcpip.c Allocates/frees error_details and sets detailed SSL/TLS failure messages via cs_set_error.
src/unix.c Allocates/frees error_details for UNIX-domain COMSTACK instances (and accepted connections).
src/url.c Appends COMSTACK error code/message/details into yaz_url error output on failures.
src/statserv.c Centralizes COMSTACK-aware logging for listen/accept/bind failures.
client/client.c Improves diagnostics by printing/logging COMSTACK error code/message/details for connection and I/O failures.
test/test_comstack.c Adds a unit test validating details lifecycle for cs_get_error/cs_set_error.
doc/book.xml Documents the new API and adds it to the COMSTACK synopsis.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread client/client.c Outdated
Comment thread src/yaz/comstack.h Outdated
Provides error details for COMSTACK failures. This is, especially,
useful for SSL failures.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Comment thread src/comstack.c Outdated
Comment thread client/client.c

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Comment thread src/statserv.c

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Comment thread src/yaz/comstack.h
@adamdickmeiss adamdickmeiss changed the title Add cs_get_error, cs_put_error Add cs_get_error Jul 24, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.

Comment thread src/tcpip.c Outdated
Comment thread test/test_comstack.c Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (2)

src/tcpip.c:1158

  • On this failure path, state->session has already been created by gnutls_init, but tcpip_state_destroy(state) does not deinitialize the GnuTLS session. This leaks the session when gnutls_set_default_priority fails.
                tcpip_state_destroy(state);
                xfree(cnew);
                return 0;

src/tcpip.c:1167

  • Same as above: if gnutls_credentials_set fails, state->session is still live, but tcpip_state_destroy(state) doesn't call gnutls_deinit. Deinitialize the session before destroying the state to avoid leaking the TLS session object.
                tcpip_state_destroy(state);
                xfree(cnew);
                return 0;

@adamdickmeiss
adamdickmeiss requested a review from Copilot July 24, 2026 14:53

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated no new comments.

Instead consistently print to stdout for info messages and stderr
for error messages.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Comment thread test/test_comstack.c
@adamdickmeiss
adamdickmeiss merged commit 3f69b89 into master Jul 24, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants