mirror of
https://github.com/sheumann/hush.git
synced 2024-12-22 14:30:31 +00:00
Fix symlink following bug in chmod -R and friends. Allow SYSV style
'chown foo:bar' in addition to 'chown foo.bar', and fix a bug in the busybox globbing routine such that 'find /dir -name [i]' no longer segfaults. -Erik
This commit is contained in:
parent
c366050a23
commit
632bb57135
@ -48,7 +48,7 @@ static const char chgrp_usage[] = "chgrp [OPTION]... GROUP FILE...\n\n"
|
|||||||
|
|
||||||
"\nOptions:\n\t-R\tchange files and directories recursively\n";
|
"\nOptions:\n\t-R\tchange files and directories recursively\n";
|
||||||
static const char chown_usage[] =
|
static const char chown_usage[] =
|
||||||
"chown [OPTION]... OWNER[.[GROUP] FILE...\n\n"
|
"chown [OPTION]... OWNER[<.|:>[GROUP] FILE...\n\n"
|
||||||
"Change the owner and/or group of each FILE to OWNER and/or GROUP.\n"
|
"Change the owner and/or group of each FILE to OWNER and/or GROUP.\n"
|
||||||
|
|
||||||
"\nOptions:\n\t-R\tchange files and directories recursively\n";
|
"\nOptions:\n\t-R\tchange files and directories recursively\n";
|
||||||
@ -140,6 +140,8 @@ int chmod_chown_chgrp_main(int argc, char **argv)
|
|||||||
goto bad_group;
|
goto bad_group;
|
||||||
} else {
|
} else {
|
||||||
groupName = strchr(*argv, '.');
|
groupName = strchr(*argv, '.');
|
||||||
|
if (groupName == NULL)
|
||||||
|
groupName = strchr(*argv, ':');
|
||||||
if (groupName) {
|
if (groupName) {
|
||||||
*groupName++ = '\0';
|
*groupName++ = '\0';
|
||||||
gid = strtoul(groupName, &p, 10);
|
gid = strtoul(groupName, &p, 10);
|
||||||
@ -169,7 +171,7 @@ int chmod_chown_chgrp_main(int argc, char **argv)
|
|||||||
fatalError( "%s: too few arguments\n", invocationName);
|
fatalError( "%s: too few arguments\n", invocationName);
|
||||||
}
|
}
|
||||||
while (argc-- > 1) {
|
while (argc-- > 1) {
|
||||||
if (recursiveAction (*(++argv), recursiveFlag, TRUE, FALSE,
|
if (recursiveAction (*(++argv), recursiveFlag, FALSE, FALSE,
|
||||||
fileAction, fileAction, NULL) == FALSE)
|
fileAction, fileAction, NULL) == FALSE)
|
||||||
exit(FALSE);
|
exit(FALSE);
|
||||||
}
|
}
|
||||||
|
17
utility.c
17
utility.c
@ -1058,6 +1058,7 @@ extern int check_wildcard_match(const char *text, const char *pattern)
|
|||||||
const char *retryText;
|
const char *retryText;
|
||||||
int ch;
|
int ch;
|
||||||
int found;
|
int found;
|
||||||
|
int len;
|
||||||
|
|
||||||
retryPat = NULL;
|
retryPat = NULL;
|
||||||
retryText = NULL;
|
retryText = NULL;
|
||||||
@ -1084,13 +1085,17 @@ extern int check_wildcard_match(const char *text, const char *pattern)
|
|||||||
if (*text == ch)
|
if (*text == ch)
|
||||||
found = TRUE;
|
found = TRUE;
|
||||||
}
|
}
|
||||||
if (found == FALSE)
|
len=strlen(text);
|
||||||
continue;
|
if (found == FALSE && len!=0) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
if (found == TRUE) {
|
if (found == TRUE) {
|
||||||
//printf("Got a match. pattern='%s' text='%s'\n", pattern, text);
|
if (strlen(pattern)==0 && len==1) {
|
||||||
if (retryPat || retryText) {
|
return TRUE;
|
||||||
pattern = retryPat;
|
}
|
||||||
text = ++retryText;
|
if (len!=0) {
|
||||||
|
text++;
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user