Deleted Added
full compact
id.c (32025) id.c (32663)
1/*-
2 * Copyright (c) 1997 Brian Somers <brian@Awfulhak.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
1/*-
2 * Copyright (c) 1997 Brian Somers <brian@Awfulhak.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $Id: id.c,v 1.4 1997/12/21 12:11:05 brian Exp $
26 * $Id: id.c,v 1.5 1997/12/27 19:23:12 brian Exp $
27 */
28
29#include <sys/types.h>
30#include <sys/socket.h>
31
32#include <sys/ioctl.h>
33#include <fcntl.h>
34#include <stdio.h>
27 */
28
29#include <sys/types.h>
30#include <sys/socket.h>
31
32#include <sys/ioctl.h>
33#include <fcntl.h>
34#include <stdio.h>
35#include <stdlib.h>
36#include <sysexits.h>
37#include <unistd.h>
38
39#include "command.h"
40#include "mbuf.h"
41#include "log.h"
42#include "main.h"
43#ifdef __OpenBSD__
44#include <util.h>
45#else
46#include <libutil.h>
47#endif
48#include "id.h"
49
50static int uid;
35#include <sysexits.h>
36#include <unistd.h>
37
38#include "command.h"
39#include "mbuf.h"
40#include "log.h"
41#include "main.h"
42#ifdef __OpenBSD__
43#include <util.h>
44#else
45#include <libutil.h>
46#endif
47#include "id.h"
48
49static int uid;
51static int gid;
52static int euid;
50static int euid;
53static int egid;
54
55void
56ID0init()
57{
58 uid = getuid();
51
52void
53ID0init()
54{
55 uid = getuid();
59 gid = getgid();
60 euid = geteuid();
56 euid = geteuid();
61 egid = getegid();
62}
63
64static void
65ID0setuser(void)
66{
67 if (seteuid(uid) == -1) {
68 LogPrintf(LogERROR, "ID0setuser: Unable to seteuid!\n");
69 Cleanup(EX_NOPERM);

--- 113 unchanged lines hidden ---
57}
58
59static void
60ID0setuser(void)
61{
62 if (seteuid(uid) == -1) {
63 LogPrintf(LogERROR, "ID0setuser: Unable to seteuid!\n");
64 Cleanup(EX_NOPERM);

--- 113 unchanged lines hidden ---