X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=src%2Ftestsuite%2Frpm-fake-test.c;fp=src%2Ftestsuite%2Frpm-fake-test.c;h=57054e188ea89728eee8a2af8f7b4bfc25a25608;hb=8cf13bb177d92c93eb73dc8939777150536c2d00;hp=0000000000000000000000000000000000000000;hpb=6bf3f95de36c804c97716b2d0bdf10680c559044;p=util-vserver.git diff --git a/src/testsuite/rpm-fake-test.c b/src/testsuite/rpm-fake-test.c new file mode 100644 index 0000000..57054e1 --- /dev/null +++ b/src/testsuite/rpm-fake-test.c @@ -0,0 +1,92 @@ +// $Id: rpm-fake-test.c,v 1.4 2004/02/27 18:57:28 ensc Exp $ --*- c -*-- + +// Copyright (C) 2003 Enrico Scholz +// +// 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; version 2 of the License. +// +// 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. + + +#ifdef HAVE_CONFIG_H +# include +#endif + + +#include +#include +#include +#include +#include +#include +#include + +#define ENSC_WRAPPERS_UNISTD 1 +#include + +int wrapper_exit_code = 1; + +int main(/*int argc, char *argv[]*/) +{ + char buf[1000]; + + while (true) { + char *ptr = buf; + char c; + do { + if (read(0, &c, 1)==0) break; + if (c=='\n') break; + *ptr++ = c; + } while (ptrpw_uid); + else printf("(null)\n"); + + break; + } + + case 'G' : { + struct group *gr; + + gr = getgrnam(buf+1); + printf("G(%s) = ", buf+1); + if (gr) printf("%u\n", gr->gr_gid); + else printf("(null)\n"); + + break; + } + + case 'C' : + switch (buf[1]) { + case 'g' : endgrent(); break; + case 'p' : endpwent(); break; + default : abort(); break; + } + break; + + default : + abort(); + } + } + + { + char * cmd[] = { "/bin/grep", "^s_context", "/proc/self/status", 0 }; + Eexecv(cmd[0], cmd); + } +}