summaryrefslogtreecommitdiffstats
path: root/MDK
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2003-01-29 14:02:04 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2003-01-29 14:02:04 +0000
commit013a89c5e97f83f832f624f689563130ab6534d1 (patch)
tree209df32359c358b0c4b47f231c9bb2755b7956dd /MDK
parentf41b7d4af0f37976f1a1385ef52b4835907e7727 (diff)
downloadperl-MDK-Common-013a89c5e97f83f832f624f689563130ab6534d1.tar
perl-MDK-Common-013a89c5e97f83f832f624f689563130ab6534d1.tar.gz
perl-MDK-Common-013a89c5e97f83f832f624f689563130ab6534d1.tar.bz2
perl-MDK-Common-013a89c5e97f83f832f624f689563130ab6534d1.tar.xz
perl-MDK-Common-013a89c5e97f83f832f624f689563130ab6534d1.zip
(list_users) introduce it to get the id list of unprivilegied users,
thus enabling to consolidate code in printerdrake, mcc/menu_launchers, drakcronat and the like
Diffstat (limited to 'MDK')
-rw-r--r--MDK/Common/System.pm11
1 files changed, 10 insertions, 1 deletions
diff --git a/MDK/Common/System.pm b/MDK/Common/System.pm
index c41485b..c22120a 100644
--- a/MDK/Common/System.pm
+++ b/MDK/Common/System.pm
@@ -54,6 +54,11 @@ return the list of home (eg: /home/foo, /home/pixel, ...)
return the directories where we can find dot files: homes, /root and /etc/skel
+=item list_users()
+
+return the list of unprivilegied users (aka those whose uid is greater
+than 500 and who are not "nobody").
+
=item syscall_(NAME, PARA)
calls the syscall NAME
@@ -163,7 +168,7 @@ use MDK::Common::File;
use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK %compat_arch $printable_chars $sizeof_int $bitof_int); #);
@ISA = qw(Exporter);
-@EXPORT_OK = qw(%compat_arch $printable_chars $sizeof_int $bitof_int arch typeFromMagic list_passwd list_home list_skels syscall_ psizeof availableMemory availableRamMB gettimeofday unix2dos getVarsFromSh setVarsInSh setVarsInShMode setExportedVarsInSh setExportedVarsInCsh template2file template2userfile update_gnomekderc fuzzy_pidofs); #);
+@EXPORT_OK = qw(%compat_arch $printable_chars $sizeof_int $bitof_int arch typeFromMagic list_passwd list_home list_skels list_users syscall_ psizeof availableMemory availableRamMB gettimeofday unix2dos getVarsFromSh setVarsInSh setVarsInShMode setExportedVarsInSh setExportedVarsInCsh template2file template2userfile update_gnomekderc fuzzy_pidofs); #);
%EXPORT_TAGS = (all => [ @EXPORT_OK ]);
@@ -240,6 +245,10 @@ sub list_skels {
grep { -d $_ && -w $_ } map { "$prefix$_/$suffix" } '/etc/skel', '/root', list_home();
}
+sub list_users {
+ map { 500 < $_->[2] && $_->[0] ne "nobody" ? $_->[0] : () } list_passwd();
+}
+
sub syscall_ {