X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=tests%2Fchrootsafe.c;fp=tests%2Fchrootsafe.c;h=0000000000000000000000000000000000000000;hb=fb4dfa4b3396d374cc8db40f4813caef82d8459f;hp=bb49c658f31b8390036b2b84c5b382e20a14b6d7;hpb=d56ea1e992af7da828e89b98f2878bcc04250708;p=util-vserver.git diff --git a/tests/chrootsafe.c b/tests/chrootsafe.c deleted file mode 100644 index bb49c65..0000000 --- a/tests/chrootsafe.c +++ /dev/null @@ -1,64 +0,0 @@ -// $Id: chrootsafe.c 268 2003-10-21 13:54:59Z ensc $ --*- c++ -*-- - -// Copyright (C) 2003 Enrico Scholz -// based on tests/chrootsafe.cc by Jacques Gelinas -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2, or (at your option) -// any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -/* - Test the chrootsafe command. - Pass the path of a vserver as the only argument - - chrootsafe /vservers/test -*/ -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "compat.h" -#include "vserver.h" - -int main (int UNUSED argc, char *argv[]) -{ - // This test must fail - int fd = open ("/",O_RDONLY); - if (fd != -1){ - if (vc_chrootsafe(argv[1])==-1){ - fprintf (stderr,"Ok, chrootsafe failed with one open directory errno=%s\n",strerror(errno)); - }else{ - fprintf (stderr,"Hum, chrootsafe succeed with one open directory\n"); - system ("/bin/sh"); - } - close (fd); - } - // Now it should work - if (vc_chrootsafe(argv[1])!=-1){ - fprintf (stderr,"Ok, chrootsafe worked\n"); - system ("/bin/sh"); - }else{ - fprintf (stderr,"chrootsafe failed errno=%s\n",strerror(errno)); - } - return 0; -} -