mirror of
https://github.com/clearml/dropbear
synced 2025-02-07 13:21:15 +00:00
merge
This commit is contained in:
commit
6f6aa9db5a
@ -41,6 +41,9 @@ struct ChanSess {
|
|||||||
|
|
||||||
char * cmd; /* command to exec */
|
char * cmd; /* command to exec */
|
||||||
pid_t pid; /* child process pid */
|
pid_t pid; /* child process pid */
|
||||||
|
/* command that was sent by the client, if authorized_keys command= or
|
||||||
|
dropbear -c was used */
|
||||||
|
char *original_command;
|
||||||
|
|
||||||
/* pty details */
|
/* pty details */
|
||||||
int master; /* the master terminal fd*/
|
int master; /* the master terminal fd*/
|
||||||
@ -72,10 +75,6 @@ struct ChanSess {
|
|||||||
char * agentfile;
|
char * agentfile;
|
||||||
char * agentdir;
|
char * agentdir;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if DROPBEAR_SVR_PUBKEY_OPTIONS_BUILT
|
|
||||||
char *original_command;
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ChildPid {
|
struct ChildPid {
|
||||||
|
@ -92,6 +92,7 @@ int svr_pubkey_allows_pty() {
|
|||||||
* by any 'command' public key option. */
|
* by any 'command' public key option. */
|
||||||
void svr_pubkey_set_forced_command(struct ChanSess *chansess) {
|
void svr_pubkey_set_forced_command(struct ChanSess *chansess) {
|
||||||
if (ses.authstate.pubkey_options && ses.authstate.pubkey_options->forced_command) {
|
if (ses.authstate.pubkey_options && ses.authstate.pubkey_options->forced_command) {
|
||||||
|
TRACE(("Forced command '%s'", ses.authstate.pubkey_options->forced_command))
|
||||||
if (chansess->cmd) {
|
if (chansess->cmd) {
|
||||||
/* original_command takes ownership */
|
/* original_command takes ownership */
|
||||||
chansess->original_command = chansess->cmd;
|
chansess->original_command = chansess->cmd;
|
||||||
@ -182,8 +183,6 @@ int svr_add_pubkey_options(buffer *options_buf, int line_num, const char* filena
|
|||||||
memcpy(ses.authstate.pubkey_options->forced_command,
|
memcpy(ses.authstate.pubkey_options->forced_command,
|
||||||
command_start, command_len-1);
|
command_start, command_len-1);
|
||||||
ses.authstate.pubkey_options->forced_command[command_len-1] = '\0';
|
ses.authstate.pubkey_options->forced_command[command_len-1] = '\0';
|
||||||
dropbear_log(LOG_WARNING, "Forced command '%s'",
|
|
||||||
ses.authstate.pubkey_options->forced_command);
|
|
||||||
goto next_option;
|
goto next_option;
|
||||||
}
|
}
|
||||||
escaped = (!escaped && c == '\\');
|
escaped = (!escaped && c == '\\');
|
||||||
|
@ -322,10 +322,7 @@ static void cleanupchansess(const struct Channel *channel) {
|
|||||||
|
|
||||||
m_free(chansess->cmd);
|
m_free(chansess->cmd);
|
||||||
m_free(chansess->term);
|
m_free(chansess->term);
|
||||||
|
|
||||||
#if DROPBEAR_SVR_PUBKEY_OPTIONS_BUILT
|
|
||||||
m_free(chansess->original_command);
|
m_free(chansess->original_command);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (chansess->tty) {
|
if (chansess->tty) {
|
||||||
/* write the utmp/wtmp login record */
|
/* write the utmp/wtmp login record */
|
||||||
@ -833,7 +830,7 @@ static int ptycommand(struct Channel *channel, struct ChanSess *chansess) {
|
|||||||
(dup2(chansess->slave, STDOUT_FILENO) < 0)) {
|
(dup2(chansess->slave, STDOUT_FILENO) < 0)) {
|
||||||
TRACE(("leave ptycommand: error redirecting filedesc"))
|
TRACE(("leave ptycommand: error redirecting filedesc"))
|
||||||
return DROPBEAR_FAILURE;
|
return DROPBEAR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
close(chansess->slave);
|
close(chansess->slave);
|
||||||
|
|
||||||
@ -997,11 +994,9 @@ static void execchild(const void *user_data) {
|
|||||||
addnewvar("SSH_CLIENT", chansess->client_string);
|
addnewvar("SSH_CLIENT", chansess->client_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if DROPBEAR_SVR_PUBKEY_OPTIONS_BUILT
|
|
||||||
if (chansess->original_command) {
|
if (chansess->original_command) {
|
||||||
addnewvar("SSH_ORIGINAL_COMMAND", chansess->original_command);
|
addnewvar("SSH_ORIGINAL_COMMAND", chansess->original_command);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/* change directory */
|
/* change directory */
|
||||||
if (chdir(ses.authstate.pw_dir) < 0) {
|
if (chdir(ses.authstate.pw_dir) < 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user