]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/plugins/radius/config.c
Merge pull request #417 from enaess/fixes
[ppp.git] / pppd / plugins / radius / config.c
index 871cea060cb0e68cbccd99957ca1e800b55b0e8c..e1a4814873488945c0f60febb660996005f37464 100644 (file)
@@ -212,6 +212,7 @@ int rc_read_config(char *filename)
 
                if ((pos = strcspn(p, "\t ")) == 0) {
                        error("%s: line %d: bogus format: %s", filename, line, p);
+                       fclose(configfd);
                        return (-1);
                }
 
@@ -224,6 +225,7 @@ int rc_read_config(char *filename)
 
                if (option->status != ST_UNDEF) {
                        error("%s: line %d: duplicate option line: %s", filename, line, p);
+                       fclose(configfd);
                        return (-1);
                }
 
@@ -233,20 +235,28 @@ int rc_read_config(char *filename)
 
                switch (option->type) {
                        case OT_STR:
-                                if (set_option_str(filename, line, option, p) < 0)
+                               if (set_option_str(filename, line, option, p) < 0) {
+                                       fclose(configfd);
                                        return (-1);
+                               }
                                break;
                        case OT_INT:
-                                if (set_option_int(filename, line, option, p) < 0)
+                               if (set_option_int(filename, line, option, p) < 0) {
+                                       fclose(configfd);
                                        return (-1);
+                               }
                                break;
                        case OT_SRV:
-                                if (set_option_srv(filename, line, option, p) < 0)
+                               if (set_option_srv(filename, line, option, p) < 0) {
+                                       fclose(configfd);
                                        return (-1);
+                               }
                                break;
                        case OT_AUO:
-                                if (set_option_auo(filename, line, option, p) < 0)
+                               if (set_option_auo(filename, line, option, p) < 0) {
+                                       fclose(configfd);
                                        return (-1);
+                               }
                                break;
                        default:
                                fatal("rc_read_config: impossible case branch!");
@@ -525,7 +535,6 @@ int rc_find_server (char *server_name, UINT4 *ip_addr, char *secret)
        if (result == 0)
        {
                memset (buffer, '\0', sizeof (buffer));
-               memset (secret, '\0', sizeof (secret));
                error("rc_find_server: couldn't find RADIUS server %s in %s",
                      server_name, rc_conf_str("servers"));
                return (-1);