From b1fdd0f5d4c32ed9dd60a26b6cc2591ea3ebe1aa Mon Sep 17 00:00:00 2001 From: kkalev Date: Sat, 7 Sep 2002 20:46:41 +0000 Subject: [PATCH] * If an sql attribute is not contained in sql, assume that it has the same name as in dialup_admin and that it is a reply item. Add a comment for that in conf/sql.attrmap. * Change the way radius attributes are read from the sql database. The change should make things somewhat faster. Create a reverse mapping from radius attributes to dialup_admin attributes. * Add a configuration directive called ldap_use_http_credentials. If it is set to yes then we try to connect to the ldap server with the username/password given in http authentication, not those contained in admin.conf. That way multiple admins with different permissions on the ldap tree can work on a single dialup_admin. * With the same logic we allow for multiple buttons html pages. We now create a folder html/buttons which by default contains a folder default. If the user logs in with http authentication then we try to open the file html/buttons//buttons.html.php3. If we can't we open html/buttons/default/buttons.html.php3. That way we can create muiltiple views of say the online users page based on which admin requests the page. --- Changelog | 15 +++++++++- conf/admin.conf | 11 +++++++ conf/sql.attrmap | 3 ++ htdocs/buttons.php3 | 15 ++++++++++ htdocs/index.html | 2 +- .../buttons/default/buttons.html.php3 | 4 +++ lib/ldap/change_attrs.php3 | 4 +-- lib/ldap/change_info.php3 | 3 +- lib/ldap/change_passwd.php3 | 3 +- lib/ldap/create_user.php3 | 3 +- lib/ldap/defaults.php3 | 3 +- lib/ldap/delete_user.php3 | 3 +- lib/ldap/find.php3 | 3 +- lib/ldap/functions.php3 | 30 ++++++++++++++++++- lib/ldap/password_check.php3 | 1 - lib/ldap/user_info.php3 | 3 +- lib/sql/attrmap.php3 | 1 + lib/sql/change_attrs.php3 | 5 ++++ lib/sql/create_group.php3 | 9 ++++-- lib/sql/create_user.php3 | 9 ++++-- lib/sql/defaults.php3 | 13 ++++++-- lib/sql/find.php3 | 4 +++ lib/sql/group_info.php3 | 14 +++++++-- lib/sql/user_info.php3 | 14 +++++++-- 24 files changed, 150 insertions(+), 25 deletions(-) create mode 100644 htdocs/buttons.php3 rename htdocs/buttons.html => html/buttons/default/buttons.html.php3 (96%) diff --git a/Changelog b/Changelog index 9c21533..09a85e6 100644 --- a/Changelog +++ b/Changelog @@ -1,4 +1,4 @@ -Ver 1.56: +Ver 1.60: * Small html fixes in user_edit.php3 and password.php3 * Show number of failed logins in the last 7 days in the user admin page * Show date in the user/server test page @@ -20,6 +20,19 @@ Ver 1.56: after the user tables. As a result user values should in general overwrite default values. * Add support for the default_user_profile of the sql module in lib/sql/defaults.php3 * In sql.attrmap User-Password should map to User-Password, not Password +* If an sql attribute is not contained in sql, assume that it has the same name as in dialup_admin and that + it is a reply item. Add a comment for that in conf/sql.attrmap. +* Change the way radius attributes are read from the sql database. The change should make things somewhat + faster. Create a reverse mapping from radius attributes to dialup_admin attributes. +* Add a configuration directive called ldap_use_http_credentials. If it is set to yes then we try to + connect to the ldap server with the username/password given in http authentication, not those contained + in admin.conf. That way multiple admins with different permissions on the ldap tree can work on a single + dialup_admin. +* With the same logic we allow for multiple buttons html pages. We now create a folder html/buttons which + by default contains a folder default. If the user logs in with http authentication then we try + to open the file html/buttons//buttons.html.php3. If we can't we open + html/buttons/default/buttons.html.php3. That way we can create muiltiple views of say the online users + page based on which admin requests the page. Ver 1.55: * Update the FAQ about missing attributes from the user/group edit pages and add a few comments in the configuration files diff --git a/conf/admin.conf b/conf/admin.conf index 47393a8..2fbc503 100644 --- a/conf/admin.conf +++ b/conf/admin.conf @@ -78,6 +78,17 @@ ldap_bindpw: XXXXXXX ldap_default_new_entry_suffix: ou=dialup,ou=guests,%{ldap_base} ldap_default_dn: uid=default-dialup,%{ldap_base} ldap_regular_profile_attr: dialupregularprofile +# +# If set to yes then the HTTP credentials (http authentication) +# will be used to bind to the ldap server instead of ldap_binddn +# and ldap_bindpw. That way multiple admins with different rights +# on the ldap database can connect through one dialup_admin interface. +# The ldap_binddn and ldap_bindpw are still needed to find the DN +# to bind with (http authentication will only provide us with a +# username). As a result the ldap_binddn should be able to do a search +# with a filter of (uid=). Normally, the anonymous (empty DN) +# user can do that. +#ldap_use_http_credentials: yes # # can be one of mysql,pg where: diff --git a/conf/sql.attrmap b/conf/sql.attrmap index b828c76..9a41e37 100644 --- a/conf/sql.attrmap +++ b/conf/sql.attrmap @@ -2,6 +2,9 @@ # A mapping between the attributes used by dialup_admin and the attribute # names that will be stored in the SQL database # +# Attributes that are not contained in this file are assumed to be reply +# items and map to the same name as the one used by dialup_admin +# # Format: # checkItem|replyItem Attribute-In-Dialup-Admin Attribute-In-SQL # diff --git a/htdocs/buttons.php3 b/htdocs/buttons.php3 new file mode 100644 index 0000000..12c2c32 --- /dev/null +++ b/htdocs/buttons.php3 @@ -0,0 +1,15 @@ + diff --git a/htdocs/index.html b/htdocs/index.html index e08c94e..b05a435 100644 --- a/htdocs/index.html +++ b/htdocs/index.html @@ -4,7 +4,7 @@ dialup administration - diff --git a/htdocs/buttons.html b/html/buttons/default/buttons.html.php3 similarity index 96% rename from htdocs/buttons.html rename to html/buttons/default/buttons.html.php3 index 0314494..49ab0b2 100644 --- a/htdocs/buttons.html +++ b/html/buttons/default/buttons.html.php3 @@ -18,6 +18,10 @@ function myout(a) { +Logged in as " . $HTTP_SERVER_VARS["PHP_AUTH_USER"] . "...

