summaryrefslogtreecommitdiff
path: root/radsecproxy.c
diff options
context:
space:
mode:
authorvenaas <venaas>2007-01-03 16:18:58 +0000
committervenaas <venaas@e88ac4ed-0b26-0410-9574-a7f39faa03bf>2007-01-03 16:18:58 +0000
commit1bed790ea804bcbaad818f65e94d808521cf2265 (patch)
treedfd4c616cbc33735a5962a2f4c5c25119aff4edd /radsecproxy.c
parentfabfb78abfd614a755c7e0a2d145b1c073e768ce (diff)
radsrv realm routing changes
git-svn-id: https://svn.testnett.uninett.no/radsecproxy/trunk@21 e88ac4ed-0b26-0410-9574-a7f39faa03bf
Diffstat (limited to 'radsecproxy.c')
-rw-r--r--radsecproxy.c38
1 files changed, 7 insertions, 31 deletions
diff --git a/radsecproxy.c b/radsecproxy.c
index 59eb316..fe5be41 100644
--- a/radsecproxy.c
+++ b/radsecproxy.c
@@ -473,13 +473,16 @@ int pwdcrypt(uint8_t *plain, uint8_t *enc, uint8_t enclen, uint8_t *shared, uint
struct peer *id2peer(char *id, uint8_t len) {
int i;
- char **realm;
+ char **realm, *idrealm;
+ idrealm = strchr(id, '@');
+ if (idrealm)
+ idrealm++;
+ len -= idrealm - id;
for (i = 0; i < peer_count; i++) {
for (realm = peers[i].realms; *realm; realm++) {
- /* assume test@domain */
- printf("realmlength %d, usernamelength %d\n", strlen(*realm), len);
- if (strlen(*realm) == len - 5 && !memcmp(id + 5, *realm, len - 5)) {
+ printf("realm len %d\n", len);
+ if (strlen(*realm) == len && !memcmp(idrealm, *realm, len)) {
printf("found matching realm: %s, host %s\n", *realm, peers[i].host);
return peers + i;
}
@@ -537,39 +540,12 @@ struct peer *radsrv(struct request *rq, char *buf, struct peer *from) {
printf("\n");
}
- /* find out where to send the packet, for now we send to first connected
- TLS peer if UDP, and first UDP peer if TLS */
-
to = id2peer(&usernameattr[RAD_Attr_Value], usernameattr[RAD_Attr_Length] - 2);
if (!to) {
printf("radsrv: ignoring request, don't know where to send it\n");
return NULL;
}
-#if 0
- i = peer_count;
-
- switch (from->type) {
- case 'U':
- for (i = 0; i < peer_count; i++)
- if (peers[i].type == 'T' && peers[i].sockcl >= 0)
- break;
- break;
- case 'T':
- for (i = 0; i < peer_count; i++)
- if (peers[i].type == 'U')
- break;
- break;
- }
- if (i == peer_count) {
- printf("radsrv: ignoring request, don't know where to send it\n");
- return NULL;
- }
-
- to = &peers[i];
-
-#endif
-
if (!RAND_bytes(newauth, 16)) {
printf("radsrv: failed to generate random auth\n");
return NULL;