Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 599706 | Differences between
and this patch

Collapse All | Expand All

(-)a/tests/Makefile.am (+2 lines)
Lines 20-26 check_PROGRAMS = \ Link Here
20
	creat64-0 \
20
	creat64-0 \
21
	execvp-0 \
21
	execvp-0 \
22
	faccessat-0 \
22
	faccessat-0 \
23
	fchmod-0 \
23
	fchmodat-0 \
24
	fchmodat-0 \
25
	fchown-0 \
24
	fchownat-0 \
26
	fchownat-0 \
25
	fopen-0 \
27
	fopen-0 \
26
	fopen64-0 \
28
	fopen64-0 \
(-)a/tests/fchmod-0.c (+27 lines)
Line 0 Link Here
1
/*
2
 * https://bugs.gentoo.org/599706
3
 *
4
 */
5
6
#include "headers.h"
7
8
int main(int argc, char *argv[])
9
{
10
	if (argc < 2)
11
		return -2;
12
13
	int mode = 0;
14
	sscanf(argv[1], "%i", &mode);
15
	/* The sandbox catches this:
16
	 *
17
	 *   int fd = open(argv[2], O_RDWR);
18
	 *
19
	 * And it /should/ catch this:
20
	 *
21
	 *    int fd = open(argv[2], O_RDONLY);
22
	*/
23
	int fd = open(argv[2], O_RDONLY);
24
	int fchmod_result = fchmod(fd, (mode_t)mode);
25
	close(fd);
26
	return fchmod_result;
27
}
(-)a/tests/fchmod-1.sh (+14 lines)
Line 0 Link Here
1
#!/bin/sh
2
#
3
# https://bugs.gentoo.org/599706
4
#
5
6
addwrite $PWD
7
8
# The sandbox doesn't log anything when it returns a junk file
9
# descriptor? It doesn't look like we can test the contents of
10
# sandbox.log here... instead, we just have to count on fchmod
11
# failing, which it does if you use O_RDWR, and it *should* if you use
12
# O_RDONLY (because that won't stop the change of permissions).
13
fchmod-0 $(stat --format='%#04a' ../..) ../.. && exit 1
14
exit 0
(-)a/tests/fchmod.at (+1 lines)
Line 0 Link Here
1
SB_CHECK(1)
(-)a/tests/fchown-0.c (+27 lines)
Line 0 Link Here
1
/*
2
 * https://bugs.gentoo.org/599706
3
 *
4
 */
5
6
#include "headers.h"
7
8
int main(int argc, char *argv[])
9
{
10
	if (argc < 3)
11
		return -2;
12
13
	uid_t uid = atoi(argv[1]);
14
	gid_t gid = atoi(argv[2]);
15
	/* The sandbox catches this:
16
	 *
17
	 *   int fd = open(argv[3], O_RDWR);
18
	 *
19
	 * And it /should/ catch this:
20
	 *
21
	 *    int fd = open(argv[3], O_RDONLY);
22
	*/
23
	int fd = open(argv[3], O_RDONLY);
24
	int fchown_result = fchown(fd, uid, gid);
25
	close(fd);
26
	return fchown_result;
27
}
(-)a/tests/fchown-1.sh (+14 lines)
Line 0 Link Here
1
#!/bin/sh
2
#
3
# https://bugs.gentoo.org/599706
4
#
5
6
addwrite $PWD
7
8
# The sandbox doesn't log anything when it returns a junk file
9
# descriptor? It doesn't look like we can test the contents of
10
# sandbox.log here... instead, we just have to count on fchown
11
# failing, which it does if you use O_RDWR, and it *should* if you use
12
# O_RDONLY (because that won't stop the change of ownership).
13
fchown-0 ${SB_UID} ${SB_GID} ../.. && exit 1
14
exit 0
(-)a/tests/fchown.at (-1 / +1 lines)
Line 0 Link Here
0
- 
1
SB_CHECK(1)

Return to bug 599706