From d7a404bc6f3174cd090a62240f0fe53507f02bb2 Mon Sep 17 00:00:00 2001 From: Leigh B Stoller <stoller@flux.utah.edu> Date: Fri, 28 Jun 2013 11:58:33 -0600 Subject: [PATCH] Add noexport bit to prevent some (Windows) from URL export. --- sql/database-create.sql | 1 + sql/updates/4/360 | 22 ++++++++++++++++++++++ utils/spewimage.in | 12 +++++++++++- 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 sql/updates/4/360 diff --git a/sql/database-create.sql b/sql/database-create.sql index 25ea558d99..8220dbc248 100644 --- a/sql/database-create.sql +++ b/sql/database-create.sql @@ -1884,6 +1884,7 @@ CREATE TABLE `images` ( `metadata_url` tinytext, `imagefile_url` tinytext, `logfileid` varchar(40) default NULL, + `noexport` tinyint(1) NOT NULL default '0', PRIMARY KEY (`imageid`), UNIQUE KEY `pid` (`pid`,`imagename`), KEY `gid` (`gid`), diff --git a/sql/updates/4/360 b/sql/updates/4/360 new file mode 100644 index 0000000000..e8b0541827 --- /dev/null +++ b/sql/updates/4/360 @@ -0,0 +1,22 @@ +# +# Add noexport flag to images. +# +use strict; +use libdb; + +my $impotent = 0; + +sub DoUpdate($$$) +{ + my ($dbhandle, $dbname, $version) = @_; + + if (!DBSlotExists("images", "noexport")) { + DBQueryFatal("alter table images add ". + " `noexport` tinyint(1) NOT NULL default '0'"); + } + return 0; +} + +# Local Variables: +# mode:perl +# End: diff --git a/utils/spewimage.in b/utils/spewimage.in index a2aea8a32a..89d03bd7a6 100644 --- a/utils/spewimage.in +++ b/utils/spewimage.in @@ -1,6 +1,6 @@ #!/usr/bin/perl -wT # -# Copyright (c) 2000-2007 University of Utah and the Flux Group. +# Copyright (c) 2000-2013 University of Utah and the Flux Group. # # {{{EMULAB-LICENSE # @@ -190,6 +190,16 @@ sub SpewImage() # sub VerifyImage() { + # + # Some images are not allowed to be exported. + # + if ($image->noexport()) { + if ($debug) { + print STDERR "Not allowed to export this image!\n"; + } + return 1; + } + # # The current user needs to be able to read the image file and must # have provided proper access key. -- GitLab