[Openvas-commits] r2828 - in trunk/openvas-client: . include libnessus
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Wed Mar 18 11:40:05 CET 2009
Author: felix
Date: 2009-03-18 11:40:02 +0100 (Wed, 18 Mar 2009)
New Revision: 2828
Modified:
trunk/openvas-client/ChangeLog
trunk/openvas-client/include/libnessus.h
trunk/openvas-client/libnessus/network.c
Log:
Removed auth_printf and auth_gets which were reported as unused by
cppcheck. Reformatting and doc.
* libnessus/network.c (auth_printf, auth_gets): Removed, cppcheck
identified them as not being called ever.
* libnessus/network.c: Replaced K&R function declarations, minor other
reformatting and doc.
* include/libnessus.h: Removed auth_printf forward declaration.
Modified: trunk/openvas-client/ChangeLog
===================================================================
--- trunk/openvas-client/ChangeLog 2009-03-18 10:16:49 UTC (rev 2827)
+++ trunk/openvas-client/ChangeLog 2009-03-18 10:40:02 UTC (rev 2828)
@@ -1,5 +1,18 @@
2009-03-18 Felix Wolfsteller <felix.wolfsteller at intevation.de>
+ Removed auth_printf and auth_gets which were reported as unused by
+ cppcheck. Reformatting and doc.
+
+ * libnessus/network.c (auth_printf, auth_gets): Removed, cppcheck
+ identified them as not being called ever.
+
+ * libnessus/network.c: Replaced K&R function declarations, minor other
+ reformatting and doc.
+
+ * include/libnessus.h: Removed auth_printf forward declaration.
+
+2009-03-18 Felix Wolfsteller <felix.wolfsteller at intevation.de>
+
Update the report detail view (GUI, right side if report is selected)
together with the scope tree (GUI, left side), so that when
severity_overrides were applied / undone it is updated with eventually
Modified: trunk/openvas-client/include/libnessus.h
===================================================================
--- trunk/openvas-client/include/libnessus.h 2009-03-18 10:16:49 UTC (rev 2827)
+++ trunk/openvas-client/include/libnessus.h 2009-03-18 10:40:02 UTC (rev 2828)
@@ -78,11 +78,6 @@
ExtFunc int open_sock_opt_hn(const char * , unsigned int , int , int, int );
ExtFunc struct in_addr nn_resolve (const char *);
-#ifdef __GNUC__
-ExtFunc void auth_printf(struct arglist *, char * , ...) __attribute__ (( format (printf, 2, 3)));
-#else
-ExtFunc void auth_printf(struct arglist *, char * , ...);
-#endif
ExtFunc void scanner_add_port(struct arglist*, int, char *);
ExtFunc void auth_send(struct arglist *, char *);
ExtFunc char * auth_gets(struct arglist *, char * , size_t);
Modified: trunk/openvas-client/libnessus/network.c
===================================================================
--- trunk/openvas-client/libnessus/network.c 2009-03-18 10:16:49 UTC (rev 2827)
+++ trunk/openvas-client/libnessus/network.c 2009-03-18 10:40:02 UTC (rev 2828)
@@ -116,8 +116,10 @@
return 0;
}
-/*
- * Returns a free file descriptor
+/**
+ * @brief Returns a free file descriptor.
+ *
+ * @return A free file descriptor.
*/
static int
get_connection_fd()
@@ -140,8 +142,7 @@
}
static int
-release_connection_fd(fd)
- int fd;
+release_connection_fd (int fd)
{
nessus_connection *p;
@@ -189,9 +190,7 @@
/* ******** Compatibility function ******** */
ExtFunc int
-nessus_register_connection(s, ssl)
- int s;
- SSL *ssl;
+nessus_register_connection (int s, SSL* ssl)
{
int fd;
nessus_connection *p;
@@ -210,8 +209,7 @@
}
ExtFunc int
-nessus_deregister_connection(fd)
- int fd;
+nessus_deregister_connection (int fd)
{
nessus_connection * p;
if(!NESSUS_STREAM(fd))
@@ -272,9 +270,7 @@
/* Adapted from stunnel source code */
ExtFunc
-void sslerror2(txt, err)
- char *txt;
- int err;
+void sslerror2 (char* txt, int err)
{
char string[120];
@@ -283,15 +279,16 @@
}
void
-sslerror(txt)
- char *txt;
+sslerror (char* txt)
{
sslerror2(txt, ERR_get_error());
}
+/**
+ * @param path Entropy pool file name.
+ */
ExtFunc int
-nessus_SSL_init(path)
- char *path; /* entropy pool file name */
+nessus_SSL_init (char* path)
{
SSL_library_init();
SSL_load_error_strings();
@@ -356,8 +353,7 @@
ExtFunc int
-nessus_get_socket_from_connection(fd)
- int fd;
+nessus_get_socket_from_connection (int fd)
{
nessus_connection *fp;
@@ -400,9 +396,7 @@
ExtFunc void
-nessus_install_passwd_cb(ssl_ctx, pass)
- SSL_CTX *ssl_ctx;
- char *pass;
+nessus_install_passwd_cb (SSL_CTX* ssl_ctx, char* pass)
{
SSL_CTX_set_default_passwd_cb(ssl_ctx, nessus_SSL_password_cb);
SSL_CTX_set_default_passwd_cb_userdata(ssl_ctx, pass);
@@ -411,8 +405,7 @@
ExtFunc SSL*
-stream_get_ssl(fd)
- int fd;
+stream_get_ssl (int fd)
{
nessus_connection * fp;
if(!NESSUS_STREAM(fd))
@@ -428,9 +421,7 @@
}
ExtFunc int
-stream_set_timeout(fd, timeout)
- int fd;
- int timeout;
+stream_set_timeout (int fd, int timeout)
{
int old;
nessus_connection * fp;
@@ -446,8 +437,7 @@
}
ExtFunc int
-stream_set_options(fd, reset_opt, set_opt)
- int fd, reset_opt, set_opt;
+stream_set_options (int fd, int reset_opt, int set_opt)
{
nessus_connection * fp;
if(!NESSUS_STREAM(fd))
@@ -463,10 +453,7 @@
static int
-read_stream_connection_unbuffered(fd, buf0, min_len, max_len)
- int fd;
- void* buf0;
- int min_len, max_len;
+read_stream_connection_unbuffered (int fd, void* buf0, int min_len, int max_len)
{
int ret, realfd, trp, t, err;
int total = 0, flag = 0, timeout = TIMEOUT, waitall = 0;
@@ -648,10 +635,7 @@
}
ExtFunc int
-read_stream_connection_min(fd, buf0, min_len, max_len)
- int fd;
- void* buf0;
- int min_len, max_len;
+read_stream_connection_min (int fd, void* buf0, int min_len, int max_len)
{
nessus_connection *fp;
@@ -709,20 +693,13 @@
}
ExtFunc int
-read_stream_connection(fd, buf0, len)
- int fd;
- void* buf0;
- int len;
+read_stream_connection (int fd, void* buf0, int len)
{
return read_stream_connection_min(fd, buf0, -1, len);
}
static int
-write_stream_connection4(fd, buf0, n, i_opt)
- int fd;
- void * buf0;
- int n;
- int i_opt;
+write_stream_connection4 (int fd, void* buf0, int n, int i_opt)
{
int err, ret, count;
unsigned char* buf = (unsigned char*)buf0;
@@ -841,19 +818,13 @@
}
ExtFunc int
-write_stream_connection(fd, buf0, n)
- int fd;
- void * buf0;
- int n;
+write_stream_connection (int fd, void* buf0, int n)
{
return write_stream_connection4(fd, buf0, n, 0);
}
ExtFunc int
-nsend (fd, data, length, i_opt)
- int fd;
- void * data;
- int length, i_opt;
+nsend (int fd, void* data, int length, int i_opt)
{
int n = 0;
@@ -891,10 +862,7 @@
}
ExtFunc int
-nrecv (fd, data, length, i_opt)
- int fd;
- void * data;
- int length, i_opt;
+nrecv (int fd, void* data, int length, int i_opt)
{
int e;
if(NESSUS_STREAM(fd))
@@ -917,8 +885,7 @@
ExtFunc int
-close_stream_connection(fd)
- int fd;
+close_stream_connection (int fd)
{
if(!NESSUS_STREAM(fd))
{
@@ -937,8 +904,8 @@
static int
-open_socket(struct sockaddr_in *paddr,
- int port, int type, int protocol, int timeout)
+open_socket (struct sockaddr_in *paddr,
+ int port, int type, int protocol, int timeout)
{
fd_set fd_w;
struct timeval to;
@@ -1028,15 +995,11 @@
ExtFunc
-int open_sock_opt_hn(hostname, port, type, protocol, timeout)
- const char * hostname;
- unsigned int port;
- int type;
- int protocol;
- int timeout;
+int open_sock_opt_hn (const char* hostname, unsigned int port, int type,
+ int protocol, int timeout)
{
- struct sockaddr_in addr;
-
+ struct sockaddr_in addr;
+
bzero((void*)&addr, sizeof(addr));
addr.sin_family=AF_INET;
addr.sin_port=htons((unsigned short)port);
@@ -1052,9 +1015,7 @@
ExtFunc
-int open_sock_tcp_hn(hostname, port)
- const char * hostname;
- unsigned int port;
+int open_sock_tcp_hn (const char* hostname, unsigned int port)
{
return open_sock_opt_hn(hostname, port, SOCK_STREAM, IPPROTO_TCP, TIMEOUT);
}
@@ -1065,15 +1026,12 @@
/**
* @brief Reads a text from the socket stream into the argument buffer, always
- * @brief appending a '\0' byte.
+ * @brief appending a '\\0' byte.
*
- * @return Number of bytes read, without the trailing '\0'.
+ * @return Number of bytes read, without the trailing '\\0'.
*/
ExtFunc
-int recv_line(soc, buf, bufsiz)
- int soc;
- char * buf;
- size_t bufsiz;
+int recv_line (int soc, char* buf, size_t bufsiz)
{
int n, ret = 0;
@@ -1173,8 +1131,7 @@
}
ExtFunc int
-socket_close(soc)
-int soc;
+socket_close (int soc)
{
#if defined NESSUS_CNX_LOCK
if (lock_cnt > 0)
@@ -1190,27 +1147,8 @@
return close(soc);
}
-/**
- * @brief Writes data to the global socket of the thread.
- */
-ExtFunc void
-auth_printf(struct arglist * globals, char * data, ...)
-{
- va_list param;
- char buffer[65535];
-
- bzero(buffer, sizeof(buffer));
-
- va_start(param, data);
- vsnprintf(buffer, sizeof(buffer) - 1, data, param);
-
- va_end(param);
- auth_send(globals, buffer);
-}
-
-
ExtFunc void
-auth_send(struct arglist * globals, char * data)
+auth_send (struct arglist * globals, char * data)
{
int soc = GPOINTER_TO_SIZE(arg_get_value(globals, "global_socket"));
int confirm = GPOINTER_TO_SIZE(arg_get_value(globals, "confirm"));
@@ -1264,42 +1202,19 @@
#endif
}
-/**
- * @brief Reads data from the global socket of the thread.
- */
-ExtFunc char *
-auth_gets(globals, buf, bufsiz)
- struct arglist * globals;
- char * buf;
- size_t bufsiz;
-{
- int soc = GPOINTER_TO_SIZE(arg_get_value(globals, "global_socket"));
- int n;
- /* bzero(buf, bufsiz); */
- n = recv_line(soc, buf, bufsiz);
- if(n <= 0)
- return NULL;
-
- return(buf);
-}
-
-
/*
* Select() routines
*/
-
+
ExtFunc int
-stream_zero(set)
- fd_set * set;
-{
+stream_zero (fd_set* set)
+{
FD_ZERO(set);
return 0;
}
ExtFunc int
-stream_set(fd, set)
- int fd;
- fd_set * set;
+stream_set (int fd, fd_set* set)
{
int soc = nessus_get_socket_from_connection(fd);
if(soc >= 0)
@@ -1308,16 +1223,13 @@
}
ExtFunc int
-stream_isset(fd, set)
- int fd;
- fd_set * set;
+stream_isset (int fd, fd_set* set)
{
return FD_ISSET(nessus_get_socket_from_connection(fd), set);
}
ExtFunc int
-fd_is_stream(fd)
- int fd;
+fd_is_stream (int fd)
{
return NESSUS_STREAM(fd); /* Should probably be smarter... */
}
@@ -1335,8 +1247,7 @@
ExtFunc int
-stream_set_buffer(fd, sz)
- int fd, sz;
+stream_set_buffer (int fd, int sz)
{
nessus_connection *p;
char *b;
@@ -1385,7 +1296,8 @@
/*------------------------------------------------------------------*/
-int os_send(int soc, void * buf, int len, int opt )
+int
+os_send (int soc, void * buf, int len, int opt )
{
char * buf0 = (char*)buf;
int e, n;
@@ -1400,7 +1312,8 @@
return n;
}
-int os_recv(int soc, void * buf, int len, int opt )
+int
+os_recv (int soc, void * buf, int len, int opt )
{
char * buf0 = (char*)buf;
int e, n;
@@ -1418,7 +1331,7 @@
int
-get_and_clear_stream_socket_errno(int fd)
+get_and_clear_stream_socket_errno (int fd)
{
nessus_connection *fp = NULL;
int err;
@@ -1459,7 +1372,9 @@
return err;
}
-ExtFunc int stream_pending(int fd)
+ExtFunc
+int
+stream_pending (int fd)
{
nessus_connection * fp;
if ( ! NESSUS_STREAM(fd) )
More information about the Openvas-commits
mailing list