summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2003-11-20 03:27:56 +0000
committerTim Potter <tpot@samba.org>2003-11-20 03:27:56 +0000
commit8f0f97b078f45abbd001a1fa893455bd27d072cd (patch)
tree106e850d702f527d21db22505b17b02189d41494 /source4
parent52cae6b9088cae3c2daa8d195dcaba0c481a87d3 (diff)
downloadsamba-8f0f97b078f45abbd001a1fa893455bd27d072cd.tar.gz
samba-8f0f97b078f45abbd001a1fa893455bd27d072cd.tar.bz2
samba-8f0f97b078f45abbd001a1fa893455bd27d072cd.zip
Added ATSVC pipe.
(This used to be commit 274058486766f7a1094918702e7bc225aa938b2e)
Diffstat (limited to 'source4')
-rw-r--r--source4/Makefile.in7
-rw-r--r--source4/librpc/idl/atsvc.idl65
-rw-r--r--source4/librpc/ndr/libndr.h1
-rw-r--r--source4/librpc/ndr/ndr_atsvc.c429
-rw-r--r--source4/librpc/ndr/ndr_atsvc.h90
-rw-r--r--source4/librpc/rpc/rpc_atsvc.c88
-rw-r--r--source4/torture/rpc/atsvc.c165
-rw-r--r--source4/torture/torture.c1
8 files changed, 843 insertions, 3 deletions
diff --git a/source4/Makefile.in b/source4/Makefile.in
index 2628447723..69ee66f7ba 100644
--- a/source4/Makefile.in
+++ b/source4/Makefile.in
@@ -197,11 +197,12 @@ LIBRAW_NDR_OBJ = librpc/ndr/ndr.o librpc/ndr/ndr_basic.o librpc/ndr/ndr_sec.o \
librpc/ndr/ndr_echo.o librpc/ndr/ndr_misc.o librpc/ndr/ndr_lsa.o \
librpc/ndr/ndr_dfs.o librpc/ndr/ndr_samr.o \
librpc/ndr/ndr_spoolss.o librpc/ndr/ndr_spoolss_buf.o \
- librpc/ndr/ndr_wkssvc.o librpc/ndr/ndr_srvsvc.o
+ librpc/ndr/ndr_wkssvc.o librpc/ndr/ndr_srvsvc.o librpc/ndr/ndr_atsvc.o
LIBRAW_RPC_OBJ = librpc/rpc/dcerpc.o librpc/rpc/rpc_echo.o librpc/rpc/rpc_lsa.o \
librpc/rpc/dcerpc_smb.o librpc/rpc/rpc_dfs.o librpc/rpc/rpc_spoolss.o \
- librpc/rpc/rpc_samr.o librpc/rpc/rpc_wkssvc.o librpc/rpc/rpc_srvsvc.o
+ librpc/rpc/rpc_samr.o librpc/rpc/rpc_wkssvc.o librpc/rpc/rpc_srvsvc.o \
+ librpc/rpc/rpc_atsvc.o
LIBRAW_OBJ = libcli/raw/rawfile.o libcli/raw/smb_signing.o \
libcli/raw/clisocket.o libcli/raw/clitransport.o \
@@ -438,7 +439,7 @@ SMBTORTURE_RAW_OBJ = torture/raw/qfsinfo.o torture/raw/qfileinfo.o torture/raw/s
SMBTORTURE_RPC_OBJ = torture/rpc/lsa.o torture/rpc/echo.o torture/rpc/dfs.o \
torture/rpc/spoolss.o torture/rpc/samr.o torture/rpc/wkssvc.o \
- torture/rpc/srvsvc.o
+ torture/rpc/srvsvc.o torture/rpc/atsvc.o
SMBTORTURE_OBJ1 = torture/torture.o torture/torture_util.o torture/nbio.o torture/scanner.o \
torture/utable.o torture/denytest.o torture/mangle_test.o \
diff --git a/source4/librpc/idl/atsvc.idl b/source4/librpc/idl/atsvc.idl
new file mode 100644
index 0000000000..81394c747b
--- /dev/null
+++ b/source4/librpc/idl/atsvc.idl
@@ -0,0 +1,65 @@
+/*
+ atsvc interface definition
+*/
+
+[ uuid(1ff70682-0a51-30e8-076d-740be8cee98b),
+ version(1.0),
+ pointer_default(unique)
+] interface atsvc
+{
+ typedef struct {
+ uint32 job_time;
+ uint32 days_of_month;
+ uint8 days_of_week;
+ uint8 flags;
+ unistr *command;
+ } atsvc_JobInfo;
+
+ /******************/
+ /* Function: 0x00 */
+ NTSTATUS atsvc_JobAdd(
+ [in] unistr *servername,
+ [in,ref] atsvc_JobInfo *job_info,
+ [out] uint32 job_id
+ );
+
+ /******************/
+ /* Function: 0x01 */
+ NTSTATUS atsvc_JobDel(
+ [in] unistr *servername,
+ [in] uint32 min_job_id,
+ [in] uint32 max_job_id
+ );
+
+ typedef struct {
+ uint32 job_id;
+ uint32 job_time;
+ uint32 days_of_month;
+ uint8 days_of_week;
+ uint8 flags;
+ unistr *command;
+ } atsvc_JobEnumInfo;
+
+ typedef struct {
+ uint32 entries_read;
+ [size_is(entries_read)] atsvc_JobEnumInfo *first_entry;
+ } atsvc_enum_ctr;
+
+ /******************/
+ /* Function: 0x02 */
+ NTSTATUS atsvc_JobEnum(
+ [in] unistr *servername,
+ [in,out,ref] atsvc_enum_ctr *ctr,
+ [in] uint32 preferred_max_len,
+ [out] uint32 total_entries,
+ [in,out] uint32 *resume_handle
+ );
+
+ /******************/
+ /* Function: 0x03 */
+ NTSTATUS atsvc_JobGetInfo(
+ [in] unistr *servername,
+ [in] uint32 job_id,
+ [out] atsvc_JobInfo *job_info
+ );
+}
diff --git a/source4/librpc/ndr/libndr.h b/source4/librpc/ndr/libndr.h
index df058abc68..8975874c90 100644
--- a/source4/librpc/ndr/libndr.h
+++ b/source4/librpc/ndr/libndr.h
@@ -200,3 +200,4 @@ typedef void (*ndr_print_union_fn_t)(struct ndr_print *, const char *, uint32, v
#include "librpc/ndr/ndr_samr.h"
#include "librpc/ndr/ndr_wkssvc.h"
#include "librpc/ndr/ndr_srvsvc.h"
+#include "librpc/ndr/ndr_atsvc.h"
diff --git a/source4/librpc/ndr/ndr_atsvc.c b/source4/librpc/ndr/ndr_atsvc.c
new file mode 100644
index 0000000000..76255b44d7
--- /dev/null
+++ b/source4/librpc/ndr/ndr_atsvc.c
@@ -0,0 +1,429 @@
+/* parser auto-generated by pidl */
+
+#include "includes.h"
+
+NTSTATUS ndr_push_atsvc_JobInfo(struct ndr_push *ndr, int ndr_flags, struct atsvc_JobInfo *r)
+{
+ if (!(ndr_flags & NDR_SCALARS)) goto buffers;
+ NDR_CHECK(ndr_push_struct_start(ndr));
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint32(ndr, r->job_time));
+ NDR_CHECK(ndr_push_uint32(ndr, r->days_of_month));
+ NDR_CHECK(ndr_push_uint8(ndr, r->days_of_week));
+ NDR_CHECK(ndr_push_uint8(ndr, r->flags));
+ NDR_CHECK(ndr_push_ptr(ndr, r->command));
+ ndr_push_struct_end(ndr);
+buffers:
+ if (!(ndr_flags & NDR_BUFFERS)) goto done;
+ if (r->command) {
+ NDR_CHECK(ndr_push_unistr(ndr, r->command));
+ }
+done:
+ return NT_STATUS_OK;
+}
+
+NTSTATUS ndr_push_atsvc_JobAdd(struct ndr_push *ndr, struct atsvc_JobAdd *r)
+{
+ NDR_CHECK(ndr_push_ptr(ndr, r->in.servername));
+ if (r->in.servername) {
+ NDR_CHECK(ndr_push_unistr(ndr, r->in.servername));
+ }
+ NDR_CHECK(ndr_push_atsvc_JobInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.job_info));
+
+ return NT_STATUS_OK;
+}
+
+NTSTATUS ndr_push_atsvc_JobDel(struct ndr_push *ndr, struct atsvc_JobDel *r)
+{
+ NDR_CHECK(ndr_push_ptr(ndr, r->in.servername));
+ if (r->in.servername) {
+ NDR_CHECK(ndr_push_unistr(ndr, r->in.servername));
+ }
+ NDR_CHECK(ndr_push_uint32(ndr, r->in.min_job_id));
+ NDR_CHECK(ndr_push_uint32(ndr, r->in.max_job_id));
+
+ return NT_STATUS_OK;
+}
+
+NTSTATUS ndr_push_atsvc_JobEnumInfo(struct ndr_push *ndr, int ndr_flags, struct atsvc_JobEnumInfo *r)
+{
+ if (!(ndr_flags & NDR_SCALARS)) goto buffers;
+ NDR_CHECK(ndr_push_struct_start(ndr));
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint32(ndr, r->job_id));
+ NDR_CHECK(ndr_push_uint32(ndr, r->job_time));
+ NDR_CHECK(ndr_push_uint32(ndr, r->days_of_month));
+ NDR_CHECK(ndr_push_uint8(ndr, r->days_of_week));
+ NDR_CHECK(ndr_push_uint8(ndr, r->flags));
+ NDR_CHECK(ndr_push_ptr(ndr, r->command));
+ ndr_push_struct_end(ndr);
+buffers:
+ if (!(ndr_flags & NDR_BUFFERS)) goto done;
+ if (r->command) {
+ NDR_CHECK(ndr_push_unistr(ndr, r->command));
+ }
+done:
+ return NT_STATUS_OK;
+}
+
+NTSTATUS ndr_push_atsvc_enum_ctr(struct ndr_push *ndr, int ndr_flags, struct atsvc_enum_ctr *r)
+{
+ if (!(ndr_flags & NDR_SCALARS)) goto buffers;
+ NDR_CHECK(ndr_push_struct_start(ndr));
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint32(ndr, r->entries_read));
+ NDR_CHECK(ndr_push_ptr(ndr, r->first_entry));
+ ndr_push_struct_end(ndr);
+buffers:
+ if (!(ndr_flags & NDR_BUFFERS)) goto done;
+ if (r->first_entry) {
+ NDR_CHECK(ndr_push_uint32(ndr, r->entries_read));
+ NDR_CHECK(ndr_push_array(ndr, NDR_SCALARS|NDR_BUFFERS, r->first_entry, sizeof(r->first_entry[0]), r->entries_read, (ndr_push_flags_fn_t)ndr_push_atsvc_JobEnumInfo));
+ }
+done:
+ return NT_STATUS_OK;
+}
+
+NTSTATUS ndr_push_atsvc_JobEnum(struct ndr_push *ndr, struct atsvc_JobEnum *r)
+{
+ NDR_CHECK(ndr_push_ptr(ndr, r->in.servername));
+ if (r->in.servername) {
+ NDR_CHECK(ndr_push_unistr(ndr, r->in.servername));
+ }
+ NDR_CHECK(ndr_push_atsvc_enum_ctr(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.ctr));
+ NDR_CHECK(ndr_push_uint32(ndr, r->in.preferred_max_len));
+ NDR_CHECK(ndr_push_ptr(ndr, r->in.resume_handle));
+ if (r->in.resume_handle) {
+ NDR_CHECK(ndr_push_uint32(ndr, *r->in.resume_handle));
+ }
+
+ return NT_STATUS_OK;
+}
+
+NTSTATUS ndr_push_atsvc_JobGetInfo(struct ndr_push *ndr, struct atsvc_JobGetInfo *r)
+{
+ NDR_CHECK(ndr_push_ptr(ndr, r->in.servername));
+ if (r->in.servername) {
+ NDR_CHECK(ndr_push_unistr(ndr, r->in.servername));
+ }
+ NDR_CHECK(ndr_push_uint32(ndr, r->in.job_id));
+
+ return NT_STATUS_OK;
+}
+
+NTSTATUS ndr_pull_atsvc_JobInfo(struct ndr_pull *ndr, int ndr_flags, struct atsvc_JobInfo *r)
+{
+ uint32 _ptr_command;
+ NDR_CHECK(ndr_pull_struct_start(ndr));
+ if (!(ndr_flags & NDR_SCALARS)) goto buffers;
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_uint32(ndr, &r->job_time));
+ NDR_CHECK(ndr_pull_uint32(ndr, &r->days_of_month));
+ NDR_CHECK(ndr_pull_uint8(ndr, &r->days_of_week));
+ NDR_CHECK(ndr_pull_uint8(ndr, &r->flags));
+ NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_command));
+ if (_ptr_command) {
+ NDR_ALLOC(ndr, r->command);
+ } else {
+ r->command = NULL;
+ }
+ ndr_pull_struct_end(ndr);
+buffers:
+ if (!(ndr_flags & NDR_BUFFERS)) goto done;
+ if (r->command) {
+ NDR_CHECK(ndr_pull_unistr(ndr, &r->command));
+ }
+done:
+ return NT_STATUS_OK;
+}
+
+NTSTATUS ndr_pull_atsvc_JobAdd(struct ndr_pull *ndr, struct atsvc_JobAdd *r)
+{
+ NDR_CHECK(ndr_pull_uint32(ndr, &r->out.job_id));
+ NDR_CHECK(ndr_pull_NTSTATUS(ndr, &r->out.result));
+
+ return NT_STATUS_OK;
+}
+
+NTSTATUS ndr_pull_atsvc_JobDel(struct ndr_pull *ndr, struct atsvc_JobDel *r)
+{
+ NDR_CHECK(ndr_pull_NTSTATUS(ndr, &r->out.result));
+
+ return NT_STATUS_OK;
+}
+
+NTSTATUS ndr_pull_atsvc_JobEnumInfo(struct ndr_pull *ndr, int ndr_flags, struct atsvc_JobEnumInfo *r)
+{
+ uint32 _ptr_command;
+ NDR_CHECK(ndr_pull_struct_start(ndr));
+ if (!(ndr_flags & NDR_SCALARS)) goto buffers;
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_uint32(ndr, &r->job_id));
+ NDR_CHECK(ndr_pull_uint32(ndr, &r->job_time));
+ NDR_CHECK(ndr_pull_uint32(ndr, &r->days_of_month));
+ NDR_CHECK(ndr_pull_uint8(ndr, &r->days_of_week));
+ NDR_CHECK(ndr_pull_uint8(ndr, &r->flags));
+ NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_command));
+ if (_ptr_command) {
+ NDR_ALLOC(ndr, r->command);
+ } else {
+ r->command = NULL;
+ }
+ ndr_pull_struct_end(ndr);
+buffers:
+ if (!(ndr_flags & NDR_BUFFERS)) goto done;
+ if (r->command) {
+ NDR_CHECK(ndr_pull_unistr(ndr, &r->command));
+ }
+done:
+ return NT_STATUS_OK;
+}
+
+NTSTATUS ndr_pull_atsvc_enum_ctr(struct ndr_pull *ndr, int ndr_flags, struct atsvc_enum_ctr *r)
+{
+ uint32 _ptr_first_entry;
+ NDR_CHECK(ndr_pull_struct_start(ndr));
+ if (!(ndr_flags & NDR_SCALARS)) goto buffers;
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_uint32(ndr, &r->entries_read));
+ NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_first_entry));
+ if (_ptr_first_entry) {
+ NDR_ALLOC(ndr, r->first_entry);
+ } else {
+ r->first_entry = NULL;
+ }
+ ndr_pull_struct_end(ndr);
+buffers:
+ if (!(ndr_flags & NDR_BUFFERS)) goto done;
+ if (r->first_entry) {
+ {
+ uint32 _array_size;
+ NDR_CHECK(ndr_pull_uint32(ndr, &_array_size));
+ if (r->entries_read > _array_size) {
+ return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should be %u", _array_size, r->entries_read);
+ }
+ }
+ NDR_ALLOC_N_SIZE(ndr, r->first_entry, r->entries_read, sizeof(r->first_entry[0]));
+ NDR_CHECK(ndr_pull_array(ndr, NDR_SCALARS|NDR_BUFFERS, (void **)r->first_entry, sizeof(r->first_entry[0]), r->entries_read, (ndr_pull_flags_fn_t)ndr_pull_atsvc_JobEnumInfo));
+ }
+done:
+ return NT_STATUS_OK;
+}
+
+NTSTATUS ndr_pull_atsvc_JobEnum(struct ndr_pull *ndr, struct atsvc_JobEnum *r)
+{
+ uint32 _ptr_resume_handle;
+ NDR_CHECK(ndr_pull_atsvc_enum_ctr(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.ctr));
+ NDR_CHECK(ndr_pull_uint32(ndr, &r->out.total_entries));
+ NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_resume_handle));
+ if (_ptr_resume_handle) {
+ NDR_ALLOC(ndr, r->out.resume_handle);
+ } else {
+ r->out.resume_handle = NULL;
+ }
+ if (r->out.resume_handle) {
+ NDR_CHECK(ndr_pull_uint32(ndr, r->out.resume_handle));
+ }
+ NDR_CHECK(ndr_pull_NTSTATUS(ndr, &r->out.result));
+
+ return NT_STATUS_OK;
+}
+
+NTSTATUS ndr_pull_atsvc_JobGetInfo(struct ndr_pull *ndr, struct atsvc_JobGetInfo *r)
+{
+ uint32 _ptr_job_info;
+ NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_job_info));
+ if (_ptr_job_info) {
+ NDR_ALLOC(ndr, r->out.job_info);
+ } else {
+ r->out.job_info = NULL;
+ }
+ if (r->out.job_info) {
+ NDR_CHECK(ndr_pull_atsvc_JobInfo(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.job_info));
+ }
+ NDR_CHECK(ndr_pull_NTSTATUS(ndr, &r->out.result));
+
+ return NT_STATUS_OK;
+}
+
+void ndr_print_atsvc_JobInfo(struct ndr_print *ndr, const char *name, struct atsvc_JobInfo *r)
+{
+ ndr_print_struct(ndr, name, "atsvc_JobInfo");
+ ndr->depth++;
+ ndr_print_uint32(ndr, "job_time", r->job_time);
+ ndr_print_uint32(ndr, "days_of_month", r->days_of_month);
+ ndr_print_uint8(ndr, "days_of_week", r->days_of_week);
+ ndr_print_uint8(ndr, "flags", r->flags);
+ ndr_print_ptr(ndr, "command", r->command);
+ ndr->depth++;
+ if (r->command) {
+ ndr_print_unistr(ndr, "command", r->command);
+ }
+ ndr->depth--;
+ ndr->depth--;
+}
+
+void ndr_print_atsvc_JobAdd(struct ndr_print *ndr, const char *name, int flags, struct atsvc_JobAdd *r)
+{
+ ndr_print_struct(ndr, name, "atsvc_JobAdd");
+ ndr->depth++;
+ if (flags & NDR_IN) {
+ ndr_print_struct(ndr, "in", "atsvc_JobAdd");
+ ndr->depth++;
+ ndr_print_ptr(ndr, "servername", r->in.servername);
+ ndr->depth++;
+ if (r->in.servername) {
+ ndr_print_unistr(ndr, "servername", r->in.servername);
+ }
+ ndr->depth--;
+ ndr_print_ptr(ndr, "job_info", r->in.job_info);
+ ndr->depth++;
+ ndr_print_atsvc_JobInfo(ndr, "job_info", r->in.job_info);
+ ndr->depth--;
+ ndr->depth--;
+ }
+ if (flags & NDR_OUT) {
+ ndr_print_struct(ndr, "out", "atsvc_JobAdd");
+ ndr->depth++;
+ ndr_print_uint32(ndr, "job_id", r->out.job_id);
+ ndr_print_NTSTATUS(ndr, "result", &r->out.result);
+ ndr->depth--;
+ }
+ ndr->depth--;
+}
+
+void ndr_print_atsvc_JobDel(struct ndr_print *ndr, const char *name, int flags, struct atsvc_JobDel *r)
+{
+ ndr_print_struct(ndr, name, "atsvc_JobDel");
+ ndr->depth++;
+ if (flags & NDR_IN) {
+ ndr_print_struct(ndr, "in", "atsvc_JobDel");
+ ndr->depth++;
+ ndr_print_ptr(ndr, "servername", r->in.servername);
+ ndr->depth++;
+ if (r->in.servername) {
+ ndr_print_unistr(ndr, "servername", r->in.servername);
+ }
+ ndr->depth--;
+ ndr_print_uint32(ndr, "min_job_id", r->in.min_job_id);
+ ndr_print_uint32(ndr, "max_job_id", r->in.max_job_id);
+ ndr->depth--;
+ }
+ if (flags & NDR_OUT) {
+ ndr_print_struct(ndr, "out", "atsvc_JobDel");
+ ndr->depth++;
+ ndr_print_NTSTATUS(ndr, "result", &r->out.result);
+ ndr->depth--;
+ }
+ ndr->depth--;
+}
+
+void ndr_print_atsvc_JobEnumInfo(struct ndr_print *ndr, const char *name, struct atsvc_JobEnumInfo *r)
+{
+ ndr_print_struct(ndr, name, "atsvc_JobEnumInfo");
+ ndr->depth++;
+ ndr_print_uint32(ndr, "job_id", r->job_id);
+ ndr_print_uint32(ndr, "job_time", r->job_time);
+ ndr_print_uint32(ndr, "days_of_month", r->days_of_month);
+ ndr_print_uint8(ndr, "days_of_week", r->days_of_week);
+ ndr_print_uint8(ndr, "flags", r->flags);
+ ndr_print_ptr(ndr, "command", r->command);
+ ndr->depth++;
+ if (r->command) {
+ ndr_print_unistr(ndr, "command", r->command);
+ }
+ ndr->depth--;
+ ndr->depth--;
+}
+
+void ndr_print_atsvc_enum_ctr(struct ndr_print *ndr, const char *name, struct atsvc_enum_ctr *r)
+{
+ ndr_print_struct(ndr, name, "atsvc_enum_ctr");
+ ndr->depth++;
+ ndr_print_uint32(ndr, "entries_read", r->entries_read);
+ ndr_print_ptr(ndr, "first_entry", r->first_entry);
+ ndr->depth++;
+ if (r->first_entry) {
+ ndr_print_array(ndr, "first_entry", r->first_entry, sizeof(r->first_entry[0]), r->entries_read, (ndr_print_fn_t)ndr_print_atsvc_JobEnumInfo);
+ }
+ ndr->depth--;
+ ndr->depth--;
+}
+
+void ndr_print_atsvc_JobEnum(struct ndr_print *ndr, const char *name, int flags, struct atsvc_JobEnum *r)
+{
+ ndr_print_struct(ndr, name, "atsvc_JobEnum");
+ ndr->depth++;
+ if (flags & NDR_IN) {
+ ndr_print_struct(ndr, "in", "atsvc_JobEnum");
+ ndr->depth++;
+ ndr_print_ptr(ndr, "servername", r->in.servername);
+ ndr->depth++;
+ if (r->in.servername) {
+ ndr_print_unistr(ndr, "servername", r->in.servername);
+ }
+ ndr->depth--;
+ ndr_print_ptr(ndr, "ctr", r->in.ctr);
+ ndr->depth++;
+ ndr_print_atsvc_enum_ctr(ndr, "ctr", r->in.ctr);
+ ndr->depth--;
+ ndr_print_uint32(ndr, "preferred_max_len", r->in.preferred_max_len);
+ ndr_print_ptr(ndr, "resume_handle", r->in.resume_handle);
+ ndr->depth++;
+ if (r->in.resume_handle) {
+ ndr_print_uint32(ndr, "resume_handle", *r->in.resume_handle);
+ }
+ ndr->depth--;
+ ndr->depth--;
+ }
+ if (flags & NDR_OUT) {
+ ndr_print_struct(ndr, "out", "atsvc_JobEnum");
+ ndr->depth++;
+ ndr_print_ptr(ndr, "ctr", r->out.ctr);
+ ndr->depth++;
+ ndr_print_atsvc_enum_ctr(ndr, "ctr", r->out.ctr);
+ ndr->depth--;
+ ndr_print_uint32(ndr, "total_entries", r->out.total_entries);
+ ndr_print_ptr(ndr, "resume_handle", r->out.resume_handle);
+ ndr->depth++;
+ if (r->out.resume_handle) {
+ ndr_print_uint32(ndr, "resume_handle", *r->out.resume_handle);
+ }
+ ndr->depth--;
+ ndr_print_NTSTATUS(ndr, "result", &r->out.result);
+ ndr->depth--;
+ }
+ ndr->depth--;
+}
+
+void ndr_print_atsvc_JobGetInfo(struct ndr_print *ndr, const char *name, int flags, struct atsvc_JobGetInfo *r)
+{
+ ndr_print_struct(ndr, name, "atsvc_JobGetInfo");
+ ndr->depth++;
+ if (flags & NDR_IN) {
+ ndr_print_struct(ndr, "in", "atsvc_JobGetInfo");
+ ndr->depth++;
+ ndr_print_ptr(ndr, "servername", r->in.servername);
+ ndr->depth++;
+ if (r->in.servername) {
+ ndr_print_unistr(ndr, "servername", r->in.servername);
+ }
+ ndr->depth--;
+ ndr_print_uint32(ndr, "job_id", r->in.job_id);
+ ndr->depth--;
+ }
+ if (flags & NDR_OUT) {
+ ndr_print_struct(ndr, "out", "atsvc_JobGetInfo");
+ ndr->depth++;
+ ndr_print_ptr(ndr, "job_info", r->out.job_info);
+ ndr->depth++;
+ if (r->out.job_info) {
+ ndr_print_atsvc_JobInfo(ndr, "job_info", r->out.job_info);
+ }
+ ndr->depth--;
+ ndr_print_NTSTATUS(ndr, "result", &r->out.result);
+ ndr->depth--;
+ }
+ ndr->depth--;
+}
+
diff --git a/source4/librpc/ndr/ndr_atsvc.h b/source4/librpc/ndr/ndr_atsvc.h
new file mode 100644
index 0000000000..e8e7276de2
--- /dev/null
+++ b/source4/librpc/ndr/ndr_atsvc.h
@@ -0,0 +1,90 @@
+/* header auto-generated by pidl */
+
+#define DCERPC_ATSVC_UUID "1ff70682-0a51-30e8-076d-740be8cee98b"
+#define DCERPC_ATSVC_VERSION 1.0
+#define DCERPC_ATSVC_NAME "atsvc"
+
+#define DCERPC_ATSVC_JOBADD 0
+#define DCERPC_ATSVC_JOBDEL 1
+#define DCERPC_ATSVC_JOBENUM 2
+#define DCERPC_ATSVC_JOBGETINFO 3
+
+
+struct atsvc_JobInfo {
+ uint32 job_time;
+ uint32 days_of_month;
+ uint8 days_of_week;
+ uint8 flags;
+ const char *command;
+};
+
+struct atsvc_JobAdd {
+ struct {
+ const char *servername;
+ struct atsvc_JobInfo *job_info;
+ } in;
+
+ struct {
+ uint32 job_id;
+ NTSTATUS result;
+ } out;
+
+};
+
+struct atsvc_JobDel {
+ struct {
+ const char *servername;
+ uint32 min_job_id;
+ uint32 max_job_id;
+ } in;
+
+ struct {
+ NTSTATUS result;
+ } out;
+
+};
+
+struct atsvc_JobEnumInfo {
+ uint32 job_id;
+ uint32 job_time;
+ uint32 days_of_month;
+ uint8 days_of_week;
+ uint8 flags;
+ const char *command;
+};
+
+struct atsvc_enum_ctr {
+ uint32 entries_read;
+ struct atsvc_JobEnumInfo *first_entry;
+};
+
+struct atsvc_JobEnum {
+ struct {
+ const char *servername;
+ struct atsvc_enum_ctr *ctr;
+ uint32 preferred_max_len;
+ uint32 *resume_handle;
+ } in;
+
+ struct {
+ struct atsvc_enum_ctr *ctr;
+ uint32 total_entries;
+ uint32 *resume_handle;
+ NTSTATUS result;
+ } out;
+
+};
+
+struct atsvc_JobGetInfo {
+ struct {
+ const char *servername;
+ uint32 job_id;
+ } in;
+
+ struct {
+ struct atsvc_JobInfo *job_info;
+ NTSTATUS result;
+ } out;
+
+};
+
diff --git a/source4/librpc/rpc/rpc_atsvc.c b/source4/librpc/rpc/rpc_atsvc.c
new file mode 100644
index 0000000000..1bc81b5a68
--- /dev/null
+++ b/source4/librpc/rpc/rpc_atsvc.c
@@ -0,0 +1,88 @@
+/* dcerpc client calls generated by pidl */
+
+#include "includes.h"
+
+
+NTSTATUS dcerpc_atsvc_JobAdd(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct atsvc_JobAdd *r)
+{
+ NTSTATUS status;
+
+ if (p->flags & DCERPC_DEBUG_PRINT_IN) {
+ NDR_PRINT_IN_DEBUG(atsvc_JobAdd, r);
+ }
+
+ status = dcerpc_ndr_request(p, DCERPC_ATSVC_JOBADD, mem_ctx,
+ (ndr_push_fn_t) ndr_push_atsvc_JobAdd,
+ (ndr_pull_fn_t) ndr_pull_atsvc_JobAdd,
+ r);
+
+ if (NT_STATUS_IS_OK(status) && (p->flags & DCERPC_DEBUG_PRINT_OUT)) {
+ NDR_PRINT_OUT_DEBUG(atsvc_JobAdd, r);
+ }
+ if (NT_STATUS_IS_OK(status)) status = r->out.result;
+
+ return status;
+}
+
+NTSTATUS dcerpc_atsvc_JobDel(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct atsvc_JobDel *r)
+{
+ NTSTATUS status;
+
+ if (p->flags & DCERPC_DEBUG_PRINT_IN) {
+ NDR_PRINT_IN_DEBUG(atsvc_JobDel, r);
+ }
+
+ status = dcerpc_ndr_request(p, DCERPC_ATSVC_JOBDEL, mem_ctx,
+ (ndr_push_fn_t) ndr_push_atsvc_JobDel,
+ (ndr_pull_fn_t) ndr_pull_atsvc_JobDel,
+ r);
+
+ if (NT_STATUS_IS_OK(status) && (p->flags & DCERPC_DEBUG_PRINT_OUT)) {
+ NDR_PRINT_OUT_DEBUG(atsvc_JobDel, r);
+ }
+ if (NT_STATUS_IS_OK(status)) status = r->out.result;
+
+ return status;
+}
+
+NTSTATUS dcerpc_atsvc_JobEnum(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct atsvc_JobEnum *r)
+{
+ NTSTATUS status;
+
+ if (p->flags & DCERPC_DEBUG_PRINT_IN) {
+ NDR_PRINT_IN_DEBUG(atsvc_JobEnum, r);
+ }
+
+ status = dcerpc_ndr_request(p, DCERPC_ATSVC_JOBENUM, mem_ctx,
+ (ndr_push_fn_t) ndr_push_atsvc_JobEnum,
+ (ndr_pull_fn_t) ndr_pull_atsvc_JobEnum,
+ r);
+
+ if (NT_STATUS_IS_OK(status) && (p->flags & DCERPC_DEBUG_PRINT_OUT)) {
+ NDR_PRINT_OUT_DEBUG(atsvc_JobEnum, r);
+ }
+ if (NT_STATUS_IS_OK(status)) status = r->out.result;
+
+ return status;
+}
+
+NTSTATUS dcerpc_atsvc_JobGetInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct atsvc_JobGetInfo *r)
+{
+ NTSTATUS status;
+
+ if (p->flags & DCERPC_DEBUG_PRINT_IN) {
+ NDR_PRINT_IN_DEBUG(atsvc_JobGetInfo, r);
+ }
+
+ status = dcerpc_ndr_request(p, DCERPC_ATSVC_JOBGETINFO, mem_ctx,
+ (ndr_push_fn_t) ndr_push_atsvc_JobGetInfo,
+ (ndr_pull_fn_t) ndr_pull_atsvc_JobGetInfo,
+ r);
+
+ if (NT_STATUS_IS_OK(status) && (p->flags & DCERPC_DEBUG_PRINT_OUT)) {
+ NDR_PRINT_OUT_DEBUG(atsvc_JobGetInfo, r);
+ }
+ if (NT_STATUS_IS_OK(status)) status = r->out.result;
+
+ return status;
+}
diff --git a/source4/torture/rpc/atsvc.c b/source4/torture/rpc/atsvc.c
new file mode 100644
index 0000000000..3ebcaf7ff2
--- /dev/null
+++ b/source4/torture/rpc/atsvc.c
@@ -0,0 +1,165 @@
+/*
+ Unix SMB/CIFS implementation.
+ test suite for lsa rpc operations
+
+ Copyright (C) Tim Potter 2003
+
+ 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 of the License, 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "includes.h"
+
+static BOOL test_JobGetInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, uint32 job_id)
+{
+ NTSTATUS status;
+ struct atsvc_JobGetInfo r;
+
+ r.in.servername = dcerpc_server_name(p);
+ r.in.job_id = job_id;
+
+ status = dcerpc_atsvc_JobGetInfo(p, mem_ctx, &r);
+
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("JobGetInfo failed - %s\n", nt_errstr(status));
+ return False;
+ }
+
+ return True;
+}
+
+static BOOL test_JobDel(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, uint32 min_job_id,
+ uint32 max_job_id)
+{
+ NTSTATUS status;
+ struct atsvc_JobDel r;
+
+ r.in.servername = dcerpc_server_name(p);
+ r.in.min_job_id = min_job_id;
+ r.in.max_job_id = max_job_id;
+
+ status = dcerpc_atsvc_JobDel(p, mem_ctx, &r);
+
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("JobDel failed - %s\n", nt_errstr(status));
+ return False;
+ }
+
+ return True;
+}
+
+static BOOL test_JobEnum(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
+{
+ NTSTATUS status;
+ struct atsvc_JobEnum r;
+ struct atsvc_enum_ctr ctr;
+ uint32 resume_handle = 0, i;
+ BOOL ret = True;
+
+ printf("\ntesting JobEnum\n");
+
+ r.in.servername = dcerpc_server_name(p);
+ ctr.entries_read = 0;
+ ctr.first_entry = NULL;
+ r.in.ctr = r.out.ctr = &ctr;
+ r.in.preferred_max_len = 0xffffffff;
+ r.in.resume_handle = r.out.resume_handle = &resume_handle;
+
+ status = dcerpc_atsvc_JobEnum(p, mem_ctx, &r);
+
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("JobEnum failed - %s\n", nt_errstr(status));
+ return False;
+ }
+
+ for (i = 0; r.out.ctr && i < r.out.ctr->entries_read; i++) {
+ if (!test_JobGetInfo(p, mem_ctx, r.out.ctr->first_entry[i].job_id)) {
+ ret = False;
+ }
+ }
+
+ return ret;
+}
+
+static BOOL test_JobAdd(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
+{
+ NTSTATUS status;
+ struct atsvc_JobAdd r;
+ struct atsvc_JobInfo info;
+
+ printf("\ntesting JobAdd\n");
+
+ r.in.servername = dcerpc_server_name(p);
+ info.job_time = 0x050ae4c0; /* 11:30pm */
+ info.days_of_month = 0; /* n/a */
+ info.days_of_week = 0x02; /* Tuesday */
+ info.flags = 0x11; /* periodic, non-interactive */
+ info.command = "foo.exe";
+ r.in.job_info = &info;
+
+ status = dcerpc_atsvc_JobAdd(p, mem_ctx, &r);
+
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("JobAdd failed - %s\n", nt_errstr(status));
+ return False;
+ }
+
+ /* Run EnumJobs again in case there were no jobs to begin with */
+
+ if (!test_JobEnum(p, mem_ctx)) {
+ return False;
+ }
+
+ if (!test_JobGetInfo(p, mem_ctx, r.out.job_id)) {
+ return False;
+ }
+
+ if (!test_JobDel(p, mem_ctx, r.out.job_id, r.out.job_id)) {
+ return False;
+ }
+
+ return True;
+}
+
+BOOL torture_rpc_atsvc(int dummy)
+{
+ NTSTATUS status;
+ struct dcerpc_pipe *p;
+ TALLOC_CTX *mem_ctx;
+ BOOL ret = True;
+
+ mem_ctx = talloc_init("torture_rpc_atsvc");
+
+ status = torture_rpc_connection(&p,
+ DCERPC_ATSVC_NAME,
+ DCERPC_ATSVC_UUID,
+ DCERPC_ATSVC_VERSION);
+ if (!NT_STATUS_IS_OK(status)) {
+ return False;
+ }
+
+ p->flags |= DCERPC_DEBUG_PRINT_BOTH;
+
+ if (!test_JobEnum(p, mem_ctx)) {
+ return False;
+ }
+
+ if (!test_JobAdd(p, mem_ctx)) {
+ return False;
+ }
+
+ torture_rpc_close(p);
+
+ return ret;
+}
diff --git a/source4/torture/torture.c b/source4/torture/torture.c
index fca54de64e..cfb1289149 100644
--- a/source4/torture/torture.c
+++ b/source4/torture/torture.c
@@ -3994,6 +3994,7 @@ static struct {
{"RPC-SAMR", torture_rpc_samr, 0},
{"RPC-WKSSVC", torture_rpc_wkssvc, 0},
{"RPC-SRVSVC", torture_rpc_srvsvc, 0},
+ {"RPC-ATSVC", torture_rpc_atsvc, 0},
{NULL, NULL, 0}};