[Openvas-commits] r6112 - in trunk/openvas-scanner: . openvassd
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Wed Dec 9 10:32:36 CET 2009
Author: felix
Date: 2009-12-09 10:32:34 +0100 (Wed, 09 Dec 2009)
New Revision: 6112
Modified:
trunk/openvas-scanner/ChangeLog
trunk/openvas-scanner/openvassd/ntp_11.c
trunk/openvas-scanner/openvassd/utils.c
Log:
* openvassd/ntp_11.c: Cosmetics.
* openvassd/utils.c (temp_file_name): Reformatted.
Modified: trunk/openvas-scanner/ChangeLog
===================================================================
--- trunk/openvas-scanner/ChangeLog 2009-12-09 09:19:40 UTC (rev 6111)
+++ trunk/openvas-scanner/ChangeLog 2009-12-09 09:32:34 UTC (rev 6112)
@@ -1,3 +1,9 @@
+2009-12-09 Felix Wolfsteller <felix.wolfsteller at intevation.de>
+
+ * openvassd/ntp_11.c: Cosmetics.
+
+ * openvassd/utils.c (temp_file_name): Reformatted.
+
2009-12-07 Michael Wiegand <michael.wiegand at intevation.de>
Post-release version bump.
Modified: trunk/openvas-scanner/openvassd/ntp_11.c
===================================================================
--- trunk/openvas-scanner/openvassd/ntp_11.c 2009-12-09 09:19:40 UTC (rev 6111)
+++ trunk/openvas-scanner/openvassd/ntp_11.c 2009-12-09 09:32:34 UTC (rev 6112)
@@ -96,15 +96,15 @@
{
input = str + 5;
str = strchr(input, ' ');
- if(str != NULL )
- str[0] = '\0';
+ if (str != NULL )
+ str[0] = '\0';
- if(input[strlen(input) - 1] == '\n')
- input[strlen(input) - 1] = '\0';
+ if (input[strlen(input) - 1] == '\n')
+ input[strlen(input) - 1] = '\0';
switch(otp_1_0_get_client_request(input)) {
case CREQ_ATTACHED_FILE:
- ntp_11_recv_file(globals);
+ ntp_11_recv_file (globals);
break;
case CREQ_LONG_ATTACK:
@@ -112,11 +112,11 @@
break;
case CREQ_CERTIFICATES:
- otp_1_0_server_send_certificates(globals);
+ otp_1_0_server_send_certificates (globals);
break;
case CREQ_OPENVAS_VERSION:
- otp_1_0_server_openvas_version(globals);
+ otp_1_0_server_openvas_version (globals);
break;
case CREQ_PLUGIN_INFO: {
@@ -172,7 +172,7 @@
log_write("user %s : stopping attack against %s\n", user, s);
hosts_stop_host(globals, s);
ntp_1x_timestamp_host_scan_interrupted(globals, s);
- ntp_11_show_end(globals, s, 0);
+ ntp_11_show_end (globals, s, 0);
break;
}
@@ -376,13 +376,13 @@
void
ntp_11_show_end (struct arglist* globals, char * name, int internal)
{
- int soc = GPOINTER_TO_SIZE(arg_get_value( globals, "global_socket"));
- char buf[1024];
- snprintf(buf, sizeof(buf), "SERVER <|> FINISHED <|> %s <|> SERVER\n", name);
- if ( internal )
- internal_send(soc, buf, INTERNAL_COMM_MSG_TYPE_DATA);
- else
- auth_printf(globals, "%s", buf);
+ int soc = GPOINTER_TO_SIZE (arg_get_value (globals, "global_socket"));
+ char buf[1024];
+ snprintf (buf, sizeof (buf), "SERVER <|> FINISHED <|> %s <|> SERVER\n", name);
+ if (internal)
+ internal_send (soc, buf, INTERNAL_COMM_MSG_TYPE_DATA);
+ else
+ auth_printf (globals, "%s", buf);
}
/**
@@ -416,13 +416,13 @@
/**
* @brief Reads in a hashtable from file that maps login-account names to host
- * names.
- *
+ * @brief names.
+ *
* On client side the file is known as .host_logins (if defined, found in each
* task directory).
* The GHashTable will be available through the (global) arglist under the key
* "MAP_HOST_SSHLOGIN_NAME".
- *
+ *
* @param globals Arglist to add the GHashTable to.
* @param filepath Path to file with serialized GHashTable.
*/
@@ -488,10 +488,10 @@
int fd;
#if 0
- fprintf(stderr, "ntp_11_recv_file\n");
+ fprintf (stderr, "ntp_11_recv_file\n");
#endif
- n = recv_line(soc, input, sizeof(input) - 1);
+ n = recv_line (soc, input, sizeof(input) - 1);
if (n <= 0)
return -1;
@@ -523,7 +523,7 @@
/* We now know that we have to read <bytes> bytes from the remote socket. */
- fd = open(localname, O_CREAT|O_WRONLY|O_TRUNC, 0600);
+ fd = open (localname, O_CREAT|O_WRONLY|O_TRUNC, 0600);
if (fd < 0)
{
perror ("ntp_11_recv_file: open() ");
@@ -532,7 +532,7 @@
#if 0
fprintf(stderr, "ntp_11_recv_file: localname=%s\n", localname);
-#endif
+#endif
while (tot < bytes)
{
@@ -551,8 +551,8 @@
tot += n;
}
}
- auth_printf (globals, "SERVER <|> FILE_ACCEPTED <|> SERVER\n");
- /* Add the fact that what the remote client calls <filename> is actually
+ auth_printf (globals, "SERVER <|> FILE_ACCEPTED <|> SERVER\n");
+ /* Add the fact that what the remote client calls <filename> is actually
* <localname> here. */
files_add_translation (globals, origname, localname);
Modified: trunk/openvas-scanner/openvassd/utils.c
===================================================================
--- trunk/openvas-scanner/openvassd/utils.c 2009-12-09 09:19:40 UTC (rev 6111)
+++ trunk/openvas-scanner/openvassd/utils.c 2009-12-09 09:32:34 UTC (rev 6112)
@@ -297,25 +297,26 @@
* Maybe this hashtable should instead carry the (uploaded) file itself.
*/
char*
-temp_file_name()
+temp_file_name ()
{
- char* ret = emalloc(strlen(OPENVASSD_STATEDIR)+ strlen("tmp/") + strlen("tmp") + 40);
- int fd = - 1;
- do {
- if(fd > 0){
- if(close(fd) < 0)
- perror("close");
- }
- sprintf(ret, "%s/tmp", OPENVASSD_STATEDIR);
- mkdir(ret, 0700);
- sprintf(ret, "%s/tmp/tmp.%d-%d", OPENVASSD_STATEDIR, getpid(), rand()%1024);
- fd = open(ret, O_RDONLY);
- }
- while (fd >= 0);
- if(close(fd) < 0)
- perror("close");
+ char* ret = emalloc (strlen (OPENVASSD_STATEDIR) + strlen ("tmp/")
+ + strlen ("tmp") + 40);
+ int fd = - 1;
+ do {
+ if (fd > 0 && close (fd) < 0)
+ perror("close");
- return ret;
+ sprintf (ret, "%s/tmp", OPENVASSD_STATEDIR);
+ mkdir (ret, 0700);
+ sprintf (ret, "%s/tmp/tmp.%d-%d", OPENVASSD_STATEDIR, getpid (),
+ rand () % 1024);
+ fd = open (ret, O_RDONLY);
+ } while (fd >= 0);
+
+ if (close (fd) < 0)
+ perror ("close");
+
+ return ret;
}
More information about the Openvas-commits
mailing list