[Openvas-commits] r6113 - in trunk/openvas-libraries: . misc
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Wed Dec 9 11:03:59 CET 2009
Author: felix
Date: 2009-12-09 11:03:57 +0100 (Wed, 09 Dec 2009)
New Revision: 6113
Modified:
trunk/openvas-libraries/ChangeLog
trunk/openvas-libraries/misc/openvas_ssh_login.c
Log:
* misc/openvas_ssh_login.c: Cosmetics (maily spaces).
Modified: trunk/openvas-libraries/ChangeLog
===================================================================
--- trunk/openvas-libraries/ChangeLog 2009-12-09 09:32:34 UTC (rev 6112)
+++ trunk/openvas-libraries/ChangeLog 2009-12-09 10:03:57 UTC (rev 6113)
@@ -1,3 +1,7 @@
+2009-12-09 Felix Wolfsteller <felix.wolfsteller at intevation.de>
+
+ * misc/openvas_ssh_login.c: Cosmetics (maily spaces).
+
2009-12-09 Chandrashekhar B <bchandra at secpod.com>
* misc/plugutils.c (mark_post): resolved compiler wanring
Modified: trunk/openvas-libraries/misc/openvas_ssh_login.c
===================================================================
--- trunk/openvas-libraries/misc/openvas_ssh_login.c 2009-12-09 09:32:34 UTC (rev 6112)
+++ trunk/openvas-libraries/misc/openvas_ssh_login.c 2009-12-09 10:03:57 UTC (rev 6113)
@@ -47,12 +47,12 @@
* if OpenVAS and GTK are compiled with a different libc.
* TODO: The windows issue needs verification and proper documentation. Maybe a
* proper build could prohibit any problems.
- *
*
+ *
* FIXME: handle symbolic links
* FIXME: this one is a code duplicate of check_exists in
* openvas-client/context.c, but needed in openvas-libraries as well.
- *
+ *
* @return 1 if file exists, 0 otherwise.
*/
int
@@ -60,7 +60,7 @@
{
struct stat sb;
- if(stat(name, &sb))
+ if (stat (name, &sb))
return 0;
else
return 1;
@@ -68,13 +68,13 @@
/**
* @brief Initializes a openvas_ssh_login.
- *
+ *
* Key and Info files have to be created separately.
* However, it is tested if the keyfiles do exist and the 'valid' flag is set
* accordingly.
* Note that the parameter are not copied, so ensure they live as long as this
* login.
- *
+ *
* @return A fresh openvas_ssh_login.
*/
openvas_ssh_login*
@@ -89,17 +89,17 @@
loginfo->private_key_path = privkey_file;
loginfo->ssh_key_passphrase = passphrase;
loginfo->comment = comment;
-
+
loginfo->valid = (file_check_exists(pubkey_file) == 1
&& file_check_exists(privkey_file) == 1);
-
+
return loginfo;
}
/**
* @brief Frees data associated with a openvas_ssh_login.
- *
+ *
* @param loginfo openvas_ssh_login to free.
*/
void
@@ -127,12 +127,12 @@
/**
* @brief Creates a string to be sent to the server as value for a SSH_LOGIN
* plugin preference.
- *
+ *
* It follows the pattern:
* username|userpass|pubkeyfilepath|privkeyfilepath|passphrase .
- *
+ *
* @param loginfo openvas_ssh_login that will be used to assemble the string.
- *
+ *
* @return Freshly created string or NULL if loginfo == NULL.
*/
char*
@@ -174,12 +174,12 @@
/**
* @brief Writes information of all ssh logins found in a hashtable into a file.
- *
+ *
* To load the information again, openvas_ssh_login_file_read can be used.
- *
+ *
* @param ssh_logins Hashtable with pointers to openvas_ssh_login s as values.
* @param filename Path to file to wtite to.
- *
+ *
* @return TRUE if file was written (success), FALSE if an error occured.
*/
gboolean
@@ -190,7 +190,7 @@
gsize data_length;
GError* err = NULL;
int fd;
-
+
g_key_file_set_comment(key_file, NULL, NULL,
"This file was generated by OpenVAS and shall not be edited manually.",
&err);
@@ -207,7 +207,7 @@
{
g_hash_table_foreach(ssh_logins, (GHFunc) add_sshlogin_to_file, key_file);
} // (else file content is comment only)
-
+
// Write GKeyFile to filesystem.
fd = open(filename, O_RDWR|O_CREAT|O_TRUNC, 0600);
if(!fd)
@@ -238,18 +238,18 @@
/**
* @brief Reads a ssh_login file and returns info in a GHashTable.
- *
+ *
* The GHashTable contains the names as keys and pointers to openvas_ssh_logins
* as values.
* If check_keyfiles TRUE, openvas_ssh_logins are checked before being
* added to the hashtable:
* if the public and private key files do not exist, the openvas_ssh_login would
* not be added.
- *
+ *
* @param filename File to read from.
* @param check_keyfiles If TRUE, checks if referenced keyfiles do exist, before
* adding the openvas_ssh_login to the HashTable.
- *
+ *
* @return GHashTable, keys are names of openvas_ssh_logins, who are values.
*/
GHashTable*
@@ -262,7 +262,7 @@
GHashTable* loginfos = g_hash_table_new_full(g_str_hash, g_str_equal,
NULL, (GDestroyNotify) openvas_ssh_login_free);
- g_key_file_load_from_file(key_file, filename, G_KEY_FILE_NONE, &err);
+ g_key_file_load_from_file (key_file, filename, G_KEY_FILE_NONE, &err);
if(err != NULL)
{
@@ -326,8 +326,10 @@
passphrase = g_key_file_get_string (key_file, names[i],
KEY_SSHLOGIN_PASSPHRASE, &err);
- openvas_ssh_login* loginfo = openvas_ssh_login_new (name, pubkey, privkey,
- passphrase, comment, username, userpass);
+ openvas_ssh_login* loginfo = openvas_ssh_login_new (name,
+ pubkey, privkey,
+ passphrase, comment,
+ username, userpass);
// Discard if error or files do not exist (depending on check_keyfiles param)
if (err != NULL)
More information about the Openvas-commits
mailing list