[Setup-tool-hackers] users-admin
- From: Tambet Ingo <tambeti sa ee>
- To: setup-tool-hackers helixcode com
- Subject: [Setup-tool-hackers] users-admin
- Date: 08 Jan 2001 17:49:42 +0200
Hello,
I broke users-admin couple of days ago. It's because of I'm adding
Network users tab. users-admin wasn't designed for that in the beginning
and now I have to make all code more general to use same functions for
network stuff too. I have fixed everything else except new [user,
group]. I'm testing it with NIS, and after modifications it will be easy
to add other sources too.
Backend doesn't support it yet, so to try it out You can apply my hack
to user-conf.in. It just gets local users and groups and pretends they
are from NIS server.
I hope users-admin will be fixed tomorrow.
Tambet
Index: users-conf.in
===================================================================
RCS file: /cvs/gnome/helix-setup-tools/backends/users-conf.in,v
retrieving revision 1.27
diff -u -r1.27 users-conf.in
--- users-conf.in 2001/01/04 18:39:53 1.27
+++ users-conf.in 2001/01/08 13:11:31
@@ -310,6 +310,11 @@
close (FILE);
}
+sub write_logindefs
+{
+
+}
+
sub write_group_passwd
{
my ($i, $j, $k);
@@ -539,23 +544,23 @@
sub xml_parse_login_defs
{
my $tree = $_[0];
-
+
shift @$tree; # Skip attributes.
-
- while (@$tree)
- {
- if ($login_defs_prop_map{$$tree[0]} ne undef)
- {
- $login_defs{$$tree[0]} = $$tree[1][2];
- }
- else
- {
- be_report_warning(2, "Unexpected tag " . $$tree[0] . " while parsing logindefs");
- }
-
- shift @$tree;
- shift @$tree;
- }
+
+ while (@$tree)
+ {
+ if ($login_defs_prop_map{$$tree[0]} ne undef)
+ {
+ $login_defs{$$tree[0]} = $$tree[1][2];
+ }
+ else
+ {
+ be_report_warning(2, "Unexpected tag " . $$tree[0] . " while parsing logindefs");
+ }
+
+ shift @$tree;
+ shift @$tree;
+ }
}
sub xml_parse_passwd_last_modified
@@ -689,6 +694,60 @@
# --- XML printing --- #
+sub xml_print_nis
+{
+ my ($key, $i, $j, $k);
+
+ &be_xml_print ("<nis_userdb>\n");
+ &be_xml_enter ();
+ foreach $i (@users)
+ {
+ &be_xml_vspace ();
+ &be_xml_print ("<user>\n");
+ &be_xml_enter ();
+ for ($j = 0; $j < ($#users_prop_array - 1) / 2; $j++) {
+ &be_xml_print ("<" . $users_prop_map{"$j"} . ">" . $$i[$j] . "</" . $users_prop_map {$j} . ">\n");
+ }
+ &be_xml_leave ();
+ &be_xml_print ("</user>\n");
+ }
+ &be_xml_leave ();
+ &be_xml_vspace ();
+ &be_xml_print ("</nis_userdb>\n");
+
+ &be_xml_print ("<!-- Now the groups -->\n");
+ &be_xml_vspace ();
+
+ &be_xml_print ("<nis_groupdb>\n");
+ &be_xml_enter ();
+ foreach $i (@groups)
+ {
+ &be_xml_vspace ();
+ &be_xml_print ("<group>\n");
+ &be_xml_enter ();
+ for ($j = 0; $j < ($#groups_prop_array - 1) / 2 - 1; $j++) {
+ &be_xml_print ("<" . $groups_prop_map{$j} . ">" . $$i[$j] . "</" . $groups_prop_map {$j} . ">\n");
+ }
+ &be_xml_print ("<users>\n");
+ &be_xml_enter ();
+ $k = $$i[$groups_prop_map{"users"}];
+ foreach $j (@$k)
+ {
+ &be_xml_print ("<user>$j</user>\n");
+ }
+ &be_xml_leave ();
+ &be_xml_print ("</users>\n");
+
+ &be_xml_leave ();
+ &be_xml_print ("</group>\n");
+ }
+ &be_xml_leave ();
+ &be_xml_vspace ();
+ &be_xml_print ("</nis_groupdb>\n");
+
+ &be_xml_vspace ();
+}
+
sub xml_print
{
my ($key, $i, $j, $k);
@@ -774,6 +833,8 @@
&be_xml_print ("</groupdb>\n");
&be_xml_vspace ();
+
+ &xml_print_nis ();
&be_xml_leave ();
print "</users>\n";
}
@@ -799,6 +860,7 @@
if ($be_do_immediate)
{
+ &write_logindefs ();
&write_group_passwd ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]