X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=util-vserver%2Fsrc%2Fchcontext.c;h=06adb992c883e44045ccff3cfa91f52158a2c350;hb=c379a190b0c8f633c6daca9586cc44b5bc4f4c28;hp=4c4c52948c20feca272413dbeb84601e6594a19f;hpb=19b505f485927357115dcd74d4576f5c7f4dd995;p=util-vserver.git diff --git a/util-vserver/src/chcontext.c b/util-vserver/src/chcontext.c index 4c4c529..06adb99 100644 --- a/util-vserver/src/chcontext.c +++ b/util-vserver/src/chcontext.c @@ -38,6 +38,7 @@ #include #include #include +#include #define ENSC_WRAPPERS_PREFIX "chcontext: " #define ENSC_WRAPPERS_VSERVER 1 @@ -90,6 +91,8 @@ static struct Arguments const * global_args = 0; static void showHelp(int fd, char const *cmd, int res) { + VSERVER_DECLARE_CMD(cmd); + WRITE_MSG(fd, "Usage: "); WRITE_STR(fd, cmd); WRITE_MSG(fd, @@ -165,7 +168,7 @@ static void showVersion() { WRITE_MSG(1, - "chcontext " VERSION " -- allocates/enters a security context\n" + "chcontext-compat " VERSION " -- allocates/enters a security context\n" "This program is part of " PACKAGE_STRING "\n\n" "Copyright (C) 2003,2004 Enrico Scholz\n" VERSION_COPYRIGHT_DISCLAIMER); @@ -199,14 +202,13 @@ setCap(char const *str, uint32_t *add_caps, uint32_t *remove_caps) static inline void setFlags(char const *str, uint32_t *flags) { - char const *err_ptr; - size_t err_len; + struct vc_err_listparser err; - *flags = vc_textlist2flag(str, 0, &err_ptr, &err_len); + *flags = vc_list2flag_compat(str, 0, &err); - if (err_ptr!=0) { + if (err.ptr!=0) { WRITE_MSG(2, "Unknown flag '"); - write(2, err_ptr, err_len); + write(2, err.ptr, err.len); WRITE_MSG(2, "'\n"); exit(wrapper_exit_code); } @@ -377,7 +379,7 @@ int main (int argc, char *argv[]) args.domainname = ""; if (args.nbctx == 0) - args.ctxs[args.nbctx++] = VC_RANDCTX; + args.ctxs[args.nbctx++] = VC_DYNAMIC_XID; xflags = args.flags & S_CTX_INFO_INIT; args.flags &= ~S_CTX_INFO_INIT; @@ -391,13 +393,13 @@ int main (int argc, char *argv[]) if (args.remove_caps!=0 || xflags!=0) Evc_new_s_context (VC_SAMECTX,args.remove_caps,xflags); - tellContext(args.ctxs[0]==VC_RANDCTX ? newctx : args.ctxs[0]); + tellContext(args.ctxs[0]==VC_DYNAMIC_XID ? newctx : args.ctxs[0]); doSyncStage1(p); execvp (argv[optind],argv+optind); doSyncStage2(p); - perror("chcontext: execvp()"); + PERROR_Q("chcontext: execvp", argv[optind]); exit(255); }