]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/plugins/radius/radrealms.c
config: Include some extra files in the tarball
[ppp.git] / pppd / plugins / radius / radrealms.c
index 493af0322f7d412ed67170174492e782fe94002e..2702a40b084a574bec435f1591ce307a546fcf1a 100644 (file)
 *
 */
 
 *
 */
 
-static char const RCSID[] =
-    "$Id: radrealms.c,v 1.2 2004/11/14 07:26:26 paulus Exp $";
-
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
+#include <sys/param.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdarg.h>
+#include <sys/types.h>
+
 #include <pppd/pppd.h>
 
 #include "radiusclient.h"
 #include <pppd/pppd.h>
 
 #include "radiusclient.h"
@@ -68,7 +71,7 @@ lookup_realm(char const *user,
     }
     
     if ((fd = fopen(radrealms_config, "r")) == NULL) {
     }
     
     if ((fd = fopen(radrealms_config, "r")) == NULL) {
-       option_error("cannot open %s", radrealms_config);
+       ppp_option_error("cannot open %s", radrealms_config);
        free(auths);
        free(accts);
        return;
        free(auths);
        free(accts);
        return;
@@ -88,7 +91,7 @@ lookup_realm(char const *user,
        if (p == NULL || (strcmp(p, "authserver") !=0
            && strcmp(p, "acctserver"))) {
            fclose(fd);
        if (p == NULL || (strcmp(p, "authserver") !=0
            && strcmp(p, "acctserver"))) {
            fclose(fd);
-           option_error("%s: invalid line %d: %s", radrealms_config,
+           ppp_option_error("%s: invalid line %d: %s", radrealms_config,
                         line, buffer);
            free(auths);
            free(accts);
                         line, buffer);
            free(auths);
            free(accts);
@@ -104,7 +107,7 @@ lookup_realm(char const *user,
 
        if ((p = strtok(NULL, "\t ")) == NULL) {
            fclose(fd);
 
        if ((p = strtok(NULL, "\t ")) == NULL) {
            fclose(fd);
-           option_error("%s: realm name missing on line %d: %s",
+           ppp_option_error("%s: realm name missing on line %d: %s",
                         radrealms_config, line, buffer);
            free(auths);
            free(accts);
                         radrealms_config, line, buffer);
            free(auths);
            free(accts);
@@ -116,7 +119,7 @@ lookup_realm(char const *user,
            info(" - Matched realm %s", p);
            if ((p = strtok(NULL, ":")) == NULL) {
                fclose(fd);
            info(" - Matched realm %s", p);
            if ((p = strtok(NULL, ":")) == NULL) {
                fclose(fd);
-               option_error("%s: server address missing on line %d: %s",
+               ppp_option_error("%s: server address missing on line %d: %s",
                             radrealms_config, line, buffer);
                free(auths);
                free(accts);
                             radrealms_config, line, buffer);
                free(auths);
                free(accts);
@@ -126,7 +129,7 @@ lookup_realm(char const *user,
            info(" - Address is '%s'",p);
            if ((p = strtok(NULL, "\t ")) == NULL) {
                fclose(fd);
            info(" - Address is '%s'",p);
            if ((p = strtok(NULL, "\t ")) == NULL) {
                fclose(fd);
-               option_error("%s: server port missing on line %d:  %s",
+               ppp_option_error("%s: server port missing on line %d:  %s",
                             radrealms_config, line, buffer);
                free(auths);
                free(accts);
                             radrealms_config, line, buffer);
                free(auths);
                free(accts);
@@ -142,9 +145,13 @@ lookup_realm(char const *user,
 
     if (accts->max)
        *acctserver = accts;
 
     if (accts->max)
        *acctserver = accts;
+    else
+       free(accts);
 
     if (auths->max)
        *authserver = auths;
 
     if (auths->max)
        *authserver = auths;
+    else
+       free(auths);
 
     return;
 }
 
     return;
 }
@@ -154,6 +161,6 @@ plugin_init(void)
 {
     radius_pre_auth_hook = lookup_realm;
 
 {
     radius_pre_auth_hook = lookup_realm;
 
-    add_options(Options);
+    ppp_add_options(Options);
     info("RADIUS Realms plugin initialized.");
 }
     info("RADIUS Realms plugin initialized.");
 }