Commit b1e26457 authored by Nigel Kukard's avatar Nigel Kukard

Fixed support for blank realms

parent 78e098c1
...@@ -197,14 +197,14 @@ sub getConfig ...@@ -197,14 +197,14 @@ sub getConfig
} }
# Extract realm from username # Extract realm from username
if (defined($user->{'Username'}) && $user->{'Username'} =~ /^\S+@(\S+)$/) { if (defined($user->{'Username'}) && $user->{'Username'} =~ /^\S+(?:@(\S+))?$/) {
$realmName = $1; $realmName = $1 // "";
$server->log(LOG_DEBUG,"Processing realm attributes for '$realmName'"); $server->log(LOG_DEBUG,"Processing attributes for realm '$realmName'");
$sth = DBSelect($config->{'get_config_realm_id_query'},$realmName); $sth = DBSelect($config->{'get_config_realm_id_query'},$realmName);
if (!$sth) { if (!$sth) {
$server->log(LOG_ERR,"Failed to get user realm config attributes: ".AWITPT::DB::DBLayer::Error()); $server->log(LOG_ERR,"Failed to get realm config attributes: ".AWITPT::DB::DBLayer::Error());
return MOD_RES_NACK; return MOD_RES_NACK;
} }
# Fetch realm ID # Fetch realm ID
...@@ -216,7 +216,7 @@ sub getConfig ...@@ -216,7 +216,7 @@ sub getConfig
# User realm attributes # User realm attributes
$sth = DBSelect($config->{'get_config_realm_attributes_query'},$realmID); $sth = DBSelect($config->{'get_config_realm_attributes_query'},$realmID);
if (!$sth) { if (!$sth) {
$server->log(LOG_ERR,"Failed to get user realm config attributes: ".AWITPT::DB::DBLayer::Error()); $server->log(LOG_ERR,"Failed to get realm config attributes: ".AWITPT::DB::DBLayer::Error());
return MOD_RES_NACK; return MOD_RES_NACK;
} }
# Add any realm attributes to config attributes # Add any realm attributes to config attributes
...@@ -233,6 +233,8 @@ sub getConfig ...@@ -233,6 +233,8 @@ sub getConfig
return MOD_RES_NACK; return MOD_RES_NACK;
} }
$server->log(LOG_DEBUG,"Realm '$realmName' has ID '$realmID'");
# Get client name # Get client name
my $clientID; my $clientID;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment