Date: Sat, 15 Feb 1997 09:34:44 -0800 (PST) From: mark thompson <thompson@tgsoft.com> To: freebsd-questions@freebsd.com Subject: at Message-ID: <199702151734.JAA13816@squirrel.tgsoft.com>
next in thread | raw e-mail | index | archive | help
I sometimes like to write at scripts that resubmit themselves, perhaps one day later (sometimes this is cooler than using cron). This doesn't work on FreeBSD 2.1.6 (at least on my system) because the resubmitted script starts out with: #! /bin/sh # mail root 0 and the code in atrun.c does this: if (fscanf(stream, "#! /bin/sh\n# mail %8s %d", mailbuf, &send_mail) == 2) { mailname = mailbuf; pentry = getpwnam(mailname); if (pentry == NULL || pentry->pw_uid != uid) { syslog(LOG_ERR,"Userid %lu mismatch name %s - aborting job %s", (unsigned long) uid, mailname, filename); exit(EXIT_FAILURE); } } and pukes because 'root' is not my name. I looked at at.c: /* Get the userid to mail to, first by trying getlogin(), which reads * /etc/utmp, then from LOGNAME, finally from getpwuid(). */ mailname = getlogin(); if (mailname == NULL) mailname = getenv("LOGNAME"); if ((mailname == NULL) || (mailname[0] == '\0') || (strlen(mailname) > 8) || (getpwnam(mailname)==NULL)) { pass_entry = getpwuid(getuid()); if (pass_entry != NULL) mailname = pass_entry->pw_name; } obviously, getlogin is succeeding, because LOGNAME is set correctly in the at job. atrun.c does not do a setlogin. Should it? -mark --HAA13697.856020498/squirrel.tgsoft.com-- ------- End of forwarded message -------
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199702151734.JAA13816>