File: secureware.c

package info (click to toggle)
ibcs 971113-3
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 1,108 kB
  • ctags: 2,061
  • sloc: ansic: 14,910; makefile: 280; sh: 203; asm: 47; perl: 18; pascal: 2
file content (61 lines) | stat: -rw-r--r-- 1,613 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*
 *  linux/ibcs/secureware.c
 *
 *  Copyright (C) 1994  Mike Jagdis (jaggy@purplet.demon.co.uk)
 *
 * $Id: secureware.c,v 1.4 1995/02/13 10:13:13 mike Exp $
 * $Source: /usr/CVS/ibcs/iBCSemul/secureware.c,v $
 *
 * SecureWare, Inc. provided the C2 security subsystem used on SCO Unix.
 * This is not that package. This does not even attempt to emulate
 * that package. This emulates just enough of the "obvious" bits to
 * allow some programs to get a bit further. It is not useful to
 * try to implement C2 security in an emulator. Nor is it particularly
 * useful to run SCO's secure admin programs on Linux anyway...
 */

#include <linux/config.h>

#include <linux/module.h>
#include <linux/version.h>

#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/sched.h>

#include <ibcs/ibcs.h>

#ifdef IBCS_TRACE
#include <ibcs/trace.h>
#endif


int
sw_security(int cmd, void *p1, void *p2, void *p3, void *p4, void *p5)
{
	switch (cmd) {
		case 1: /* getluid */
			/* We want the login user id. We don't have it
			 * specifically so we'll just use the real uid
			 * instead - it should be good enough.
			 */
			return current->uid;

		case 2: /* setluid */
			/* Strictly we should only be able to call setluid()
			 * once but we can't enforce that. We have the choice
			 * between having it always succeed or always fail.
			 * Since setluid() should only ever be invoked by
			 * things like login processes we always fail it.
			 */
			return -EPERM;

		case 0:
		case 3:
		case 4:
		default:
			printk(KERN_ERR "iBCS: unsupported security call cmd=%d\n",
				cmd);
			return -EINVAL;
	}
}