This flag allows with a single function to check the signature
and the case that a not signed widget is to be refused in the same
way that the signature is wrong.
The CMAKE boolean ALLOW_NO_SIGNATURE can be used to control
the default behavior at compile time. By default its value
is OFF meaning that install will refuse widgets without
signature.
Relates to Bug-AGL: SPEC-1590
Change-Id: I403109272759454696a1e5d9913879aaea7676e6
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
set(USE_LIBZIP ON CACHE BOOL "should try to use libzip?")
set(USE_SIMULATION OFF CACHE BOOL "if set simulates security manager and smack")
set(USE_SDK OFF CACHE BOOL "if set, avoids installating system runtime files")
set(USE_LIBZIP ON CACHE BOOL "should try to use libzip?")
set(USE_SIMULATION OFF CACHE BOOL "if set simulates security manager and smack")
set(USE_SDK OFF CACHE BOOL "if set, avoids installating system runtime files")
+set(ALLOW_NO_SIGNATURE OFF CACHE BOOL "if set, widgets without signature are accepted")
set(SIMULATE_SECMGR OFF CACHE BOOL "if set, the security manager is simulated")
set(SIMULATE_SMACK OFF CACHE BOOL "if set, the smack environment is simulated")
set(SIMULATE_SECMGR OFF CACHE BOOL "if set, the security manager is simulated")
set(SIMULATE_SMACK OFF CACHE BOOL "if set, the smack environment is simulated")
-DSYSTEMD_UNITS_ROOT="${systemd_units_root}"
-DAFM_VERSION="${PROJECT_VERSION}"
)
-DSYSTEMD_UNITS_ROOT="${systemd_units_root}"
-DAFM_VERSION="${PROJECT_VERSION}"
)
+if(ALLOW_NO_SIGNATURE)
+ add_definitions(-DDEFAULT_ALLOW_NO_SIGNATURE=1)
+else(ALLOW_NO_SIGNATURE)
+ add_definitions(-DDEFAULT_ALLOW_NO_SIGNATURE=0)
+endif(ALLOW_NO_SIGNATURE)
+
add_subdirectory(src)
add_subdirectory(conf)
add_subdirectory(src)
add_subdirectory(conf)
}
/* check all the signature files */
}
/* check all the signature files */
-int check_all_signatures()
+int check_all_signatures(int allow_none)
{
int rc, irc;
unsigned int i, n;
struct filedesc *fdesc;
n = signature_count();
{
int rc, irc;
unsigned int i, n;
struct filedesc *fdesc;
n = signature_count();
+ if (n == 0 && !allow_none) {
+ ERROR("no signature found");
+ return -1;
+ }
rc = 0;
for (i = n ; i-- > 0 ; ) {
fdesc = signature_of_index(i);
rc = 0;
for (i = n ; i-- > 0 ; ) {
fdesc = signature_of_index(i);
extern int create_digsig(unsigned int index, const char *key, const char **certs);
/* check the signatures of the current directory */
extern int create_digsig(unsigned int index, const char *key, const char **certs);
/* check the signatures of the current directory */
-extern int check_all_signatures();
+extern int check_all_signatures(int allow_none);
+#if !defined(DEFAULT_ALLOW_NO_SIGNATURE)
+#define DEFAULT_ALLOW_NO_SIGNATURE 0
+#endif
if (zread(wgtfile, 0))
goto error2;
if (zread(wgtfile, 0))
goto error2;
- if (check_all_signatures())
+ if (check_all_signatures(1)) /* info even on WGT without signature */
goto error2;
check_and_show();
goto error2;
check_and_show();
error2:
remove_workdir();
return;
error2:
remove_workdir();
return;
if (c == 0) {
ERROR("empty string forbidden in '%s' (temporary constraints)", name);
errno = EINVAL;
if (c == 0) {
ERROR("empty string forbidden in '%s' (temporary constraints)", name);
errno = EINVAL;
}
do {
if (!isalnum(c) && !strchr(".-_", c)) {
ERROR("forbidden char %c in '%s' -> '%s' (temporary constraints)", c, name, value);
errno = EINVAL;
}
do {
if (!isalnum(c) && !strchr(".-_", c)) {
ERROR("forbidden char %c in '%s' -> '%s' (temporary constraints)", c, name, value);
errno = EINVAL;
}
c = value[++pos];
} while(c);
}
c = value[++pos];
} while(c);
if (zread(wgtfile, 0))
goto error2;
if (zread(wgtfile, 0))
goto error2;
- if (check_all_signatures())
+ if (check_all_signatures(DEFAULT_ALLOW_NO_SIGNATURE))
goto error2;
ifo = wgt_info_createat(workdirfd, NULL, 1, 1, 1);
goto error2;
ifo = wgt_info_createat(workdirfd, NULL, 1, 1, 1);