@@ -59,13 +59,10 @@ struct ldb_table oss_license;
5959struct ldb_table oss_attribution ;
6060struct ldb_table oss_cryptography ;
6161struct ldb_table oss_sources ;
62-
62+ struct ldb_table oss_notices ;
6363component_item * ignore_components ;
6464component_item * declared_components ;
6565
66- /* File tracing -qi */
67- uint8_t trace_id [MD5_LEN ];
68- bool trace_on ;
6966bool lib_encoder_present = false;
7067#define LDB_VER_MIN "4.1.0"
7168
@@ -168,6 +165,9 @@ void initialize_ldb_tables(char *name)
168165 snprintf (dbtable , MAX_ARGLN * 2 , "%s/%s" , oss_db_name , "sources" );
169166 oss_sources = ldb_read_cfg (dbtable );
170167
168+ snprintf (dbtable , MAX_ARGLN * 2 , "%s/%s" , oss_db_name , "notices" );
169+ oss_notices = ldb_read_cfg (dbtable );
170+
171171 kb_version_get ();
172172 osadl_load_file ();
173173
@@ -272,10 +272,6 @@ int main(int argc, char **argv)
272272 //global var initialization - it must be improved
273273 debug_on = false;
274274 quiet = false;
275-
276- /* File tracing with -qi */
277- trace_on = false;
278- memset (trace_id , 0 ,16 );
279275
280276 if (argc <= 1 )
281277 {
@@ -295,7 +291,7 @@ int main(int argc, char **argv)
295291 int option ;
296292 bool invalid_argument = false;
297293 char * ldb_db_name = NULL ;
298- while ((option = getopt (argc , argv , ":f:s:b:B:c:k:a:F:l:n:i: M:N:wtvhedqH" )) != -1 )
294+ while ((option = getopt (argc , argv , ":f:s:b:B:c:k:a:F:l:n:M:N:wtvhedqH" )) != -1 )
299295 {
300296 /* Check valid alpha is entered */
301297 if (optarg )
@@ -325,12 +321,17 @@ int main(int argc, char **argv)
325321
326322 case 'k' :
327323 initialize_ldb_tables (ldb_db_name );
328- mz_file_contents ( optarg , oss_file . db );
324+ mz_get_key ( oss_sources , optarg );
329325 exit (EXIT_SUCCESS );
330326 break ;
331327
332328 case 'a' :
333- if (declared_components ) printf ("Cannot combine -s and -a\n" );
329+ if (declared_components )
330+ {
331+ printf ("Cannot combine -s and -a\n" );
332+ break ;
333+ }
334+ initialize_ldb_tables (ldb_db_name );
334335 exit (attribution_notices (optarg ));
335336 break ;
336337
@@ -340,6 +341,7 @@ int main(int argc, char **argv)
340341 break ;
341342
342343 case 'l' :
344+ initialize_ldb_tables (ldb_db_name );
343345 print_osadl_license_data (optarg );
344346 exit (EXIT_SUCCESS );
345347 break ;
@@ -353,15 +355,6 @@ int main(int argc, char **argv)
353355 case 'N' :
354356 scan_max_components = atol (optarg );
355357 break ;
356- case 'i' :
357- if (strlen (optarg ) == (MD5_LEN * 2 ))
358- {
359- ldb_hex_to_bin (optarg , MD5_LEN * 2 , trace_id );
360- trace_on = true;
361- }
362- else fprintf (stderr , "Ignoring -i due to invalid length\n" );
363- break ;
364-
365358 case 'w' :
366359 force_wfp = true;
367360 break ;
@@ -370,6 +363,7 @@ int main(int argc, char **argv)
370363 force_snippet_scan = true;
371364 break ;
372365 case 't' :
366+ initialize_ldb_tables (ldb_db_name );
373367 scan_benchmark ();
374368 exit (EXIT_SUCCESS );
375369 break ;
@@ -417,7 +411,7 @@ int main(int argc, char **argv)
417411 else
418412 {
419413 printf ("'libhpsm.so' must be present in the system to execute this command\n" );
420- exit (1 );
414+ exit (EXIT_FAILURE );
421415 }
422416 break ;
423417 }
0 commit comments