aboutsummaryrefslogtreecommitdiff
path: root/gnu/libexec/uucp/contrib/amiga.c
diff options
context:
space:
mode:
authorsvn2git <svn2git@FreeBSD.org>1994-07-01 08:00:00 +0000
committersvn2git <svn2git@FreeBSD.org>1994-07-01 08:00:00 +0000
commit5e0e9b99dc3fc0ecd49d929db0d57c784b66f481 (patch)
treee779b5a6edddbb949b7990751b12d6f25304ba86 /gnu/libexec/uucp/contrib/amiga.c
parenta16f65c7d117419bd266c28a1901ef129a337569 (diff)
downloadsrc-releng/1.tar.gz
src-releng/1.zip
This commit was manufactured to restore the state of the 1.1.5.1-RELEASE image. Releases prior to 5.3-RELEASE are omitting the secure/ and crypto/ subdirs.
Diffstat (limited to 'gnu/libexec/uucp/contrib/amiga.c')
-rw-r--r--gnu/libexec/uucp/contrib/amiga.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/gnu/libexec/uucp/contrib/amiga.c b/gnu/libexec/uucp/contrib/amiga.c
new file mode 100644
index 000000000000..d982364cfd57
--- /dev/null
+++ b/gnu/libexec/uucp/contrib/amiga.c
@@ -0,0 +1,43 @@
+/* Wrapper code for Taylor UUCP on Amiga Unix (SVR4) for cron invoked UUCP */
+/* processes. */
+
+/* The problem: Cron is not a "licensed" process. any process that grabs a
+ controlling terminal needs to be licensed. Taylor UUCP needs controlling
+ terminals. Taylor UUCP does relinquish the controlling terminal before
+ fork(), so the "UUCP" license is appropriate.
+ This simple program does the "right" thing, but *MUST* be SETUID ROOT */
+
+/* Written by: Lawrence E. Rosenman <ler@lerami.lerctr.org> */
+
+#include <sys/sysm68k.h>
+#include <sys/types.h>
+#include <stdio.h>
+#include <errno.h>
+#include <unistd.h>
+#include <pwd.h>
+
+int main(int argc,char *argv[],char *envp)
+{
+ struct passwd *pw;
+ char name[256];
+
+ strcpy(name,"/usr/local/lib/uucp/uucico");
+ if (sysm68k(_m68k_LIMUSER,EUA_GET_LIC) == 0 ) { /* are we unlicensed? */
+ if (sysm68k(_m68k_LIMUSER,EUA_UUCP) == -1) { /* yes, get a "uucp" license */
+ fprintf(stderr,"sysm68k failed, errno=%d\n",errno); /* we didn't? crab it */
+ exit(errno);
+ }
+ }
+
+ pw = getpwnam("uucp"); /* get the Password Entry for uucp */
+ if (pw == NULL)
+ {
+ fprintf(stderr,"User ID \"uucp\" doesn't exist.\n");
+ exit(1);
+ }
+ setgid(pw->pw_gid); /* set gid to uucp */
+ setuid(pw->pw_uid); /* set uid to uucp */
+ argv[0]=name; /* have PS not lie... */
+ execv("/usr/local/lib/uucp/uucico",argv); /* go to the real program */
+ exit(errno);
+}