/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1996-2012 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
/*
* Glenn Fowler
* AT&T Research
*
* atx -- the at impersonator
*
* cd AT_JOB_DIR
* $PWD/AT_EXEC_FILE $SHELL <job>
*/
#include "at.h"
/*
* prepend current date-time to buffer on fd==2
* and drop the initial command label if any
*/
static ssize_t
{
register char* s;
register int i;
register ssize_t r;
register ssize_t z;
r = 0;
{
i = strlen(s);
s[i++] = ' ';
r = -1;
else
r += z;
if (*s == ':')
{
n -= s - (char*)buf;
buf = (void*)s;
break;
}
}
r = -1;
else if (r >= 0)
r += z;
return r;
}
int
{
register int n = 0;
unsigned long uid;
unsigned long gid;
unsigned long tid;
if (argc != 3 ||
error(ERROR_SYSTEM|3, "%s %s group denied (gid=%u egid=%u => gid=%d)", argv[2], error_info.id, getgid(), getegid(), gid);
error(ERROR_SYSTEM|3, "%s %s user denied (uid=%u euid=%u => uid=%d)", argv[2], error_info.id, getuid(), geteuid(), uid);
setsid();
argv++;
return 1;
}