Re: Using ‚at‘ as regular user

karu.pruun karu.pruun at gmail.com
Thu Mar 17 02:57:37 PDT 2016


On Mon, Mar 14, 2016 at 4:48 PM, Bomrek Koganvutram
<232.20711 at chiffre.aleturo.com> wrote:
> * Justin Sherrill on Mon, Mar 14, 2016 at 10:11:22AM -0400:
>> > Did I forget to do something else to make this work?  I am hesitant to
>> > believe that this is a but—according to git the relevant code is from
>> > 2010, and it seems unlikely that I’m the first one in six years to
>> > encounter it.  Or does indeed nobody use ‚at‘ anymore…? :o)
>>
>> If neither /var/at/at.allow or /var/at/at/deny exist, only root can
>> use at, going by the 'at' man page.
>>
>> I think most people are using cron, or at least I am.
>
> I al already this far.  /var/at/at.deny exists and is empty.  If I
> remote it, ‚at‘ rejects me outright and tells me that I am not allowed
> to use it.  If it exists, I can place new jobs (hence, access to ‚at‘
> works), but my jobs don’t get executed because of this… bug.
>
> I am using cron as well, but for different purposes.  For some one-off
> things such as ‚do remove this file in two months‘, ‚at‘ is just the
> right tool.
>
> --


The issue seems to be with format conversion. The nuid and ngid get
their values from fscanf a few lines earlier:

---
224  if (fscanf(stream, fmt, &nuid, &ngid, mailbuf, &send_mail) != 4)
225    perrx("File %s is in wrong format - aborting", filename);
---

where the format fmt is specified above. However, in fmt nuid and ngid
are assumed %ld, whereas nuid is uid_t which is defined, in the end,
as unsigned int (but correct me for details). So changing

%ld --> %u

resolves the issue. Open/NetBSD both use %u, FreeBSD uses %ld. I
checked that atrun works on FreeBSD, but a simple code snippet with
%ld fails to read uid on FreeBSD in the same way it fails on
DragonFly.

I attach a simple patch. I filed a bug with the patch as well.

For the impatient:

cd /usr/src/libexec/atrun
apply the patch
make
cp atrun /usr/libexec/


Cheers

Peeter

--
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Change-the-format-for-fscanf-so-atrun-correctly-read.patch
Type: application/octet-stream
Size: 883 bytes
Desc: not available
URL: <http://lists.dragonflybsd.org/pipermail/users/attachments/20160317/3ec2b976/attachment-0002.obj>


More information about the Users mailing list