Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
settingsd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
settingsd
Commits
0510a09a
Commit
0510a09a
authored
Feb 02, 2011
by
Devaev Maxim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added methods for get UID variables from login.defs
parent
e28fc51f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
2 deletions
+39
-2
org.etersoft.settingsd.conf
configs/dbus/org.etersoft.settingsd.conf
+6
-0
fmod_local_users.py
plugins/functions/fmod_local_users.py
+33
-2
No files found.
configs/dbus/org.etersoft.settingsd.conf
View file @
0510a09a
...
...
@@ -56,6 +56,7 @@
<!--
fmod_system_services
-->
<
policy
context
=
"default"
>
<
allow
send_destination
=
"org.etersoft.settingsd"
send_interface
=
"org.etersoft.settingsd.functions.systemServices"
send_member
=
"servicesChanged"
/>
<
allow
send_destination
=
"org.etersoft.settingsd"
send_interface
=
"org.etersoft.settingsd.functions.systemService"
send_member
=
"realName"
/>
<
allow
send_destination
=
"org.etersoft.settingsd"
send_interface
=
"org.etersoft.settingsd.functions.systemService"
send_member
=
"description"
/>
<
allow
send_destination
=
"org.etersoft.settingsd"
send_interface
=
"org.etersoft.settingsd.functions.systemService"
send_member
=
"shortDescription"
/>
...
...
@@ -66,7 +67,12 @@
<!--
fmod_local_users
-->
<
policy
context
=
"default"
>
<
allow
send_destination
=
"org.etersoft.settingsd"
send_interface
=
"org.etersoft.settingsd.functions.localUsers"
send_member
=
"minUid"
/>
<
allow
send_destination
=
"org.etersoft.settingsd"
send_interface
=
"org.etersoft.settingsd.functions.localUsers"
send_member
=
"maxUid"
/>
<
allow
send_destination
=
"org.etersoft.settingsd"
send_interface
=
"org.etersoft.settingsd.functions.localUsers"
send_member
=
"minSystemUid"
/>
<
allow
send_destination
=
"org.etersoft.settingsd"
send_interface
=
"org.etersoft.settingsd.functions.localUsers"
send_member
=
"maxSystemUid"
/>
<
allow
send_destination
=
"org.etersoft.settingsd"
send_interface
=
"org.etersoft.settingsd.functions.localUsers"
send_member
=
"usersChanged"
/>
<
allow
send_destination
=
"org.etersoft.settingsd"
send_interface
=
"org.etersoft.settingsd.functions.localUser"
send_member
=
"realName"
/>
<
allow
send_destination
=
"org.etersoft.settingsd"
send_interface
=
"org.etersoft.settingsd.functions.localUser"
send_member
=
"uid"
/>
<
allow
send_destination
=
"org.etersoft.settingsd"
send_interface
=
"org.etersoft.settingsd.functions.localUser"
send_member
=
"gid"
/>
...
...
plugins/functions/fmod_local_users.py
View file @
0510a09a
...
...
@@ -18,6 +18,7 @@ import settingsd.validators.os
import
settingsd.tools
as
tools
import
settingsd.tools.dbus
import
settingsd.tools.process
import
settingsd.tools.editors
##### Private constants #####
...
...
@@ -167,6 +168,24 @@ class LocalUsers(service.FunctionObject) :
return
tools
.
process
.
execProcess
(
"
%
s
%
s
%
s"
%
(
config
.
value
(
SERVICE_NAME
,
"userdel_prog_path"
),
remove_data_arg
,
user_name
),
False
)[
2
]
###
@service.functionMethod
(
LOCAL_USERS_METHODS_NAMESPACE
,
out_signature
=
"i"
)
def
minUid
(
self
)
:
return
self
.
loginDefsValue
(
"UID_MIN"
)
@service.functionMethod
(
LOCAL_USERS_METHODS_NAMESPACE
,
out_signature
=
"i"
)
def
maxUid
(
self
)
:
return
self
.
loginDefsValue
(
"UID_MAX"
)
@service.functionMethod
(
LOCAL_USERS_METHODS_NAMESPACE
,
out_signature
=
"i"
)
def
minSystemUid
(
self
)
:
return
self
.
loginDefsValue
(
"SYS_UID_MIN"
)
@service.functionMethod
(
LOCAL_USERS_METHODS_NAMESPACE
,
out_signature
=
"i"
)
def
maxSystemUid
(
self
)
:
return
self
.
loginDefsValue
(
"SYS_UID_MAX"
)
### DBus signals ###
...
...
@@ -175,6 +194,16 @@ class LocalUsers(service.FunctionObject) :
pass
### Private ###
def
loginDefsValue
(
self
,
variable_name
)
:
editor
=
tools
.
editors
.
PlainEditor
(
delimiter
=
""
,
quotes_list
=
[])
editor
.
open
(
config
.
value
(
SERVICE_NAME
,
"login_defs_config_file_path"
))
values_list
=
editor
.
value
(
variable_name
)
editor
.
close
()
return
(
int
(
values_list
[
-
1
])
if
len
(
values_list
)
>
0
else
-
1
)
##### Public classes #####
class
Service
(
service
.
Service
,
pyinotify
.
ThreadedNotifier
)
:
def
__init__
(
self
)
:
...
...
@@ -229,7 +258,8 @@ class Service(service.Service, pyinotify.ThreadedNotifier) :
(
SERVICE_NAME
,
"userdel_prog_path"
,
"/usr/sbin/userdel"
,
str
),
(
SERVICE_NAME
,
"usermod_prog_path"
,
"/usr/sbin/usermod"
,
str
),
(
SERVICE_NAME
,
"passwd_config_file_path"
,
"/etc/passwd"
,
str
),
(
SERVICE_NAME
,
"shadow_config_file_path"
,
"/etc/shadow"
,
str
)
(
SERVICE_NAME
,
"shadow_config_file_path"
,
"/etc/shadow"
,
str
),
(
SERVICE_NAME
,
"login_defs_config_file_path"
,
"/etc/login.defs"
,
str
)
]
...
...
@@ -237,7 +267,8 @@ class Service(service.Service, pyinotify.ThreadedNotifier) :
def
inotifyEvent
(
self
,
event
)
:
if
event
.
dir
or
not
event
.
pathname
in
(
config
.
value
(
SERVICE_NAME
,
"passwd_config_file_path"
),
config
.
value
(
SERVICE_NAME
,
"shadow_config_file_path"
)
)
:
config
.
value
(
SERVICE_NAME
,
"shadow_config_file_path"
),
config
.
value
(
SERVICE_NAME
,
"login_defs_config_file_path"
)
)
:
return
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment