summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--auth/addr/src/addr.c22
-rw-r--r--auth/login/src/login.c16
2 files changed, 33 insertions, 5 deletions
diff --git a/auth/addr/src/addr.c b/auth/addr/src/addr.c
index 3bd893d6e..08e79d40a 100644
--- a/auth/addr/src/addr.c
+++ b/auth/addr/src/addr.c
@@ -39,6 +39,7 @@
auth_result_t
gf_auth (dict_t *input_params, dict_t *config_params)
{
+ int ret = 0;
char *name = NULL;
char *searchstr = NULL;
char peer_addr[UNIX_PATH_MAX];
@@ -55,19 +56,34 @@ gf_auth (dict_t *input_params, dict_t *config_params)
return AUTH_DONT_CARE;
}
- asprintf (&searchstr, "auth.addr.%s.allow", name);
+ ret = asprintf (&searchstr, "auth.addr.%s.allow", name);
+ if (-1 == ret) {
+ gf_log ("auth/addr", GF_LOG_ERROR,
+ "asprintf failed while setting search string");
+ return AUTH_DONT_CARE;
+ }
allow_addr = dict_get (config_params,
searchstr);
free (searchstr);
- asprintf (&searchstr, "auth.addr.%s.reject", name);
+ ret = asprintf (&searchstr, "auth.addr.%s.reject", name);
+ if (-1 == ret) {
+ gf_log ("auth/addr", GF_LOG_ERROR,
+ "asprintf failed while setting search string");
+ return AUTH_DONT_CARE;
+ }
reject_addr = dict_get (config_params,
searchstr);
free (searchstr);
if (!allow_addr) {
/* TODO: backword compatibility */
- asprintf (&searchstr, "auth.ip.%s.allow", name);
+ ret = asprintf (&searchstr, "auth.ip.%s.allow", name);
+ if (-1 == ret) {
+ gf_log ("auth/addr", GF_LOG_ERROR,
+ "asprintf failed while setting search string");
+ return AUTH_DONT_CARE;
+ }
allow_addr = dict_get (config_params, searchstr);
free (searchstr);
}
diff --git a/auth/login/src/login.c b/auth/login/src/login.c
index 9b12365fc..ec77fc172 100644
--- a/auth/login/src/login.c
+++ b/auth/login/src/login.c
@@ -27,6 +27,7 @@
auth_result_t gf_auth (dict_t *input_params, dict_t *config_params)
{
+ int ret = 0;
char *username = NULL, *password = NULL;
data_t *allow_user = NULL, *username_data = NULL, *password_data = NULL;
int32_t result = AUTH_DONT_CARE;
@@ -52,7 +53,13 @@ auth_result_t gf_auth (dict_t *input_params, dict_t *config_params)
return AUTH_REJECT;
}
- asprintf (&searchstr, "auth.login.%s.allow", brick_name);
+ ret = asprintf (&searchstr, "auth.login.%s.allow", brick_name);
+ if (-1 == ret) {
+ gf_log ("auth/login", GF_LOG_ERROR,
+ "asprintf failed while setting search string");
+ return AUTH_DONT_CARE;
+ }
+
allow_user = dict_get (config_params,
searchstr);
free (searchstr);
@@ -69,7 +76,12 @@ auth_result_t gf_auth (dict_t *input_params, dict_t *config_params)
if (!fnmatch (username_str,
username,
0)) {
- asprintf (&searchstr, "auth.login.%s.password", username);
+ ret = asprintf (&searchstr, "auth.login.%s.password", username);
+ if (-1 == ret) {
+ gf_log ("auth/login", GF_LOG_ERROR,
+ "asprintf failed while setting search string");
+ return AUTH_DONT_CARE;
+ }
passwd_data = dict_get (config_params, searchstr);
FREE (searchstr);