svn commit: samba r4075 - in branches/SAMBA_4_0/source: libnet
librpc/idl rpc_server/srvsvc
metze at samba.org
metze at samba.org
Mon Dec 6 11:10:15 GMT 2004
Author: metze
Date: 2004-12-06 11:10:15 +0000 (Mon, 06 Dec 2004)
New Revision: 4075
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=4075
Log:
implement RemoteTOD server function
metze
Modified:
branches/SAMBA_4_0/source/libnet/libnet_time.c
branches/SAMBA_4_0/source/librpc/idl/srvsvc.idl
branches/SAMBA_4_0/source/rpc_server/srvsvc/dcesrv_srvsvc.c
Changeset:
Modified: branches/SAMBA_4_0/source/libnet/libnet_time.c
===================================================================
--- branches/SAMBA_4_0/source/libnet/libnet_time.c 2004-12-06 07:13:50 UTC (rev 4074)
+++ branches/SAMBA_4_0/source/libnet/libnet_time.c 2004-12-06 11:10:15 UTC (rev 4075)
@@ -82,7 +82,7 @@
tm.tm_isdst = -1;
r->srvsvc.out.time = timegm(&tm);
- r->srvsvc.out.time_zone = ((int32_t)tod.out.info->timezone) * 60;
+ r->srvsvc.out.time_zone = tod.out.info->timezone * 60;
goto disconnect;
Modified: branches/SAMBA_4_0/source/librpc/idl/srvsvc.idl
===================================================================
--- branches/SAMBA_4_0/source/librpc/idl/srvsvc.idl 2004-12-06 07:13:50 UTC (rev 4074)
+++ branches/SAMBA_4_0/source/librpc/idl/srvsvc.idl 2004-12-06 11:10:15 UTC (rev 4075)
@@ -1128,14 +1128,14 @@
/* srvsvc_NetRemoteTOD */
/**************************/
typedef struct {
- uint32 elapsed;
- uint32 msecs;
+ uint32 elapsed; /* time(NULL) */
+ uint32 msecs; /* milliseconds till system reboot (uptime) */
uint32 hours;
uint32 mins;
uint32 secs;
uint32 hunds;
- uint32 timezone;
- uint32 tinterval;
+ int32 timezone; /* in minutes */
+ uint32 tinterval; /* clock tick interval in 0.0001 second units; 310 on windows */
uint32 day;
uint32 month;
uint32 year;
Modified: branches/SAMBA_4_0/source/rpc_server/srvsvc/dcesrv_srvsvc.c
===================================================================
--- branches/SAMBA_4_0/source/rpc_server/srvsvc/dcesrv_srvsvc.c 2004-12-06 07:13:50 UTC (rev 4074)
+++ branches/SAMBA_4_0/source/rpc_server/srvsvc/dcesrv_srvsvc.c 2004-12-06 11:10:15 UTC (rev 4075)
@@ -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_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;
}
More information about the samba-cvs
mailing list