summaryrefslogtreecommitdiffstats
path: root/src/hci
diff options
context:
space:
mode:
Diffstat (limited to 'src/hci')
-rw-r--r--src/hci/commands/console_cmd.c2
-rw-r--r--src/hci/commands/digest_cmd.c2
-rw-r--r--src/hci/commands/image_cmd.c18
-rw-r--r--src/hci/commands/image_trust_cmd.c9
4 files changed, 22 insertions, 9 deletions
diff --git a/src/hci/commands/console_cmd.c b/src/hci/commands/console_cmd.c
index db413686..d2eae59f 100644
--- a/src/hci/commands/console_cmd.c
+++ b/src/hci/commands/console_cmd.c
@@ -92,7 +92,7 @@ static int console_exec ( int argc, char **argv ) {
if ( opts.picture ) {
/* Acquire image */
- if ( ( rc = imgacquire ( opts.picture, &image ) ) != 0 )
+ if ( ( rc = imgacquire ( opts.picture, 0, &image ) ) != 0 )
goto err_acquire;
/* Convert to pixel buffer */
diff --git a/src/hci/commands/digest_cmd.c b/src/hci/commands/digest_cmd.c
index 3cf2f102..71308064 100644
--- a/src/hci/commands/digest_cmd.c
+++ b/src/hci/commands/digest_cmd.c
@@ -77,7 +77,7 @@ static int digest_exec ( int argc, char **argv,
for ( i = optind ; i < argc ; i++ ) {
/* Acquire image */
- if ( ( rc = imgacquire ( argv[i], &image ) ) != 0 )
+ if ( ( rc = imgacquire ( argv[i], 0, &image ) ) != 0 )
continue;
offset = 0;
len = image->len;
diff --git a/src/hci/commands/image_cmd.c b/src/hci/commands/image_cmd.c
index dc30b3f2..a9e831bf 100644
--- a/src/hci/commands/image_cmd.c
+++ b/src/hci/commands/image_cmd.c
@@ -40,6 +40,8 @@ FILE_LICENCE ( GPL2_OR_LATER );
struct imgsingle_options {
/** Image name */
char *name;
+ /** Download timeout */
+ unsigned long timeout;
/** Replace image */
int replace;
/** Free image after execution */
@@ -49,13 +51,17 @@ struct imgsingle_options {
/** "img{single}" option list */
static union {
/* "imgexec" takes all three options */
- struct option_descriptor imgexec[3];
- /* Other "img{single}" commands take only --name and --autofree */
- struct option_descriptor imgsingle[2];
+ struct option_descriptor imgexec[4];
+ /* Other "img{single}" commands take only --name, --timeout,
+ * and --autofree
+ */
+ struct option_descriptor imgsingle[3];
} opts = {
.imgexec = {
OPTION_DESC ( "name", 'n', required_argument,
struct imgsingle_options, name, parse_string ),
+ OPTION_DESC ( "timeout", 't', required_argument,
+ struct imgsingle_options, timeout, parse_timeout),
OPTION_DESC ( "autofree", 'a', no_argument,
struct imgsingle_options, autofree, parse_flag ),
OPTION_DESC ( "replace", 'r', no_argument,
@@ -68,7 +74,8 @@ struct imgsingle_descriptor {
/** Command descriptor */
struct command_descriptor *cmd;
/** Function to use to acquire the image */
- int ( * acquire ) ( const char *name, struct image **image );
+ int ( * acquire ) ( const char *name, unsigned long timeout,
+ struct image **image );
/** Pre-action to take upon image, or NULL */
void ( * preaction ) ( struct image *image );
/** Action to take upon image, or NULL */
@@ -114,7 +121,8 @@ static int imgsingle_exec ( int argc, char **argv,
/* Acquire the image */
if ( name_uri ) {
- if ( ( rc = desc->acquire ( name_uri, &image ) ) != 0 )
+ if ( ( rc = desc->acquire ( name_uri, opts.timeout,
+ &image ) ) != 0 )
goto err_acquire;
} else {
image = image_find_selected();
diff --git a/src/hci/commands/image_trust_cmd.c b/src/hci/commands/image_trust_cmd.c
index ef4bbfa8..ca59a858 100644
--- a/src/hci/commands/image_trust_cmd.c
+++ b/src/hci/commands/image_trust_cmd.c
@@ -86,6 +86,8 @@ struct imgverify_options {
char *signer;
/** Keep signature after verification */
int keep;
+ /** Download timeout */
+ unsigned long timeout;
};
/** "imgverify" option list */
@@ -94,6 +96,8 @@ static struct option_descriptor imgverify_opts[] = {
struct imgverify_options, signer, parse_string ),
OPTION_DESC ( "keep", 'k', no_argument,
struct imgverify_options, keep, parse_flag ),
+ OPTION_DESC ( "timeout", 't', required_argument,
+ struct imgverify_options, timeout, parse_timeout),
};
/** "imgverify" command descriptor */
@@ -127,11 +131,12 @@ static int imgverify_exec ( int argc, char **argv ) {
signature_name_uri = argv[ optind + 1 ];
/* Acquire the image */
- if ( ( rc = imgacquire ( image_name_uri, &image ) ) != 0 )
+ if ( ( rc = imgacquire ( image_name_uri, opts.timeout, &image ) ) != 0 )
goto err_acquire_image;
/* Acquire the signature image */
- if ( ( rc = imgacquire ( signature_name_uri, &signature ) ) != 0 )
+ if ( ( rc = imgacquire ( signature_name_uri, opts.timeout,
+ &signature ) ) != 0 )
goto err_acquire_signature;
/* Verify image */