Date: Mon, 23 Jun 2014 09:19:23 +0200 From: =?UTF-8?Q?Tomek_Wa=C5=82aszek?= <tmwalaszek@gmail.com> To: olli hauer <ohauer@gmx.de> Cc: freebsd-arch@freebsd.org Subject: Re: Improve cron(8) Message-ID: <CAN3T69tXGkAELJrqJ=SG%2Bm-8VNwXmvh6h7scBS_AE6AZ1fPzcw@mail.gmail.com> In-Reply-To: <53A7B645.3000801@gmx.de> References: <CAN3T69vCQTb1hU%2BAUKg%2BKLgsuCttLxYS6u2r9k3w5LM2D4zZoA@mail.gmail.com> <CAF6rxgmSL3kfh0Tt2Nw3Kh1hAe3HCdspvkKCTifLnU5QxP-f7A@mail.gmail.com> <53A7B645.3000801@gmx.de>
next in thread | previous in thread | raw e-mail | index | archive | help
2014-06-23 7:08 GMT+02:00 olli hauer <ohauer@gmx.de>:
> On 2014-06-13 09:04, Eitan Adler wrote:
> > +arch since hackers@ seems to be silent.
> >
> > On 11 June 2014 23:56, Tomek Wałaszek <tmwalaszek@gmail.com> wrote:
> >> Hello,
> >> I saw on the FreeBSD Ideas page topic about cron :).
> >> I've started updating the 'original' FreeBSD cron from sources to vixi
> cron
> >> 4.1. I think (well I hope :P) most of the features that were done in
> >> FreeBSD cron are now ported into vixi cron 4.1, there are unfortunately
> >> some missing features at the moment:
> >> - @every_second - this need to be done
> >> - -s and -o, in vixi cron 4.1 daylight time switches are enabled by
> >> default, at the moment there is no -s and -o options. So you need to
> remove
> >> '-s' from the cron rc script
> >>
> >> I've also added one feature from OpenBSD, crontab is poking cron using
> >> unix-domain socket so we don't need to have suid on crontab.
> >>
> >> Path is in the attachment. I'm testing it on my FreeBSD box and it looks
> >> good but anyway don't try it on production machines :).
> >>
> >> After the installation we have to do a few things:
> >> - Add crontab group
> >> - Change group to crontab on /var/cron/tabs
> >> - Add sticky bit on /var/cron/tabs
> >> - Add group write permissions on /var/cron/tabs
> >>
> >> This is still work in progress but if someone could have a look on this
> and
> >> give me some feedback it would be great.
> >>
> >> Regards,
> >> Tomasz Walaszek
> >>
>
> Hi Thomaz,
>
> having only a quick look into the diff but see there are also changes
> from snprintf to sprintf :( see the following snippet ).
> Anyway it seems no one is looking into PR's against cron so I like the
> idea to start with updating and looking into the PR's for cron.
>
> - if (mailto) {
> - register char **env;
> - auto char mailcmd[MAX_COMMAND];
> - auto char hostname[MAXHOSTNAMELEN];
> -
> - (void) gethostname(hostname, MAXHOSTNAMELEN);
> - (void) snprintf(mailcmd, sizeof(mailcmd),
> - MAILARGS, MAILCMD);
> + if (mailto && safe_p(usernm, mailto)) {
> + char **env;
> + char mailcmd[MAX_COMMAND];
> + char hostname[MAXHOSTNAMELEN];
> +
> + gethostname(hostname, MAXHOSTNAMELEN);
> + if (strlens(MAILFMT, MAILARG, NULL) + 1
> + >= sizeof mailcmd) {
> + fprintf(stderr, "mailcmd too long\n");
> + (void) _exit(ERROR_EXIT);
> + }
> + (void)sprintf(mailcmd, MAILFMT, MAILARG);
>
> --
> olli
>
Hi,
Thanks for finding this sprintf, I will fix it. I'm quite sure :) that
there are some parts that need to be fixed or rewritten.
I will generate a patch against HEAD and submit a bug with the patch.
Thanks guys for good words ! :)
--
Best regards,
Tomasz Wałaszek
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAN3T69tXGkAELJrqJ=SG%2Bm-8VNwXmvh6h7scBS_AE6AZ1fPzcw>
