[tin-dev] [PATCH] fix messed up txt_log_data_hidden

Dennis Preiser dennis at d--p.de
Thu Aug 17 17:56:12 CEST 2023


On Thu, Aug 17, 2023 at 08:41:44AM +0200, Urs Janßen wrote:
> Whatever I did (active.c ~435 ???) it was unfinished.
> this should fix things.
> 
> === modified file 'src/active.c'
> --- old/src/active.c	2023-08-03 05:45:56 +0000
> +++ new/src/active.c	2023-08-17 06:28:19 +0000
> @@ -435,18 +435,14 @@
> 							char fmt[25];
> 
> 							snprintf(fmt, sizeof(fmt), "%%"T_ARTNUM_SFMT" %%"T_ARTNUM_SFMT" %%"T_ARTNUM_SFMT" %%%ds", NNTP_GRPLEN);
> -							if (sscanf(line, fmt, &count, &min, &max, ngname) != 4) {
> -#	ifdef DEBUG
> -								if ((debug & DEBUG_NNTP) && verbose > 1)
> -									debug_print_file("NNTP", "Invalid response to \"GROUP %s\txt_log_data_hidden%s\"", ngnames[index_o], line);
> -#	endif /* DEBUG */
> -							}
> -							if (strcmp(ngname, ngnames[index_o]) != 0) {
> -#	ifdef DEBUG
> -								if ((debug & DEBUG_NNTP) && verbose > 1)
> -									debug_print_file("NNTP", "Groupname mismatch in response to \"GROUP %s\txt_log_data_hidden%s\"", ngnames[index_o], line);
> -#	endif /* DEBUG */
> -							}
> +#	ifdef DEBUG
> +							if ((debug & DEBUG_NNTP) && verbose > 1) {
> +								if (sscanf(line, fmt, &count, &min, &max, ngname) != 4)
> +									debug_print_file("NNTP", "Invalid response to \"GROUP %s\": \"%s\"", ngnames[index_o], line);
> +								if (strcmp(ngname, ngnames[index_o]) != 0)
> +									debug_print_file("NNTP", "Groupname mismatch in response to \"GROUP %s\": \"%s\"", ngnames[index_o], line);
> +							}
> +#	endif /* DEBUG */
> 							ptr = ngname;
> 							free(ngnames[index_o]);
> 							index_o = (index_o + 1) % NUM_SIMULTANEOUS_GROUP_COMMAND;

This change breaks '-n' on some servers (e.g. news.individual.de, which
doesn't respond properly to CAPABILITIES and tin doesn't use LIST
COUNTS). It works with '-D1 -vv', because then sscanf() is called. The
sscanf must be outside of #ifdef DEBUG.

Dennis
-------------- next part --------------
--- a/src/active.c
+++ b/src/active.c
@@ -435,14 +435,15 @@ do_read_newsrc_active_file(
 							char fmt[25];
 
 							snprintf(fmt, sizeof(fmt), "%%"T_ARTNUM_SFMT" %%"T_ARTNUM_SFMT" %%"T_ARTNUM_SFMT" %%%ds", NNTP_GRPLEN);
+							if (sscanf(line, fmt, &count, &min, &max, ngname) != 4) {
 #	ifdef DEBUG
-							if ((debug & DEBUG_NNTP) && verbose > 1) {
-								if (sscanf(line, fmt, &count, &min, &max, ngname) != 4)
-									debug_print_file("NNTP", "Invalid response to \"GROUP %s\": \"%s\"", ngnames[index_o], line);
-								if (strcmp(ngname, ngnames[index_o]) != 0)
-									debug_print_file("NNTP", "Groupname mismatch in response to \"GROUP %s\": \"%s\"", ngnames[index_o], line);
-							}
+								if ((debug & DEBUG_NNTP) && verbose > 1) {
+										debug_print_file("NNTP", "Invalid response to \"GROUP %s\": \"%s\"", ngnames[index_o], line);
+									if (strcmp(ngname, ngnames[index_o]) != 0)
+										debug_print_file("NNTP", "Groupname mismatch in response to \"GROUP %s\": \"%s\"", ngnames[index_o], line);
+								}
 #	endif /* DEBUG */
+							}
 							ptr = ngname;
 							free(ngnames[index_o]);
 							index_o = (index_o + 1) % NUM_SIMULTANEOUS_GROUP_COMMAND;


More information about the tin-dev mailing list