Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
ffbs-gluon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ffbs
ffbs-gluon
Commits
c2e27196
Unverified
Commit
c2e27196
authored
3 years ago
by
aiyion.prime
Committed by
Matthias Schiffer
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
gluon-web-admin: use util.popen3 in remote.lua
[Matthias Schiffer: whitespace changes, error handling]
parent
e410a9c2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
package/gluon-web-admin/luasrc/lib/gluon/config-mode/model/admin/remote.lua
+9
-22
9 additions, 22 deletions
...admin/luasrc/lib/gluon/config-mode/model/admin/remote.lua
with
9 additions
and
22 deletions
package/gluon-web-admin/luasrc/lib/gluon/config-mode/model/admin/remote.lua
+
9
−
22
View file @
c2e27196
...
...
@@ -12,8 +12,8 @@ You may obtain a copy of the License at
local
util
=
require
'gluon.util'
local
site
=
require
'gluon.site'
local
sp
=
util
.
subprocess
local
fcntl
=
require
'posix.fcntl'
local
unistd
=
require
'posix.unistd'
local
wait
=
require
'posix.sys.wait'
...
...
@@ -76,29 +76,16 @@ function pw2.cfgvalue()
end
local
function
set_password
(
password
)
local
inr
,
inw
=
unistd
.
pipe
()
local
pid
=
unistd
.
fork
()
if
pid
<
0
then
local
options
=
{
stdin
=
sp
.
PIPE
,
stdout
=
sp
.
DEVNULL
,
stderr
=
sp
.
DEVNULL
,
}
local
pid
,
pipe
=
sp
.
popen
(
'passwd'
,
{},
options
)
if
not
pid
then
return
false
elseif
pid
==
0
then
unistd
.
close
(
inw
)
local
null
=
fcntl
.
open
(
'/dev/null'
,
fcntl
.
O_WRONLY
)
unistd
.
dup2
(
null
,
unistd
.
STDOUT_FILENO
)
unistd
.
dup2
(
null
,
unistd
.
STDERR_FILENO
)
if
null
>
2
then
unistd
.
close
(
null
)
end
unistd
.
dup2
(
inr
,
unistd
.
STDIN_FILENO
)
unistd
.
close
(
inr
)
unistd
.
execp
(
'passwd'
,
{[
0
]
=
'passwd'
})
os.exit
(
127
)
end
unistd
.
close
(
inr
)
local
inw
=
pipe
.
stdin
unistd
.
write
(
inw
,
string.format
(
'%s\n%s\n'
,
password
,
password
))
unistd
.
close
(
inw
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment