aboutsummaryrefslogtreecommitdiff
path: root/src/client.c
diff options
context:
space:
mode:
authorFranklin Wei <git@fwei.tk>2016-04-03 12:15:44 -0400
committerFranklin Wei <git@fwei.tk>2016-04-03 12:15:44 -0400
commit724f4ee59b0af7b64a3317af3c9ee5d3f45e9fc4 (patch)
tree9e1f93726995bfd2d8e2e355f7ca3d0869be037f /src/client.c
parent73c9244faee21a65e2143cc52dcbcf5cfe0648c6 (diff)
downloadnetcosm-724f4ee59b0af7b64a3317af3c9ee5d3f45e9fc4.zip
netcosm-724f4ee59b0af7b64a3317af3c9ee5d3f45e9fc4.tar.gz
netcosm-724f4ee59b0af7b64a3317af3c9ee5d3f45e9fc4.tar.bz2
netcosm-724f4ee59b0af7b64a3317af3c9ee5d3f45e9fc4.tar.xz
various fixes
Diffstat (limited to 'src/client.c')
-rw-r--r--src/client.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/client.c b/src/client.c
index d66836e..7c69708 100644
--- a/src/client.c
+++ b/src/client.c
@@ -158,7 +158,7 @@ tryagain:
{
ssize_t len = read(client_fd, buf + bufidx, CLIENT_READ_SZ - bufidx - 1);
if(len <= 0)
- error("lost connection (%d)", fds[i].revents);
+ error("lost connection");
buf[CLIENT_READ_SZ - 1] = '\0';
@@ -316,6 +316,7 @@ int client_cb(char **save)
{
const char *msg = "Kicking everyone...\n";
send_master(REQ_KICKALL, msg, strlen(msg));
+ out("All clients kicked.\n");
return CMD_OK;
}
/* weird pointer voodoo */
@@ -338,7 +339,6 @@ int client_cb(char **save)
sizeof(pidbuf) - sizeof(pid_t),
"You were kicked.\n");
send_master(REQ_KICK, pidbuf, len);
- debugf("Success.\n");
}
else
out("Usage: CLIENT KICK <PID|ALL>\n");
@@ -438,6 +438,8 @@ int drop_cb(char **save)
int chpass_cb(char **save)
{
+ (void) save;
+ out("Changing password for %s\n", current_user);
out("Enter current password: ");
char *current = client_read_password();
@@ -448,7 +450,7 @@ int chpass_cb(char **save)
if(!current_data)
{
- out("Password mismatch.\n");
+ out("Authentication failed.\n");
return CMD_OK;
}
@@ -477,6 +479,8 @@ int chpass_cb(char **save)
memset(pass1, 0, strlen(pass1));
+ out("Password updated.\n");
+
return CMD_OK;
}
@@ -526,11 +530,9 @@ void client_main(int fd, struct sockaddr_in *addr, int total, int to, int from)
telnet_init();
char *ip = inet_ntoa(addr->sin_addr);
- debugf("New client %s\n", ip);
+ debugf("== New client %s ==\n", ip);
debugf("Total clients: %d\n", total);
- debugf("client is running with uid %d\n", getuid());
-
auth:
out("NetCosm " NETCOSM_VERSION "\n");
@@ -597,7 +599,7 @@ auth:
client_change_state(STATE_LOGGEDIN);
/* authenticated, begin main command loop */
- debugf("client: Authenticated as %s\n", current_user);
+ debugf("Client %s: authenticated as %s.\n", ip, current_user);
client_change_user(current_user);
current_room = 0;