[Snort-devel] Snort 1.9 Win32: Bug on MSSQL database support ?

Diverse.Snort.Developers snort-devel at ...1607...
Tue Oct 8 08:14:07 EDT 2002


I tried the precompiled binaries for Snort 1.9 Win32 but when Snort should check the
vseq value in table schema it returned a error. (Se below)

I looked onto the code for database.c an discovered a difference related to the problem between 1.8.7 <-> 1.9 (se below),
Is this the problem (notice  the use of "#ifndef ENABLE_MSSQL")?

/Rgds, Hans


Error returned from Snort 1.9 Win32:
database: SQL Server message 5701, state 2, severity 0:
        Changed database context to 'Snort'.
Server 'SPC_SQLSERVER',
database: SQL Server message 5701, state 1, severity 0:
        Changed database context to 'Snort'.
Server 'SPC_SQLSERVER', Line 1
database:     sensor id = 1
database: SQL Server message 156, state 1, severity 15:
        Incorrect syntax near the keyword 'schema'.
Server 'SPC_SQLSERVER', Line 1
database:  The above error was caused by the following statement:
SELECT vseq FROM schema
database: DB-Library error:
        General SQL Server error: Check messages from the SQL Server.
database:  The above error was caused by the following statement:
SELECT vseq FROM schema
database: schema version = 0
database: The underlying database seems to be running an older version of
          the DB schema (current version=0, required minimum version= 106).


database.c 1.8.7:

int CheckDBVersion(DatabaseData * data)
{
  char *select0;
  int schema_version;

  select0 = (char *) malloc (MAX_QUERY_LENGTH+1);
  snprintf(select0, MAX_QUERY_LENGTH, 
#ifndef ENABLE_MSSQL
           "SELECT vseq FROM schema");
#else
           /* "schema" is a keyword in SQL Server, so quote it with square brackets */
           "SELECT vseq FROM [schema]");
#endif

  schema_version = Select(select0,data);
  free(select0);

  return schema_version;
}

database.c 1.9:

int CheckDBVersion(DatabaseData * data)
{
   char *select0;
   int schema_version;

   select0 = (char *) malloc (MAX_QUERY_LENGTH+1);

#ifndef ENABLE_MSSQL
   if ( data->shared->dbtype_id == DB_MSSQL )
      /* "schema" is a keyword in SQL Server, so use square brackets
       *  to indicate that we are referring to the table
       */
      snprintf(select0, MAX_QUERY_LENGTH, "SELECT vseq FROM [schema]");
   else
#endif
      snprintf(select0, MAX_QUERY_LENGTH, "SELECT vseq FROM schema");

   schema_version = Select(select0,data);
   free(select0);

   return schema_version;
}




More information about the Snort-devel mailing list