mirror of
https://github.com/clearml/dropbear
synced 2025-03-09 13:30:45 +00:00
- Port restriction code back in
- Remove bad strerror() logging --HG-- extra : convert_revision : 8ad0c90d041d667876641822a5d870e2e73059c6
This commit is contained in:
parent
ae1b0b07cf
commit
18bfb4dd48
@ -108,6 +108,8 @@ void common_session_init(int sock, runopts *opts) {
|
||||
|
||||
ses.chantypes = NULL;
|
||||
|
||||
ses.allowprivport = 0;
|
||||
|
||||
|
||||
TRACE(("leave session_init"));
|
||||
}
|
||||
|
@ -138,10 +138,13 @@ struct sshsession {
|
||||
|
||||
|
||||
/* TCP forwarding - where manage listeners */
|
||||
#ifndef DISABLE_REMOTETCPFWD
|
||||
#ifdef USING_LISTENERS
|
||||
struct Listener ** listeners;
|
||||
unsigned int listensize;
|
||||
/* Whether to allow binding to privileged ports (<1024). This doesn't
|
||||
* really belong here, but nowhere else fits nicely */
|
||||
#endif
|
||||
int allowprivport;
|
||||
|
||||
};
|
||||
|
||||
|
@ -341,6 +341,10 @@ void send_msg_userauth_success() {
|
||||
|
||||
svr_ses.authstate.authdone = 1;
|
||||
|
||||
if (svr_ses.authstate.pw->pw_uid == 0) {
|
||||
ses.allowprivport = 1;
|
||||
}
|
||||
|
||||
/* Remove from the list of pre-auth sockets. Should be m_close(), since if
|
||||
* we fail, we might end up leaking connection slots, and disallow new
|
||||
* logins - a nasty situation. */
|
||||
|
@ -183,12 +183,6 @@ void svr_dropbear_exit(int exitcode, const char* format, va_list param) {
|
||||
"exit before auth: %s", format);
|
||||
}
|
||||
|
||||
if (errno != 0) {
|
||||
/* XXX - is this valid? */
|
||||
snprintf(fmtbuf, sizeof(fmtbuf), "%s [%d %s]", fmtbuf,
|
||||
errno, strerror(errno));
|
||||
}
|
||||
|
||||
_dropbear_log(LOG_INFO, fmtbuf, param);
|
||||
|
||||
/* must be after we've done with username etc */
|
||||
|
@ -208,13 +208,10 @@ static int remotetcpreq() {
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* XXX matt - server change
|
||||
if (ses.authstate.pw->pw_uid != 0
|
||||
&& port < IPPORT_RESERVED) {
|
||||
if (!ses.allowprivport && port < IPPORT_RESERVED) {
|
||||
TRACE(("can't assign port < 1024 for non-root"));
|
||||
goto out;
|
||||
}
|
||||
*/
|
||||
|
||||
ret = listen_tcpfwd(bindaddr, port);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user