From: Kay Sievers <kay.sievers@vrfy.org>
To: linux-hotplug@vger.kernel.org
Subject: $local user
Date: Mon, 18 Oct 2004 19:10:00 +0000 [thread overview]
Message-ID: <20041018191000.GD7487@vrfy.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 406 bytes --]
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 :)
Thanks,
Kay
[-- Attachment #2: udev-local_user-01.patch --]
[-- Type: text/plain, Size: 3091 bytes --]
===== klibc_fixups.c 1.11 vs edited =====
--- 1.11/klibc_fixups.c 2004-09-05 11:41:34 +02:00
+++ edited/klibc_fixups.c 2004-10-18 20:55:31 +02:00
@@ -125,38 +125,4 @@
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
===== klibc_fixups.h 1.8 vs edited =====
--- 1.8/klibc_fixups.h 2004-05-21 06:17:58 +02:00
+++ edited/klibc_fixups.h 2004-10-18 20:55:40 +02:00
@@ -62,10 +62,5 @@
char __unused[20]; /* reserved for future use */
};
-struct utmp *getutent(void);
-void setutent(void);
-void endutent(void);
-
-
#endif /* KLIBC_FIXUPS_H */
#endif /* __KLIBC__ */
===== udev.8.in 1.61 vs edited =====
--- 1.61/udev.8.in 2004-10-14 03:14:12 +02:00
+++ edited/udev.8.in 2004-10-18 20:57:42 +02:00
@@ -335,17 +335,6 @@
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
===== udev_add.c 1.79 vs edited =====
--- 1.79/udev_add.c 2004-10-18 19:48:33 +02:00
+++ edited/udev_add.c 2004-10-18 20:56:27 +02:00
@@ -48,8 +48,6 @@
#include "udevdb.h"
#include "klibc_fixups.h"
-#define LOCAL_USER "$local"
-
#include "selinux.h"
/*
@@ -155,37 +153,6 @@
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 @@
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)
next reply other threads:[~2004-10-18 19:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-18 19:10 Kay Sievers [this message]
2004-10-18 19:55 ` $local user Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20041018191000.GD7487@vrfy.org \
--to=kay.sievers@vrfy.org \
--cc=linux-hotplug@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.