Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-devel
Commits
dd8bdbae
Commit
dd8bdbae
authored
Nov 09, 2014
by
Mike Hibler
Browse files
Finish the AMD-related hack.
parent
cfd91409
Changes
1
Hide whitespace changes
Inline
Side-by-side
clientside/os/frisbee.redux/config_emulab.c
View file @
dd8bdbae
...
...
@@ -97,6 +97,11 @@ static int INELABINELAB = ELABINELAB;
#else
static
int
INELABINELAB
=
0
;
#endif
#ifdef WITHAMD
static
char
*
AMDROOT
=
AMD_ROOT
;
#else
static
char
*
AMDROOT
=
NULL
;
#endif
/*
* An Emulab image ID string looks like:
...
...
@@ -630,6 +635,7 @@ allow_stddirs(char *imageid,
struct
config_imageinfo
*
ci
;
struct
stat
sb
;
int
exists
;
int
onamd
;
if
(
get
==
NULL
&&
put
==
NULL
)
return
;
...
...
@@ -764,7 +770,6 @@ allow_stddirs(char *imageid,
FrisInfo
(
"%s: exists=%d, resolves to: '%s'"
,
imageid
,
exists
,
tpath
);
#ifdef WITHAMD
/*
* We have to explicitly check for the AMD prefix.
* The realpath resolution in emulab_init checks the root of
...
...
@@ -774,13 +779,18 @@ allow_stddirs(char *imageid,
* know which of /users, /proj, /groups and /share might be an
* AMD mount point.
*/
if
(
strncmp
(
AMD_ROOT
,
tpath
,
strlen
(
AMD_ROOT
))
==
0
)
{
free
(
fpath
);
fpath
=
mystrdup
(
tpath
+
strlen
(
AMD_ROOT
));
if
(
debug
)
FrisInfo
(
"%s: stripped AMD prefix"
,
fpath
);
onamd
=
0
;
if
(
AMDROOT
)
{
int
arlen
=
strlen
(
AMDROOT
);
if
(
strncmp
(
AMDROOT
,
tpath
,
arlen
)
==
0
)
{
onamd
=
1
;
free
(
fpath
);
fpath
=
mystrdup
(
tpath
+
arlen
);
if
(
debug
)
FrisInfo
(
"%s: stripped AMD prefix"
,
fpath
);
}
}
#endif
/*
* Make the appropriate access checks for get/put
...
...
@@ -797,7 +807,13 @@ allow_stddirs(char *imageid,
put
->
numimages
=
1
;
ci
=
&
put
->
imageinfo
[
0
];
ci
->
imageid
=
mystrdup
(
imageid
);
ci
->
dir
=
mystrdup
(
fdir
);
if
(
onamd
)
{
assert
(
fdir
[
0
]
==
'/'
);
ci
->
dir
=
mymalloc
(
strlen
(
AMDROOT
)
+
strlen
(
fdir
)
+
1
);
strcpy
(
ci
->
dir
,
AMDROOT
);
strcat
(
ci
->
dir
,
fdir
);
}
else
ci
->
dir
=
mystrdup
(
fdir
);
ci
->
path
=
mystrdup
(
imageid
);
ci
->
flags
=
CONFIG_PATH_ISFILE
|
CONFIG_PATH_RESOLVE
;
if
(
exists
&&
stat
(
ci
->
path
,
&
sb
)
==
0
)
{
...
...
@@ -827,7 +843,13 @@ allow_stddirs(char *imageid,
get
->
numimages
=
1
;
ci
=
&
get
->
imageinfo
[
0
];
ci
->
imageid
=
mystrdup
(
imageid
);
ci
->
dir
=
mystrdup
(
fdir
);
if
(
onamd
)
{
assert
(
fdir
[
0
]
==
'/'
);
ci
->
dir
=
mymalloc
(
strlen
(
AMDROOT
)
+
strlen
(
fdir
)
+
1
);
strcpy
(
ci
->
dir
,
AMDROOT
);
strcat
(
ci
->
dir
,
fdir
);
}
else
ci
->
dir
=
mystrdup
(
fdir
);
ci
->
path
=
mystrdup
(
imageid
);
ci
->
flags
=
CONFIG_PATH_ISFILE
|
CONFIG_PATH_RESOLVE
;
if
(
exists
&&
stat
(
ci
->
path
,
&
sb
)
==
0
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment