Coder Social home page Coder Social logo

Comments (7)

fcolista avatar fcolista commented on July 1, 2024 1

This issue is opened since 4 months and nobody answered?

from gvmd.

fcolista avatar fcolista commented on July 1, 2024 1

Thanks, I've applied the patch, the first task started, the second one remain stucked at 1% with the following errors in the log:

md manage:WARNING:2019-09-30 12h10.26 UTC:9633: sql_prepare_internal: sqlite3_prepare failed: no more rows available
md manage:WARNING:2019-09-30 12h10.26 UTC:9633: sql_x_internal: sql_prepare failed
md manage:WARNING:2019-09-30 12h10.26 UTC:9633: sql_close: attempt to close db with open statement(s)

This happens also when trying to open the report from the 1st completed target scan.
Thanks.

from gvmd.

0x4c-code avatar 0x4c-code commented on July 1, 2024

I'm experiencing the same problem. I'm running alpine edge in a docker container with the following package versions installed:

sqlite-3.29.0
gvmd-8.0.1
openvas-scanner-6.0.1
greenbone-security-assistant-8.0.1

from gvmd.

b40yd avatar b40yd commented on July 1, 2024

@fcolista @0x4c-code
this problem, you need change sql "%" to "%%", it's init_otp_pref_iterator function in manage_sql.c

test code

#include <glib.h>
#include <stdio.h>

// use centos or other linux
/*
void
test_glib(const char *format, ...)
{
    gchar *formatted = NULL;
    va_list args;
    va_start (args, format);

    formatted = g_strdup_vprintf(format, args);
    printf("format: %d %s\n", len, formatted);
    va_end(args);
}
*/
// use vasprintf 
void
test_vasprintf(const char *format, ...)
{
    gint len;
    gchar *formatted = NULL;
    va_list args;
    va_start (args, format);
    len = vasprintf (&formatted, format, args);
    if (len < 0)
        formatted = NULL;
    printf("format: %d %s\n", len, formatted);
    va_end(args);
}

void 
main(void)
{
    long long int config = 5;
    gchar *t1 = "SERVER_PREFS";
    gchar *t2 = "NOT LIKE '%[%]%'";
    
    /**
        simale test
    **/
    //test_glib("%llu, %s, %s, %llu\n", config, t1, t2, config);
    test_vasprintf("%llu, %s, %s, %llu\n", config, t1, t2, config);
    
    /*
        origin sql code
        results are different on alpine linux and centos
    */
    const char *format = "SELECT config_preferences.name, config_preferences.value"
         " FROM config_preferences, nvt_preferences"
         " WHERE config_preferences.config = %llu"
         " AND config_preferences.type = '%s'"
         " AND (config_preferences.name = nvt_preferences.name"
         "      OR config_preferences.name LIKE 'timeout.%')"
         " AND config_preferences.name != 'max_checks'"
         " AND config_preferences.name != 'max_hosts'"            
         " UNION"                                                       
         " SELECT nvt_preferences.name, nvt_preferences.value"
         " FROM nvt_preferences"
         " WHERE nvt_preferences.name %s"
         " AND (SELECT COUNT(*) FROM config_preferences"
         "      WHERE config = %llu"
         "      AND config_preferences.name = nvt_preferences.name) = 0;\n\n";
    
    //test_glib(format, config, t1, t2, config);
    
    test_vasprintf(format, config, t1, t2, config); // It' ok on centos result, But it turns out to be null on alpine linux
    
    /*
        change 'timeout.%' to 'timeout.%%'
    */
    
    const char *format1 = "SELECT config_preferences.name, config_preferences.value"
         " FROM config_preferences, nvt_preferences"
         " WHERE config_preferences.config = %llu"
         " AND config_preferences.type = '%s'"
         " AND (config_preferences.name = nvt_preferences.name"
         "      OR config_preferences.name LIKE 'timeout.%%')"
         " AND config_preferences.name != 'max_checks'"
         " AND config_preferences.name != 'max_hosts'"            
         " UNION"                                                       
         " SELECT nvt_preferences.name, nvt_preferences.value"
         " FROM nvt_preferences"
         " WHERE nvt_preferences.name %s"
         " AND (SELECT COUNT(*) FROM config_preferences"
         "      WHERE config = %llu"
         "      AND config_preferences.name = nvt_preferences.name) = 0;\n\n";
    //test_glib(format1, config, t1, t2, config);
    
    test_vasprintf(format1, config, t1, t2, config);// same result, on centos and alpine linux
    
}

compiling:
gcc $(pkg-config --cflags --libs glib-2.0) -o test test.c

from gvmd.

b40yd avatar b40yd commented on July 1, 2024

@fcolista
This same problem.
patch

from gvmd.

beastie29a avatar beastie29a commented on July 1, 2024

@fcolista, on this issue:

What I've noticed (perhaps is linked to this problem), is that importing the nvt i got tons of these WARNING:

md manage:WARNING:2019-04-09 19h27.24 utc:1035: parse_ctime: Failed to parse time '2018-02-27T19:15:33.110Z'

This has to do with the difference in Musl-lib and Gliibc's strptime. I've opened a merge request on the aports repo and wanted to let the upstream (Greenbone) as well as any others having the same issue know about it.
https://gitlab.alpinelinux.org/alpine/aports/merge_requests/4427
Similar issue with gvm-libs:
https://gitlab.alpinelinux.org/alpine/aports/merge_requests/4426

from gvmd.

bjoernricks avatar bjoernricks commented on July 1, 2024

sqlite support has been dropped some versions ago. therefore closing this issue.

from gvmd.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.