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
09caa3bc
Commit
09caa3bc
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
b2e45d53
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
6 deletions
+22
-6
misc.c
misc.c
+22
-6
No files found.
misc.c
View file @
09caa3bc
...
...
@@ -61,6 +61,9 @@
#include "misc.h"
#include "log.h"
#include "ssh.h"
#include "key.h"
#include "readconf.h"
extern
Options
options
;
/* remove newline at end of string */
char
*
...
...
@@ -609,13 +612,26 @@ tilde_expand_filename(const char *filename, uid_t uid)
}
else
if
((
pw
=
getpwuid
(
uid
))
==
NULL
)
/* ~/path */
fatal
(
"tilde_expand_filename: No such uid %ld"
,
(
long
)
uid
);
/* Make sure directory has a trailing '/' */
len
=
strlen
(
pw
->
pw_dir
);
if
(
len
==
0
||
pw
->
pw_dir
[
len
-
1
]
!=
'/'
)
sep
=
"/"
;
else
sep
=
""
;
if
(
options
.
home
)
{
if
(
strlcpy
(
ret
,
options
.
home
,
sizeof
(
ret
))
>=
sizeof
(
ret
))
fatal
(
"tilde_expand_filename: Path too long"
);
/* Make sure directory has a trailing '/' */
len
=
strlen
(
options
.
home
);
if
((
len
==
0
||
options
.
home
[
len
-
1
]
!=
'/'
)
&&
strlcat
(
ret
,
"/"
,
sizeof
(
ret
))
>=
sizeof
(
ret
))
fatal
(
"tilde_expand_filename: Path too long"
);
}
else
{
/* Make sure directory has a trailing '/' */
len
=
strlen
(
pw
->
pw_dir
);
if
(
len
==
0
||
pw
->
pw_dir
[
len
-
1
]
!=
'/'
)
sep
=
"/"
;
else
sep
=
""
;
}
/* Skip leading '/' from specified path */
if
(
path
!=
NULL
)
filename
=
path
+
1
;
...
...
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