Bug 55

Summary: fnmatch does not seem to work
Product: Sudo Reporter: software
Component: SudoAssignee: Todd C. Miller <Todd.Miller>
Status: RESOLVED FIXED    
Severity: normal    
Priority: normal    
Version: 1.6.3   
Hardware: PC   
OS: Linux   

Description software 2001-10-30 16:21:34 MST
glibc-2.2-12
$ sudo -V
Sudo version 1.6.3p6

$ sudo -l
User hippy may run the following commands on this host:
(root) NOPASSWD: /usr/bin/args a*

$ cat /usr/bin/args
#! /bin/bash

echo "PID is $$"
id
echo "Argument count is $#"
echo "argv[0] = $0"
count=1
while [ $# -gt 0 ]
do
        echo "argv[$count] = $1"
        shift
        count=$(($count + 1))
done

$ sudo /usr/bin/args a b c d 5
PID is 25313
uid=0(root) gid=0(root) groups=501(admin),10(wheel),500(www)
Argument count is 5
argv[0] = /usr/bin/args
argv[1] = a
argv[2] = b
argv[3] = c
argv[4] = d
argv[5] = 5
Comment 1 Todd C. Miller 2001-10-30 16:49:59 MST
The problem is that '*' matches anything, including multiple arguments.  It is much like '*' in the shell.
Comment 2 software 2001-10-30 16:55:59 MST
But shouldn't a* only match arguments starting with an 'a' like in the shell?
$ mkdir crap
$ touch crap/{a,b,c}
$ ls crap/a*
crap/a

Matching multiple arguments not starting with 'a' is not intuitive.