From owner-freebsd-arch@FreeBSD.ORG Mon Jun 23 07:19:24 2014 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AB46B76C for ; Mon, 23 Jun 2014 07:19:24 +0000 (UTC) Received: from mail-oa0-x234.google.com (mail-oa0-x234.google.com [IPv6:2607:f8b0:4003:c02::234]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 74102260A for ; Mon, 23 Jun 2014 07:19:24 +0000 (UTC) Received: by mail-oa0-f52.google.com with SMTP id j17so9579896oag.25 for ; Mon, 23 Jun 2014 00:19:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=GJcw8DFSms2dsEmtg67fMqYmZsf+LrHDCe2hc9gsGpU=; b=XzdbXMfjD8NdSFAzyh58PEWr81ERY/Uv6aNrNAKIPQjo8jngEHvveE0fB38AzMZ6Xo Sc0s5iDN4VVsdCYmRFFpgdLyHalRhbup5h1v+/2ZfMNCTVBYvwObv2HecgFUuWA+CUiy UKBHYauPSnNBGL8AFY1IPxJzZY8B2XRQrVUJ9CbUzv1GJtWaoknyp47GaVwJWyVKBrl9 JwoiyPdRcjehL6IXW5UYdyeMIdyiqCFDjWlTpcSeL4bEBuUnCS1zJpY8oFplmyqjESKW ruXxSSVDk2wsB+7V+DCubh3M6qDpkoXs8rerz/OEwgcAqy0TxaKphaBO9oHW5h3To8YS ukLw== MIME-Version: 1.0 X-Received: by 10.60.15.231 with SMTP id a7mr1355036oed.50.1403507963710; Mon, 23 Jun 2014 00:19:23 -0700 (PDT) Received: by 10.76.154.8 with HTTP; Mon, 23 Jun 2014 00:19:23 -0700 (PDT) In-Reply-To: <53A7B645.3000801@gmx.de> References: <53A7B645.3000801@gmx.de> Date: Mon, 23 Jun 2014 09:19:23 +0200 Message-ID: Subject: Re: Improve cron(8) From: =?UTF-8?Q?Tomek_Wa=C5=82aszek?= To: olli hauer Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.18 Cc: freebsd-arch@freebsd.org X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Jun 2014 07:19:24 -0000 2014-06-23 7:08 GMT+02:00 olli hauer : > On 2014-06-13 09:04, Eitan Adler wrote: > > +arch since hackers@ seems to be silent. > > > > On 11 June 2014 23:56, Tomek Wa=C5=82aszek 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 unfortunatel= y > >> 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 loo= ks > >> 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 thi= s > 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 > + >=3D 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 ! :) --=20 Best regards, Tomasz Wa=C5=82aszek