Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug with TASK_ONLY_FROM #50

Closed
jkeltz opened this issue Dec 17, 2021 · 2 comments
Closed

bug with TASK_ONLY_FROM #50

jkeltz opened this issue Dec 17, 2021 · 2 comments
Assignees
Labels

Comments

@jkeltz
Copy link

jkeltz commented Dec 17, 2021

Our local moodle installation is moving to the cloud. TASK_ONLY_FROM was working perfectly for the local installation which lists only 2 IP ranges. In the cloud, it doesn't work. It turns out this is because when I list the 6 possible IPs that can submit tasks, only the first few work. I believe, in particular, the first 3 work but everything else fails. Can you look into this for me please? Running on CentOS 7 with latest Jail server 2.7.1.

@jkeltz
Copy link
Author

jkeltz commented Dec 17, 2021

in configuration.cpp this code isn't working quite right... i inserted some debug syslog lines...

        string dir;
        size_t pos=0;
        while((pos=tof.find(" ", pos)) != string::npos){
                dir=tof.substr(0, pos);
                Util::trimAndRemoveQuotes(dir);
                if(dir.length() > 0) {
                        taskOnlyFrom.push_back(dir);
                        syslog(LOG_INFO, "in readconfigfile and IP is %s",dir.c_str());
                }
                tof.erase(0, pos);
        }
        dir=tof.substr(0, pos);

        Util::trimAndRemoveQuotes(dir);
        if(dir.size() > 0) {
                taskOnlyFrom.push_back(dir);
                syslog(LOG_INFO, "after while loop dir contains  %s",dir.c_str());
        }

(IPs changed for privacy)

The result in syslog was..

Dec 17 16:05:42 vpl1 vpl-jail-system[26544]: in readconfigfile and IP is 1.2.3.4
Dec 17 16:05:42 vpl1 vpl-jail-system[26544]: in readconfigfile and IP is 5.6.7.8
Dec 17 16:05:42 vpl1 vpl-jail-system[26544]: in readconfigfile and IP is 9.10.11.12 13.14.15.16
Dec 17 16:05:42 vpl1 vpl-jail-system[26544]: after while loop dir contains  17.18.19.20 21.22.23.24

... which messes with the IP blocking in the further addresses...

I replaced the above code with this simpler use:


        std::istringstream iss (tof);
        for (string s; iss >> s; ) {
          taskOnlyFrom.push_back(s);
          syslog(LOG_INFO,"found IP %s",s.c_str());
        }

It picks out all the IPs properly.

I had to also define at the top:

#include <sstream>

@jcrodriguez-dis
Copy link
Owner

Dear keltz.
Thank you for the bug report. I will review the problem and your code to solve the issue as soon as possible.

Juan Carlos.

@jcrodriguez-dis jcrodriguez-dis self-assigned this Dec 21, 2021
jcrodriguez-dis added a commit that referenced this issue Jan 18, 2022
Buf #50 reported by @jkeltz fixed using the code suggested by  @jkeltz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants