Skip to content

Commit d65e69e

Browse files
committed
Add logging of connection security to ippeveprinter.
1 parent 0034146 commit d65e69e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tools/ippeveprinter.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4745,6 +4745,8 @@ process_client(ippeve_client_t *client) // I - Client
47454745

47464746
if (recv(httpGetFd(client->http), buf, 1, MSG_PEEK) == 1 && (!buf[0] || !strchr("DGHOPT", buf[0])))
47474747
{
4748+
char security[256]; // Security description
4749+
47484750
fprintf(stderr, "%s Starting HTTPS session.\n", client->hostname);
47494751

47504752
if (!httpSetEncryption(client->http, HTTP_ENCRYPTION_ALWAYS))
@@ -4753,7 +4755,7 @@ process_client(ippeve_client_t *client) // I - Client
47534755
break;
47544756
}
47554757

4756-
fprintf(stderr, "%s Connection now encrypted.\n", client->hostname);
4758+
fprintf(stderr, "%s Connection now encrypted (%s).\n", client->hostname, httpGetSecurity(client->http, security, sizeof(security)));
47574759
}
47584760

47594761
first_time = false;
@@ -4890,6 +4892,8 @@ process_http(ippeve_client_t *client) // I - Client connection
48904892
{
48914893
if (strstr(httpGetField(client->http, HTTP_FIELD_UPGRADE), "TLS/") != NULL && !httpIsEncrypted(client->http))
48924894
{
4895+
char security[256]; // Security description
4896+
48934897
if (!respond_http(client, HTTP_STATUS_SWITCHING_PROTOCOLS, NULL, NULL, 0))
48944898
return (0);
48954899

@@ -4901,7 +4905,7 @@ process_http(ippeve_client_t *client) // I - Client connection
49014905
return (0);
49024906
}
49034907

4904-
fprintf(stderr, "%s Connection now encrypted.\n", client->hostname);
4908+
fprintf(stderr, "%s Connection now encrypted (%s).\n", client->hostname, httpGetSecurity(client->http, security, sizeof(security)));
49054909
}
49064910
else if (!respond_http(client, HTTP_STATUS_NOT_IMPLEMENTED, NULL, NULL, 0))
49074911
return (0);

0 commit comments

Comments
 (0)