Kaynağa Gözat

Change from simply using the hub name as the radius realm to allowing the realm name to be configured

Sacha J Bernstein 11 yıl önce
ebeveyn
işleme
e29a83ea61
3 değiştirilmiş dosya ile 5 ekleme ve 5 silme
  1. 1 1
      src/Cedar/Hub.h
  2. 2 2
      src/Cedar/Sam.c
  3. 2 2
      src/Cedar/Server.c

+ 1 - 1
src/Cedar/Hub.h

@@ -424,7 +424,7 @@ struct HUB
 	UINT RadiusRetryInterval;			// Radius retry interval
 	BUF *RadiusSecret;					// Radius shared key
 	char RadiusSuffixFilter[MAX_SIZE];	// Radius suffix filter
-	bool RadiusIncludeRealm;		// Radius - Should be use hub name as realm
+	char *RadiusRealm;		// Radius realm (optional)
 	volatile bool Halt;					// Halting flag
 	bool Offline;						// Offline
 	bool BeingOffline;					// Be Doing Offline

+ 2 - 2
src/Cedar/Sam.c

@@ -211,12 +211,12 @@ bool SamAuthUserByPlainPassword(CONNECTION *c, HUB *hub, char *username, char *p
 					AUTHRADIUS *auth = (AUTHRADIUS *)u->AuthData;
 					if (ast || auth->RadiusUsername == NULL || UniStrLen(auth->RadiusUsername) == 0)
 					{
-						if( h->RadiusIncludeRealm )
+						if( h->RadiusRealm && (StrLen(h->RadiusRealm) > 0) )
 						{	
 							char name_and_realm[MAX_SIZE];
 							StrCpy(name_and_realm, MAX_SIZE, username);
 							StrCat(name_and_realm, (MAX_SIZE - StrLen(name_and_realm)), "@");
-							StrCat(name_and_realm, (MAX_SIZE - StrLen(name_and_realm)), hub->Name);
+							StrCat(name_and_realm, (MAX_SIZE - StrLen(name_and_realm)), h->RadiusRealm);
 							name = CopyStrToUni(name_and_realm);
 						}
 						else

+ 2 - 2
src/Cedar/Server.c

@@ -4926,7 +4926,7 @@ void SiWriteHubCfg(FOLDER *f, HUB *h)
 		CfgAddInt(f, "RadiusServerPort", h->RadiusServerPort);
 		CfgAddInt(f, "RadiusRetryInterval", h->RadiusRetryInterval);
 		CfgAddStr(f, "RadiusSuffixFilter", h->RadiusSuffixFilter);
-		CfgAddBool(f, "RadiusIncludeRealm", h->RadiusIncludeRealm);
+		CfgAddStr(f, "RadiusRealm", h->RadiusRealm);
 	}
 	Unlock(h->RadiusOptionLock);
 
@@ -5092,7 +5092,7 @@ void SiLoadHubCfg(SERVER *s, FOLDER *f, char *name)
 			interval = CfgGetInt(f, "RadiusRetryInterval");
 
 			CfgGetStr(f, "RadiusSuffixFilter", h->RadiusSuffixFilter, sizeof(h->RadiusSuffixFilter));
-			h->RadiusIncludeRealm = CfgGetBool(f, "RadiusIncludeRealm");
+			CfgGetStr(f, "RadiusRealm", h->RadiusRealm, sizeof(h->RadiusRealm));
 
 			if (interval == 0)
 			{