git://git.onelab.eu
/
util-vserver.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge 0.30.214.
[util-vserver.git]
/
src
/
capchroot.c
diff --git
a/src/capchroot.c
b/src/capchroot.c
index
69dbe37
..
71ad061
100644
(file)
--- a/
src/capchroot.c
+++ b/
src/capchroot.c
@@
-1,4
+1,4
@@
-// $Id: capchroot.c
,v 1.7 2004/03/24 01:41:28 ensc Exp
$
+// $Id: capchroot.c
2403 2006-11-24 23:06:08Z dhozac
$
// Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
// based on capchroot.cc by Jacques Gelinas
// Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
// based on capchroot.cc by Jacques Gelinas
@@
-66,6
+66,11
@@
static void
showHelp(int fd, char const *cmd, int res)
{
VSERVER_DECLARE_CMD(cmd);
showHelp(int fd, char const *cmd, int res)
{
VSERVER_DECLARE_CMD(cmd);
+
+#if !defined(VC_ENABLE_API_COMPAT) && !defined(VC_ENABLE_API_LEGACY)
+ WRITE_MSG(1, "ERROR: tools were built without legacy API support; capchroot will not work!\n\n");
+#endif
+
WRITE_MSG(fd, "Usage: ");
WRITE_STR(fd, cmd);
WRITE_MSG(fd,
WRITE_MSG(fd, "Usage: ");
WRITE_STR(fd, cmd);
WRITE_MSG(fd,
@@
-92,11
+97,11
@@
showVersion()
exit(0);
}
exit(0);
}
-static void
+static
UNUSED
void
setUser(char const *user)
{
struct passwd *p = 0;
setUser(char const *user)
{
struct passwd *p = 0;
- if (user!=0 && strcmp(user, "root")!=0) {
+ if (user!=0 && strcmp(user, "root")!=0
&& strcmp(user, "0")!=0
) {
errno = 0;
p = getpwnam(user);
if (p==0) {
errno = 0;
p = getpwnam(user);
if (p==0) {
@@
-135,12
+140,13
@@
int main (int argc, char *argv[])
default :
WRITE_MSG(2, "Try '");
WRITE_STR(2, argv[0]);
default :
WRITE_MSG(2, "Try '");
WRITE_STR(2, argv[0]);
- WRITE_MSG(2, " --help
\"
for more information.\n");
+ WRITE_MSG(2, " --help
'
for more information.\n");
return EXIT_FAILURE;
break;
}
}
return EXIT_FAILURE;
break;
}
}
+#if defined(VC_ENABLE_API_COMPAT) || defined(VC_ENABLE_API_LEGACY)
if (optind==argc)
WRITE_MSG(2, "No directory specified; try '--help' for more information\n");
else if (optind+1==argc)
if (optind==argc)
WRITE_MSG(2, "No directory specified; try '--help' for more information\n");
else if (optind+1==argc)
@@
-159,6
+165,9
@@
int main (int argc, char *argv[])
setUser(suid_user);
EexecvpD(argv[optind+1], argv+optind+1);
}
setUser(suid_user);
EexecvpD(argv[optind+1], argv+optind+1);
}
-
+#else
+ WRITE_MSG(2, "capchroot: tools were built without legacy API support; can not continue\n");
+#endif
+
return EXIT_FAILURE;
}
return EXIT_FAILURE;
}