Loading ...
Sorry, an error occurred while loading the content.

Re: qmgr ignoring syslog_facility?

Expand Messages
  • Victor Duchovni
    ... Only in the case that master.cf contains -o syslog_name=... overrides, right? ... mail_params_init(); if (redo_syslog_init)
    Message 1 of 20 , Jun 2, 2008
    • 0 Attachment
      On Mon, Jun 02, 2008 at 10:49:40AM -0400, Wietse Venema wrote:

      > > > Apparently, that fixes changes in syslog_name, but not changes in
      > > > syslog_facility. I'll put that on the TODO list.
      > >
      > > All msg_syslog_init() calls have fixed parameters, so it seems that
      > > the syslog_facility parameter implementation was not completed
      > > after the main.cf parameter was defined.
      >
      > Actually, the syslog_facility feature got broken when I implemented
      > the above fix for syslog_name.


      Only in the case that master.cf contains "-o syslog_name=..." overrides, right?

      ...

      mail_params_init();
      if (redo_syslog_init)
      msg_syslog_init(mail_task(var_procname), LOG_PID, LOG_FACILITY);
      ^^^^^^^^^^^^
      should be var_syslog_facility?

      ...

      case 'o':
      /* XXX Use split_nameval() */
      if ((oval = split_at(optarg, '=')) == 0)
      oval = "";
      mail_conf_update(optarg, oval);
      if (strcmp(optarg, VAR_SYSLOG_NAME) == 0)
      redo_syslog_init = 1;
      break;

      ...

      --
      Viktor.

      Disclaimer: off-list followups get on-list replies or get ignored.
      Please do not ignore the "Reply-To" header.

      To unsubscribe from the postfix-users list, visit
      http://www.postfix.org/lists.html or click the link below:
      <mailto:majordomo@...?body=unsubscribe%20postfix-users>

      If my response solves your problem, the best way to thank me is to not
      send an "it worked, thanks" follow-up. If you must respond, please put
      "It worked, thanks" in the "Subject" so I can delete these quickly.
    • Wietse Venema
      ... A bug is a bug, even if it triggers only sometimes. The redo_syslog_init branch clobbers the syslog_facility. However, LOG_FACILITY is an int, while
      Message 2 of 20 , Jun 2, 2008
      • 0 Attachment
        Victor Duchovni:
        > On Mon, Jun 02, 2008 at 10:49:40AM -0400, Wietse Venema wrote:
        >
        > > > > Apparently, that fixes changes in syslog_name, but not changes in
        > > > > syslog_facility. I'll put that on the TODO list.
        > > >
        > > > All msg_syslog_init() calls have fixed parameters, so it seems that
        > > > the syslog_facility parameter implementation was not completed
        > > > after the main.cf parameter was defined.
        > >
        > > Actually, the syslog_facility feature got broken when I implemented
        > > the above fix for syslog_name.
        >
        >
        > Only in the case that master.cf contains "-o syslog_name=..." overrides, right?
        >
        > ...
        >
        > mail_params_init();
        > if (redo_syslog_init)
        > msg_syslog_init(mail_task(var_procname), LOG_PID, LOG_FACILITY);
        > ^^^^^^^^^^^^
        > should be var_syslog_facility?

        A bug is a bug, even if it triggers only sometimes.

        The redo_syslog_init branch clobbers the syslog_facility. However,
        LOG_FACILITY is an int, while var_syslog_facility is a string.
        The msg_syslog(3) API needs to be revised so that name and facility
        can be updated more easily.

        Wietse
      • Victor Duchovni
        ... I am also not sure about when/how the explicit syslog_facility is used. It seems that it is passed with each call to msg_syslog(): static void
        Message 3 of 20 , Jun 2, 2008
        • 0 Attachment
          On Mon, Jun 02, 2008 at 12:45:51PM -0400, Wietse Venema wrote:

          > > Only in the case that master.cf contains "-o syslog_name=..." overrides, right?
          > >
          > > ...
          > >
          > > mail_params_init();
          > > if (redo_syslog_init)
          > > msg_syslog_init(mail_task(var_procname), LOG_PID, LOG_FACILITY);
          > > ^^^^^^^^^^^^
          > > should be var_syslog_facility?
          >
          > A bug is a bug, even if it triggers only sometimes.
          >
          > The redo_syslog_init branch clobbers the syslog_facility. However,
          > LOG_FACILITY is an int, while var_syslog_facility is a string.
          > The msg_syslog(3) API needs to be revised so that name and facility
          > can be updated more easily.

          I am also not sure about when/how the explicit syslog_facility is used. It seems
          that it is passed with each call to msg_syslog():

          static void msg_syslog_print(int level, const char *text)
          {
          static int log_level[] = {
          LOG_INFO, LOG_WARNING, LOG_ERR, LOG_CRIT, LOG_CRIT,
          };
          static char *severity_name[] = {
          "info", "warning", "error", "fatal", "panic",
          };

          if (level < 0 || level >= (int) (sizeof(log_level) / sizeof(log_level[0])))
          msg_panic("msg_syslog_print: invalid severity level: %d", level);

          if (level == MSG_INFO) {
          syslog(syslog_facility | log_level[level], "%.*s",
          (int) MSG_SYSLOG_RECLEN, text);
          } else {
          syslog(syslog_facility | log_level[level], "%s: %.*s",
          severity_name[level], (int) MSG_SYSLOG_RECLEN, text);
          }
          }

          So does it in fact matter what facility is passed to the second openlog()?

          --
          Viktor.

          Disclaimer: off-list followups get on-list replies or get ignored.
          Please do not ignore the "Reply-To" header.

          To unsubscribe from the postfix-users list, visit
          http://www.postfix.org/lists.html or click the link below:
          <mailto:majordomo@...?body=unsubscribe%20postfix-users>

          If my response solves your problem, the best way to thank me is to not
          send an "it worked, thanks" follow-up. If you must respond, please put
          "It worked, thanks" in the "Subject" so I can delete these quickly.
        • Wietse Venema
          ... No, but the whole discussion shows that syslog_name/facility support is poorly structured and that it needs to be cleaned up. This code is no longer
          Message 4 of 20 , Jun 2, 2008
          • 0 Attachment
            Victor Duchovni:
            > So does it in fact matter what facility is passed to the second openlog()?

            No, but the whole discussion shows that syslog_name/facility support
            is poorly structured and that it needs to be cleaned up. This code
            is no longer "obviously correct".

            Wietse
          Your message has been successfully submitted and would be delivered to recipients shortly.