* Change the return value to return 0 instead of -1 when the
authorhartwick <hartwick>
Mon, 5 Feb 2001 19:23:34 +0000 (19:23 +0000)
committerhartwick <hartwick>
Mon, 5 Feb 2001 19:23:34 +0000 (19:23 +0000)
  clients, naslist, or realms files cannot be opened.  This makes
  the calling code treat it as a non-fatal error.

src/main/client.c
src/main/files.c
src/main/nas.c

index a0b26b0..6dd7c6f 100644 (file)
@@ -78,8 +78,11 @@ int read_clients_file(const char *file)
        clients = NULL;
 
        if ((fp = fopen(file, "r")) == NULL) {
-               radlog(L_CONS|L_ERR, "cannot open %s", file);
-               return -1;
+               /* The clients file is no longer required.  All configuration
+                  information is read from radiusd.conf and friends.  If
+                  clients exists it will be used, but if it doesn't no harm
+                  done. */
+               return 0;
        }
 
        while(fgets(buffer, 256, fp) != NULL) {
index 118695b..bf68f8e 100644 (file)
@@ -377,12 +377,11 @@ int read_realms_file(const char *file)
        realms = NULL;
 
        if ((fp = fopen(file, "r")) == NULL) {
-#if 1 /* For now - realms file is not obligatory */
+               /* The realms file is not mandatory.  If it exists it will
+                  be used, however, since the new style config files are
+                  more robust and flexible they are more likely to get used.
+                  So this is a non-fatal error.  */
                return 0;
-#else
-               radlog(L_CONS|L_ERR, "cannot open %s", file);
-               return -1;
-#endif
        }
        while(fgets(buffer, 256, fp) != NULL) {
                lineno++;
index 8b55bc2..b4c7485 100644 (file)
@@ -70,8 +70,11 @@ int read_naslist_file(char *file)
        naslist = NULL;
 
        if ((fp = fopen(file, "r")) == NULL) {
-               radlog(L_CONS|L_ERR, "cannot open %s", file);
-               return -1;
+               /* The naslist file is no longer required.  All configuration
+                  information comes from radiusd.conf.  If naslist exists it
+                  will be used, but if it doesn't exist it will be silently
+                  ignored. */
+               return 0;
        }
        while(fgets(buffer, 256, fp) != NULL) {
                lineno++;