Skip to content

NOLOGON disable configuration not working #4

Description

@rombust

This configuration command appears to be ignored.
NOLOGON disable

As a temporary fix, redirect the NOLOGINDIR folder elsewhere
From
NOLOGINDIR /etc
To
NOLOGINDIR /etc/apcupsd

Looking in src/action.c


static void prohibit_logins(UPSINFO *ups)
{
   if (ups->nologin_file)
      return;                      /* already done */

   logonfail(ups, 0);
   ups->nologin_file = true;

   log_event(ups, LOG_ALERT, _("User logins prohibited"));
}

The "ups->nologin_file" is only ever set to false in lib/apcconfig.c

I suggest adding this fix:

In apcconfig.c
In the function below add the switch case to use GENINFO logins - "disable", NEVER "


void check_for_config(UPSINFO *ups, char *cfgfile)
    -
   switch (ups->nologin.type) {
   case TIMEOUT:
      if (ups->maxtime != 0)
         ups->nologin_time = (int)(ups->maxtime * 0.9);
      break;
   case PERCENT:
      ups->nologin_time = (int)(ups->percent * 1.1);
      if (ups->nologin_time == ups->percent)
         ups->nologin_time++;
      break;
   case MINUTES:
      ups->nologin_time = (int)(ups->runtime * 1.1);
      if (ups->nologin_time == ups->runtime)
         ups->nologin_time++;
      break;

*************************
***** Add this case *****
*************************
	case NEVER:
		ups->nologin_file = true;
		break;	
   default:
      break;

	-

Edit: I see this isn't the official repo. It's a shame Apcupsd project isn't moved to something like Github. An easy place to view submitted patches

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions