diff options
author | rm88369 <none@none> | 2007-10-26 02:00:34 -0700 |
---|---|---|
committer | rm88369 <none@none> | 2007-10-26 02:00:34 -0700 |
commit | 6f1fe22336d824f58bda6680410a6b1c2a72ea2d (patch) | |
tree | 7c88f36c7f4f14b4a6f532060f3dd96eb7d77391 /usr/src | |
parent | a0f240f727c69440a25dbadf27cbc401f4429dc4 (diff) | |
download | illumos-gate-6f1fe22336d824f58bda6680410a6b1c2a72ea2d.tar.gz |
6605707 /dev* automap causes root console logins to hang until the NFS mount times out
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/lib/libdevinfo/devinfo_devperm.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/usr/src/lib/libdevinfo/devinfo_devperm.c b/usr/src/lib/libdevinfo/devinfo_devperm.c index 2b10a90ba3..3f7380a2de 100644 --- a/usr/src/lib/libdevinfo/devinfo_devperm.c +++ b/usr/src/lib/libdevinfo/devinfo_devperm.c @@ -446,20 +446,24 @@ dir_dev_acc(char *path, char *left_to_do, uid_t uid, gid_t gid, mode_t mode, finddev_close(handle); return (-1); } - match = (char *)calloc(MAXPATHLEN, 1); + match = (char *)calloc(MAXPATHLEN + 2, 1); if (match == NULL) { finddev_close(handle); free(newpath); return (-1); } - if (p) { - (void) strncpy(match, left_to_do, p - left_to_do); - } else { - (void) strcpy(match, left_to_do); + /* transform pattern into ^pattern$ for exact match */ + if (snprintf(match, MAXPATHLEN + 2, "^%.*s$", + p ? (p - left_to_do) : strlen(left_to_do), left_to_do) >= + MAXPATHLEN + 2) { + finddev_close(handle); + free(newpath); + free(match); + return (-1); } - if (strcmp(match, "*") == 0) { + if (strcmp(match, "^*$") == 0) { alwaysmatch = 1; } else { if (regcomp(®ex, match, REG_EXTENDED) != 0) { |