Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nxssh
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
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
rx-etersoft
nxssh
Commits
1ecc98c4
Commit
1ecc98c4
authored
Nov 08, 2016
by
Stas Korobeynikov
Committed by
Pavel Vainerman
Oct 04, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix pw->pw_dir for options.home
parent
68aa513d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
3 deletions
+16
-3
ssh.c
ssh.c
+16
-3
No files found.
ssh.c
View file @
1ecc98c4
...
...
@@ -582,7 +582,7 @@ process_config_files(const char *host_arg, struct passwd *pw, int post_canon)
fatal
(
"Can't open user config file %.100s: "
"%.100s"
,
config
,
strerror
(
errno
));
}
else
{
r
=
snprintf
(
buf
,
sizeof
buf
,
"%s/%s"
,
pw
->
pw_dir
,
r
=
snprintf
(
buf
,
sizeof
buf
,
"%s/%s"
,
options
.
home
,
_PATH_SSH_USER_CONFFILE
);
if
(
r
>
0
&&
(
size_t
)
r
<
sizeof
(
buf
))
(
void
)
read_config_file
(
buf
,
pw
,
host
,
host_arg
,
...
...
@@ -760,6 +760,19 @@ main(int ac, char **av)
*/
initialize_options
(
&
options
);
/* Using $HOME instead of pw->pw_dir. If $HOME is not set the original
* method is used. */
options
.
home
=
getenv
(
"HOME"
);
if
(
!
options
.
home
)
{
options
.
home
=
pw
->
pw_dir
;
}
else
if
(
stat
(
options
.
home
,
&
st
)
<
0
)
{
fprintf
(
stderr
,
"Warning: $HOME directory '%s' "
"does not exist.
\n
"
,
options
.
home
);
}
/* Parse command-line arguments. */
host
=
NULL
;
use_syslog
=
0
;
...
...
@@ -1601,8 +1614,8 @@ main(int ac, char **av)
* directory if it doesn't already exist.
*/
if
(
config
==
NULL
)
{
r
=
snprintf
(
buf
,
sizeof
buf
,
"%s%s%s"
,
pw
->
pw_dir
,
strcmp
(
pw
->
pw_dir
,
"/"
)
?
"/"
:
""
,
_PATH_SSH_USER_DIR
);
r
=
snprintf
(
buf
,
sizeof
buf
,
"%s%s%s"
,
options
.
home
,
strcmp
(
options
.
home
,
"/"
)
?
"/"
:
""
,
_PATH_SSH_USER_DIR
);
if
(
r
>
0
&&
(
size_t
)
r
<
sizeof
(
buf
)
&&
stat
(
buf
,
&
st
)
<
0
)
{
#ifdef WITH_SELINUX
ssh_selinux_setfscreatecon
(
buf
);
...
...
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