summaryrefslogtreecommitdiff
path: root/source4/rpc_server/srvsvc/dcesrv_srvsvc.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2004-12-06 11:10:15 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:06:23 -0500
commitc62615f2686a048bbb470801b146d589b17eece4 (patch)
tree2535e080f34cbfae60cbe975ce51d0d42a1278d7 /source4/rpc_server/srvsvc/dcesrv_srvsvc.c
parent690b352fc19cb5444b923c220af91f17a88a5e3c (diff)
downloadsamba-c62615f2686a048bbb470801b146d589b17eece4.tar.gz
samba-c62615f2686a048bbb470801b146d589b17eece4.tar.bz2
samba-c62615f2686a048bbb470801b146d589b17eece4.zip
r4075: implement RemoteTOD server function
metze (This used to be commit 0c6d4246a45f649e7373606f12db74c2acd0f538)
Diffstat (limited to 'source4/rpc_server/srvsvc/dcesrv_srvsvc.c')
-rw-r--r--source4/rpc_server/srvsvc/dcesrv_srvsvc.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c
index 0679ac6e42..8909fc17a7 100644
--- a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c
+++ b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c
@@ -24,6 +24,7 @@
#include "rpc_server/dcerpc_server.h"
#include "librpc/gen_ndr/ndr_srvsvc.h"
#include "rpc_server/common/common.h"
+#include "system/time.h"
/*
srvsvc_NetCharDevEnum
@@ -807,7 +808,36 @@ static WERROR srvsvc_NETRSERVERTRANSPORTDEL(struct dcesrv_call_state *dce_call,
static WERROR srvsvc_NetRemoteTOD(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
struct srvsvc_NetRemoteTOD *r)
{
- DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
+ struct timeval tval;
+ time_t t;
+ struct tm tm;
+
+ r->out.info = talloc_p(mem_ctx, struct srvsvc_NetRemoteTODInfo);
+ WERR_TALLOC_CHECK(r->out.info);
+
+ GetTimeOfDay(&tval);
+ t = tval.tv_sec;
+
+ gmtime_r(&t, &tm);
+
+ r->out.info->elapsed = t;
+ /* fake the uptime: just return the milliseconds till 0:00:00 today */
+ r->out.info->msecs = (tm.tm_hour*60*60*1000)
+ + (tm.tm_min*60*1000)
+ + (tm.tm_sec*1000)
+ + (tval.tv_usec/1000);
+ r->out.info->hours = tm.tm_hour;
+ r->out.info->mins = tm.tm_min;
+ r->out.info->secs = tm.tm_sec;
+ r->out.info->hunds = tval.tv_usec/10000;
+ r->out.info->timezone = get_time_zone(t)/60;
+ r->out.info->tinterval = 310; /* just return the same as windows */
+ r->out.info->day = tm.tm_mday;
+ r->out.info->month = tm.tm_mon + 1;
+ r->out.info->year = tm.tm_year + 1900;
+ r->out.info->weekday = tm.tm_wday;
+
+ return WERR_OK;
}