Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ee8c0c1cc1 | ||
|
|
f61e44d110 | ||
|
|
55ceac775c | ||
|
|
7b07c55c86 | ||
|
|
793673df3c | ||
|
|
6219d87071 |
41
ChangeLog
41
ChangeLog
@@ -1,3 +1,44 @@
|
||||
commit 55ceac775c388191090fe37aef489d721ee9299d
|
||||
Author: William Hubbs <w.d.hubbs@gmail.com>
|
||||
Commit: William Hubbs <w.d.hubbs@gmail.com>
|
||||
|
||||
checkpath: fix code to walk the directory path
|
||||
|
||||
X-Gentoo-Bug: 782808
|
||||
X-Gentoo-Bug-URL: https://bugs.gentoo.org/782808
|
||||
|
||||
commit 7b07c55c86cf356a832fe2975c9f8e164bcb2b7b
|
||||
Author: William Hubbs <w.d.hubbs@gmail.com>
|
||||
Commit: William Hubbs <w.d.hubbs@gmail.com>
|
||||
|
||||
version 0.43.2
|
||||
|
||||
commit 793673df3ca3ad8692e135bd5c77b21bae3ebbe2
|
||||
Author: William Hubbs <w.d.hubbs@gmail.com>
|
||||
Commit: William Hubbs <w.d.hubbs@gmail.com>
|
||||
|
||||
update ChangeLog
|
||||
|
||||
commit 6219d87071d07acf4d6b3e99ec58134acf129d8e
|
||||
Author: William Hubbs <w.d.hubbs@gmail.com>
|
||||
Commit: William Hubbs <w.d.hubbs@gmail.com>
|
||||
|
||||
checkpath: remove extra slashes from paths
|
||||
|
||||
This fixes #418.
|
||||
|
||||
commit 72b5c7429011e0d20c450fe06dc4b645e36eecb0
|
||||
Author: William Hubbs <w.d.hubbs@gmail.com>
|
||||
Commit: William Hubbs <w.d.hubbs@gmail.com>
|
||||
|
||||
version 0.43.1
|
||||
|
||||
commit aad77d0267426edef6a568e26c9bae11c2367db4
|
||||
Author: William Hubbs <w.d.hubbs@gmail.com>
|
||||
Commit: William Hubbs <w.d.hubbs@gmail.com>
|
||||
|
||||
update ChangeLog
|
||||
|
||||
commit 99565e359f3081e053573d10756e1a756c56342b
|
||||
Author: William Hubbs <w.d.hubbs@gmail.com>
|
||||
Commit: William Hubbs <w.d.hubbs@gmail.com>
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
NAME= openrc
|
||||
VERSION= 0.43.1
|
||||
VERSION= 0.43.3
|
||||
PKG= ${NAME}-${VERSION}
|
||||
|
||||
@@ -92,13 +92,13 @@ static int get_dirfd(char *path, bool symlinks) {
|
||||
if (dirfd == -1)
|
||||
eerrorx("%s: unable to open the root directory: %s",
|
||||
applet, strerror(errno));
|
||||
path_dupe = xstrdup(path);
|
||||
ch = path_dupe;
|
||||
ch = path;
|
||||
while (*ch) {
|
||||
if (*ch == '/')
|
||||
components++;
|
||||
ch++;
|
||||
}
|
||||
path_dupe = xstrdup(path);
|
||||
item = strtok(path_dupe, "/");
|
||||
#ifdef O_PATH
|
||||
flags |= O_PATH;
|
||||
@@ -131,6 +131,7 @@ static int get_dirfd(char *path, bool symlinks) {
|
||||
*/
|
||||
close(new_dirfd);
|
||||
} else {
|
||||
/* now walk down the directory path */
|
||||
close(dirfd);
|
||||
dirfd = new_dirfd;
|
||||
free(linkpath);
|
||||
@@ -140,13 +141,39 @@ static int get_dirfd(char *path, bool symlinks) {
|
||||
}
|
||||
}
|
||||
free(path_dupe);
|
||||
if (linkpath) {
|
||||
free(linkpath);
|
||||
linkpath = NULL;
|
||||
}
|
||||
free(linkpath);
|
||||
return dirfd;
|
||||
}
|
||||
|
||||
static char *clean_path(char *path)
|
||||
{
|
||||
char *ch;
|
||||
char *ch2;
|
||||
char *str;
|
||||
str = xmalloc(strlen(path));
|
||||
ch = path;
|
||||
ch2 = str;
|
||||
while (true) {
|
||||
*ch2 = *ch;
|
||||
ch++;
|
||||
ch2++;
|
||||
if (!*(ch-1))
|
||||
break;
|
||||
while (*(ch - 1) == '/' && *ch == '/')
|
||||
ch++;
|
||||
}
|
||||
/* get rid of trailing / characters */
|
||||
while ((ch = strrchr(str, '/'))) {
|
||||
if (ch == str)
|
||||
break;
|
||||
if (!*(ch+1))
|
||||
*ch = 0;
|
||||
else
|
||||
break;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
static int do_check(char *path, uid_t uid, gid_t gid, mode_t mode,
|
||||
inode_t type, bool trunc, bool chowner, bool symlinks, bool selinux_on)
|
||||
{
|
||||
@@ -344,6 +371,7 @@ int main(int argc, char **argv)
|
||||
bool symlinks = false;
|
||||
bool writable = false;
|
||||
bool selinux_on = false;
|
||||
char *path = NULL;
|
||||
|
||||
applet = basename_c(argv[0]);
|
||||
while ((opt = getopt_long(argc, argv, getoptstring,
|
||||
@@ -406,12 +434,14 @@ int main(int argc, char **argv)
|
||||
selinux_on = true;
|
||||
|
||||
while (optind < argc) {
|
||||
path = clean_path(argv[optind]);
|
||||
if (writable)
|
||||
exit(!is_writable(argv[optind]));
|
||||
if (do_check(argv[optind], uid, gid, mode, type, trunc, chowner,
|
||||
exit(!is_writable(path));
|
||||
if (do_check(path, uid, gid, mode, type, trunc, chowner,
|
||||
symlinks, selinux_on))
|
||||
retval = EXIT_FAILURE;
|
||||
optind++;
|
||||
free(path);
|
||||
}
|
||||
|
||||
if (selinux_on)
|
||||
|
||||
Reference in New Issue
Block a user