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
8 years ago
by
Stas Korobeynikov
Committed by
Pavel Vainerman
7 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix pw->pw_dir for options.home
parent
b2e45d53
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
1 deletion
+17
-1
misc.c
misc.c
+17
-1
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
);
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
;
...
...
This diff is collapsed.
Click to expand it.
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