X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=command.c;h=66c658acb3f5c33a98eb2cf4bdf0249f26d9d1bc;hp=c4229d4f21a8d8f0ec43d66ba1a7d35ed4acda4f;hb=883af7d8af543616fe4ca09b0273dd4f59848779;hpb=63020a72f5f5c815ac69caa2d7f79b5d8928be36 diff --git a/command.c b/command.c index c4229d4f..66c658ac 100644 --- a/command.c +++ b/command.c @@ -19,7 +19,6 @@ /** \file command.c does client authentication and executes server commands */ #include /* gettimeofday */ -#include "crypt.h" #include "server.cmdline.h" #include "db.h" #include "server.h" @@ -32,6 +31,7 @@ #include "daemon.h" #include "string.h" #include "fd.h" +#include "user_list.h" static RC4_KEY rc4_recv_key; static RC4_KEY rc4_send_key; @@ -699,11 +699,12 @@ out: return ret; } -static int send_description(int fd, struct server_command *cmd, const char *handler, int num) +static int send_list_of_commands(int fd, struct server_command *cmd, + const char *handler) { int ret, i; - for (i = 1; cmd->name && (!num || i <= num); cmd++, i++) { + for (i = 1; cmd->name; cmd++, i++) { char *perms = cmd_perms_itohuman(cmd->perms); ret = send_va_buffer(fd, "%s\t%s\t%s\t%s\n", cmd->name, handler, @@ -749,13 +750,13 @@ static int com_help(int fd, int argc, char **argv) if (argc < 2) { /* no argument given, print list of commands */ - if ((ret = send_description(fd, cmd_struct, "server", 0)) < 0) + if ((ret = send_list_of_commands(fd, cmd_struct, "server")) < 0) return ret; mmd_lock(); handler = para_strdup(selectors[mmd->selector_num].name); cmd = selectors[mmd->selector_num].cmd_list; mmd_unlock(); - ret = send_description(fd, cmd, handler, 0); + ret = send_list_of_commands(fd, cmd, handler); free(handler); return ret; } @@ -1022,7 +1023,7 @@ int handle_connect(int fd, struct sockaddr_in *addr) int numbytes, ret, argc, use_rc4 = 0; char buf[STRINGSIZE]; unsigned char crypt_buf[MAXLINE]; - struct _user u; + struct user u; struct server_command *cmd = NULL; long unsigned challenge_nr, chall_response; char **argv = NULL; @@ -1062,7 +1063,7 @@ int handle_connect(int fd, struct sockaddr_in *addr) } PARA_DEBUG_LOG("received %s request for user %s\n", use_rc4? "rc4" : "auth", u.name); - if ((ret = _get_user(&u)) < 0) + if ((ret = lookup_user(&u)) < 0) goto err_out; if (!ret) { /* user not found */ PARA_WARNING_LOG("auth request for unknown user %s\n", u.name);