rpm-software-management / yum

[DEPRECATED] YUM package manager
GNU General Public License v2.0
127 stars 87 forks source link

Sender email address does not appear to be treated the same way for the envelope level as it is for email headers #126

Open atc0005 opened 4 years ago

atc0005 commented 4 years ago

Let's assume that the system is named cheetah.

It appears that the logic used to replace root@localhost with root@cheetah works as intended for the email headers, but does not apply to the address used as the sender address (the envelope) when sending the email message.

This code:

https://github.com/rpm-software-management/yum/blob/f8616a2d6e22705371fe6ba47597238d3d1dc2f1/yum-cron/yum-cron.py#L244-L247

appears to replace root@localhost with root@cheetah and store the result in domain. The domain variable is then used here:

https://github.com/rpm-software-management/yum/blob/f8616a2d6e22705371fe6ba47597238d3d1dc2f1/yum-cron/yum-cron.py#L247 to form msg['From'].

We can see here:

https://github.com/rpm-software-management/yum/blob/f8616a2d6e22705371fe6ba47597238d3d1dc2f1/yum-cron/yum-cron.py#L254

that the msg type is converted to a string to form the complete email headers/body (I may be butchering this description) as the last argument to the s.sendmail() call.

The first part of the s.sendmail() call appears to use the email_from value as-is without any conversion, so if the configuration has root@localhost, then this is used as-is for the first argument in the s.sendmail() function call.

Is this intentional?

Looking here:

https://github.com/rpm-software-management/yum/blob/f8616a2d6e22705371fe6ba47597238d3d1dc2f1/etc/yum-cron.conf#L33-L36

and here:

https://github.com/rpm-software-management/yum/blob/f8616a2d6e22705371fe6ba47597238d3d1dc2f1/etc/yum-cron.conf#L50-L59

I don't see this behavior documented as intentional.

Is this a documentation problem or is the s.sendmail() function call intended to be called this way:

            s.sendmail(msg['From'], self.opts.email_to, msg.as_string())