\n"; +?>
diff --git a/lib/ldap/change_attrs.php3 b/lib/ldap/change_attrs.php3 index 5d03a60..937d70c 100644 --- a/lib/ldap/change_attrs.php3 +++ b/lib/ldap/change_attrs.php3 @@ -1,8 +1,8 @@ $attr){ diff --git a/lib/ldap/change_info.php3 b/lib/ldap/change_info.php3 index a4d4188..d41a414 100644 --- a/lib/ldap/change_info.php3 +++ b/lib/ldap/change_info.php3 @@ -1,7 +1,8 @@ $desc){ if ($attrmap["$key"] == 'none') continue; + if ($attrmap["$key"] == ''){ + $attrmap["$key"] = $key; + $attr_type["key"] = 'replyItem'; + $rev_attrmap["$key"] = $key; + } $i = 0; $j = -1; $name = $attrmap["$key"] . $i; diff --git a/lib/sql/create_group.php3 b/lib/sql/create_group.php3 index bae7175..f6dee4b 100644 --- a/lib/sql/create_group.php3 +++ b/lib/sql/create_group.php3 @@ -29,11 +29,16 @@ if ($link){ foreach($show_attrs as $key => $attr){ if ($attrmap["$key"] == 'none') continue; - if ($attr_type[$key] == 'checkItem'){ + if ($attrmap["$key"] == ''){ + $attrmap["$key"] = $key; + $attr_type["$key"] = 'replyItem'; + $rev_attrmap["$key"] = $key; + } + if ($attr_type["$key"] == 'checkItem'){ $table = "$config[sql_groupcheck_table]"; $type = 1; } - else if ($attr_type[$key] == 'replyItem'){ + else if ($attr_type["$key"] == 'replyItem'){ $table = "$config[sql_groupreply_table]"; $type = 2; } diff --git a/lib/sql/create_user.php3 b/lib/sql/create_user.php3 index 7271325..fd723ef 100644 --- a/lib/sql/create_user.php3 +++ b/lib/sql/create_user.php3 @@ -66,11 +66,16 @@ if ($link){ foreach($show_attrs as $key => $attr){ if ($attrmap["$key"] == 'none') continue; - if ($attr_type[$key] == 'checkItem'){ + if ($attrmap["$key"] == ''){ + $attrmap["$key"] = $key; + $attr_type["$key"] = 'replyItem'; + $rev_attrmap["$key"] = $key; + } + if ($attr_type["$key"] == 'checkItem'){ $table = "$config[sql_check_table]"; $type = 1; } - else if ($attr_type[$key] == 'replyItem'){ + else if ($attr_type["$key"] == 'replyItem'){ $table = "$config[sql_reply_table]"; $type = 2; } diff --git a/lib/sql/defaults.php3 b/lib/sql/defaults.php3 index fbaa3ef..7641617 100644 --- a/lib/sql/defaults.php3 +++ b/lib/sql/defaults.php3 @@ -66,8 +66,17 @@ if ($login != ''){ } else echo "Database query failed: " . da_sql_error($link,$config) . "
\n"; - foreach($attrmap as $key => $val){ - if (isset($tmp[$val])){ + if (isset($tmp)){ + foreach(array_keys($tmp) as $val){ + if ($val == '') + continue; + $key = $rev_attrmap["$val"]; + if ($key == ''){ + $key = $val; + $attrmap["$key"] = $val; + $attr_type["$key"] = 'replyItem'; + $rev_attrmap["$val"] = $key; + } if (isset($default_vals["$key"]) && $overwrite_defaults){ if ($use_op) $default_vals["$key"][operator] = $tmp["$val"][operator]; diff --git a/lib/sql/find.php3 b/lib/sql/find.php3 index 22d2e5b..2c63819 100644 --- a/lib/sql/find.php3 +++ b/lib/sql/find.php3 @@ -22,6 +22,10 @@ if ($link){ } else if ($search_IN == 'radius' && $radius_attr != ''){ require("../lib/sql/attrmap.php3"); + if ($attrmap["$radius_attr"] == ''){ + $attrmap["$radius_attr"] = $radius_attr; + $attr_type["$radius_attr"] = 'replyItem'; + } $table = ($attr_type[$radius_attr] == 'checkItem') ? $config[sql_check_table] : $config[sql_reply_table]; $attr = $attrmap[$radius_attr]; $res = @da_sql_query($link,$config, diff --git a/lib/sql/group_info.php3 b/lib/sql/group_info.php3 index d26a912..eb29d74 100644 --- a/lib/sql/group_info.php3 +++ b/lib/sql/group_info.php3 @@ -64,13 +64,21 @@ if ($link){ } else echo "Database query failed partially: " . da_sql_error($link,$config) . "
\n"; - foreach($attrmap as $key => $val){ - if (isset($tmp[$val])){ + if (isset($tmp)){ + foreach(array_keys($tmp) as $val){ + if ($val == '') + continue; + $key = $rev_attrmap["$val"]; + if ($key == ''){ + $key = $val; + $attrmap["$key"] = $val; + $attr_type["$key"] = 'replyItem'; + $rev_attrmap["$val"] = $key; + } $item_vals["$key"] = $tmp[$val]; $item_vals["$key"][count] = $tmp[$val][count]; if ($use_op) $item_vals["$key"][operator] = $tmp[$val][operator]; - } } diff --git a/lib/sql/user_info.php3 b/lib/sql/user_info.php3 index 0bea692..81abcfb 100644 --- a/lib/sql/user_info.php3 +++ b/lib/sql/user_info.php3 @@ -93,13 +93,21 @@ if ($link){ } else echo "Database query failed partially: " . da_sql_error($link,$config) . "
\n"; - foreach($attrmap as $key => $val){ - if (isset($tmp[$val])){ + if (isset($tmp)){ + foreach(array_keys($tmp) as $val){ + if ($val == '') + continue; + $key = $rev_attrmap["$val"]; + if ($key == ''){ + $key = $val; + $attrmap["$key"] = $val; + $attr_type["$key"] = 'replyItem'; + $rev_attrmap["$val"] = $key; + } $item_vals["$key"] = $tmp[$val]; $item_vals["$key"][count] = $tmp[$val][count]; if ($use_op) $item_vals["$key"][operator] = $tmp[$val][operator]; - } } -- 2.39.5