diff options
Diffstat (limited to 'source4')
-rw-r--r-- | source4/libnet/libnet_time.c | 16 | ||||
-rw-r--r-- | source4/librpc/idl/srvsvc.idl | 2 | ||||
-rw-r--r-- | source4/rpc_server/srvsvc/dcesrv_srvsvc.c | 37 | ||||
-rw-r--r-- | source4/torture/rpc/srvsvc.c | 3 |
4 files changed, 32 insertions, 26 deletions
diff --git a/source4/libnet/libnet_time.c b/source4/libnet/libnet_time.c index e1e53fb947..61a451d3fd 100644 --- a/source4/libnet/libnet_time.c +++ b/source4/libnet/libnet_time.c @@ -30,6 +30,7 @@ static NTSTATUS libnet_RemoteTOD_srvsvc(struct libnet_context *ctx, TALLOC_CTX * NTSTATUS status; struct libnet_RpcConnect c; struct srvsvc_NetRemoteTOD tod; + struct srvsvc_NetRemoteTODInfo *info = NULL; struct tm tm; /* prepare connect to the SRVSVC pipe of a timeserver */ @@ -48,6 +49,7 @@ static NTSTATUS libnet_RemoteTOD_srvsvc(struct libnet_context *ctx, TALLOC_CTX * /* prepare srvsvc_NetrRemoteTOD */ tod.in.server_unc = talloc_asprintf(mem_ctx, "\\%s", c.in.name); + tod.out.info = &info; /* 2. try srvsvc_NetRemoteTOD */ status = dcerpc_srvsvc_NetRemoteTOD(c.out.dcerpc_pipe, mem_ctx, &tod); @@ -68,18 +70,18 @@ static NTSTATUS libnet_RemoteTOD_srvsvc(struct libnet_context *ctx, TALLOC_CTX * } /* need to set the out parameters */ - tm.tm_sec = (int)tod.out.info->secs; - tm.tm_min = (int)tod.out.info->mins; - tm.tm_hour = (int)tod.out.info->hours; - tm.tm_mday = (int)tod.out.info->day; - tm.tm_mon = (int)tod.out.info->month -1; - tm.tm_year = (int)tod.out.info->year - 1900; + tm.tm_sec = (int)info->secs; + tm.tm_min = (int)info->mins; + tm.tm_hour = (int)info->hours; + tm.tm_mday = (int)info->day; + tm.tm_mon = (int)info->month -1; + tm.tm_year = (int)info->year - 1900; tm.tm_wday = -1; tm.tm_yday = -1; tm.tm_isdst = -1; r->srvsvc.out.time = timegm(&tm); - r->srvsvc.out.time_zone = tod.out.info->timezone * 60; + r->srvsvc.out.time_zone = info->timezone * 60; goto disconnect; diff --git a/source4/librpc/idl/srvsvc.idl b/source4/librpc/idl/srvsvc.idl index 2afc6f9ec6..22e2a23073 100644 --- a/source4/librpc/idl/srvsvc.idl +++ b/source4/librpc/idl/srvsvc.idl @@ -1326,7 +1326,7 @@ import "security.idl", "svcctl.idl"; /* Function: 0x1c */ WERROR srvsvc_NetRemoteTOD( [in,unique] [string,charset(UTF16)] uint16 *server_unc, - [out,unique] srvsvc_NetRemoteTODInfo *info + [out,ref] srvsvc_NetRemoteTODInfo **info ); /**************************/ diff --git a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c index 90fba297e3..8a5f6708c3 100644 --- a/source4/rpc_server/srvsvc/dcesrv_srvsvc.c +++ b/source4/rpc_server/srvsvc/dcesrv_srvsvc.c @@ -1688,31 +1688,34 @@ static WERROR dcesrv_srvsvc_NetRemoteTOD(struct dcesrv_call_state *dce_call, TAL struct timeval tval; time_t t; struct tm tm; + struct srvsvc_NetRemoteTODInfo *info; - r->out.info = talloc(mem_ctx, struct srvsvc_NetRemoteTODInfo); - W_ERROR_HAVE_NO_MEMORY(r->out.info); + info = talloc(mem_ctx, struct srvsvc_NetRemoteTODInfo); + W_ERROR_HAVE_NO_MEMORY(info); GetTimeOfDay(&tval); t = tval.tv_sec; gmtime_r(&t, &tm); - r->out.info->elapsed = t; + info->elapsed = t; /* TODO: 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; + info->msecs = (tm.tm_hour*60*60*1000) + + (tm.tm_min*60*1000) + + (tm.tm_sec*1000) + + (tval.tv_usec/1000); + info->hours = tm.tm_hour; + info->mins = tm.tm_min; + info->secs = tm.tm_sec; + info->hunds = tval.tv_usec/10000; + info->timezone = get_time_zone(t)/60; + info->tinterval = 310; /* just return the same as windows */ + info->day = tm.tm_mday; + info->month = tm.tm_mon + 1; + info->year = tm.tm_year + 1900; + info->weekday = tm.tm_wday; + + *r->out.info = info; return WERR_OK; } diff --git a/source4/torture/rpc/srvsvc.c b/source4/torture/rpc/srvsvc.c index 9b475ab826..4ddab75883 100644 --- a/source4/torture/rpc/srvsvc.c +++ b/source4/torture/rpc/srvsvc.c @@ -851,10 +851,11 @@ static bool test_NetRemoteTOD(struct torture_context *tctx, { NTSTATUS status; struct srvsvc_NetRemoteTOD r; + struct srvsvc_NetRemoteTODInfo *info = NULL; r.in.server_unc = talloc_asprintf(tctx,"\\\\%s",dcerpc_server_name(p)); + r.out.info = &info; - ZERO_STRUCT(r.out); torture_comment(tctx, "testing NetRemoteTOD\n"); status = dcerpc_srvsvc_NetRemoteTOD(p, tctx, &r); torture_assert_ntstatus_ok(tctx, status, "NetRemoteTOD failed"); |