projects
/
paraslash.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Introduce the vss task.
[paraslash.git]
/
command.c
diff --git
a/command.c
b/command.c
index
d35113a
..
b6c2de2
100644
(file)
--- a/
command.c
+++ b/
command.c
@@
-1,5
+1,5
@@
/*
/*
- * Copyright (C) 1997-200
7
Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 1997-200
8
Andre Noll <maan@systemlinux.org>
*
* Licensed under the GPL v2. For licencing details see COPYING.
*/
*
* Licensed under the GPL v2. For licencing details see COPYING.
*/
@@
-20,12
+20,12
@@
#include "afs.h"
#include "server.h"
#include "vss.h"
#include "afs.h"
#include "server.h"
#include "vss.h"
+#include "list.h"
#include "send.h"
#include "rc4.h"
#include "net.h"
#include "daemon.h"
#include "fd.h"
#include "send.h"
#include "rc4.h"
#include "net.h"
#include "daemon.h"
#include "fd.h"
-#include "list.h"
#include "user_list.h"
#include "server_command_list.h"
#include "afs_command_list.h"
#include "user_list.h"
#include "server_command_list.h"
#include "afs_command_list.h"
@@
-242,9
+242,9
@@
int com_sender(int fd, int argc, char * const * argv)
if (scd.sender_num < 0)
return ret;
msg = senders[scd.sender_num].help();
if (scd.sender_num < 0)
return ret;
msg = senders[scd.sender_num].help();
- send_buffer(fd, msg);
+
ret =
send_buffer(fd, msg);
free(msg);
free(msg);
- return
1
;
+ return
ret
;
}
for (i = 0; i < 10; i++) {
mmd_lock();
}
for (i = 0; i < 10; i++) {
mmd_lock();
@@
-309,7
+309,7
@@
int com_version(int fd, int argc, __a_unused char * const * argv)
return -E_COMMAND_SYNTAX;
return send_buffer(fd, VERSION_TEXT("server")
"built: " BUILD_DATE "\n"
return -E_COMMAND_SYNTAX;
return send_buffer(fd, VERSION_TEXT("server")
"built: " BUILD_DATE "\n"
-
SYSTEM
", " CC_VERSION "\n"
+
UNAME_RS
", " CC_VERSION "\n"
);
}
);
}
@@
-335,7
+335,7
@@
int com_stat(int fd, int argc, char * const * argv)
if (ret < 0)
goto out;
ret = 1;
if (ret < 0)
goto out;
ret = 1;
- if (num
== 1
)
+ if (num
> 0 && !--num
)
goto out;
sleep(50);
if (getppid() == 1)
goto out;
sleep(50);
if (getppid() == 1)
@@
-578,7
+578,7
@@
out:
*/
static int check_perms(unsigned int perms, struct server_command *cmd_ptr)
{
*/
static int check_perms(unsigned int perms, struct server_command *cmd_ptr)
{
- PARA_DEBUG_LOG("
%s", "
checking permissions\n");
+ PARA_DEBUG_LOG("checking permissions\n");
return (cmd_ptr->perms & perms) < cmd_ptr->perms ? -E_PERM : 0;
}
return (cmd_ptr->perms & perms) < cmd_ptr->perms ? -E_PERM : 0;
}
@@
-660,12
+660,10
@@
out:
}
/**
}
/**
- *
perform user authentication and execute a command
+ *
Perform user authentication and execute a command.
*
*
- * \param fd The file descriptor to send output to
- * \param peername Identifies the connecting peer.
- *
- * \return EXIT_SUCCESS or EXIT_FAILURE
+ * \param fd The file descriptor to send output to.
+ * \param peername Identifies the connecting peer.
*
* Whenever para_server accepts an incoming tcp connection on
* the port it listens on, it forks and the resulting child
*
* Whenever para_server accepts an incoming tcp connection on
* the port it listens on, it forks and the resulting child
@@
-688,7
+686,7
@@
out:
*
* \sa alarm(2), rc4(3), crypt.c, crypt.h
*/
*
* \sa alarm(2), rc4(3), crypt.c, crypt.h
*/
-
int
handle_connect(int fd, const char *peername)
+
__noreturn void
handle_connect(int fd, const char *peername)
{
int ret, argc, use_rc4 = 0;
char buf[4096];
{
int ret, argc, use_rc4 = 0;
char buf[4096];
@@
-799,15
+797,12
@@
int handle_connect(int fd, const char *peername)
PARA_NOTICE_LOG("calling com_%s() for %s@%s\n", cmd->name, u->name,
peername);
ret = cmd->handler(fd, argc, argv);
PARA_NOTICE_LOG("calling com_%s() for %s@%s\n", cmd->name, u->name,
peername);
ret = cmd->handler(fd, argc, argv);
- if (ret >= 0) {
- ret = EXIT_SUCCESS;
+ if (ret >= 0)
goto out;
goto out;
- }
err_out:
err_out:
- send_va_buffer(fd, "%s\n",
PARA_STRERROR
(-ret));
+ send_va_buffer(fd, "%s\n",
para_strerror
(-ret));
net_err:
net_err:
- PARA_NOTICE_LOG("%s\n", PARA_STRERROR(-ret));
- ret = EXIT_FAILURE;
+ PARA_NOTICE_LOG("%s\n", para_strerror(-ret));
out:
free(command);
free(argv);
out:
free(command);
free(argv);
@@
-816,5
+811,5
@@
out:
mmd->events++;
mmd->active_connections--;
mmd_unlock();
mmd->events++;
mmd->active_connections--;
mmd_unlock();
-
return ret
;
+
exit(ret < 0? EXIT_FAILURE : EXIT_SUCCESS)
;
}
}