gluon-core: remove unused user/group management functions, call lock command directly
This commit is contained in:
parent
6ae1af9694
commit
987eef011a
@ -6,28 +6,15 @@ local string = string
|
||||
|
||||
module 'gluon.users'
|
||||
|
||||
function add_user(username, uid, gid)
|
||||
util.lock('/var/lock/passwd')
|
||||
util.replace_prefix('/etc/passwd', username .. ':', string.format('%s:*:%u:%u::/var:/bin/false\n', username, uid, gid))
|
||||
util.replace_prefix('/etc/shadow', username .. ':', string.format('%s:*:0:0:99999:7:::\n', username))
|
||||
util.unlock('/var/lock/passwd')
|
||||
end
|
||||
|
||||
function remove_user(username)
|
||||
util.lock('/var/lock/passwd')
|
||||
os.execute('exec lock /var/lock/passwd')
|
||||
util.replace_prefix('/etc/passwd', username .. ':')
|
||||
util.replace_prefix('/etc/shadow', username .. ':')
|
||||
util.unlock('/var/lock/passwd')
|
||||
end
|
||||
|
||||
function add_group(groupname, gid)
|
||||
util.lock('/var/lock/group')
|
||||
util.replace_prefix('/etc/group', groupname .. ':', string.format('%s:x:%u:\n', groupname, gid))
|
||||
util.unlock('/var/lock/group')
|
||||
os.execute('exec lock -u /var/lock/passwd')
|
||||
end
|
||||
|
||||
function remove_group(groupname)
|
||||
util.lock('/var/lock/group')
|
||||
os.execute('exec lock /var/lock/group')
|
||||
util.replace_prefix('/etc/group', groupname .. ':')
|
||||
util.unlock('/var/lock/group')
|
||||
os.execute('exec lock -u /var/lock/group')
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user