yo8192 / fcron

fcron is an advanced cron for Linux/Unix systems
http://fcron.free.fr
GNU General Public License v2.0
135 stars 12 forks source link

Resolving fcrontab warnings when run as root #4

Closed yo8192 closed 5 months ago

yo8192 commented 4 years ago

(raising on behalf of tux88)

I have encountered a problem for a long time with pam and nslcd, which produces an unnecessary warning when calling "fcrontab " as user root. It produces an output similar in /var/log/warn "nslcd[673]: [...] request denied by validnames option"

yo8192 commented 4 years ago

Hi tux88,

Apologies for the delay. I've tried reproducing your issue, without success (when using a valid config line).

It looks like the fcrontab file example you proposed had some formatting issue, I assume when copying as a comment in github. I have fixed the formatting and used:

!erroronlymail(true)
!mailto(root)
IN_BOOT=
IN_RUNLEVEL=
PATH=/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin
20 2 * * *       root /bin/true

Can you try with this exact example and tell me if you still see the warning?

Note that in my case I don't have nslcd, but instead I've added a debug statement to print the value of 'username' right before the if statement you are proposing to change:

/FIXME TEMPORARY DEBUG
    fprintf(stderr, "username='%s'\n", username);
    if ((userpwent = getpwnam(username)) != NULL) {

Based on your code change proposal, it seems that the issue would be if username='', but I could not reproduce this with a valid config line.

It seems to me the code before this function check_username() is called should skip all blank spaces before calling check_username(), so I can't see how username could be empty, unless:

e.g. each of the two lines below will get me username=''

20 2 * * * %root /bin/true
20 2 * * * 

I'd be quite curious to confirm which line does cause the issue on your side, so I can reproduce here

yo8192 commented 5 months ago

closing this old PR... feel free to reopen / open a new one answering the remaining questions and addressing the points I raised if you're still interested in this.