Skip to content

Commit

Permalink
some tiny code/language adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
cdpxe committed Sep 26, 2024
1 parent 209d414 commit b0b3bb2
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion build
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3241
3243
Binary file modified docs/docs.pdf
Binary file not shown.
21 changes: 12 additions & 9 deletions src/libssl.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
/*
* WendzelNNTPd is distributed under the following license:
*
* Copyright (c) 2004-2024 Steffen Wendzel <wendzel (at) hs-worms (dot) de>
* Copyright (C) 2004-2024 Steffen Wendzel
*
* -This file was initially contributed by my students. Thanks for that!-
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -163,14 +165,14 @@ check_tls_prerequisites(connectorinfo_t *connectorinfo)
return FALSE;
}

if (access(connectorinfo->server_cert_file,R_OK) != 0) {
fprintf(stderr,"Certificate file is not found on defined path!\n");
if (access(connectorinfo->server_cert_file, R_OK) != 0) {
fprintf(stderr,"Certificate file '%s' is not found on defined path!\n", connectorinfo->server_cert_file);
ERR_print_errors_fp(stderr);
return FALSE;
}

if (access(connectorinfo->server_key_file,R_OK) != 0) {
fprintf(stderr,"Server key file is not found on defined path!\n");
if (access(connectorinfo->server_key_file, R_OK) != 0) {
fprintf(stderr,"Server key file '%s' is not found on defined path!\n", connectorinfo->server_key_file);
ERR_print_errors_fp(stderr);
return FALSE;
}
Expand All @@ -191,23 +193,24 @@ tls_session_init(server_cb_inf *inf)
{
char *connection_log = NULL;
inf->sockinf->tls_session = SSL_new(inf->sockinf->connectorinfo->ctx);
char conn_s[50] = { '\0' };

if(!SSL_set_fd(inf->sockinf->tls_session,inf->sockinf->sockfd)) {
fprintf(stderr,"Error creating TLS session!!\n");
fprintf(stderr,"Error creating TLS session!\n");
ERR_print_errors_fp(stderr);
return FALSE;
}

if (SSL_accept(inf->sockinf->tls_session) <=0) {
fprintf(stderr,"Error negotiating TLS session!!\n");
fprintf(stderr,"Error negotiating TLS session!\n");
ERR_print_errors_fp(stderr);
return FALSE;
}

/* Log the started connection */
char conn_s[50];
/* TODO: replace sprintf() with snprintf() */
sprintf(conn_s,"%s:%d",inf->sockinf->connectorinfo->listen,inf->sockinf->connectorinfo->port);
connection_log = str_concat("Created TLS connection from ", inf->sockinf->ip, " Connector:", conn_s, NULL);
connection_log = str_concat("Created TLS connection from ", inf->sockinf->ip, ", Connector:", conn_s, NULL);
DO_SYSL(connection_log);
fprintf(stderr,"%s\n",connection_log);
FFLUSH
Expand Down
2 changes: 1 addition & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ main(int argc, char *argv[])

for (i = 0; i < size_sockinfo_t; i++) {
if (FD_ISSET((sockinfo + i)->sockfd, &fds)) {
onxxdebug("accepting tcp connection.\n");
onxxdebug("accepting TCP connection.\n");
if ((connfd = accept((sockinfo+i)->sockfd,
SWITCHIP(i, (struct sockaddr *)&sa, (struct sockaddr *)&sa6),
SWITCHIP(i, &salen, &sa6len))) < 0) {
Expand Down

0 comments on commit b0b3bb2

Please sign in to comment.