From ccd0e13c05e2f45931f0622e7a48a4f9cbb165b0 Mon Sep 17 00:00:00 2001 From: Alexey Khromov Date: Mon, 21 Apr 2025 00:55:45 +0300 Subject: [PATCH] Fxd PVS-Studio lint warnings --- debian/Makefile.in | 263 --------------------------------- debian/README.Debian | 6 - {debian => source}/Makefile.am | 0 source/bforce/netspool.c | 3 +- source/bforce/prot_binkp.c | 100 +++++++------ source/bforce/prot_common.c | 10 +- source/bforce/prot_emsi.c | 2 +- source/bforce/prot_emsi_misc.c | 33 +++-- source/bforce/prot_hydra.c | 4 +- source/bforce/prot_yoohoo.c | 5 +- source/bforce/sess_call.c | 14 +- source/configure | 11 +- source/configure.in | 2 +- source/include/session.h | 14 +- 14 files changed, 105 insertions(+), 362 deletions(-) delete mode 100644 debian/Makefile.in delete mode 100644 debian/README.Debian rename {debian => source}/Makefile.am (100%) diff --git a/debian/Makefile.in b/debian/Makefile.in deleted file mode 100644 index 2bd30e0..0000000 --- a/debian/Makefile.in +++ /dev/null @@ -1,263 +0,0 @@ -# Makefile.in generated by automake 1.8.3 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = ../debian -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -am__aclocal_m4_deps = $(top_srcdir)/configure.in -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) -mkinstalldirs = $(mkdir_p) -CONFIG_HEADER = $(top_builddir)/include/config.h -CONFIG_CLEAN_FILES = -SOURCES = -DIST_SOURCES = -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -CC = @CC@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -DEFS = @DEFS@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -GROUP = @GROUP@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LTLIBOBJS = @LTLIBOBJS@ -OBJEXT = @OBJEXT@ -OWNER = @OWNER@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -SHELL = @SHELL@ -YACC = @YACC@ -ac_ct_CC = @ac_ct_CC@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -includedir = @includedir@ -infodir = @infodir@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -oldincludedir = @oldincludedir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ - -# $Id$ -EXTRA_DIST = copyright changelog rules conffiles \ - control dirs init.d - -all: all-am - -.SUFFIXES: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu ../debian/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu ../debian/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -uninstall-info-am: -tags: TAGS -TAGS: - -ctags: CTAGS -CTAGS: - - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am - -.PHONY: all all-am check check-am clean clean-generic distclean \ - distclean-generic distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \ - uninstall-info-am - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/debian/README.Debian b/debian/README.Debian deleted file mode 100644 index 7bb2149..0000000 --- a/debian/README.Debian +++ /dev/null @@ -1,6 +0,0 @@ -bforce for Debian ------------------ - -See CHANGES.ugenk - - -- Evgeniy Kozhuhovskiy , Thu Feb 10 23:54:48 2005 diff --git a/debian/Makefile.am b/source/Makefile.am similarity index 100% rename from debian/Makefile.am rename to source/Makefile.am diff --git a/source/bforce/netspool.c b/source/bforce/netspool.c index 2ce7461..4985243 100644 --- a/source/bforce/netspool.c +++ b/source/bforce/netspool.c @@ -243,7 +243,8 @@ void netspool_acknowledge(s_netspool_state *state) void netspool_end(s_netspool_state *state) { - sendstr(state->socket, "END satisfied"); + int i; + i = sendstr(state->socket, "END satisfied"); close(state->socket); state->state = NS_NOTINIT; } diff --git a/source/bforce/prot_binkp.c b/source/bforce/prot_binkp.c index 1e7f098..d45a7e1 100644 --- a/source/bforce/prot_binkp.c +++ b/source/bforce/prot_binkp.c @@ -469,8 +469,10 @@ case 2: case 3: // send password on outgoing or pw confirmation on incoming // special empty password is sent if there is no password for the remote addr - if (bstate->mode==bmode_incoming_handshake) { - if (bstate->password_received) { + if (bstate->mode==bmode_incoming_handshake) + { + if (bstate->password_received) + { DEB((D_24554, "send OK, password verified")); buf[0] = BPMSG_OK; *block_type = BINKP_BLK_CMD; @@ -481,45 +483,54 @@ case 3: // send password on outgoing or pw confirmation on incoming DEB((D_24554, "waiting for password from remote")); return 0; // nothing to send } - else if (bstate->mode==bmode_outgoing_handshake) { - if (!bstate->address_established) { - DEB((D_24554, "address not received still")); - return 0; - } - DEB((D_24554, "send password")); + else + { + if (!bstate->address_established) + { + DEB((D_24554, "address not received still")); + return 0; + } + DEB((D_24554, "send password")); - buf[0] = BPMSG_PWD; - *block_type = BINKP_BLK_CMD; + buf[0] = BPMSG_PWD; + *block_type = BINKP_BLK_CMD; - if( bstate->local_data->passwd[0] == '\0' ) { - *block_length = 1 + sprintf(buf+1, "-"); - } - else if( bstate->remote_data->options & BINKP_OPT_MD5 ) { - char digest_bin[16]; - char digest_hex[33]; - - if(bstate->remote_data->challenge_length==0) { - DEB((D_24554, "waiting for challenge")); - return 0; + if( bstate->local_data->passwd[0] == '\0' ) + { + *block_length = 1 + sprintf(buf+1, "-"); + } + else + if( bstate->remote_data->options & BINKP_OPT_MD5 ) + { + char digest_bin[16]; + char digest_hex[33]; + + if(bstate->remote_data->challenge_length==0) + { + DEB((D_24554, "waiting for challenge")); + return 0; + } + + md5_cram_get(bstate->local_data->passwd, + bstate->remote_data->challenge, + bstate->remote_data->challenge_length, + digest_bin); + + /* Encode digest to the hex string */ + string_bin_to_hex(digest_hex, digest_bin, 16); + + *block_length = 1 + sprintf(buf+1, + "CRAM-MD5-%s", digest_hex); + } + else + { + *block_length = 1 + sprintf(buf+1, "%s", bstate->local_data->passwd); + } + bstate->phase += 1; + return 1; } - md5_cram_get(bstate->local_data->passwd, bstate->remote_data->challenge, - bstate->remote_data->challenge_length, digest_bin); - - /* Encode digest to the hex string */ - string_bin_to_hex(digest_hex, digest_bin, 16); - - *block_length = 1 + sprintf(buf+1, "CRAM-MD5-%s", digest_hex); - } - else { - *block_length = 1 + sprintf(buf+1, "%s", bstate->local_data->passwd); - } - bstate->phase += 1; - return 1; - } - else { - log("impossible mode"); - return -1; - } + return -1; + case 4: @@ -699,12 +710,11 @@ case BPMSG_ADR: /* List of addresses */ if (bstate->address_established) { PROTO_ERROR("remote tries to change address"); } - if( bstate->extracmd[0] != (char)-1 ) return 0; // suspend !!! + if( bstate->extracmd[0] != (char)0xFF ) return 0; // suspend !!! binkp_process_ADR(buf+1); if( !state.n_remoteaddr ) { log("error: remote did not supplied any addresses"); - if( bstate->extracmd[0] != (char)-1 ) return 0; // suspend bstate->extracmd[0] = BPMSG_BSY; strcpy(bstate->extracmd+1, "No addresses was presented"); bstate->extraislast = true; @@ -783,7 +793,7 @@ case BPMSG_PWD: /* Session password */ // lock addresses if( session_addrs_lock(state.remoteaddrs, state.n_remoteaddr) ) { log("error locking addresses of the remote"); - if( bstate->extracmd[0] != (char)-1 ) return 0; // suspend if extra is occupied + if( bstate->extracmd[0] != (char)0xFF ) return 0; // suspend if extra is occupied bstate->extracmd[0] = BPMSG_BSY; strcpy(bstate->extracmd+1, "All addresses are busy"); bstate->extraislast = true; @@ -870,7 +880,7 @@ case 2: default: PROTO_ERROR("p_rx_fopen_error"); } - PROTO_ERROR("never should get here"); + // PROTO_ERROR("never should get here"); case BPMSG_OK: /* Password was acknowleged (data ignored) */ DEB((D_24554, "received M_OK len=%d", block_length)); @@ -879,7 +889,7 @@ case BPMSG_OK: /* Password was acknowleged (data ignored) */ } if (session_addrs_lock(state.remoteaddrs, state.n_remoteaddr)) { log("error: unable to lock"); - if (bstate->extracmd[0]!= (char)-1) return 0; + if (bstate->extracmd[0]!= (char)0xFF) return 0; bstate->extracmd[0] = BPMSG_BSY; strcpy(bstate->extracmd+1, "All addresses are busy"); bstate->extraislast = true; @@ -989,7 +999,7 @@ case BPMSG_GET: /* Get a file from offset */ } DEB((D_24554, "M_GET file %s size %d time %d offset %d", getfi.fn, getfi.sz, getfi.tm, getfi.offs)); - if (bstate->extracmd[0] != (char)-1) return 0; + if (bstate->extracmd[0] != (char)0xFF) return 0; if (bstate->pi->send) if (p_compfinfo(bstate->pi->send, getfi.fn, getfi.sz, getfi.tm)==0) { DEB((D_24554, "M_GET for currently transmitted file")); @@ -1079,7 +1089,7 @@ case BINKP_BLK_DATA: return 1; } - if (bstate->extracmd[0] != (char)-1) return 0; + if (bstate->extracmd[0] != (char)0xFF) return 0; long int n; n = p_rx_writefile(buf, block_length, bstate->pi); diff --git a/source/bforce/prot_common.c b/source/bforce/prot_common.c index 1d9ccae..be52ea7 100644 --- a/source/bforce/prot_common.c +++ b/source/bforce/prot_common.c @@ -43,11 +43,11 @@ const char *Protocols[] = static int prot_get_next_file(s_filelist **dest, s_protinfo *pi) { - DEB((D_OUTBOUND, "prot_get_next_file")); // %s %d", hint->fn, hint->sz); + DEB((D_OUTBOUND, "prot_get_next_file")); // %s %d", hint->fn, hint->sz); s_filelist *ptrl = NULL; s_filelist *best = NULL; s_fsqueue *q = &state.queue; - s_filehint *hint = NULL; // M_GET hinting does not work good here as it spec net_name and it is unknown here (especially for PKTs) + s_filehint *hint = NULL; // M_GET hinting does not work good here as it spec net_name and it is unknown here (especially for PKTs) *dest = NULL; @@ -296,10 +296,10 @@ get_next_file: pi->send_left_num -= 1; pi->send_left_size -= ptrl->size; - if( pi->send_left_size < 0 ) - pi->send_left_size = 0; + //if( pi->send_left_size < 0 ) + // pi->send_left_size = 0; if( pi->send_left_num < 0 ) - pi->send_left_num = 0; + pi->send_left_num = 0; DEB((D_PROT, "p_tx_fopen: now opening \"%s\"", ptrl->fname)); diff --git a/source/bforce/prot_emsi.c b/source/bforce/prot_emsi.c index 6798cec..93bffd3 100644 --- a/source/bforce/prot_emsi.c +++ b/source/bforce/prot_emsi.c @@ -599,7 +599,7 @@ void emsi_set_sysinfo(s_emsi *emsi, s_emsi *remote_emsi, int hrc, s_cval_entry *hide_ptr; s_faddr *primary = NULL; char xdt[EMSI_MAXXDATETIME+1]; - time_t xtm; + time_t xtm = 0; const long options = conf_options(cf_options); const long speed = conf_number(cf_max_speed); diff --git a/source/bforce/prot_emsi_misc.c b/source/bforce/prot_emsi_misc.c index b9b68e8..c15c185 100644 --- a/source/bforce/prot_emsi_misc.c +++ b/source/bforce/prot_emsi_misc.c @@ -554,7 +554,7 @@ int emsi_parsedat(char *emsi_dat, s_emsi *emsi) /* password */ if( (p=get_field(&emsi_dat, '{', '}')) == NULL ) return(1); - if( p && *p ) strnxcpy(emsi->passwd, p, sizeof(emsi->passwd)); + if( *p ) strnxcpy(emsi->passwd, p, sizeof(emsi->passwd)); /* link codes */ if( (p=get_field(&emsi_dat, '{', '}')) == NULL ) return(1); @@ -669,21 +669,22 @@ int emsi_parsedat(char *emsi_dat, s_emsi *emsi) else if( !strcmp(p, "HFR") ) emsi->compcodes.HFR = 1; } /* Delete last comma from order list */ - emsi->proto_order[strlen(emsi->proto_order)-1] = '\0'; + if (strlen(emsi->proto_order) > 0) + emsi->proto_order[strlen(emsi->proto_order)-1] = '\0'; DEB((D_HSHAKE,"Ordered compcodes: %s",emsi->proto_order)); /* mailer information */ if( (p=get_field(&emsi_dat, '{', '}')) == NULL ) return(1); - if( p && *p ) strnxcpy(emsi->m_pid, p, sizeof(emsi->m_pid)); + if( *p ) strnxcpy(emsi->m_pid, p, sizeof(emsi->m_pid)); if( (p=get_field(&emsi_dat, '{', '}')) == NULL ) return(1); - if( p && *p ) strnxcpy(emsi->m_name, p, sizeof(emsi->m_name)); + if( *p ) strnxcpy(emsi->m_name, p, sizeof(emsi->m_name)); if( (p=get_field(&emsi_dat, '{', '}')) == NULL ) return(1); - if( p && *p ) strnxcpy(emsi->m_ver, p, sizeof(emsi->m_ver)); + if( *p ) strnxcpy(emsi->m_ver, p, sizeof(emsi->m_ver)); if( (p=get_field(&emsi_dat, '{', '}')) == NULL ) return(1); - if( p && *p ) strnxcpy(emsi->m_reg, p, sizeof(emsi->m_reg));; + if( *p ) strnxcpy(emsi->m_reg, p, sizeof(emsi->m_reg));; } else if( strcmp(tmp, "IDENT") == 0 ) { @@ -691,17 +692,17 @@ int emsi_parsedat(char *emsi_dat, s_emsi *emsi) if( (tmp=get_field(&emsi_dat, '{', '}')) == NULL ) return(1); if( (p=get_field(&tmp, '[', ']')) == NULL ) return(1); - if( p && *p ) strnxcpy(emsi->sname, p, sizeof(emsi->sname)); + if( *p ) strnxcpy(emsi->sname, p, sizeof(emsi->sname)); if( (p=get_field(&tmp, '[', ']')) == NULL ) return(1); - if( p && *p ) strnxcpy(emsi->location, p, sizeof(emsi->location)); + if( *p ) strnxcpy(emsi->location, p, sizeof(emsi->location)); if( (p=get_field(&tmp, '[', ']')) == NULL ) return(1); - if( p && *p ) strnxcpy(emsi->sysop, p, sizeof(emsi->sysop)); + if( *p ) strnxcpy(emsi->sysop, p, sizeof(emsi->sysop)); if( (p=get_field(&tmp, '[', ']')) == NULL ) return(1); - if( p && *p ) strnxcpy(emsi->phone, p, sizeof(emsi->phone));; + if( *p ) strnxcpy(emsi->phone, p, sizeof(emsi->phone));; if( (p=get_field(&tmp, '[', ']')) == NULL ) return(1); - if( p && *p ) sscanf(p, "%d", &emsi->speed); + if( *p ) sscanf(p, "%d", &emsi->speed); if( (p=get_field(&tmp, '[', ']')) == NULL ) return(1); - if( p && *p ) strnxcpy(emsi->flags, p, sizeof(emsi->flags)); + if( *p ) strnxcpy(emsi->flags, p, sizeof(emsi->flags)); } else if( strcmp(tmp, "TRX#") == 0 ) { @@ -719,7 +720,7 @@ int emsi_parsedat(char *emsi_dat, s_emsi *emsi) else if( strcmp(tmp, "TRAF") == 0 ) { if( (p=get_field(&emsi_dat, '{', '}')) == NULL ) return(1); - if( p && *p ) + if( *p ) { if( sscanf(p, "%08zX %08zX", &emsi->netmail_size, &emsi->arcmail_size) == 2 ) { @@ -735,7 +736,7 @@ int emsi_parsedat(char *emsi_dat, s_emsi *emsi) { if( (p=get_field(&emsi_dat, '{', '}')) == NULL ) return(1); if( (p=get_field(&p, '[', ']')) == NULL ) return(1); - if( p && *p ) + if( *p ) { if( sscanf(p, "%08zX", &emsi->files_size) == 1 ) { @@ -880,7 +881,7 @@ void emsi_logdat(s_emsi *emsi) if( emsi->compcodes.HFR ) strcat(flags, "HFR,"); - if( *flags ) + if( *flags && (strlen(flags) > 0) ) { flags[strlen(flags)-1] = '\0'; log(" Options : %s", flags); @@ -921,7 +922,7 @@ void emsi_logdat(s_emsi *emsi) if( emsi->have_emsi ) { if( emsi->m_name[0] || emsi->m_pid[0] - || emsi->m_ver[0] || emsi->m_reg ) + || emsi->m_ver[0] || emsi->m_reg[0] ) { log(" Mailer : %s [%s] %s/%s", emsi->m_name[0] ? string_printable(emsi->m_name) : "?", diff --git a/source/bforce/prot_hydra.c b/source/bforce/prot_hydra.c index c2159e9..7d230c2 100644 --- a/source/bforce/prot_hydra.c +++ b/source/bforce/prot_hydra.c @@ -1549,7 +1549,9 @@ int hydra_batch(s_hydrainfo *hi, s_protinfo *pi) /* * Check current CPS, session time limits, etc. */ - if( (rc = p_info(pi, 1)) ) gotoexit(rc); + rc = p_info(pi, 1); + + if( rc != PRC_NOERROR ) gotoexit(rc); /* * Send/receive as much data as possible, but without delays diff --git a/source/bforce/prot_yoohoo.c b/source/bforce/prot_yoohoo.c index d84e36a..30d75fc 100644 --- a/source/bforce/prot_yoohoo.c +++ b/source/bforce/prot_yoohoo.c @@ -85,13 +85,12 @@ static void yoohoo_put_hello(char *buffer, s_yoohoo_sysinfo *myhello) * Add domain after the end of 'Node name' * TODO: check it for buffer overflows %-I */ - if( state.n_localaddr > 0 && state.localaddrs[0].addr.domain - && *state.localaddrs[0].addr.domain ) + if( state.n_localaddr > 0 && *state.localaddrs[0].addr.domain ) { char *q; if( strlen(myhello->system) + strlen(state.localaddrs[0].addr.domain) > 57 ) { - if( strlen(state.localaddrs[0].addr.domain) < 60 ) + if( strlen(state.localaddrs[0].addr.domain) < 60 ) //PVS-Suppress V547 q = p + (60 - strlen(state.localaddrs[0].addr.domain)); else q = p; diff --git a/source/bforce/sess_call.c b/source/bforce/sess_call.c index b0c04a6..1a84fc7 100644 --- a/source/bforce/sess_call.c +++ b/source/bforce/sess_call.c @@ -210,7 +210,7 @@ int call_system_quiet(const char *connstr, bool inet) if( (exec_cmd = conf_string(cf_run_before_session)) != NULL ) { exec_result = system(exec_cmd); - if( exec_result = 0 ) + if( exec_result == 0 ) log("external application %s executed with zero return code (%i)", exec_cmd, exec_result); else logerr("external application %s executed with non-zero return code %i", exec_cmd, exec_result); @@ -378,7 +378,7 @@ int call_system_modem(void) log("calling with modem %s (%s, %s)", ftn_addrstr(abuf, state.node.addr), - (state.node.name && *state.node.name) ? state.node.name : "", + ( *state.node.name) ? state.node.name : "", string_printable(dialstring)); /* @@ -526,8 +526,8 @@ default: log("calling with internet %s (%s, %s)", ftn_addrstr(abuf, state.node.addr), - (state.node.name && *state.node.name ) ? state.node.name : "", - (state.node.host && *state.node.host) ? state.node.host : ""); + (*state.node.name ) ? state.node.name : "", + ( *state.node.host) ? state.node.host : ""); memset(abuf, '\0', BF_MAXADDRSTR+1); pbuf = xmalloc(1024); @@ -568,7 +568,7 @@ default: if( (rc = tcpip_connect(pbuf, state.tcpmode)) == 0 - && (rc = tcpip_init() == 0) ) + && ( (rc = tcpip_init()) == 0) ) { TTYSTATUS(1); rc = session(); @@ -862,7 +862,7 @@ int call_system(s_faddr addr, const s_bforce_opts *opts) } if( NULL != state.override.run && strlen(state.override.run) > 0 ) { - if ( (runrc = system(state.override.run) != 0 )) + if ( (runrc = system(state.override.run)) != 0 ) { logerr("run script \"%s\" executed with non-zero return value", state.override.run); } @@ -872,7 +872,7 @@ int call_system(s_faddr addr, const s_bforce_opts *opts) // try allowed methods and break if rc == 0 rc = -1; - if( rc && (call_mayuse & CALL_STDIO) ) + if( call_mayuse & CALL_STDIO ) { DEB((D_EVENT,"sess_call: calling stdio")); rc = call_system_quiet(opts->connect, opts->inetd); diff --git a/source/configure b/source/configure index a966685..413f597 100755 --- a/source/configure +++ b/source/configure @@ -580,12 +580,12 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='bforce' PACKAGE_TARNAME='bforce' -PACKAGE_VERSION='0.24.1' -PACKAGE_STRING='bforce 0.24.1' +PACKAGE_VERSION='0.26.2' +PACKAGE_STRING='bforce 0.26.2' PACKAGE_BUGREPORT='zx@zxalexis.ru' PACKAGE_URL='https://prj.zxalexis.ru/gitea/zx/bforce.git' -ac_default_prefix=/usr/local/fido +ac_default_prefix=/usr # Factoring default headers for most tests. ac_includes_default="\ #include @@ -1436,7 +1436,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -bforce configure 0.24 +bforce configure 0.26 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -5792,7 +5792,7 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi -ac_config_files="$ac_config_files ../debian/Makefile" +ac_config_files="$ac_config_files" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -6486,7 +6486,6 @@ do case $ac_config_target in "include/config.h") CONFIG_HEADERS="$CONFIG_HEADERS include/config.h" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "../debian/Makefile") CONFIG_FILES="$CONFIG_FILES ../debian/Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac diff --git a/source/configure.in b/source/configure.in index 017523d..5efe9be 100644 --- a/source/configure.in +++ b/source/configure.in @@ -3,7 +3,7 @@ dnl dnl $Id$ dnl #AC_INIT(bforce/bforce.c) -AC_INIT([bforce],[0.26.1],[zx@zxalexis.ru]) +AC_INIT([bforce],[0.26.2],[zx@zxalexis.ru]) AC_CONFIG_HEADER(include/config.h) AC_CANONICAL_SYSTEM dnl # Minimum Autoconf version required. diff --git a/source/include/session.h b/source/include/session.h index 649c143..f0e0bb7 100644 --- a/source/include/session.h +++ b/source/include/session.h @@ -78,13 +78,13 @@ typedef struct { } s_session_passwd; typedef struct sendopts { - int fnc:1, /* Convert outgoing file names to 8+3 format */ - holdreq:1, /* Hold .REQ files? (file requests) */ - holdhold:1, /* Hold files with HOLD flavor? */ - holdfiles:1, /* Hold all files except netmail + arcmail */ - holdxt:1, /* Hold all except netmail? */ - holdall:1, /* Hold ALL trafic!? */ - hydraRH1; /* Hydra RH1 mode (EMSI only) */ + unsigned int fnc:1, /* Convert outgoing file names to 8+3 format */ + holdreq:1, /* Hold .REQ files? (file requests) */ + holdhold:1, /* Hold files with HOLD flavor? */ + holdfiles:1, /* Hold all files except netmail + arcmail */ + holdxt:1, /* Hold all except netmail? */ + holdall:1, /* Hold ALL trafic!? */ + hydraRH1; /* Hydra RH1 mode (EMSI only) */ } s_sendopts; /*