[prev in list] [next in list] [prev in thread] [next in thread]
List: nessus-plugins-writers
Subject: [Plugins-writers] libnasl patchset [2/6]
From: Dirk Jagdmann <doj () cubic ! org>
Date: 2007-07-29 9:22:54
Message-ID: 46AC5C6E.1000904 () cubic ! org
[Download RAW message or body]
Description of patch:
----------------------
I added -Wall to the CFLAGS and resolved all warnings emitted by gcc
4.2.0. Some minor corrections in declaring (external) functions were
made too.
--
---> Dirk Jagdmann ^ doj / cubic
----> http://cubic.org/~doj
-----> http://llg.cubic.org
["warnings.patch" (text/x-patch)]
Index: libnasl/nasl.tmpl
===================================================================
--- libnasl.orig/nasl.tmpl 2007-07-26 19:48:57.000000000 +0200
+++ libnasl/nasl.tmpl 2007-07-26 19:49:01.000000000 +0200
@@ -38,7 +38,7 @@
# C compiler options
-CFLAGS=-g -O2 $(CWARN)
+CFLAGS=-g -O2 -Wall $(CWARN)
# Do you have /usr/ucbinclude ? (SunOS)
HAVE_UCB_INCLUDE=
Index: libnasl/nasl/capture_packet.c
===================================================================
--- libnasl.orig/nasl/capture_packet.c 2007-07-26 19:48:57.000000000 +0200
+++ libnasl/nasl/capture_packet.c 2007-07-26 19:49:01.000000000 +0200
@@ -24,7 +24,7 @@
-extern int islocalhost(struct in_addr *);
+int islocalhost(struct in_addr *);
Index: libnasl/nasl/exec.c
===================================================================
--- libnasl.orig/nasl/exec.c 2007-07-26 19:48:57.000000000 +0200
+++ libnasl/nasl/exec.c 2007-07-29 11:15:30.000000000 +0200
@@ -37,7 +37,7 @@
#define NASL_DEBUG 0
#endif
-extern int naslparse( naslctxt * );
+int naslparse( naslctxt * );
int
@@ -1705,7 +1705,7 @@
* bit #0 (1) is "description"
* Bit #1 (2) is "parse only"
*/
-extern tree_cell* nasl_lint(lex_ctxt*, tree_cell*);
+tree_cell* nasl_lint(lex_ctxt*, tree_cell*);
int
execute_nasl_script(struct arglist * script_infos, const char* name, const char * cache_dir, int mode)
Index: libnasl/nasl/nasl.c
===================================================================
--- libnasl.orig/nasl/nasl.c 2007-07-26 19:48:57.000000000 +0200
+++ libnasl/nasl/nasl.c 2007-07-26 19:49:01.000000000 +0200
@@ -26,8 +26,7 @@
#include "nasl_var.h"
#include "nasl_lex_ctxt.h"
#include "exec.h"
-
-#include <getopt.h>
+#include "nasl_crypto2.h"
#ifndef MAP_FAILED
@@ -37,11 +36,11 @@
-extern char * nasl_version();
-extern void * hg_init(char *, int);
-extern int hg_next_host(void*, struct in_addr*, char *, int);
+char * nasl_version();
+void * hg_init(char *, int);
+int hg_next_host(void*, struct in_addr*, char *, int);
harglst * Globals;
-extern int execute_instruction(struct arglist *, char *);
+int execute_instruction(struct arglist *, char *);
void exit_nasl(struct arglist *, int);
Index: libnasl/nasl/nasl_cmd_exec.c
===================================================================
--- libnasl.orig/nasl/nasl_cmd_exec.c 2007-07-26 19:48:57.000000000 +0200
+++ libnasl/nasl/nasl_cmd_exec.c 2007-07-26 19:49:01.000000000 +0200
@@ -393,8 +393,7 @@
nasl_get_tmp_dir(lex_ctxt * lexic)
{
tree_cell *retc;
- char *p, path[MAXPATHLEN];
- int warn = 0;
+ char path[MAXPATHLEN];
if (check_authenticated(lexic) < 0) return NULL;
snprintf(path, sizeof(path), "%s/nessus/tmp/", NESSUS_STATE_DIR);
@@ -446,8 +445,7 @@
{
tree_cell *retc;
char *fname, *mode;
- int fd;
- int imode;
+ int fd, imode=0;
if ( check_authenticated(lexic) < 0 ) return NULL;
@@ -522,7 +520,6 @@
{
tree_cell *retc;
char *buf;
- int len;
int fd;
int flength;
int n;
@@ -615,7 +612,6 @@
nasl_file_seek(lex_ctxt * lexic)
{
tree_cell *retc;
- int len;
int fd;
int foffset;
Index: libnasl/nasl/nasl_crypto2.c
===================================================================
--- libnasl.orig/nasl/nasl_crypto2.c 2007-07-26 19:48:57.000000000 +0200
+++ libnasl/nasl/nasl_crypto2.c 2007-07-29 11:15:32.000000000 +0200
@@ -847,7 +847,7 @@
{
printf("%.2x", result[i]);
}
- printf("\n", len);
+ printf("\n");
memset(msg + msg_len, 0, sizeof(msg_len));
printf("%s", msg);
fflush(stdout);
Index: libnasl/nasl/nasl_crypto2.h
===================================================================
--- libnasl.orig/nasl/nasl_crypto2.h 2007-07-26 19:48:57.000000000 +0200
+++ libnasl/nasl/nasl_crypto2.h 2007-07-26 19:49:01.000000000 +0200
@@ -43,7 +43,8 @@
tree_cell * nasl_rsa_sign(lex_ctxt* lexic);
tree_cell * nasl_dsa_do_sign(lex_ctxt* lexic);
+int verify_script_signature(char *);
+int generate_script_signature(char *);
+int generate_signed_script(char * filename);
-int verify_script_signature(char *);
-int generate_script_signature(char *);
#endif
Index: libnasl/nasl/nasl_debug.h
===================================================================
--- libnasl.orig/nasl/nasl_debug.h 2007-07-26 19:48:57.000000000 +0200
+++ libnasl/nasl/nasl_debug.h 2007-07-26 19:49:01.000000000 +0200
@@ -30,6 +30,7 @@
#ifndef NASL_DEBUG_H__
#define NASL_DEBUG_H__
+#include "nasl_lex_ctxt.h"
void nasl_perror(lex_ctxt *, char*, ...);
void nasl_trace(lex_ctxt *, char *, ...);
Index: libnasl/nasl/nasl_grammar.y
===================================================================
--- libnasl.orig/nasl/nasl_grammar.y 2007-07-26 19:48:57.000000000 +0200
+++ libnasl/nasl/nasl_grammar.y 2007-07-29 11:15:30.000000000 +0200
@@ -30,6 +30,7 @@
#include "nasl_var.h"
#include "nasl_lex_ctxt.h"
#include "nasl_debug.h"
+#include "nasl_crypto2.h"
static void naslerror(const char *);
#define YYERROR_VERBOSE
@@ -616,9 +617,7 @@
ST_OR };
static int
-mylex(lvalp, parm)
- YYSTYPE *lvalp;
- void *parm;
+mylex(YYSTYPE *lvalp, void *parm)
{
char *p;
naslctxt *ctx = parm;
@@ -1197,10 +1196,7 @@
}
}
-int
-nasllex(lvalp, parm)
- YYSTYPE *lvalp;
- void *parm;
+int nasllex(YYSTYPE *lvalp, void *parm)
{
int x = mylex(lvalp, parm);
@@ -1213,4 +1209,3 @@
#endif
return x;
}
-
Index: libnasl/nasl/nasl_host.c
===================================================================
--- libnasl.orig/nasl/nasl_host.c 2007-07-26 19:48:57.000000000 +0200
+++ libnasl/nasl/nasl_host.c 2007-07-26 19:49:01.000000000 +0200
@@ -24,6 +24,7 @@
#include <includes.h>
+#include "nasl_debug.h"
#include "nasl_tree.h"
#include "nasl_global_ctxt.h"
#include "nasl_func.h"
@@ -269,7 +270,7 @@
h = gethostbyname(hn[i]);
if (h == NULL)
{
- nasl_perror("same_host: %s does not resolve\n", hn[i]);
+ nasl_perror(lexic, "same_host: %s does not resolve\n", hn[i]);
n[i] = 0;
if (cmp_hostname)
{
Index: libnasl/nasl/nasl_lex_ctxt.h
===================================================================
--- libnasl.orig/nasl/nasl_lex_ctxt.h 2007-07-26 19:48:57.000000000 +0200
+++ libnasl/nasl/nasl_lex_ctxt.h 2007-07-26 19:49:01.000000000 +0200
@@ -30,6 +30,9 @@
#ifndef NASL_LEX_CTXT_H_INCLUDED
#define NASL_LEX_CTXT_H_INCLUDED
+#include "nasl_tree.h"
+#include "nasl_var.h"
+#include "nasl_func.h"
typedef struct struct_lex_ctxt {
struct struct_lex_ctxt *up_ctxt;
Index: libnasl/nasl/nasl_misc_funcs.c
===================================================================
--- libnasl.orig/nasl/nasl_misc_funcs.c 2007-07-26 19:48:57.000000000 +0200
+++ libnasl/nasl/nasl_misc_funcs.c 2007-07-26 19:49:01.000000000 +0200
@@ -744,7 +744,7 @@
nasl_perror(lexic, "gettimeofday: %s\n", strerror(errno));
return NULL;
}
- sprintf(str, "%u.%06u", t.tv_sec, t.tv_usec);
+ sprintf(str, "%u.%06u", (unsigned)t.tv_sec, (unsigned)t.tv_usec);
retc = alloc_typed_cell(CONST_DATA);
retc->size = strlen(str);
retc->x.str_val = emalloc(retc->size);
@@ -834,15 +834,12 @@
nasl_open_sock_kdc(lex_ctxt* lexic)
{
tree_cell *retc;
- struct timeval t;
int timeout = 30;
int port = 88;
char *hostname = NULL; /* Domain name for windows */
int tcp = 0;
int ret;
- struct arglist *script_infos, *prefs;
- char *_port = NULL, *_tcp = NULL;
- char * val;
+ struct arglist *script_infos;
int type;
Index: libnasl/nasl/nasl_nessusd_glue.c
===================================================================
--- libnasl.orig/nasl/nasl_nessusd_glue.c 2007-07-26 19:48:57.000000000 +0200
+++ libnasl/nasl/nasl_nessusd_glue.c 2007-07-26 19:49:01.000000000 +0200
@@ -1010,7 +1010,6 @@
char * name = get_str_local_var_by_name(lexic, "name");
int soc = get_int_local_var_by_name(lexic, "socket", -1);
struct arglist * script_infos = lexic->script_infos;
- int type, opt_len = sizeof(type);
if ( name == NULL || soc < 0 )
{
@@ -1053,7 +1052,6 @@
tree_cell * nasl_shared_socket_release( lex_ctxt * lexic )
{
char * name = get_str_var_by_num(lexic, 0);
- int fd;
struct arglist * script_infos = lexic->script_infos;
if ( name == NULL )
@@ -1072,7 +1070,6 @@
tree_cell * nasl_shared_socket_destroy( lex_ctxt * lexic )
{
char * name = get_str_var_by_num(lexic, 0);
- int fd;
struct arglist * script_infos = lexic->script_infos;
if ( name == NULL )
Index: libnasl/nasl/nasl_socket.c
===================================================================
--- libnasl.orig/nasl/nasl_socket.c 2007-07-26 19:48:57.000000000 +0200
+++ libnasl/nasl/nasl_socket.c 2007-07-26 19:49:01.000000000 +0200
@@ -753,7 +753,7 @@
nasl_get_source_port(lex_ctxt* lexic)
{
struct sockaddr_in ia;
- int i, s, fd;
+ int s, fd;
unsigned int l;
tree_cell *retc;
int type;
Index: libnasl/nasl/preparse.c
===================================================================
--- libnasl.orig/nasl/preparse.c 2007-07-26 19:48:57.000000000 +0200
+++ libnasl/nasl/preparse.c 2007-07-29 11:15:28.000000000 +0200
@@ -27,9 +27,10 @@
#include "nasl_regex.h"
#include "nasl_debug.h"
+int naslparse( naslctxt * );
#ifdef ENABLE_PLUGIN_SERVER
-extern int naslparse( naslctxt * );
+int naslparse( naslctxt * );
/*---------------------------------------------------------------------------*/
Index: libnasl/nasl/strutils.c
===================================================================
--- libnasl.orig/nasl/strutils.c 2007-07-26 19:48:57.000000000 +0200
+++ libnasl/nasl/strutils.c 2007-07-26 19:49:01.000000000 +0200
@@ -44,8 +44,9 @@
while (*p ++ != '\0');
return 0;
}
- else if (icase && tolower(*pattern) != tolower(*string) ||
- ! icase && *pattern != *string)
+ else if ((icase && tolower(*pattern) != tolower(*string))
+ ||
+ (! icase && *pattern != *string))
return 0;
pattern ++; string ++;
}
_______________________________________________
Plugins-writers mailing list
Plugins-writers@list.nessus.org
http://mail.nessus.org/mailman/listinfo/plugins-writers
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic