diff options
author | kay.sievers@vrfy.org <kay.sievers@vrfy.org> | 2004-10-18 20:51:13 -0700 |
---|---|---|
committer | Greg KH <gregkh@suse.de> | 2005-04-26 22:02:46 -0700 |
commit | 9cd1b46a138dbdd6c3fad2e23f88e34740b3a054 (patch) | |
tree | f833f5c2529e8cc86465168bf896f3d8d52701aa | |
parent | 1da6b0d0a71960f49e1ecf8bd9f1bc9e14c2b90e (diff) |
[PATCH] $local user
We once implemented the devfsd feature to set the owner of a device node
to the "local" user. This was before we had the dev.d/ scripts. We discussed
a similar issue with D-BUS recently and this should be better handled depending
on the distributions way to do such a thing.
I'm for removing this here as this can be easily covered by a dev.d/
script.
Here is the patch if nobody objects :)
-rw-r--r-- | klibc_fixups.c | 34 | ||||
-rw-r--r-- | klibc_fixups.h | 5 | ||||
-rw-r--r-- | udev.8.in | 11 | ||||
-rw-r--r-- | udev_add.c | 35 |
4 files changed, 0 insertions, 85 deletions
diff --git a/klibc_fixups.c b/klibc_fixups.c index d1a452a449..e68ce22b50 100644 --- a/klibc_fixups.c +++ b/klibc_fixups.c @@ -125,38 +125,4 @@ struct group *getgrnam(const char *name) return &gr; } - -int ufd = -1; - -void setutent() -{ - if (ufd < 0) - ufd = open(UTMP_FILE, O_RDONLY); - fcntl(ufd, F_SETFD, FD_CLOEXEC); - lseek(ufd, 0, SEEK_SET); -} - -void endutent() { - if (ufd < 0) - return; - close(ufd); - ufd = -1; -} - -struct utmp *getutent(void) -{ - static struct utmp utmp; - int retval; - - if (ufd < 0) { - setutent(); - if (ufd < 0) - return NULL; - } - retval = read(ufd, &utmp, sizeof(struct utmp)); - if (retval < 1) - return NULL; - return &utmp; -} - #endif diff --git a/klibc_fixups.h b/klibc_fixups.h index f6c91cdd94..082105eb8e 100644 --- a/klibc_fixups.h +++ b/klibc_fixups.h @@ -62,10 +62,5 @@ struct utmp char __unused[20]; /* reserved for future use */ }; -struct utmp *getutent(void); -void setutent(void); -void endutent(void); - - #endif /* KLIBC_FIXUPS_H */ #endif /* __KLIBC__ */ @@ -335,17 +335,6 @@ video*:root:video:0660 dsp1:::0666 .fi .P -The value -.I $local -can be used instead of a specific username. In that case, udev will determine -the current local user at the time of device node creation and substitute -that username as the owner of the new device node. This is useful, for -example, to let hot-plugged devices, such as cameras, be owned by the user at -the current console. Note that if no user is currently logged in, or if udev -otherwise fails to determine a current user, the -.I default_owner -value is used in lieu. -.P A number of different fields in the above configuration files support a simple form of shell style pattern matching. It supports the following pattern characters: .TP diff --git a/udev_add.c b/udev_add.c index 809a33cedb..0e7d575d58 100644 --- a/udev_add.c +++ b/udev_add.c @@ -48,8 +48,6 @@ #include "udevdb.h" #include "klibc_fixups.h" -#define LOCAL_USER "$local" - #include "selinux.h" /* @@ -155,37 +153,6 @@ exit: return retval; } -/* get the local logged in user */ -static void set_to_local_user(char *user) -{ - struct utmp *u; - time_t recent = 0; - - strfieldcpymax(user, default_owner_str, OWNER_SIZE); - setutent(); - while (1) { - u = getutent(); - if (u == NULL) - break; - - /* is this a user login ? */ - if (u->ut_type != USER_PROCESS) - continue; - - /* is this a local login ? */ - if (strcmp(u->ut_host, "")) - continue; - - if (u->ut_time > recent) { - recent = u->ut_time; - strfieldcpymax(user, u->ut_user, OWNER_SIZE); - dbg("local user is '%s'", user); - break; - } - } - endutent(); -} - static int create_node(struct udevice *udev) { char filename[NAME_SIZE]; @@ -229,8 +196,6 @@ static int create_node(struct udevice *udev) uid = (uid_t) id; else { struct passwd *pw; - if (strncmp(udev->owner, LOCAL_USER, sizeof(LOCAL_USER)) == 0) - set_to_local_user(udev->owner); pw = getpwnam(udev->owner); if (pw == NULL) |