From: aland Date: Wed, 8 Nov 2000 21:22:09 +0000 (+0000) Subject: These files are no longer relevant. The new configuration file X-Git-Tag: release_0_1_0~512 X-Git-Url: http://www.project-moonshot.org/gitweb/?p=freeradius.git;a=commitdiff_plain;h=7ff2a9fd87f6411adf76d24a1d727b4bd2d0fcee These files are no longer relevant. The new configuration file does all these were proposing to do, and more. --- diff --git a/todo/realm.c b/todo/realm.c deleted file mode 100644 index f33e0a3..0000000 --- a/todo/realm.c +++ /dev/null @@ -1,185 +0,0 @@ -/* - * realm.c Read and process realm file. - * - * - * Version: @(#) realm.c 16-Jul-1998 miquels@cistron.nl - * - */ - -char util_sccsid[] = -"@(#)realm.c 1.0 Copyright 1998 Cistron Internet Services B.V."; - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include "radiusd.h" - -CONF *conf; - -struct tpl { - char *name; - int offset; -}; - -static struct tpl tpl[] = { - { "realm", offsetof(CONF, realm) }, - { "radwtmp", offsetof(CONF, radwtmp) }, - { "radutmp", offsetof(CONF, radutmp) }, - { "acctdir", offsetof(CONF, acctdir) }, - { "acctdir2", offsetof(CONF, acctdir2) }, - { "authproxy", offsetof(CONF, authproxy) }, - { "acctproxy", offsetof(CONF, acctproxy) }, - { "striprealm", offsetof(CONF, striprealm) }, - { NULL, -1 }, -}; - -/* - * Initialize the config file structs. - */ -static CONF *initconf(void) -{ - conf = (CONF *)malloc(sizeof(CONF)); - memset(conf, 0, sizeof(CONF)); - - strcpy(conf->radutmp, RADUTMP); - strcpy(conf->radutmp, RADWTMP); - strcpy(conf->confdir, RADIUS_DIR); - strcpy(conf->acctdir, RADACCT_DIR); - strcpy(conf->logdir, RADLOG_DIR); - strcpy(conf->pidfile, RADIUS_PID); - strcpy(conf->checkrad, CHECKRAD1); - strcpy(conf->checkrad2, CHECKRAD2); - strcpy(conf->striprealm, "yes"); - - return conf; -} - -/* - * Read the config file. - */ -int readconf(char *conffile) -{ - FILE *fp; - char buf[128]; - char *key, *val; - char lineno = 0; - CONF *cf, *cf2; - int first = 1; - - /* - * Initialize. - */ - if ((fp = fopen(conffile, "r")) == NULL) { - log(L_ERR, "%s: %s", conffile, strerror(errno)); - return -1; - } - cf = initconf(); - - /* - * Read config file line by line. - */ - while(fgets(buf, sizeof(buf), fp)) { - lineno++; - /* - * Skip comments and empty lines, and split - * the rest up in key/value pairs. - */ - if (buf[0] == '#' || buf[0] == '\n' || buf[0] == 0) - continue; - key = strtok(buf, " \t"); - val = strtok(NULL, "\n"); - if (key == NULL || key[0] == 0 || - val == NULL || val[0] == 0) { - log(L_ERR, "%s[%d]: syntax error", conffile, lineno); - return -1; - } - - /* - * The "realm" key is special, we allocate a new - * CONF now _unless_ the "realm" keyword is the - * first keyword in the file. - */ - if (strcmp(key, "realm") == 0 && !first) { - cf2 = (CONF *)malloc(sizeof(CONF)); - memcpy(cf2, cf, sizeof(CONF)); - strcpy(cf2->striprealm, "no"); - cf->next = cf2; - cf = cf2; - } - first = 0; - - /* - * Find the key in our keyword list and - * calculate the offset into the CONF struct - * for the value. - */ - for(i = 0; tpl[i].name; i++) { - if (strcmp(tpl[i].name, key) == 0) - break; - } - if (tpl[i].name == NULL) { - log(L_ERR, "%s[%d]: unknown keyword %s", - conffile, lineno, key); - return -1; - } - strcpy((char *)cf + tpl[i].offset, val); - } - fclose (fp); - - return 0; -} - -/* - * Find the configuration for a certain realm. - * We modify the username in-place, so this function should - * only be called once. - */ -CONF *getconf(char *username) -{ - char buf[128]; - char *realm, *user; - CONF *cf; - - strncpy(buf, username, 128); - buf[128] = 0; - - /* - * Split username and realm. We support both - * realm\username and username@realm. - */ - if ((realm = strchr(buf, '@')) != NULL) { - *realm++ = 0; - user = buf; - } else if ((user = strchr(buf, '\\')) != NULL) { - *user++ = 0; - realm = buf; - } else - return conf; - - /* - * Find this realm in the conffile, if not found use - * the default (local) realm and do not strip the realm, - * If found strip realm from username if needed. - */ - for (cf = conf; cf; cf = cf->next) - if (strcasecmp(realm, cf->realm) == 0) - break; - if (cf == NULL) { - cf = conf; - } else { - if (strcmp(cf->striprealm, "yes") == 0) - strcpy(username, user); - } - - return conf; -} - diff --git a/todo/realm.h b/todo/realm.h deleted file mode 100644 index a1da547..0000000 --- a/todo/realm.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Yep, this struct is too big, using fixed length strings - * is evil. But it makes things easier - for now. - */ -typedef struct conf { - char realm[128]; - char radwtmp[128]; - char radutmp[128]; - char acctdir[128]; - char acctdir2[128]; - char authproxy[128]; - char acctproxy[128]; - char striprealm[128]; - struct conf *next; -} CONF; - diff --git a/todo/realms b/todo/realms deleted file mode 100644 index 9abc612..0000000 --- a/todo/realms +++ /dev/null @@ -1,35 +0,0 @@ -# -# realms Realm-specific definitions. -# A realm is the part after an `@' sign in a loginname. -# - -# -# The first few entries are global settings. -# -# Notes: you can define acctdir and acctdir2, and in both -# directories the detail log will be written. `%s' expands -# to the (short) name of the terminal server. -# -radwtmp /var/log/radwtmp -radutmp /var/log/radutmp -acctdir /var/log/radacct/%s - -# -# All entries can be overridden on a per-realm base. Specific -# entries for a realm are: -# -# authproxy: remote_radius[:port] secret -# acctproxy: remote_radius[:port] secret -# -realm example.nl -acctdir /var/log/radacct/%s -acctdir2 /var/log/radacct/example -authproxy radius.example.nl testing123 -acctproxy radius.example.nl testing123 - -realm voorbeeld.nl -acctdir /var/log/radacct/%s -acctdir2 /var/log/radacct/voorbeeld -authproxy radius.voorbeeld.nl:1812 HellOtHere -acctproxy radius.voorbeeld.nl:1813 HellOtHere -