diff --git a/src/elogd.c b/src/elogd.c
index a9b39518..f2f74e45 100755
--- a/src/elogd.c
+++ b/src/elogd.c
@@ -6,6 +6,9 @@
Contents: Web server program for Electronic Logbook ELOG
$Log$
+ Revision 1.332 2004/06/04 21:37:14 midas
+ Fixed substring problem with admin user
+
Revision 1.331 2004/06/04 15:05:01 midas
Adjusted indentation
@@ -802,6 +805,7 @@ void logf(LOGBOOK * lbs, const char *format, ...);
BOOL check_login_user(LOGBOOK * lbs, char *user);
LBLIST get_logbook_hierarchy(void);
int is_logbook_in_group(LBLIST pgrp, char *logbook);
+BOOL is_admin_user(char *logbook, char *user);
void free_logbook_hierarchy(LBLIST root);
void show_top_text(LOGBOOK * lbs);
void show_bottom_text(LOGBOOK * lbs);
@@ -6292,7 +6296,7 @@ void show_change_pwd_page(LOGBOOK * lbs)
if (user[0]
&& get_user_line(lbs->name, user, act_pwd, NULL, NULL, NULL)) {
/* administrator does not have to supply old password */
- if (getcfg(lbs->name, "Admin user", str) && strstr(str, getparam("unm")) != 0)
+ if (is_admin_user(lbs->name, getparam("unm")))
wrong_pwd = 0;
else {
if (strcmp(old_pwd, act_pwd) != 0)
@@ -6338,7 +6342,7 @@ void show_change_pwd_page(LOGBOOK * lbs)
rsprintf("%s \"%s\"\n", loc("Change password for user"), user);
- if (!getcfg(lbs->name, "Admin user", str) || !strstr(str, getparam("unm")) != 0) {
+ if (is_admin_user(lbs->name, getparam("unm"))) {
if (isparam("old_pwd"))
rsprintf("name, "Admin user", str)
- && strstr(str, getparam("unm")) != 0)
+ if (is_admin_user(lbs->name, getparam("unm")))
return TRUE;
/* search attribute which contains short_name of author */
@@ -7948,7 +7951,7 @@ void show_admin_page(LOGBOOK * lbs, char *top_group)
rsprintf("\n", loc("Cancel"));
if (lbs->top_group[0] && (!top_group || strieq(top_group, "global"))) {
- if (!getcfg("global", "Admin user", str) || strstr(str, getparam("unm")) != 0) {
+ if (is_admin_user("global", getparam("unm"))) {
if (lbs->top_group[0]) {
sprintf(str, "global %s", lbs->top_group);
@@ -7963,8 +7966,7 @@ void show_admin_page(LOGBOOK * lbs, char *top_group)
}
if (is_group("global") && !strieq(top_group, "global")) {
- if (!getcfg_simple("global", "Admin user", str)
- || strstr(str, getparam("unm")) != 0) {
+ if (is_admin_user("global", getparam("unm"))) {
sprintf(str, loc("Change %s"), "[global]");
rsprintf("\n", str);
}
@@ -8548,7 +8550,7 @@ void show_config_page(LOGBOOK * lbs)
/*---- if admin user, show user list ----*/
- if (getcfg(logbook, "Admin user", str) && strstr(str, getparam("unm")) != 0) {
+ if (is_admin_user(logbook, getparam("unm"))) {
rsprintf("\n");
rsprintf("
| %s: | \n", loc("Select user"));
rsprintf(" |