void opkg_print_error_list (opkg_conf_t *conf)
{
- if ( error_list ) {
- reverse_error_list(&error_list);
+ struct errlist *err = error_list;
+
+ if (err) {
+ reverse_error_list(&err);
printf ("Collected errors:\n");
/* Here we print the errors collected and free the list */
- while (error_list != NULL) {
- printf (" * %s", error_list->errmsg);
- error_list = error_list->next;
+ while (err != NULL) {
+ printf (" * %s", err->errmsg);
+ err = err->next;
}
- free_error_list();
+
+ free_error_list(&error_list);
}
}
result = (cmd->fun)(conf, argc, argv);
if ( result != 0 && !error_list) {
- opkg_message(conf, OPKG_NOTICE, "An error ocurred, return value: %d.\n", result);
+ opkg_message(conf, OPKG_NOTICE, "An error occurred, return value: %d.\n", result);
}
opkg_print_error_list (conf);
list_file_name);
}
free(url);
-
-#ifdef HAVE_GPGME
- /* download detached signitures to verify the package lists */
- /* get the url for the sig file */
- if (src->extra_data) /* debian style? */
- sprintf_alloc(&url, "%s/%s/%s", src->value, src->extra_data,
- "Packages.sig");
- else
- sprintf_alloc(&url, "%s/%s", src->value, "Packages.sig");
-
- /* create temporary file for it */
- char *tmp_file_name;
-
- sprintf_alloc (&tmp_file_name, "%s/%s", tmp, "Packages.sig");
-
- err = opkg_download(conf, url, tmp_file_name, NULL, NULL);
- if (err) {
- failures++;
- opkg_message (conf, OPKG_NOTICE, "Signature check failed\n");
- } else {
- int err;
- err = opkg_verify_file (conf, list_file_name, tmp_file_name);
- if (err == 0)
- opkg_message (conf, OPKG_NOTICE, "Signature check passed\n");
- else
- opkg_message (conf, OPKG_NOTICE, "Signature check failed\n");
- }
- unlink (tmp_file_name);
- free (tmp_file_name);
- free (url);
+#if defined(HAVE_GPGME) || defined(HAVE_OPENSSL)
+ if (conf->check_signature) {
+ /* download detached signitures to verify the package lists */
+ /* get the url for the sig file */
+ if (src->extra_data) /* debian style? */
+ sprintf_alloc(&url, "%s/%s/%s", src->value, src->extra_data,
+ "Packages.sig");
+ else
+ sprintf_alloc(&url, "%s/%s", src->value, "Packages.sig");
+
+ /* create temporary file for it */
+ char *tmp_file_name;
+
+ /* Put the signature in the right place */
+ sprintf_alloc (&tmp_file_name, "%s/%s.sig", lists_dir, src->name);
+
+ err = opkg_download(conf, url, tmp_file_name, NULL, NULL);
+ if (err) {
+ failures++;
+ opkg_message (conf, OPKG_NOTICE, "Signature check failed\n");
+ } else {
+ int err;
+ err = opkg_verify_file (conf, list_file_name, tmp_file_name);
+ if (err == 0)
+ opkg_message (conf, OPKG_NOTICE, "Signature check passed\n");
+ else
+ opkg_message (conf, OPKG_NOTICE, "Signature check failed\n");
+ }
+ /* We shouldn't unlink the signature ! */
+ // unlink (tmp_file_name);
+ free (tmp_file_name);
+ free (url);
+ }
#else
- opkg_message (conf, OPKG_NOTICE, "Signature check for %s skipped "
- "because GPG support was not enabled in this build\n", src->name);
+ // Do nothing
#endif
free(list_file_name);
}
}
free (path);
}
+ closedir(dir);
} else
perror (ctx->statedir);
}
}
+ pkg_vec_free(available);
+
return 0;
}
char *pkg_name = NULL;
char **pkg_fields = NULL;
int n_fields = 0;
- char *buff ;
+ char *buff = NULL;
if (argc > 0) {
pkg_name = argv[0];
We need to free it :) ( Thanks florian for seeing the error )
*/
free(buff);
+ buff = NULL;
}
if (conf->verbosity > 1) {
conffile_list_elt_t *iter;