FreeBSD Bugzilla – Attachment 17290 Details for
Bug 31419
[PATCH] Allow device name patterns in fbtab(5)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
fbtab.patch
fbtab.patch (text/plain), 3.00 KB, created by
mux
on 2001-10-22 00:40:01 UTC
(
hide
)
Description:
fbtab.patch
Filename:
MIME Type:
Creator:
mux
Created:
2001-10-22 00:40:01 UTC
Size:
3.00 KB
patch
obsolete
>Index: fbtab.5 >=================================================================== >RCS file: /home/ncvs/src/share/man/man5/fbtab.5,v >retrieving revision 1.10 >diff -u -r1.10 fbtab.5 >--- fbtab.5 14 Jul 2001 19:41:09 -0000 1.10 >+++ fbtab.5 21 Oct 2001 23:15:43 -0000 >@@ -19,10 +19,8 @@ > All other lines consist of three fields delimited by > whitespace: a login device (/dev/ttyv0), an octal > permission number (0600), and a ":"-delimited list of >-devices (/dev/console). All device names are >-absolute paths. >-A path that ends in "/*" refers to all >-directory entries except "." and "..". >+device patterns (/dev/console, /dev/dsp*). >+All device patterns are absolute paths. > .Pp > If the tty argument (relative path) matches a login device > name (absolute path), the permissions of the devices in the >Index: login_fbtab.c >=================================================================== >RCS file: /home/ncvs/src/usr.bin/login/login_fbtab.c,v >retrieving revision 1.9 >diff -u -r1.9 login_fbtab.c >--- login_fbtab.c 9 Dec 2000 09:35:41 -0000 1.9 >+++ login_fbtab.c 21 Oct 2001 23:04:24 -0000 >@@ -65,7 +65,7 @@ > #include <syslog.h> > #include <string.h> > #include <errno.h> >-#include <dirent.h> >+#include <glob.h> > #include <paths.h> > #include <unistd.h> > #include "pathnames.h" >@@ -121,40 +121,28 @@ > /* login_protect - protect one device entry */ > > void >-login_protect(table, path, mask, uid, gid) >-char *table; >-char *path; >-int mask; >-uid_t uid; >-gid_t gid; >+login_protect(table, pattern, mask, uid, gid) >+ char *table; >+ char *pattern; >+ int mask; >+ uid_t uid; >+ gid_t gid; > { >- char buf[BUFSIZ]; >- int pathlen = strlen(path); >- struct dirent *ent; >- DIR *dir; >- >- if (strcmp("/*", path + pathlen - 2) != 0) { >- /* clear flags of the device */ >- if (chflags(path, 0) && errno != ENOENT && errno != EOPNOTSUPP) >- syslog(LOG_ERR, "%s: chflags(%s): %m", table, path); >- if (chmod(path, mask) && errno != ENOENT) >- syslog(LOG_ERR, "%s: chmod(%s): %m", table, path); >- if (chown(path, uid, gid) && errno != ENOENT) >- syslog(LOG_ERR, "%s: chown(%s): %m", table, path); >- } else { >- strcpy(buf, path); >- buf[pathlen - 1] = 0; >- if ((dir = opendir(buf)) == 0) { >- syslog(LOG_ERR, "%s: opendir(%s): %m", table, path); >- } else { >- while ((ent = readdir(dir)) != 0) { >- if (strcmp(ent->d_name, ".") != 0 >- && strcmp(ent->d_name, "..") != 0) { >- strcpy(buf + pathlen - 1, ent->d_name); >- login_protect(table, buf, mask, uid, gid); >- } >- } >- closedir(dir); >+ glob_t gl; >+ char *path; >+ int i; >+ >+ if (glob(pattern, GLOB_NOSORT, NULL, &gl) != 0) >+ return; >+ for (i = 0; i < gl.gl_pathc; i++) { >+ path = gl.gl_pathv[i]; >+ /* clear flags of the device */ >+ if (chflags(path, 0) && errno != ENOENT && errno != EOPNOTSUPP) >+ syslog(LOG_ERR, "%s: chflags(%s): %m", table, path); >+ if (chmod(path, mask) && errno != ENOENT) >+ syslog(LOG_ERR, "%s: chmod(%s): %m", table, path); >+ if (chown(path, uid, gid) && errno != ENOENT) >+ syslog(LOG_ERR, "%s: chown(%s): %m", table, path); > } >- } >+ globfree(&gl); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 31419
: 17290