do not do the lo-check anymore
authorEnrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
Fri, 20 Feb 2004 16:59:40 +0000 (16:59 +0000)
committerEnrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
Fri, 20 Feb 2004 16:59:40 +0000 (16:59 +0000)
git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@965 94cd875c-1c1d-0410-91d2-eb244daf1a30

13 files changed:
util-vserver/src/chcontext.c
util-vserver/src/clearenv.c
util-vserver/src/exec-cd.c
util-vserver/src/exec-ulimit.c
util-vserver/src/ifspec.c
util-vserver/src/listdevip.c
util-vserver/src/new-namespace.c
util-vserver/src/reducecap.c
util-vserver/src/rpm-fake-resolver.c
util-vserver/src/rpm-fake.c
util-vserver/src/save_ctxinfo.c
util-vserver/src/secure-mount.c
util-vserver/src/vkill.c

index e6e7425..4c4c529 100644 (file)
@@ -39,6 +39,7 @@
 #include <assert.h>
 #include <fcntl.h>
 
+#define ENSC_WRAPPERS_PREFIX   "chcontext: "
 #define ENSC_WRAPPERS_VSERVER  1
 #define ENSC_WRAPPERS_UNISTD   1
 #define ENSC_WRAPPERS_FCNTL    1
@@ -217,7 +218,7 @@ setHostname(char const *name)
   if (name == NULL) return;
   
   if (sethostname(name, strlen(name))==-1) {
-    perror("sethostname()");
+    perror("chcontext: sethostname()");
     exit(255);
   }
   if (!global_args->do_silent) {
@@ -233,7 +234,7 @@ setDomainname(char const *name)
   if (name == NULL) return;
   
   if (setdomainname(name, strlen(name))==-1) {
-    perror("setdomainname()");
+    perror("chcontext: setdomainname()");
     exit(255);
   }
   if (!global_args->do_silent) {
@@ -396,7 +397,7 @@ int main (int argc, char *argv[])
     execvp (argv[optind],argv+optind);
     doSyncStage2(p);
 
-    perror("execvp()");
+    perror("chcontext: execvp()");
     exit(255);
   }
 
index 6cd73a5..c9e7062 100644 (file)
@@ -67,6 +67,6 @@ int main(int argc, char *argv[])
   }
 
   execve(argv[1], argv+1, env);
-  perror("execve()");
+  perror("clearenv: execve()");
   return 255;
 }
index 4250f72..0c47459 100644 (file)
@@ -22,7 +22,9 @@
 
 #include "util.h"
 #include <fcntl.h>
+#include <errno.h>
 
+#define ENSC_WRAPPERS_PREFIX   "exec-cd: "
 #define ENSC_WRAPPERS_FCNTL    1
 #define ENSC_WRAPPERS_UNISTD   1
 #include <wrappers.h>
@@ -35,7 +37,7 @@ showHelp(int fd, char const *cmd, int res)
   WRITE_MSG(fd, "Usage:  ");
   WRITE_STR(fd, cmd);
   WRITE_MSG(fd,
-           "[--] <dir> <cmd> <args>*\n\n"
+           " [--] <dir> <cmd> <args>*\n\n"
            "Please report bugs to " PACKAGE_BUGREPORT "\n");
   exit(res);
 }
index a4ff4f8..39dc59e 100644 (file)
@@ -26,7 +26,9 @@
 #include <sys/resource.h>
 #include <unistd.h>
 #include <fcntl.h>
+#include <errno.h>
 
+#define ENSC_WRAPPERS_PREFIX   "exec-ulimit: "
 #define ENSC_WRAPPERS_UNISTD   1
 #define ENSC_WRAPPERS_FCNTL    1
 #define ENSC_WRAPPERS_RESOURCE 1
