[tor-commits] [torsocks/master] Fix: move functions in file and set hidden attribute
dgoulet at torproject.org
dgoulet at torproject.org
Fri Apr 4 22:40:27 UTC 2014
commit d8de94d57f695c4011535c5a1ec8fad60b37ac69
Author: David Goulet <dgoulet at ev0ke.net>
Date: Mon Mar 3 15:55:06 2014 -0500
Fix: move functions in file and set hidden attribute
Signed-off-by: David Goulet <dgoulet at ev0ke.net>
---
src/common/config-file.c | 126 +++++++++++++++++++++++-----------------------
1 file changed, 64 insertions(+), 62 deletions(-)
diff --git a/src/common/config-file.c b/src/common/config-file.c
index aaaa663..2882678 100644
--- a/src/common/config-file.c
+++ b/src/common/config-file.c
@@ -45,68 +45,6 @@ static const char *conf_socks5_pass_str = "SOCKS5Password";
static unsigned int both_socks5_pass_user_set;
/*
- * Set the SOCKS5 username to the given configuration.
- *
- * Return 0 on success else a negative value.
- */
-int conf_file_set_socks5_user(const char *username,
- struct configuration *config)
-{
- int ret;
-
- assert(username);
- assert(config);
-
- if (strlen(username) > sizeof(config->conf_file.socks5_username)) {
- ERR("[config] Invalid %s value for %s", username,
- conf_socks5_user_str);
- ret = -EINVAL;
- goto error;
- }
-
- strncpy(config->conf_file.socks5_username, username, strlen(username));
- if (++both_socks5_pass_user_set == 2) {
- config->socks5_use_auth = 1;
- }
- DBG("[config] %s set to %s", conf_socks5_user_str, username);
- return 0;
-
-error:
- return ret;
-}
-
-/*
- * Set the SOCKS5 password to the given configuration.
- *
- * Return 0 on success else a negative value.
- */
-int conf_file_set_socks5_pass(const char *password,
- struct configuration *config)
-{
- int ret;
-
- assert(password);
- assert(config);
-
- if (strlen(password) > sizeof(config->conf_file.socks5_password)) {
- ERR("[config] Invalid %s value for %s", password,
- conf_socks5_pass_str);
- ret = -EINVAL;
- goto error;
- }
-
- strncpy(config->conf_file.socks5_password, password, strlen(password));
- if (++both_socks5_pass_user_set == 2) {
- config->socks5_use_auth = 1;
- }
- DBG("[config] %s set to %s", conf_socks5_pass_str, password);
- return 0;
-
-error:
- return ret;
-}
-
-/*
* Set the onion pool address range in the configuration object using the value
* found in the conf file.
*
@@ -330,6 +268,70 @@ error:
}
/*
+ * Set the SOCKS5 username to the given configuration.
+ *
+ * Return 0 on success else a negative value.
+ */
+ATTR_HIDDEN
+int conf_file_set_socks5_user(const char *username,
+ struct configuration *config)
+{
+ int ret;
+
+ assert(username);
+ assert(config);
+
+ if (strlen(username) > sizeof(config->conf_file.socks5_username)) {
+ ERR("[config] Invalid %s value for %s", username,
+ conf_socks5_user_str);
+ ret = -EINVAL;
+ goto error;
+ }
+
+ strncpy(config->conf_file.socks5_username, username, strlen(username));
+ if (++both_socks5_pass_user_set == 2) {
+ config->socks5_use_auth = 1;
+ }
+ DBG("[config] %s set to %s", conf_socks5_user_str, username);
+ return 0;
+
+error:
+ return ret;
+}
+
+/*
+ * Set the SOCKS5 password to the given configuration.
+ *
+ * Return 0 on success else a negative value.
+ */
+ATTR_HIDDEN
+int conf_file_set_socks5_pass(const char *password,
+ struct configuration *config)
+{
+ int ret;
+
+ assert(password);
+ assert(config);
+
+ if (strlen(password) > sizeof(config->conf_file.socks5_password)) {
+ ERR("[config] Invalid %s value for %s", password,
+ conf_socks5_pass_str);
+ ret = -EINVAL;
+ goto error;
+ }
+
+ strncpy(config->conf_file.socks5_password, password, strlen(password));
+ if (++both_socks5_pass_user_set == 2) {
+ config->socks5_use_auth = 1;
+ }
+ DBG("[config] %s set to %s", conf_socks5_pass_str, password);
+ return 0;
+
+error:
+ return ret;
+}
+
+/*
* Read and populate the given config parsed data structure.
*
* Return 0 on success or else a negative value.
More information about the tor-commits
mailing list