[SCM] Samba Shared Repository - branch v3-3-test updated -
release-3-2-0pre2-2887-g2b82779
Günther Deschner
gd at samba.org
Tue Jun 17 17:58:48 GMT 2008
The branch, v3-3-test has been updated
via 2b82779a401dd1d14f5842872ac37b2454efc92b (commit)
via 76877680a8a6400bc2d3b5e3b788b7d5fc683850 (commit)
from 1262ab1843a8a8cb794f6bbfb113bd2d99ffba22 (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test
- Log -----------------------------------------------------------------
commit 2b82779a401dd1d14f5842872ac37b2454efc92b
Author: Günther Deschner <gd at samba.org>
Date: Tue Jun 17 13:18:02 2008 +0200
netapi: add NetRemoteTOD example code.
Guenther
commit 76877680a8a6400bc2d3b5e3b788b7d5fc683850
Author: Günther Deschner <gd at samba.org>
Date: Fri Jun 6 16:41:19 2008 +0200
netapi: implement NetRemoteTOD().
Guenther
-----------------------------------------------------------------------
Summary of changes:
source/lib/netapi/examples/Makefile.in | 8 ++++-
.../{group/group_del.c => server/remote_tod.c} | 25 +++++++-------
source/lib/netapi/serverinfo.c | 34 ++++++++++++++++++-
3 files changed, 52 insertions(+), 15 deletions(-)
copy source/lib/netapi/examples/{group/group_del.c => server/remote_tod.c} (77%)
Changeset truncated at 500 lines:
diff --git a/source/lib/netapi/examples/Makefile.in b/source/lib/netapi/examples/Makefile.in
index 13a682f..4b5ce25 100644
--- a/source/lib/netapi/examples/Makefile.in
+++ b/source/lib/netapi/examples/Makefile.in
@@ -35,7 +35,8 @@ PROGS = bin/getdc at EXEEXT@ \
bin/localgroup_add at EXEEXT@ \
bin/localgroup_del at EXEEXT@ \
bin/localgroup_getinfo at EXEEXT@ \
- bin/localgroup_setinfo at EXEEXT@
+ bin/localgroup_setinfo at EXEEXT@ \
+ bin/remote_tod at EXEEXT@
all: $(PROGS)
@@ -83,6 +84,7 @@ LOCALGROUPADD_OBJ = localgroup/localgroup_add.o $(CMDLINE_OBJ)
LOCALGROUPDEL_OBJ = localgroup/localgroup_del.o $(CMDLINE_OBJ)
LOCALGROUPGETINFO_OBJ = localgroup/localgroup_getinfo.o $(CMDLINE_OBJ)
LOCALGROUPSETINFO_OBJ = localgroup/localgroup_setinfo.o $(CMDLINE_OBJ)
+REMOTETOD_OBJ = server/remote_tod.o $(CMDLINE_OBJ)
bin/getdc at EXEEXT@: $(BINARY_PREREQS) $(GETDC_OBJ)
@echo Linking $@
@@ -160,6 +162,10 @@ bin/localgroup_setinfo at EXEEXT@: $(BINARY_PREREQS) $(LOCALGROUPSETINFO_OBJ)
@echo Linking $@
@$(CC) $(FLAGS) -o $@ $(LOCALGROUPSETINFO_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
+bin/remote_tod at EXEEXT@: $(BINARY_PREREQS) $(REMOTETOD_OBJ)
+ @echo Linking $@
+ @$(CC) $(FLAGS) -o $@ $(REMOTETOD_OBJ) $(LDFLAGS) $(DYNEXP) $(CMDLINE_LIBS)
+
clean:
-rm -f $(PROGS)
-rm -f core */*~ *~ \
diff --git a/source/lib/netapi/examples/group/group_del.c b/source/lib/netapi/examples/server/remote_tod.c
similarity index 77%
copy from source/lib/netapi/examples/group/group_del.c
copy to source/lib/netapi/examples/server/remote_tod.c
index 789e429..7636f6a 100644
--- a/source/lib/netapi/examples/group/group_del.c
+++ b/source/lib/netapi/examples/server/remote_tod.c
@@ -1,6 +1,6 @@
/*
* Unix SMB/CIFS implementation.
- * NetGroupDel query
+ * NetRemoteTOD query
* Copyright (C) Guenther Deschner 2008
*
* This program is free software; you can redistribute it and/or modify
@@ -32,7 +32,7 @@ int main(int argc, const char **argv)
NET_API_STATUS status;
struct libnetapi_ctx *ctx = NULL;
const char *hostname = NULL;
- const char *groupname = NULL;
+ struct TIME_OF_DAY_INFO *tod = NULL;
poptContext pc;
int opt;
@@ -48,9 +48,9 @@ int main(int argc, const char **argv)
return status;
}
- pc = poptGetContext("group_del", argc, argv, long_options, 0);
+ pc = poptGetContext("tod", argc, argv, long_options, 0);
- poptSetOtherOptionHelp(pc, "hostname groupname");
+ poptSetOtherOptionHelp(pc, "hostname");
while((opt = poptGetNextOpt(pc)) != -1) {
}
@@ -60,18 +60,19 @@ int main(int argc, const char **argv)
}
hostname = poptGetArg(pc);
- if (!poptPeekArg(pc)) {
- poptPrintHelp(pc, stderr, 0);
- goto out;
- }
- groupname = poptGetArg(pc);
- /* NetGroupDel */
+ /* NetRemoteTOD */
- status = NetGroupDel(hostname, groupname);
+ status = NetRemoteTOD(hostname,
+ (uint8_t **)&tod);
if (status != 0) {
- printf("NetGroupDel failed with: %s\n",
+ printf("NetRemoteTOD failed with: %s\n",
libnetapi_get_error_string(ctx, status));
+ } else {
+ printf("%d-%d-%d %d:%d:%d\n",
+ tod->tod_day, tod->tod_month, tod->tod_year,
+ tod->tod_hours, tod->tod_mins, tod->tod_secs);
+ NetApiBufferFree(tod);
}
out:
diff --git a/source/lib/netapi/serverinfo.c b/source/lib/netapi/serverinfo.c
index f75779a..7920bc2 100644
--- a/source/lib/netapi/serverinfo.c
+++ b/source/lib/netapi/serverinfo.c
@@ -210,7 +210,37 @@ WERROR NetServerSetInfo_r(struct libnetapi_ctx *ctx,
WERROR NetRemoteTOD_r(struct libnetapi_ctx *ctx,
struct NetRemoteTOD *r)
{
- return WERR_NOT_SUPPORTED;
+ struct cli_state *cli = NULL;
+ struct rpc_pipe_client *pipe_cli = NULL;
+ NTSTATUS status;
+ WERROR werr;
+ struct srvsvc_NetRemoteTODInfo *info = NULL;
+
+ werr = libnetapi_open_ipc_connection(ctx, r->in.server_name, &cli);
+ if (!W_ERROR_IS_OK(werr)) {
+ goto done;
+ }
+
+ werr = libnetapi_open_pipe(ctx, cli, PI_SRVSVC, &pipe_cli);
+ if (!W_ERROR_IS_OK(werr)) {
+ goto done;
+ }
+
+ status = rpccli_srvsvc_NetRemoteTOD(pipe_cli, ctx,
+ r->in.server_name,
+ &info,
+ &werr);
+ if (!NT_STATUS_IS_OK(status)) {
+ werr = ntstatus_to_werror(status);
+ goto done;
+ }
+
+ *r->out.buf = (uint8_t *)talloc_memdup(ctx, info,
+ sizeof(struct srvsvc_NetRemoteTODInfo));
+ W_ERROR_HAVE_NO_MEMORY(*r->out.buf);
+
+ done:
+ return werr;
}
/****************************************************************
@@ -219,6 +249,6 @@ WERROR NetRemoteTOD_r(struct libnetapi_ctx *ctx,
WERROR NetRemoteTOD_l(struct libnetapi_ctx *ctx,
struct NetRemoteTOD *r)
{
- return WERR_NOT_SUPPORTED;
+ return NetRemoteTOD_r(ctx, r);
}
--
Samba Shared Repository
More information about the samba-cvs
mailing list