index 57ae0d0..6121615 100644 (file)
@@ -124,7 +124,7 @@ int ifconfig_print (
                        ret = 0;
                }
                else {
-                 perror("ioctl(SIOCGIFADDR)");
+                 perror("ifspec: ioctl(SIOCGIFADDR)");
                }
                
                if (maskstr != NULL && maskstr[0] != '\0'){
@@ -142,7 +142,7 @@ int ifconfig_print (
                        ret = 0;
                }
                else {
-                 perror("ioctl(SIOCGIFNETMASK)");
+                 perror("ifspec: ioctl(SIOCGIFNETMASK)");
                }
                
                if (bcaststr != NULL && bcaststr[0] != '\0'){
index e0e9486..abcbe7c 100644 (file)
@@ -52,7 +52,7 @@ static int devlist_read2_2()
        int ret = -1;
        int skfd = socket (AF_INET,SOCK_DGRAM,0);
        if (skfd < 0) {
-               perror ("socket");
+               perror ("listdevip: socket()");
        }else{
                struct ifconf ifc;
                int numreqs = 30;
@@ -63,7 +63,7 @@ static int devlist_read2_2()
                        ifc.ifc_buf = (char*)realloc(ifc.ifc_buf, ifc.ifc_len);
 
                        if (ioctl(skfd, SIOCGIFCONF, &ifc) < 0) {
-                               perror("SIOCGIFCONF");
+                               perror("listdevip: SIOCGIFCONF");
                                ret = -1;
                                break;
                        }
index 43862fc..e337bee 100644 (file)
@@ -38,6 +38,7 @@
 #include <sys/wait.h>
 #include <libgen.h>
 
+#define ENSC_WRAPPERS_PREFIX   "new-namespace: "
 #define ENSC_WRAPPERS_WAIT     1
 #include <wrappers.h>
 
@@ -92,11 +93,11 @@ int main(int argc, char *argv[])
 #endif
   switch (pid) {
     case -1    :
-      perror("clone()");
+      perror("new-namespace: clone()");
       exit(wrapper_exit_code);
     case 0     :
       execvp(argv[1], argv+1);
-      perror("execvp()");
+      perror("new-namespace: execvp()");
       exit(wrapper_exit_code);
     default    :
       exitLikeProcess(pid);
index caf6407..9999f61 100644 (file)
@@ -34,6 +34,7 @@
 
 #include "linuxcaps.h"
 
+#define ENSC_WRAPPERS_PREFIX   "reducecap: "
 #define ENSC_WRAPPERS_VSERVER  1
 #define ENSC_WRAPPERS_UNISTD   1
 #include <wrappers.h>
@@ -199,7 +200,7 @@ show(pid_t pid)
   header.version = _LINUX_CAPABILITY_VERSION;
   header.pid     = pid;
   if (capget(&header,&user)==-1){
-    perror ("capget");
+    perror ("reducecap: capget()");
     exit(wrapper_exit_code);
   }
   
index e8ffce3..b9abdd6 100644 (file)
@@ -30,7 +30,9 @@
 #include <grp.h>
 #include <pwd.h>
 #include <fcntl.h>
+#include <errno.h>
 
+#define ENSC_WRAPPERS_PREFIX   "rpm-fake-resolver: "
 #define ENSC_WRAPPERS_VSERVER  1
 #define ENSC_WRAPPERS_UNISTD   1
 #define ENSC_WRAPPERS_FCNTL    1
index 85347c5..5e44a08 100644 (file)
@@ -181,7 +181,7 @@ initPwSocket()
        connect(pw_sock, (struct sockaddr *)(&addr), sizeof addr)==-1 ||
        (flag=fcntl(pw_sock, F_GETFD))==-1 ||
        fcntl(pw_sock, F_SETFD, flag | FD_CLOEXEC)==-1) {
-      perror("error while initializing pw-socket");
+      perror("rpm-fake.so: error while initializing pw-socket");
       exit(255);
     }
   }
index 5bd0e22..2dd49f0 100644 (file)
 #include <fcntl.h>
 #include <stdio.h>
 #include <limits.h>
+#include <errno.h>
 
-#define ENSC_WRAPPERS_VSERVER 1
-#define ENSC_WRAPPERS_UNISTD  1
-#define ENSC_WRAPPERS_FCNTL   1
+#define ENSC_WRAPPERS_PREFIX   "save_ctxinfo: "
+#define ENSC_WRAPPERS_VSERVER  1
+#define ENSC_WRAPPERS_UNISTD   1
+#define ENSC_WRAPPERS_FCNTL    1
 #include <wrappers.h>
 
 int    wrapper_exit_code = 255;
@@ -79,7 +81,7 @@ int main(int argc, char *argv[])
   fd = Eopen(dstfile, O_EXCL|O_CREAT|O_WRONLY, 0644);
   if (write(fd, buf,     len) !=len  ||
       write(fd, "\n",    1)   !=1) {
-    perror("write()");
+    perror("save_ctxinfo: write()");
     return -1;
   }
   Eclose(fd);
index 7a48ff3..bc90769 100644 (file)
@@ -260,23 +260,23 @@ updateMtab(struct MountInfo const *mnt, struct Options const *opt)
 
   if (opt->rootdir!=0 &&
       chroot(opt->rootdir)==-1) {
-      perror("chroot()");
+      perror("secure-mount: chroot()");
       return -1;
   }
 
   fd=open(opt->mtab, O_CREAT|O_APPEND|O_WRONLY, 0644);
   
-  if (fd==-1) perror("open()");
+  if (fd==-1) perror("secure-mount: open(<mtab>)");
   
   if (fchroot(opt->cur_rootdir_fd)==-1) {
-    perror("fchroot()");
+    perror("secure-mount: fchroot()");
     goto err1;
   }
 
   if (fd==-1) goto err0;
 
   if (flock(fd, LOCK_EX)==-1) {
-    perror("flock()");
+    perror("secure-mount: flock()");
     goto err1;
   }
 
@@ -289,7 +289,7 @@ updateMtab(struct MountInfo const *mnt, struct Options const *opt)
       writeStrX(fd, " ")==-1 ||
       writeStrX(fd, mnt->data ? mnt->data : "defaults")==-1 ||
       writeStrX(fd, " 0 0\n")==-1) {
-    perror("write()");
+    perror("secure-mount: write()");
     goto err1;
   }
 
@@ -332,18 +332,18 @@ callExternalMount(struct MountInfo const *mnt)
 
   pid = fork();
   if (pid==-1) {
-    perror("fork()");
+    perror("secure-mount: fork()");
     return false;
   }
 
   if (pid==0) {
     execv(mount_prog, const_cast(char **)(argv));
-    perror("execv()");
+    perror("secure-mount: execv()");
     exit(1);
   }
 
   if (wait4(pid, &status, 0, 0)==-1) {
-    perror("wait4()");
+    perror("secure-mount: wait4()");
     return false;
   }
 
@@ -359,7 +359,7 @@ mountSingle(struct MountInfo const *mnt, struct Options const *opt)
   
   if (opt->rootdir!=0) {
     if (chdir(opt->rootdir)==-1) {
-      perror("chdir()");
+      perror("secure-mount: chdir()");
       return false;
     }
 
@@ -368,14 +368,14 @@ mountSingle(struct MountInfo const *mnt, struct Options const *opt)
 
   if (opt->is_secure) {
     if (chdirSecure(dir)==-1) {
-      perror("chdirSecure()");
+      perror("secure-mount: chdirSecure()");
       return false;
     }
   }
   else {
     if (*dir!='\0' &&
        chdir(dir)==-1) {
-      perror("chdir()");
+      perror("secure-mount: chdir()");
       return false;
     }
   }
@@ -384,7 +384,7 @@ mountSingle(struct MountInfo const *mnt, struct Options const *opt)
     if (mount(mnt->src, ".",
              mnt->type ? mnt->type : "",
              mnt->flags, mnt->data)==-1) {
-      perror("mount()");
+      perror("secure-mount: mount()");
       return false;
     }
   }
@@ -396,7 +396,7 @@ mountSingle(struct MountInfo const *mnt, struct Options const *opt)
   if ((mnt->flags&MS_BIND) && opt->rootdir!=0 &&
       (verifyPosition(mnt->src, opt->rootdir, mnt->dst)==-1 ||
        fchroot(opt->cur_rootdir_fd)==-1)) {
-    perror("verifyPosition/fchroot");
+    perror("secure-mount: verifyPosition/fchroot");
       // TODO: what is with unmounting?
     return false;
   }
@@ -489,14 +489,14 @@ mountFstab(struct Options const *opt)
   assert(opt->fstab!=0);
   fd = open(opt->fstab, O_RDONLY);
   if (fd==-1) {
-    perror("open(<fstab>)");
+    perror("secure-mount: open(<fstab>)");
     goto err0;
   }
 
   len = lseek(fd, 0, SEEK_END);
   if (len==-1 ||
       lseek(fd, 0, SEEK_SET)==-1) {
-    perror("lseek(<fstab>)");
+    perror("secure-mount: lseek(<fstab>)");
     goto err1;
   }
 
@@ -505,7 +505,7 @@ mountFstab(struct Options const *opt)
     char       *ptr, *ptrptr;
 
     if (read(fd, buf, len+1)!=len) {
-      perror("read()");
+      perror("secure-mount: read()");
       goto err1;
     }
     buf[len]   = '#';  // workaround for broken dietlibc strtok_r()
@@ -571,7 +571,7 @@ int main(int argc, char *argv[])
   opt.cur_rootdir_fd = open("/", O_RDONLY|O_DIRECTORY);
 
   if (opt.cur_rootdir_fd==-1) {
-    perror("open(\"/\")");
+    perror("secure-mount: open(\"/\")");
     return EXIT_FAILURE;
   }
 
index 52f8409..dad9cb7 100644 (file)
@@ -108,7 +108,7 @@ kill_wrapper_legacy(xid_t UNUSED ctx, char const *proc, int UNUSED sig)
 {
   pid_t                pid = fork();
   if (pid==-1) {
-    perror("fork()");
+    perror("vkill: fork()");
     exit(1);
   }
   else if (pid==0) {
@@ -121,7 +121,7 @@ kill_wrapper_legacy(xid_t UNUSED ctx, char const *proc, int UNUSED sig)
   }
 
   execl(LEGACYDIR "/vkill", "legacy/vkill", proc, (void *)(0));
-  perror("execl()");
+  perror("vkill: execl()");
   exit(1);
 }
 
@@ -135,7 +135,7 @@ kill_wrapper(xid_t ctx, char const *pid, int sig)
       return kill_wrapper_legacy(ctx, pid, sig);
     else {
       errno = err;
-      perror("vc_ctx_kill()");
+      perror("vkill: vc_ctx_kill()");
       return 1;
     }
   }
@@ -147,7 +147,7 @@ inline static int
 kill_wrapper(xid_t ctx, char const *pid, int sig)
 {
   if (vc_ctx_kill(ctx,atoi(pid),sig)==-1) {
-    perror("vc_ctx_kill()");
+    perror("vkill: vc_ctx_kill()");
     return 1;
   }
   return 0;