~ubuntu-branches/ubuntu/breezy/uucp/breezy

« back to all changes in this revision

Viewing changes to contrib/amiga.c

  • Committer: Bazaar Package Importer
  • Author(s): Peter Palfrader
  • Date: 2004-12-30 15:30:22 UTC
  • mfrom: (2.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20041230153022-mx4cdr9j3u9bldo3
Tags: 1.07-12
Add cs localisation for debconf templates (closes: #287305).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* Wrapper code for Taylor UUCP on Amiga Unix (SVR4) for cron invoked UUCP */
2
 
/* processes.                                                              */
3
 
 
4
 
/* The problem:  Cron is not a "licensed" process. any process that grabs a 
5
 
   controlling terminal needs to be licensed.  Taylor UUCP needs controlling
6
 
   terminals.  Taylor UUCP does relinquish the controlling terminal before 
7
 
   fork(), so the "UUCP" license is appropriate. 
8
 
   This simple program does the "right" thing, but *MUST* be SETUID ROOT */
9
 
 
10
 
/* Written by: Lawrence E. Rosenman <ler@lerami.lerctr.org> */
 
2
/* uucico. */
 
3
 
 
4
/* The problem: Cron and rmail (as forked by uuxqt, which may in
 
5
   turn invoke uucico) are not "licensed" processes. Any process
 
6
   that grabs a controlling terminal needs to be licensed.  Taylor
 
7
   UUCP needs controlling terminals.  Taylor UUCP does relinquish
 
8
   the controlling terminal before fork(), so the "UUCP" license is
 
9
   appropriate.  This simple program does the "right" thing, but
 
10
   *MUST* be SETUID ROOT.
 
11
 
 
12
   To use this program, you must move 'uucico' to 'uucico.real' (or
 
13
   change the *name = below), compile this program, move it to where
 
14
   uucico was originally, and make it SETUID ROOT. 
 
15
 
 
16
   This program is intended to be used as a wapper for Taylor UUCP's
 
17
   uucico so that the annoying 'unlicensed user attempted to fork'
 
18
   messages are eliminated.  */
 
19
 
 
20
/* Written by: Lawrence E. Rosenman <ler@lerami.lerctr.org>
 
21
   Modified by: Donald Phillips <don@blkhole.resun.com> */
11
22
 
12
23
#include <sys/sysm68k.h>
13
24
#include <sys/types.h>
19
30
int main(int argc,char *argv[],char *envp)
20
31
{
21
32
  struct passwd *pw;
22
 
  char   name[256];
 
33
  char   *name = {"/usr/lib/uucp/uucico.real"};
23
34
 
24
 
  strcpy(name,"/usr/local/lib/uucp/uucico");
25
35
  if (sysm68k(_m68k_LIMUSER,EUA_GET_LIC) == 0 ) { /* are we unlicensed? */
26
 
          if (sysm68k(_m68k_LIMUSER,EUA_UUCP) == -1) { /* yes, get a "uucp" license */
27
 
                 fprintf(stderr,"sysm68k failed, errno=%d\n",errno); /* we didn't? crab it */
28
 
                 exit(errno);
29
 
      }
30
 
  }
31
 
 
32
 
  pw = getpwnam("uucp"); /* get the Password Entry for uucp */
33
 
  if (pw == NULL)
34
 
  {
35
 
         fprintf(stderr,"User ID \"uucp\" doesn't exist.\n");
36
 
         exit(1);
37
 
  }
38
 
  setgid(pw->pw_gid); /* set gid to uucp */
39
 
  setuid(pw->pw_uid); /* set uid to uucp */ 
40
 
  argv[0]=name; /* have PS not lie... */
41
 
  execv("/usr/local/lib/uucp/uucico",argv); /* go to the real program */
 
36
    if (sysm68k(_m68k_LIMUSER,EUA_UUCP) == -1) { /* yes, get a "uucp"
 
37
                                                    license */
 
38
      fprintf(stderr,"sysm68k failed, errno=%d\n",errno); /* we didn't grab
 
39
                                                             it? */
 
40
      exit(errno);
 
41
    }
 
42
 
 
43
    pw = getpwnam("uucp");        /* get the Password Entry for uucp */
 
44
    if (pw == NULL) {
 
45
      fprintf(stderr,"User ID \"uucp\" doesn't exist.\n");
 
46
      exit(1);
 
47
    }
 
48
    setgid(pw->pw_gid);           /* set gid to uucp */
 
49
    setuid(pw->pw_uid);           /* set uid to uucp */ 
 
50
  }
 
51
 
 
52
  argv[0]=name;                 /* have PS not lie... */
 
53
  execv(name, argv);            /* go to the real program */
42
54
  exit(errno);
43
55
}