X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=daemon%2Fstubs.c;h=2a6035cf862382cc094056053ed989ac652ac6a9;hb=baa5a4099425803f01fa7eb2dce40c80c9c7611e;hp=78426409e9d1428ff801ad1230a5eac80e50ca4c;hpb=56bef498f46ac3dd580f4bde3c8f3ed2fe688826;p=libguestfs.git diff --git a/daemon/stubs.c b/daemon/stubs.c index 7842640..2a6035c 100644 --- a/daemon/stubs.c +++ b/daemon/stubs.c @@ -2771,6 +2771,89 @@ done: xdr_free ((xdrproc_t) xdr_guestfs_ntfs_3g_probe_args, (char *) &args); } +static void sh_stub (XDR *xdr_in) +{ + char *r; + struct guestfs_sh_args args; + char *command; + + memset (&args, 0, sizeof args); + + if (!xdr_guestfs_sh_args (xdr_in, &args)) { + reply_with_error ("%s: daemon failed to decode procedure arguments", "sh"); + return; + } + command = args.command; + + r = do_sh (command); + if (r == NULL) + /* do_sh has already called reply_with_error */ + goto done; + + struct guestfs_sh_ret ret; + ret.output = r; + reply ((xdrproc_t) &xdr_guestfs_sh_ret, (char *) &ret); + free (r); +done: + xdr_free ((xdrproc_t) xdr_guestfs_sh_args, (char *) &args); +} + +static void sh_lines_stub (XDR *xdr_in) +{ + char **r; + struct guestfs_sh_lines_args args; + char *command; + + memset (&args, 0, sizeof args); + + if (!xdr_guestfs_sh_lines_args (xdr_in, &args)) { + reply_with_error ("%s: daemon failed to decode procedure arguments", "sh_lines"); + return; + } + command = args.command; + + r = do_sh_lines (command); + if (r == NULL) + /* do_sh_lines has already called reply_with_error */ + goto done; + + struct guestfs_sh_lines_ret ret; + ret.lines.lines_len = count_strings (r); + ret.lines.lines_val = r; + reply ((xdrproc_t) &xdr_guestfs_sh_lines_ret, (char *) &ret); + free_strings (r); +done: + xdr_free ((xdrproc_t) xdr_guestfs_sh_lines_args, (char *) &args); +} + +static void glob_expand_stub (XDR *xdr_in) +{ + char **r; + struct guestfs_glob_expand_args args; + char *pattern; + + memset (&args, 0, sizeof args); + + if (!xdr_guestfs_glob_expand_args (xdr_in, &args)) { + reply_with_error ("%s: daemon failed to decode procedure arguments", "glob_expand"); + return; + } + pattern = args.pattern; + + r = do_glob_expand (pattern); + if (r == NULL) + /* do_glob_expand has already called reply_with_error */ + goto done; + + struct guestfs_glob_expand_ret ret; + ret.paths.paths_len = count_strings (r); + ret.paths.paths_val = r; + reply ((xdrproc_t) &xdr_guestfs_glob_expand_ret, (char *) &ret); + free_strings (r); +done: + xdr_free ((xdrproc_t) xdr_guestfs_glob_expand_args, (char *) &args); +} + void dispatch_incoming_message (XDR *xdr_in) { switch (proc_nr) { @@ -3104,6 +3187,15 @@ void dispatch_incoming_message (XDR *xdr_in) case GUESTFS_PROC_NTFS_3G_PROBE: ntfs_3g_probe_stub (xdr_in); break; + case GUESTFS_PROC_SH: + sh_stub (xdr_in); + break; + case GUESTFS_PROC_SH_LINES: + sh_lines_stub (xdr_in); + break; + case GUESTFS_PROC_GLOB_EXPAND: + glob_expand_stub (xdr_in); + break; default: reply_with_error ("dispatch_incoming_message: unknown procedure number %d", proc_nr); }