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
5dc7c918
Commit
5dc7c918
authored
Feb 02, 2011
by
Devaev Maxim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed word "UNIX" from log message
parent
28bba492
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
20 deletions
+20
-20
fmod_local_groups.py
plugins/functions/fmod_local_groups.py
+8
-8
fmod_local_users.py
plugins/functions/fmod_local_users.py
+12
-12
No files found.
plugins/functions/fmod_local_groups.py
View file @
5dc7c918
...
...
@@ -50,7 +50,7 @@ class LocalGroup(service.FunctionObject) :
def
addUser
(
self
,
user_name
)
:
user_name
=
validators
.
os
.
validUserName
(
user_name
)
logger
.
verbose
(
"{mod}: Request to add user
\"
%
s
\"
to
UNIX
group
\"
%
s
\"
"
%
(
user_name
,
self
.
__group_name
))
logger
.
verbose
(
"{mod}: Request to add user
\"
%
s
\"
to
local
group
\"
%
s
\"
"
%
(
user_name
,
self
.
__group_name
))
return
tools
.
process
.
execProcess
(
"
%
s -a -G
%
s
%
s"
%
(
config
.
value
(
SERVICE_NAME
,
"usermod_prog_path"
),
self
.
__group_name
,
user_name
),
False
)[
2
]
...
...
@@ -61,7 +61,7 @@ class LocalGroup(service.FunctionObject) :
users_list
=
grp
.
getgrnam
(
self
.
__group_name
)
.
gr_mem
users_list
.
remove
(
self
.
__group_name
)
logger
.
verbose
(
"{mod}: Request to remove user
\"
%
s
\"
from
UNIX
group
\"
%
s
\"
"
%
(
user_name
,
self
.
__group_name
))
logger
.
verbose
(
"{mod}: Request to remove user
\"
%
s
\"
from
local
group
\"
%
s
\"
"
%
(
user_name
,
self
.
__group_name
))
return
tools
.
process
.
execProcess
(
"
%
s -G
%
s
%
s"
%
(
config
.
value
(
SERVICE_NAME
,
"usermod_prog_path"
),
","
.
join
(
users_list
),
user_name
),
False
)[
2
]
...
...
@@ -85,7 +85,7 @@ class LocalGroups(service.FunctionObject) :
group_name
=
validators
.
os
.
validGroupName
(
group_name
)
(
gid_arg
,
gid_str
)
=
(
(
"-g
%
d"
%
(
gid
),
str
(
gid
))
if
gid
>=
0
else
(
""
,
"auto"
)
)
logger
.
verbose
(
"{mod}: Request to add
UNIX
group
\"
%
s
\"
with gid=
%
s"
%
(
group_name
,
gid_str
))
logger
.
verbose
(
"{mod}: Request to add
local
group
\"
%
s
\"
with gid=
%
s"
%
(
group_name
,
gid_str
))
return
tools
.
process
.
execProcess
(
"
%
s
%
s
%
s"
%
(
config
.
value
(
SERVICE_NAME
,
"groupadd_prog_path"
),
gid_arg
,
group_name
))
...
...
@@ -93,7 +93,7 @@ class LocalGroups(service.FunctionObject) :
def
removeGroup
(
self
,
group_name
)
:
group_name
=
validators
.
os
.
validGroupName
(
group_name
)
logger
.
verbose
(
"{mod}: Request to remove
UNIX
group
\"
%
s
\"
"
%
(
group_name
))
logger
.
verbose
(
"{mod}: Request to remove
local
group
\"
%
s
\"
"
%
(
group_name
))
return
tools
.
process
.
execProcess
(
"
%
s
%
s"
%
(
config
.
value
(
SERVICE_NAME
,
"groupdel_prog_path"
),
group_name
),
False
)[
2
]
...
...
@@ -124,7 +124,7 @@ class Service(service.Service, pyinotify.ThreadedNotifier) :
shared
.
Functions
.
addShared
(
LOCAL_GROUPS_SHARED_NAME
)
shared
.
Functions
.
addSharedObject
(
LOCAL_GROUPS_OBJECT_NAME
,
self
.
__local_groups
)
logger
.
verbose
(
"{mod}: First
UNIX
groups request..."
)
logger
.
verbose
(
"{mod}: First
local
groups request..."
)
local_groups_shared
=
shared
.
Functions
.
shared
(
LOCAL_GROUPS_SHARED_NAME
)
group_count
=
0
for
group_name
in
self
.
localGroups
()
:
...
...
@@ -132,7 +132,7 @@ class Service(service.Service, pyinotify.ThreadedNotifier) :
local_groups_shared
.
addSharedObject
(
dbus_group_name
,
LocalGroup
(
group_name
,
tools
.
dbus
.
joinPath
(
SERVICE_NAME
,
dbus_group_name
),
self
))
group_count
+=
1
logger
.
verbose
(
"{mod}: Added
%
d
UNIX
groups"
%
(
group_count
))
logger
.
verbose
(
"{mod}: Added
%
d
local
groups"
%
(
group_count
))
group_config_subdir_path
=
os
.
path
.
dirname
(
config
.
value
(
SERVICE_NAME
,
"group_config_file_path"
))
self
.
__watch_manager
.
add_watch
(
group_config_subdir_path
,
pyinotify
.
IN_DELETE
|
pyinotify
.
IN_CREATE
|
pyinotify
.
IN_MOVED_TO
,
rec
=
True
)
...
...
@@ -176,14 +176,14 @@ class Service(service.Service, pyinotify.ThreadedNotifier) :
if
not
local_groups_shared
.
hasSharedObject
(
dbus_group_names_list
[
count
])
:
local_groups_shared
.
addSharedObject
(
dbus_group_names_list
[
count
],
LocalGroup
(
group_names_list
[
count
],
tools
.
dbus
.
joinPath
(
SERVICE_NAME
,
dbus_group_names_list
[
count
]),
self
))
logger
.
verbose
(
"{mod}: Added
UNIX
group
\"
%
s
\"
"
%
(
group_names_list
[
count
]))
logger
.
verbose
(
"{mod}: Added
local
group
\"
%
s
\"
"
%
(
group_names_list
[
count
]))
for
dbus_group_name
in
local_groups_shared
.
sharedObjects
()
.
keys
()
:
if
not
dbus_group_name
in
dbus_group_names_list
:
group_name
=
local_groups_shared
.
sharedObject
(
dbus_group_name
)
.
realName
()
local_groups_shared
.
sharedObject
(
dbus_group_name
)
.
removeFromConnection
()
local_groups_shared
.
removeSharedObject
(
dbus_group_name
)
logger
.
verbose
(
"{mod}: Removed
UNIX
group
\"
%
s
\"
"
%
(
group_name
))
logger
.
verbose
(
"{mod}: Removed
local
group
\"
%
s
\"
"
%
(
group_name
))
self
.
__local_groups
.
groupsChanged
()
...
...
plugins/functions/fmod_local_users.py
View file @
5dc7c918
...
...
@@ -52,7 +52,7 @@ class LocalUser(service.FunctionObject) :
if
uid
<
0
:
raise
validators
.
ValidatorError
(
"Incorrect UID
%
d"
%
(
uid
))
logger
.
verbose
(
"{mod}: Request to change uid for
UNIX
user
\"
%
s
\"
, new uid=
%
d"
%
(
self
.
__user_name
,
uid
))
logger
.
verbose
(
"{mod}: Request to change uid for
local
user
\"
%
s
\"
, new uid=
%
d"
%
(
self
.
__user_name
,
uid
))
return
tools
.
process
.
execProcess
(
"
%
s -u
%
d
%
s"
%
(
config
.
value
(
SERVICE_NAME
,
"usermod_prog_path"
),
uid
,
self
.
__user_name
),
False
)[
2
]
...
...
@@ -68,7 +68,7 @@ class LocalUser(service.FunctionObject) :
if
gid
<
0
:
raise
validators
.
ValidatorError
(
"Incorrect GID
%
d"
%
(
gid
))
logger
.
verbose
(
"{mod}: Request to change gid for
UNIX
user
\"
%
s
\"
, new gid=
%
d"
%
(
self
.
__user_name
,
gid
))
logger
.
verbose
(
"{mod}: Request to change gid for
local
user
\"
%
s
\"
, new gid=
%
d"
%
(
self
.
__user_name
,
gid
))
return
tools
.
process
.
execProcess
(
"
%
s -g
%
d
%
s"
%
(
config
.
value
(
SERVICE_NAME
,
"usermod_prog_path"
),
gid
,
self
.
__user_name
),
False
)[
2
]
...
...
@@ -84,7 +84,7 @@ class LocalUser(service.FunctionObject) :
if
re
.
match
(
r"^[./\w\d]*$"
,
path
)
==
None
:
raise
validators
.
ValidatorError
(
"Incorrect symbols in string
\"
%
s
\"
"
%
(
path
))
logger
.
verbose
(
"{mod}: Request to change home for
UNIX
user
\"
%
s
\"
, new home=
\"
%
s
\"
"
%
(
self
.
__user_name
,
path
))
logger
.
verbose
(
"{mod}: Request to change home for
local
user
\"
%
s
\"
, new home=
\"
%
s
\"
"
%
(
self
.
__user_name
,
path
))
return
tools
.
process
.
execProcess
(
"
%
s -d
\'
%
s
\'
%
s"
%
(
config
.
value
(
SERVICE_NAME
,
"usermod_prog_path"
),
path
,
self
.
__user_name
),
False
)[
2
]
...
...
@@ -98,7 +98,7 @@ class LocalUser(service.FunctionObject) :
if
re
.
match
(
r"^[./\w\d]*$"
,
path
)
==
None
:
raise
validators
.
ValidatorError
(
"Incorrect symbols in string
\"
%
s
\"
"
%
(
path
))
logger
.
verbose
(
"{mod}: Request to change shell for
UNIX
user
\"
%
s
\"
, new shell=
\"
%
s
\"
"
%
(
self
.
__user_name
,
path
))
logger
.
verbose
(
"{mod}: Request to change shell for
local
user
\"
%
s
\"
, new shell=
\"
%
s
\"
"
%
(
self
.
__user_name
,
path
))
return
tools
.
process
.
execProcess
(
"
%
s -s
\'
%
s
\'
%
s"
%
(
config
.
value
(
SERVICE_NAME
,
"usermod_prog_path"
),
path
,
self
.
__user_name
),
False
)[
2
]
...
...
@@ -114,7 +114,7 @@ class LocalUser(service.FunctionObject) :
if
re
.
match
(
r"^[@<>./\w\d \t]*$"
,
text
)
==
None
:
raise
validators
.
ValidatorError
(
"Incorrect symbols in string
\"
%
s
\"
"
%
(
text
))
logger
.
verbose
(
"{mod}: Request to change comment for
UNIX
user
\"
%
s
\"
, new comment=
\"
%
s
\"
"
%
(
self
.
__user_name
,
text
))
logger
.
verbose
(
"{mod}: Request to change comment for
local
user
\"
%
s
\"
, new comment=
\"
%
s
\"
"
%
(
self
.
__user_name
,
text
))
return
tools
.
process
.
execProcess
(
"
%
s -c
\'
%
s
\'
%
s"
%
(
config
.
value
(
SERVICE_NAME
,
"usermod_prog_path"
),
text
,
self
.
__user_name
),
False
)[
2
]
...
...
@@ -129,7 +129,7 @@ class LocalUser(service.FunctionObject) :
def
setLock
(
self
,
lock_flag
)
:
(
lock_arg
,
lock_str
)
=
(
(
"-L"
,
"lock"
)
if
lock_flag
else
(
"-U"
,
"unlock"
)
)
logger
.
verbose
(
"{mod}: Request to
%
s
UNIX
user
\"
%
s
\"
"
%
(
lock_str
))
logger
.
verbose
(
"{mod}: Request to
%
s
local
user
\"
%
s
\"
"
%
(
lock_str
))
return
tools
.
process
.
execProcess
(
"
%
s
%
s
%
s"
%
(
config
.
value
(
SERVICE_NAME
,
"usermod_prog_path"
),
lock_arg
,
self
.
__user_name
),
False
)[
2
]
...
...
@@ -153,7 +153,7 @@ class LocalUsers(service.FunctionObject) :
(
uid_arg
,
uid_str
)
=
(
(
"-u
%
d"
%
(
uid
),
str
(
uid
))
if
uid
>=
0
else
(
""
,
"auto"
)
)
(
gid_arg
,
gid_str
)
=
(
(
"-g
%
d"
%
(
gid
),
str
(
gid
))
if
gid
>=
0
else
(
""
,
"auto"
)
)
logger
.
verbose
(
"{mod}: Request to add
UNIX
user
\"
%
s
\"
with uid=
%
s and gid=
%
s"
%
(
user_name
,
uid_str
,
gid_str
))
logger
.
verbose
(
"{mod}: Request to add
local
user
\"
%
s
\"
with uid=
%
s and gid=
%
s"
%
(
user_name
,
uid_str
,
gid_str
))
return
tools
.
process
.
execProcess
(
"
%
s
%
s
%
s
%
s"
%
(
config
.
value
(
SERVICE_NAME
,
"useradd_prog_path"
),
uid_arg
,
gid_arg
,
user_name
))
...
...
@@ -163,7 +163,7 @@ class LocalUsers(service.FunctionObject) :
user_name
=
validators
.
os
.
validUserName
(
user_name
)
(
remove_data_arg
,
remove_data_str
)
=
(
(
"-r"
,
" and its data"
)
if
remove_data_flag
else
(
""
,
""
)
)
logger
.
verbose
(
"{mod}: Request to remove
UNIX
user
\"
%
s
\"
%
s"
%
(
user_name
,
remove_data_str
))
logger
.
verbose
(
"{mod}: Request to remove
local
user
\"
%
s
\"
%
s"
%
(
user_name
,
remove_data_str
))
return
tools
.
process
.
execProcess
(
"
%
s
%
s
%
s"
%
(
config
.
value
(
SERVICE_NAME
,
"userdel_prog_path"
),
remove_data_arg
,
user_name
),
False
)[
2
]
...
...
@@ -195,7 +195,7 @@ class Service(service.Service, pyinotify.ThreadedNotifier) :
shared
.
Functions
.
addShared
(
LOCAL_USERS_SHARED_NAME
)
shared
.
Functions
.
addSharedObject
(
LOCAL_USERS_OBJECT_NAME
,
self
.
__local_users
)
logger
.
verbose
(
"{mod}: First
UNIX
users request..."
)
logger
.
verbose
(
"{mod}: First
local
users request..."
)
local_users_shared
=
shared
.
Functions
.
shared
(
LOCAL_USERS_SHARED_NAME
)
user_count
=
0
for
user_name
in
self
.
localUsers
()
:
...
...
@@ -203,7 +203,7 @@ class Service(service.Service, pyinotify.ThreadedNotifier) :
local_users_shared
.
addSharedObject
(
dbus_user_name
,
LocalUser
(
user_name
,
tools
.
dbus
.
joinPath
(
SERVICE_NAME
,
dbus_user_name
),
self
))
user_count
+=
1
logger
.
verbose
(
"{mod}: Added
%
d
UNIX
users"
%
(
user_count
))
logger
.
verbose
(
"{mod}: Added
%
d
local
users"
%
(
user_count
))
passwd_config_subdir_path
=
os
.
path
.
dirname
(
config
.
value
(
SERVICE_NAME
,
"passwd_config_file_path"
))
self
.
__watch_manager
.
add_watch
(
passwd_config_subdir_path
,
pyinotify
.
IN_DELETE
|
pyinotify
.
IN_CREATE
|
pyinotify
.
IN_MOVED_TO
,
rec
=
True
)
...
...
@@ -250,14 +250,14 @@ class Service(service.Service, pyinotify.ThreadedNotifier) :
if
not
local_users_shared
.
hasSharedObject
(
dbus_user_names_list
[
count
])
:
local_users_shared
.
addSharedObject
(
dbus_user_names_list
[
count
],
LocalUser
(
user_names_list
[
count
],
tools
.
dbus
.
joinPath
(
SERVICE_NAME
,
dbus_user_names_list
[
count
]),
self
))
logger
.
verbose
(
"{mod}: Added
UNIX
user
\"
%
s
\"
"
%
(
user_names_list
[
count
]))
logger
.
verbose
(
"{mod}: Added
local
user
\"
%
s
\"
"
%
(
user_names_list
[
count
]))
for
dbus_user_name
in
local_users_shared
.
sharedObjects
()
.
keys
()
:
if
not
dbus_user_name
in
dbus_user_names_list
:
user_name
=
local_users_shared
.
sharedObject
(
dbus_user_name
)
.
realName
()
local_users_shared
.
sharedObject
(
dbus_user_name
)
.
removeFromConnection
()
local_users_shared
.
removeSharedObject
(
dbus_user_name
)
logger
.
verbose
(
"{mod}: Removed
UNIX
user
\"
%
s
\"
"
%
(
user_name
))
logger
.
verbose
(
"{mod}: Removed
local
user
\"
%
s
\"
"
%
(
user_name
))
self
.
__local_users
.
usersChanged
()
...
...
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