[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: at was broken now is fixed

for you on google:
at was broken because it would accept jobs from a user with a username longer 
than 8 characters, but it would not execute those jobs

at the following url is a bug report and a patch:

that patch is at the end of this message

Encouraged and advised by members of this list, I did the following:
cd ~/tmp
apt-get source at
patch -p0 < the_name_I_saved_the_patch_as
cd at-3.1.8  the version number will probably be the same when you read this, 
thats part of the problem. (do they have flying cars yet?)
fakeroot dpkg-buildpackage
cd ..
su to become root
dpkg -i at*.deb
exit to become me again

I then tested it by running an job at +1min
if you changed your /etc/at.allow and /etc/at.deny to make things work, you 
may want to put them back the way they were.  On my machine all I have to do 
is remove at.allow  I think.

good luck

patch used follows:

diff -ruN at-3.1.8/atd.c at-3.1.8.hs/atd.c
--- at-3.1.8/atd.c Thu Oct 11 22:18:41 2001
+++ at-3.1.8.hs/atd.c Thu Oct 11 22:18:02 2001
@@ -196,7 +196,8 @@
     pid_t pid;
     int fd_out, fd_in;
-    char mailbuf[9], jobbuf[9];
+    char jobbuf[9];
+    char *mailbuf = NULL;
     char *mailname = NULL;
     char *newname;
     FILE *stream;
@@ -299,10 +300,22 @@
      * NFS and works with local file systems.  It's not clear where
      * the bug is located.  -Joey
-    if (fscanf(stream, "#!/bin/sh\n# atrun uid=%d gid=%d\n# mail %8s %d",
-        &nuid, &ngid, mailbuf, &send_mail) != 4)
- pabort("File %.500s is in wrong format - aborting",
-        filename);
+    /* On modern (?) systems user names may be longer than 8, even than
+     * 16 characters.  This breaks the daemon.  (SuSE patched it to allow
+     * 16 characters here, but Murphy promises that this will be to
+     * small too ;-)
+     *
+     * I've patched the next code line to make use of the NON ANSI
+     * extension %a (found in GNU scanf).  So enough space is
+     * malloc(3)ed for the mailbuf (mailname).  I don't care about
+     * free(3)ing, since this code runs only for a very limited time and
+     * exits. hs@schlittermann.de
+     */
+    if (fscanf(stream, "#!/bin/sh\n# atrun uid=%d gid=%d\n# mail %as %d",
+        &nuid, &ngid, &mailbuf, &send_mail) != 4)
+ pabort("File %.500s is in %s wrong format - aborting",
+        filename, mailbuf);
     if (mailbuf[0] == '-')
  pabort("illegal mail name %.300s in job %8lu (%.300s)", mailbuf,
diff -ruN at-3.1.8/debian/changelog at-3.1.8.hs/debian/changelog
--- at-3.1.8/debian/changelog Thu Oct 11 22:18:41 2001
+++ at-3.1.8.hs/debian/changelog Thu Oct 11 22:18:02 2001
@@ -1,3 +1,9 @@
+at (3.1.8-10.1) frozen unstable; urgency=high
+  * fixed the limit on username length introduced by atd.
+ -- Heiko Schlittermann <heiko@lotte.sax.de>  Thu, 11 Oct 2001 21:59:19 +0200

Reply to: