Skip to content

Commit

Permalink
updated indimail-mta, daemontools, ucspi-tcp
Browse files Browse the repository at this point in the history
1. indimail-mta: removed extra wsp in atrn.c, filterit_sub.c, maildir.c,
   mini-smtpd.c, qcat.c, smtpd.c
2. indimail-mta, daemontools, ucspi-tcp: installer.c: fixed out of memory
   error due to incorrect allocation of zerobuf
3. daemontools: minisvc.in: updated RCS log
  • Loading branch information
mbhangui committed Mar 11, 2024
1 parent 198b9c6 commit 96d13a3
Show file tree
Hide file tree
Showing 10 changed files with 59 additions and 44 deletions.
24 changes: 14 additions & 10 deletions daemontools-x/installer.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* $Id: installer.c,v 1.25 2024-02-12 17:19:34+05:30 Cprogrammer Exp mbhangui $
* $Id: installer.c,v 1.26 2024-03-11 17:54:44+05:30 Cprogrammer Exp mbhangui $
* taken from ezmlm-0.54
*/
#include <sys/types.h>
Expand Down Expand Up @@ -291,7 +291,7 @@ doit(stralloc *line, int uninstall, int check)
char *x;
char *type, *uidstr, *gidstr, *modestr, *mid, *name, *zerobuf;
int fdin, fdout, opt;
unsigned long m, size;
unsigned long m, size = 0;
unsigned int xlen, i;
uid_t uid;
gid_t gid;
Expand Down Expand Up @@ -520,11 +520,11 @@ doit(stralloc *line, int uninstall, int check)
} else
strerr_die3sys(111, FATAL, name, ": ");
}
if (mode == -1) {
if (lstat(name, &st) == -1)
strerr_die4sys(111, FATAL, "lstat: ", name, ": ");
if (lstat(name, &st) == -1)
strerr_die4sys(111, FATAL, "lstat: ", name, ": ");
if (mode == -1)
mode = st.st_mode;
}
size = st.st_size;
}
print_info("install file", *type == 'f' ? name : "/dev/zero", target.s, mode == -1 ? 0644 : mode, uid, gid, size);
if ((fdin = open_read(*type == 'z' ? "/dev/zero" : name)) == -1) {
Expand All @@ -533,8 +533,6 @@ doit(stralloc *line, int uninstall, int check)
else
strerr_die4sys(111, FATAL, "unable to read ", name, ": ");
}
if (!(zerobuf = (char *) alloc(sizeof(char) * size)))
nomem();
substdio_fdbuf(&ssin, read, fdin, inbuf, sizeof (inbuf));
if ((fdout = open_trunc(target.s)) == -1)
strerr_die4sys(111, FATAL, "unable to write ", target.s, ": ");
Expand All @@ -550,18 +548,20 @@ doit(stralloc *line, int uninstall, int check)
}
} else
if (*type == 'z') {
if (!(zerobuf = (char *) alloc(sizeof(char) * size)))
nomem();
if (substdio_get(&ssin, zerobuf, size) == -1)
strerr_die2sys(111, FATAL, "unable to read /dev/zero: ");
if (substdio_put(&ssout, zerobuf, size) == -1)
strerr_die4sys(111, FATAL, "unable to write ", target.s, ": ");
alloc_free(zerobuf);
}
close(fdin);
if (substdio_flush(&ssout) == -1)
strerr_die4sys(111, FATAL, "unable to write ", target.s, ": ");
if (fsync(fdout) == -1)
strerr_die4sys(111, FATAL, "unable to write ", target.s, ": ");
close(fdout);
alloc_free(zerobuf);
if (my_uid) {
#ifdef NETQMAIL
substdio_puts(subfdout, "\tchmod ");
Expand Down Expand Up @@ -669,14 +669,18 @@ main(int argc, char **argv)
void
getversion_installer_c()
{
static const char *x = "$Id: installer.c,v 1.25 2024-02-12 17:19:34+05:30 Cprogrammer Exp mbhangui $";
static const char *x = "$Id: installer.c,v 1.26 2024-03-11 17:54:44+05:30 Cprogrammer Exp mbhangui $";

if (x)
x++;
}

/*
* $Log: installer.c,v $
* Revision 1.26 2024-03-11 17:54:44+05:30 Cprogrammer
* fixed displaying size variable
* fixed allocation of zerobuf variable
*
* Revision 1.25 2024-02-12 17:19:34+05:30 Cprogrammer
* added 'z' option to create files with fixed number of zeros
*
Expand Down
7 changes: 5 additions & 2 deletions daemontools-x/minisvc.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# $Id: minisvc.in,v 1.37 2023-12-29 23:38:07+05:30 Cprogrammer Exp mbhangui $
# $Id: minisvc.in,v 1.38 2024-03-11 17:42:15+05:30 Cprogrammer Exp mbhangui $
#

#
Expand All @@ -11,7 +11,7 @@ shareddir=@shareddir@
LOGDIR=@logdir@
libexecdir=@libexecdir@
host=@HOST@
RCSID="# \$Id: minisvc.in,v 1.37 2023-12-29 23:38:07+05:30 Cprogrammer Exp mbhangui $"
RCSID="# \$Id: minisvc.in,v 1.38 2024-03-11 17:42:15+05:30 Cprogrammer Exp mbhangui $"

#
# End of User Configuration
Expand Down Expand Up @@ -2873,6 +2873,9 @@ fi
exit 0
#
# $Log: minisvc.in,v $
# Revision 1.38 2024-03-11 17:42:15+05:30 Cprogrammer
# updated RCS log
#
# Revision 1.37 2023-12-29 23:38:07+05:30 Cprogrammer
# added missing definitions for usefsync, usefdatasync, usesyncdir
#
Expand Down
2 changes: 1 addition & 1 deletion indimail-mta-x/atrn.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ atrn_queue(char *arg, char *remoteip)
case 0:
sig_pipedefault();
/*- dup 0, 1 to 6,7 for serialsmtp */
dup2(1, 7);
dup2(1, 7);
dup2(0, 6);
if (!stralloc_copys(&bin, auto_libexec) ||
!stralloc_catb(&bin, "/atrn", 5) ||
Expand Down
4 changes: 2 additions & 2 deletions indimail-mta-x/filterit_sub.c
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ take_action(substdio *ssin, substdio *ssout, char *header, int act_type,
char *MailDirNames[] = { "cur", "new", "tmp", };
char *overquota = "Recipient's mailbox is full, message returned to sender. (#5.2.2)";

if (!doit &&
if (!doit &&
subprintf(ssout, matched ? "Matched Header=[%s], " : "Unmatched Header=[%s], ", header) == -1)
strerr_die2sys(111, FATAL, "unable to write output: ");
switch (act_type)
Expand Down Expand Up @@ -403,7 +403,7 @@ filterit_sub1(int argc, char **argv)
};
char *act[] = {"exit", "forward", "maildir", 0};
char ssinbuf[BUFSIZE_IN], ssoutbuf[BUFSIZE_OUT];
int opt, i, match, negate = 0, keep_continue = 0,
int opt, i, match, negate = 0, keep_continue = 0,
c_opt = 0, a_opt = 0, default_a_opt = 0, in_header;
substdio ssin, ssout;

Expand Down
24 changes: 14 additions & 10 deletions indimail-mta-x/installer.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* $Id: installer.c,v 1.25 2024-02-12 17:19:34+05:30 Cprogrammer Exp mbhangui $
* $Id: installer.c,v 1.26 2024-03-11 17:54:44+05:30 Cprogrammer Exp mbhangui $
* taken from ezmlm-0.54
*/
#include <sys/types.h>
Expand Down Expand Up @@ -291,7 +291,7 @@ doit(stralloc *line, int uninstall, int check)
char *x;
char *type, *uidstr, *gidstr, *modestr, *mid, *name, *zerobuf;
int fdin, fdout, opt;
unsigned long m, size;
unsigned long m, size = 0;
unsigned int xlen, i;
uid_t uid;
gid_t gid;
Expand Down Expand Up @@ -520,11 +520,11 @@ doit(stralloc *line, int uninstall, int check)
} else
strerr_die3sys(111, FATAL, name, ": ");
}
if (mode == -1) {
if (lstat(name, &st) == -1)
strerr_die4sys(111, FATAL, "lstat: ", name, ": ");
if (lstat(name, &st) == -1)
strerr_die4sys(111, FATAL, "lstat: ", name, ": ");
if (mode == -1)
mode = st.st_mode;
}
size = st.st_size;
}
print_info("install file", *type == 'f' ? name : "/dev/zero", target.s, mode == -1 ? 0644 : mode, uid, gid, size);
if ((fdin = open_read(*type == 'z' ? "/dev/zero" : name)) == -1) {
Expand All @@ -533,8 +533,6 @@ doit(stralloc *line, int uninstall, int check)
else
strerr_die4sys(111, FATAL, "unable to read ", name, ": ");
}
if (!(zerobuf = (char *) alloc(sizeof(char) * size)))
nomem();
substdio_fdbuf(&ssin, read, fdin, inbuf, sizeof (inbuf));
if ((fdout = open_trunc(target.s)) == -1)
strerr_die4sys(111, FATAL, "unable to write ", target.s, ": ");
Expand All @@ -550,18 +548,20 @@ doit(stralloc *line, int uninstall, int check)
}
} else
if (*type == 'z') {
if (!(zerobuf = (char *) alloc(sizeof(char) * size)))
nomem();
if (substdio_get(&ssin, zerobuf, size) == -1)
strerr_die2sys(111, FATAL, "unable to read /dev/zero: ");
if (substdio_put(&ssout, zerobuf, size) == -1)
strerr_die4sys(111, FATAL, "unable to write ", target.s, ": ");
alloc_free(zerobuf);
}
close(fdin);
if (substdio_flush(&ssout) == -1)
strerr_die4sys(111, FATAL, "unable to write ", target.s, ": ");
if (fsync(fdout) == -1)
strerr_die4sys(111, FATAL, "unable to write ", target.s, ": ");
close(fdout);
alloc_free(zerobuf);
if (my_uid) {
#ifdef NETQMAIL
substdio_puts(subfdout, "\tchmod ");
Expand Down Expand Up @@ -669,14 +669,18 @@ main(int argc, char **argv)
void
getversion_installer_c()
{
static const char *x = "$Id: installer.c,v 1.25 2024-02-12 17:19:34+05:30 Cprogrammer Exp mbhangui $";
static const char *x = "$Id: installer.c,v 1.26 2024-03-11 17:54:44+05:30 Cprogrammer Exp mbhangui $";

if (x)
x++;
}

/*
* $Log: installer.c,v $
* Revision 1.26 2024-03-11 17:54:44+05:30 Cprogrammer
* fixed displaying size variable
* fixed allocation of zerobuf variable
*
* Revision 1.25 2024-02-12 17:19:34+05:30 Cprogrammer
* added 'z' option to create files with fixed number of zeros
*
Expand Down
2 changes: 1 addition & 1 deletion indimail-mta-x/maildir.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ append(prioq *pq, stralloc *filenames, char *subdir, datetime_sec my_time)
continue;
}
if (st.st_mtime < my_time) { /*- don't want to mix up the order */
/*
/*
* this also means that when maildirserial is called
* it will skip all files having mtime >= start time of
* maildirserial
Expand Down
2 changes: 1 addition & 1 deletion indimail-mta-x/mini-smtpd.c
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ smtp_mail(char *arg)
mailfrom_parms(arg);
convertbarelf = env_get("ALLOW_BARELF") ? 1 : 0;
seenmail = 1;
if (!stralloc_copys(&rcptto, "") ||
if (!stralloc_copys(&rcptto, "") ||
!stralloc_copys(&mailfrom, addr.s) ||
!stralloc_0(&mailfrom))
die_nomem();
Expand Down
12 changes: 6 additions & 6 deletions indimail-mta-x/qcat.c
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
/*
* qcat -- concatenate files and print on the standard output.
* Copyright (C) 1988-2024 Free Software Foundation, Inc.
*
*
* 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* convert() function code taken and adaptred from coreutils/src/cat.c
* By tege@sics.se, Torbjörn Granlund, advised by rms, Richard Stallman.
* By tege@sics.se, Torbjörn Granlund, advised by rms, Richard Stallman.
*
* $Id: qcat.c,v 1.11 2024-02-22 08:35:30+05:30 Cprogrammer Exp mbhangui $
*/
Expand Down Expand Up @@ -105,7 +105,7 @@ convert(char *inbuf, int len, int show_nonprinting, int show_tabs, int show_ends
if (ch < 128 + 127) {
inbuf[i] -= 128;
substdio_bput(&ssout, inbuf + i, 1);
} else
} else
substdio_bput(&ssout, "^?", 2);
} else {
substdio_bput(&ssout, "^", 1);
Expand Down
2 changes: 1 addition & 1 deletion indimail-mta-x/smtpd.c
Original file line number Diff line number Diff line change
Expand Up @@ -2622,7 +2622,7 @@ open_control_files2()
if (env_get("SPAMFILTER"))
open_control_once(&spsndrok, 0, &spsndrFn, 0, "SPAMIGNORE", 0, "spamignore", 0, &spsndr, &mapspsndr, 0);
/*-
* DNSCHECK
* DNSCHECK
* Look up "MAIL from:" addresses to skip for DNS check in control/nodnscheck.
*/
if (!(nodnscheck = env_get("NODNSCHECK")))
Expand Down
24 changes: 14 additions & 10 deletions ucspi-tcp-x/installer.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* $Id: installer.c,v 1.25 2024-02-12 17:19:34+05:30 Cprogrammer Exp mbhangui $
* $Id: installer.c,v 1.26 2024-03-11 17:54:44+05:30 Cprogrammer Exp mbhangui $
* taken from ezmlm-0.54
*/
#include <sys/types.h>
Expand Down Expand Up @@ -291,7 +291,7 @@ doit(stralloc *line, int uninstall, int check)
char *x;
char *type, *uidstr, *gidstr, *modestr, *mid, *name, *zerobuf;
int fdin, fdout, opt;
unsigned long m, size;
unsigned long m, size = 0;
unsigned int xlen, i;
uid_t uid;
gid_t gid;
Expand Down Expand Up @@ -520,11 +520,11 @@ doit(stralloc *line, int uninstall, int check)
} else
strerr_die3sys(111, FATAL, name, ": ");
}
if (mode == -1) {
if (lstat(name, &st) == -1)
strerr_die4sys(111, FATAL, "lstat: ", name, ": ");
if (lstat(name, &st) == -1)
strerr_die4sys(111, FATAL, "lstat: ", name, ": ");
if (mode == -1)
mode = st.st_mode;
}
size = st.st_size;
}
print_info("install file", *type == 'f' ? name : "/dev/zero", target.s, mode == -1 ? 0644 : mode, uid, gid, size);
if ((fdin = open_read(*type == 'z' ? "/dev/zero" : name)) == -1) {
Expand All @@ -533,8 +533,6 @@ doit(stralloc *line, int uninstall, int check)
else
strerr_die4sys(111, FATAL, "unable to read ", name, ": ");
}
if (!(zerobuf = (char *) alloc(sizeof(char) * size)))
nomem();
substdio_fdbuf(&ssin, read, fdin, inbuf, sizeof (inbuf));
if ((fdout = open_trunc(target.s)) == -1)
strerr_die4sys(111, FATAL, "unable to write ", target.s, ": ");
Expand All @@ -550,18 +548,20 @@ doit(stralloc *line, int uninstall, int check)
}
} else
if (*type == 'z') {
if (!(zerobuf = (char *) alloc(sizeof(char) * size)))
nomem();
if (substdio_get(&ssin, zerobuf, size) == -1)
strerr_die2sys(111, FATAL, "unable to read /dev/zero: ");
if (substdio_put(&ssout, zerobuf, size) == -1)
strerr_die4sys(111, FATAL, "unable to write ", target.s, ": ");
alloc_free(zerobuf);
}
close(fdin);
if (substdio_flush(&ssout) == -1)
strerr_die4sys(111, FATAL, "unable to write ", target.s, ": ");
if (fsync(fdout) == -1)
strerr_die4sys(111, FATAL, "unable to write ", target.s, ": ");
close(fdout);
alloc_free(zerobuf);
if (my_uid) {
#ifdef NETQMAIL
substdio_puts(subfdout, "\tchmod ");
Expand Down Expand Up @@ -669,14 +669,18 @@ main(int argc, char **argv)
void
getversion_installer_c()
{
static const char *x = "$Id: installer.c,v 1.25 2024-02-12 17:19:34+05:30 Cprogrammer Exp mbhangui $";
static const char *x = "$Id: installer.c,v 1.26 2024-03-11 17:54:44+05:30 Cprogrammer Exp mbhangui $";

if (x)
x++;
}

/*
* $Log: installer.c,v $
* Revision 1.26 2024-03-11 17:54:44+05:30 Cprogrammer
* fixed displaying size variable
* fixed allocation of zerobuf variable
*
* Revision 1.25 2024-02-12 17:19:34+05:30 Cprogrammer
* added 'z' option to create files with fixed number of zeros
*
Expand Down

0 comments on commit 96d13a3

Please sign in to comment.