All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hanna Linder <hannal@us.ibm.com>
To: linux-hotplug@vger.kernel.org
Subject: Re: [PATCH] set default owner/group in db.
Date: Sat, 17 Jan 2004 01:10:15 +0000	[thread overview]
Message-ID: <42320000.1074301815@w-hlinder> (raw)
In-Reply-To: <32230000.1074291692@w-hlinder>

--On Friday, January 16, 2004 02:51:00 PM -0800 Greg KH <greg@kroah.com> wrote:

> On Fri, Jan 16, 2004 at 02:21:32PM -0800, Hanna Linder wrote:
>> 
>> This patch fixes a bug where the udev database stored empty strings
>> for Owner and Group if they were default. This patch stores the default 
>> value into the database if not set otherwise. See example output:
>> 
>> 
>> crw-------    1 root     root       4,  65 Jan 16 11:13 ttyS1
>> 
>> P: /class/tty/ttyS1
>> N: ttyS1
>> S:
>> O: root
>> G: root
>> 
>> This is a bit of a hack. However, until udev supports setting the 
>> o/g values they will be root/root anyway so the database might as 
>> well reflect the truth instead of empty strings.
> 
> Hm, in thinking about this some more, how about just adding support for
> a default owner and default group to the main udev.config file?  Then

Good idea. This patch will now allow the admin to either set the default 
owner and group in /etc/udev/udev.conf or it will default to root/root.
Greg, you can change udev.conf to set default_owner and default_group now.

Hanna

----


=== namedev.c 1.93 vs edited ==--- 1.93/namedev.c	Fri Jan 16 15:17:19 2004
+++ edited/namedev.c	Fri Jan 16 18:17:57 2004
@@ -151,6 +151,22 @@
 	return mode;
 }
 
+static char * get_default_owner(void)
+{
+	if (strlen(default_owner_str) = 0) {
+		strncpy(default_owner_str, "root", OWNER_SIZE);
+	}
+	return default_owner_str;
+}
+
+static char * get_default_group(void)
+{
+	if (strlen(default_group_str) = 0) {
+		strncpy(default_group_str, "root", GROUP_SIZE);
+	}
+	return default_group_str;
+}
+
 static void apply_format(struct udevice *udev, unsigned char *string)
 {
 	char temp[NAME_SIZE];
@@ -720,9 +736,8 @@
 	} else {
 		/* no matching perms found :( */
 		udev->mode = get_default_mode(class_dev);
-		/* HACK until udev sets the owner and group */
-		strncpy(udev->owner, "root", sizeof(udev->owner));
-		strncpy(udev->group, "root", sizeof(udev->group));
+		strncpy(udev->owner, get_default_owner(), OWNER_SIZE);
+		strncpy(udev->group, get_default_group(), GROUP_SIZE);
 	}
 	dbg("name, '%s' is going to have owner='%s', group='%s', mode = %#o",
 	    udev->name, udev->owner, udev->group, udev->mode);
=== udev.h 1.32 vs edited ==--- 1.32/udev.h	Thu Jan 15 07:22:25 2004
+++ edited/udev.h	Fri Jan 16 18:15:57 2004
@@ -68,5 +68,7 @@
 extern char udev_config_filename[PATH_MAX+NAME_MAX];
 extern char udev_rules_filename[PATH_MAX+NAME_MAX];
 extern char default_mode_str[NAME_MAX];
+extern char default_owner_str[OWNER_SIZE];
+extern char default_group_str[GROUP_SIZE];
 
 #endif
=== udev_config.c 1.4 vs edited ==--- 1.4/udev_config.c	Thu Jan 15 07:22:25 2004
+++ edited/udev_config.c	Fri Jan 16 18:10:13 2004
@@ -46,6 +46,8 @@
 char udev_rules_filename[PATH_MAX+NAME_MAX];
 char udev_config_filename[PATH_MAX+NAME_MAX];
 char default_mode_str[NAME_MAX];
+char default_owner_str[OWNER_SIZE];
+char default_group_str[GROUP_SIZE];
 
 
 static void init_variables(void)
@@ -117,6 +119,8 @@
 		set_var("udev_rules", udev_rules_filename);
 		set_var("udev_permissions", udev_permissions_filename);
 		set_var("default_mode", default_mode_str);
+		set_var("default_owner", default_owner_str);
+		set_var("default_group", default_group_str);
 	}
 	dbg_parse("%s:%d:%Zd: error parsing '%s'", udev_config_filename,
 		  lineno, temp - line, temp);



-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

  parent reply	other threads:[~2004-01-17  1:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-16 22:21 [PATCH] set default owner/group in db Hanna Linder
2004-01-16 22:51 ` Greg KH
2004-01-17  1:10 ` Hanna Linder [this message]
2004-01-17  1:33 ` Hanna Linder
2004-01-17 15:12 ` Kay Sievers
2004-01-19 18:41 ` Hanna Linder
2004-01-19 19:44 ` Greg KH
2004-01-19 19:45 ` 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=42320000.1074301815@w-hlinder \
    --to=hannal@us.ibm.com \
    --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.