diff options
author | Jonas Gunz <himself@jonasgunz.de> | 2019-07-01 16:36:15 +0200 |
---|---|---|
committer | Jonas Gunz <himself@jonasgunz.de> | 2019-07-01 16:36:15 +0200 |
commit | 952668828a2bd73557672e5bc0a2177d7df04c63 (patch) | |
tree | 22d4b5ad01a8a91849438601ac1c95a64bf4f713 /src/main.c | |
parent | e6629281ffd30e5660b7e29003c0f9b40c586bdc (diff) | |
download | bbs-952668828a2bd73557672e5bc0a2177d7df04c63.tar.gz |
asdf
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -66,7 +66,7 @@ struct prog_params parse_args(int argc, char* argv[]) return ret; } -void handle_connection(int _socket, struct sockaddr_in _addr) +void handle_connection(int _socket, struct sockaddr_in _addr, int argc, char* argv[]) { pid_t pid = fork(); if( pid > 0 ) @@ -95,8 +95,14 @@ void handle_connection(int _socket, struct sockaddr_in _addr) dup2(_socket, STDOUT_FILENO); dup2(_socket, STDERR_FILENO); - //RUUNNNN! - execl("/usr/bin/whoami", "/usr/bin/whoami", NULL); + char* arv[argc + 1]; + + for(int i = 0; i < argc; i++) + arv[i] = argv[i]; + + arv[argc] = NULL; + + execv(argv[0], arv); PRINT_ERROR("EXEC failed"); @@ -206,6 +212,6 @@ void telnet_server(struct prog_params params) { client_socket = accept(server_socket, &client_address, &claddrsize); DEBUG_PRINTF("Connection: %s\n", inet_ntoa(client_address.sin_addr)); - handle_connection(client_socket, client_address); + handle_connection(client_socket, client_address, params.run_argc, params.run_argv); } } |