version 1.20, 2009/09/23 06:18:47 |
version 1.21, 2009/09/23 12:03:31 |
|
|
#include <sys/ioctl.h> |
#include <sys/ioctl.h> |
|
|
#include <errno.h> |
#include <errno.h> |
|
#include <paths.h> |
#include <stdlib.h> |
#include <stdlib.h> |
#include <string.h> |
#include <string.h> |
#include <time.h> |
#include <time.h> |
|
|
|
|
void server_msg_command(struct client *, struct msg_command_data *); |
void server_msg_command(struct client *, struct msg_command_data *); |
void server_msg_identify(struct client *, struct msg_identify_data *, int); |
void server_msg_identify(struct client *, struct msg_identify_data *, int); |
|
void server_msg_shell(struct client *); |
|
|
void printflike2 server_msg_command_error(struct cmd_ctx *, const char *, ...); |
void printflike2 server_msg_command_error(struct cmd_ctx *, const char *, ...); |
void printflike2 server_msg_command_print(struct cmd_ctx *, const char *, ...); |
void printflike2 server_msg_command_print(struct cmd_ctx *, const char *, ...); |
|
|
if (strchr(environdata.var, '=') != NULL) |
if (strchr(environdata.var, '=') != NULL) |
environ_put(&c->environ, environdata.var); |
environ_put(&c->environ, environdata.var); |
break; |
break; |
|
case MSG_SHELL: |
|
if (datalen != 0) |
|
fatalx("bad MSG_SHELL size"); |
|
|
|
server_msg_shell(c); |
|
break; |
default: |
default: |
fatalx("unexpected message"); |
fatalx("unexpected message"); |
} |
} |
|
|
tty_resize(&c->tty); |
tty_resize(&c->tty); |
|
|
c->flags |= CLIENT_TERMINAL; |
c->flags |= CLIENT_TERMINAL; |
|
} |
|
|
|
void |
|
server_msg_shell(struct client *c) |
|
{ |
|
struct msg_shell_data data; |
|
const char *shell; |
|
|
|
shell = options_get_string(&global_s_options, "default-shell"); |
|
|
|
if (*shell == '\0' || areshell(shell)) |
|
shell = _PATH_BSHELL; |
|
if (strlcpy(data.shell, shell, sizeof data.shell) >= sizeof data.shell) |
|
strlcpy(data.shell, _PATH_BSHELL, sizeof data.shell); |
|
|
|
server_write_client(c, MSG_SHELL, &data, sizeof data); |
|
c->flags |= CLIENT_BAD; /* it will die after exec */ |
} |
} |