View | Details | Raw Unified | Return to bug 787 | Differences between
and this patch

Collapse All | Expand All

(-)defines.h (+4 lines)
Lines 541-546 struct winsize { Link Here
541
# define SSH_SYSFDMAX 10000
541
# define SSH_SYSFDMAX 10000
542
#endif
542
#endif
543
543
544
#ifdef HAVE_SYSCONF
545
# undef NGROUPS_MAX
546
# define NGROUPS_MAX    (sysconf(_SC_NGROUPS_MAX))
547
#endif
544
548
545
/*
549
/*
546
 * Define this to use pipes instead of socketpairs for communicating with the
550
 * Define this to use pipes instead of socketpairs for communicating with the
(-)groupaccess.c (-2 / +11 lines)
Lines 31-37 RCSID("$OpenBSD: groupaccess.c,v 1.6 200 Link Here
31
#include "log.h"
31
#include "log.h"
32
32
33
static int ngroups;
33
static int ngroups;
34
static char *groups_byname[NGROUPS_MAX + 1];	/* +1 for base/primary group */
34
static char **groups_byname = NULL;
35
35
36
/*
36
/*
37
 * Initialize group access list for user with primary (base) and
37
 * Initialize group access list for user with primary (base) and
Lines 40-49 static char *groups_byname[NGROUPS_MAX + Link Here
40
int
40
int
41
ga_init(const char *user, gid_t base)
41
ga_init(const char *user, gid_t base)
42
{
42
{
43
	gid_t groups_bygid[NGROUPS_MAX + 1];
43
	gid_t *groups_bygid;
44
	int i, j;
44
	int i, j;
45
	struct group *gr;
45
	struct group *gr;
46
46
47
	if (groups_byname == NULL)
48
		groups_byname = xmalloc( sizeof(*groups_byname) *
49
		    (NGROUPS_MAX + 1));	 /* +1 for base/primary group */
50
51
	groups_bygid = xmalloc(sizeof(*groups_bygid) * (NGROUPS_MAX + 1));
52
47
	if (ngroups > 0)
53
	if (ngroups > 0)
48
		ga_free();
54
		ga_free();
49
55
Lines 85-88 ga_free(void) Link Here
85
			xfree(groups_byname[i]);
91
			xfree(groups_byname[i]);
86
		ngroups = 0;
92
		ngroups = 0;
87
	}
93
	}
94
95
	xfree(groups_byname);
96
	groups_byname = NULL;
88
}
97
}
(-)uidswap.c (-1 / +12 lines)
Lines 16-21 RCSID("$OpenBSD: uidswap.c,v 1.24 2003/0 Link Here
16
16
17
#include "log.h"
17
#include "log.h"
18
#include "uidswap.h"
18
#include "uidswap.h"
19
#include "xmalloc.h"
19
20
20
/*
21
/*
21
 * Note: all these functions must work in all of the following cases:
22
 * Note: all these functions must work in all of the following cases:
Lines 38-46 static gid_t saved_egid = 0; Link Here
38
/* Saved effective uid. */
39
/* Saved effective uid. */
39
static int	privileged = 0;
40
static int	privileged = 0;
40
static int	temporarily_use_uid_effective = 0;
41
static int	temporarily_use_uid_effective = 0;
41
static gid_t	saved_egroups[NGROUPS_MAX], user_groups[NGROUPS_MAX];
42
static gid_t	*saved_egroups = NULL, *user_groups = NULL;
42
static int	saved_egroupslen = -1, user_groupslen = -1;
43
static int	saved_egroupslen = -1, user_groupslen = -1;
43
44
45
static void
46
init_saved_groups(void)
47
{
48
	if (saved_egroups == NULL)
49
		saved_egroups = xmalloc(NGROUPS_MAX * sizeof(*saved_egroups));
50
	if (user_groups == NULL)
51
		user_groups = xmalloc(NGROUPS_MAX * sizeof(*user_groups));
52
}
53
44
/*
54
/*
45
 * Temporarily changes to the given uid.  If the effective user
55
 * Temporarily changes to the given uid.  If the effective user
46
 * id is not root, this does nothing.  This call cannot be nested.
56
 * id is not root, this does nothing.  This call cannot be nested.
Lines 48-53 static int saved_egroupslen = -1, user_g Link Here
48
void
58
void
49
temporarily_use_uid(struct passwd *pw)
59
temporarily_use_uid(struct passwd *pw)
50
{
60
{
61
	init_saved_groups();
51
	/* Save the current euid, and egroups. */
62
	/* Save the current euid, and egroups. */
52
#ifdef SAVED_IDS_WORK_WITH_SETEUID
63
#ifdef SAVED_IDS_WORK_WITH_SETEUID
53
	saved_euid = geteuid();
64
	saved_euid = geteuid();

Return to bug 787