From 7eb820d31b39cda74b56c4c2dc66daa768f5216f Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 25 Aug 2004 12:14:06 +0000 Subject: r2066: add 'net time' command use it like: net time net time -U "" -N net time -U DOM\\user ... metze (This used to be commit ea14b2780f1cb6597ba4e71b83364e6a39e966fe) --- source4/utils/net/net_time.c | 85 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 source4/utils/net/net_time.c (limited to 'source4/utils/net/net_time.c') diff --git a/source4/utils/net/net_time.c b/source4/utils/net/net_time.c new file mode 100644 index 0000000000..c7d46d4d84 --- /dev/null +++ b/source4/utils/net/net_time.c @@ -0,0 +1,85 @@ +/* + Samba Unix/Linux SMB client library + Distributed SMB/CIFS Server Management Utility + + Copyright (C) 2004 Stefan Metzmacher (metze@samba.org) + + 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" + +/* + * Code for getting the remote time + */ + + +int net_time(struct net_context *ctx, int argc, const char **argv) +{ + NTSTATUS status; + struct libnet_context *libnetctx; + union libnet_RemoteTOD r; + const char *server_name; + struct tm *tm; + char timestr[64]; + + if (argc > 0 && argv[0]) { + server_name = argv[0]; + } else { + DEBUG(0,("net_time: server name needed!\n")); + return -1; + } + + libnetctx = libnet_context_init(); + if (!libnetctx) { + return -1; + } + libnetctx->user.account_name = ctx->user.account_name; + libnetctx->user.domain_name = ctx->user.domain_name; + libnetctx->user.password = ctx->user.password; + + /* prepare to get the time */ + r.generic.level = LIBNET_REMOTE_TOD_GENERIC; + r.generic.in.server_name = server_name; + + /* get the time */ + status = libnet_RemoteTOD(libnetctx, ctx->mem_ctx, &r); + if (!NT_STATUS_IS_OK(status)) { + DEBUG(0,("net_password_change: %s\n",r.generic.out.error_string)); + return -1; + } + + ZERO_ARRAY(timestr); + tm = localtime(&r.generic.out.time); + strftime(timestr, sizeof(timestr)-1, "%c %Z",tm); + + printf("%s\n",timestr); + + libnet_context_destroy(&libnetctx); + + return 0; +} + +int net_time_usage(struct net_context *ctx, int argc, const char **argv) +{ + d_printf("net_time_usage: TODO\n"); + return 0; +} + +int net_time_help(struct net_context *ctx, int argc, const char **argv) +{ + d_printf("net_time_help: TODO\n"); + return 0; +} -- cgit From e36341a85ee444ba04c9738926835fdf366a6b6e Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 25 Aug 2004 23:10:30 +0000 Subject: r2074: fixed a typo (This used to be commit dce43a535c9f6135c162711bc12cee266fc46c4a) --- source4/utils/net/net_time.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/utils/net/net_time.c') diff --git a/source4/utils/net/net_time.c b/source4/utils/net/net_time.c index c7d46d4d84..befb406e87 100644 --- a/source4/utils/net/net_time.c +++ b/source4/utils/net/net_time.c @@ -57,7 +57,7 @@ int net_time(struct net_context *ctx, int argc, const char **argv) /* get the time */ status = libnet_RemoteTOD(libnetctx, ctx->mem_ctx, &r); if (!NT_STATUS_IS_OK(status)) { - DEBUG(0,("net_password_change: %s\n",r.generic.out.error_string)); + DEBUG(0,("net_time: %s\n",r.generic.out.error_string)); return -1; } -- cgit From a6ae640313a47ac2950c0948e4385fa934a5ef09 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 28 Oct 2004 13:19:39 +0000 Subject: r3323: more warning reductions (This used to be commit 5921587ec26e4892efc678421277e4969417d7f5) --- source4/utils/net/net_time.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/utils/net/net_time.c') diff --git a/source4/utils/net/net_time.c b/source4/utils/net/net_time.c index befb406e87..2efe8faffe 100644 --- a/source4/utils/net/net_time.c +++ b/source4/utils/net/net_time.c @@ -63,7 +63,7 @@ int net_time(struct net_context *ctx, int argc, const char **argv) ZERO_ARRAY(timestr); tm = localtime(&r.generic.out.time); - strftime(timestr, sizeof(timestr)-1, "%c %Z",tm); + sys_strftime(timestr, sizeof(timestr)-1, "%c %Z",tm); printf("%s\n",timestr); -- cgit From ead3508ac81ff3ed2a48753f3b5e23537ba6ec73 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 2 Nov 2004 00:24:21 +0000 Subject: r3447: more include/system/XXX.h include files (This used to be commit 264ce9181089922547e8f6f67116f2d7277a5105) --- source4/utils/net/net_time.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/utils/net/net_time.c') diff --git a/source4/utils/net/net_time.c b/source4/utils/net/net_time.c index 2efe8faffe..e32ec76293 100644 --- a/source4/utils/net/net_time.c +++ b/source4/utils/net/net_time.c @@ -20,6 +20,7 @@ */ #include "includes.h" +#include "system/time.h" /* * Code for getting the remote time -- cgit From 6bd02aa5046b606171a680e6f8aefba31b744af1 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 2 Nov 2004 11:42:35 +0000 Subject: r3478: split out some more pieces of includes.h (This used to be commit 8e9212ecfc61c509f686363d8ec412ce54bc1c8d) --- source4/utils/net/net_time.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source4/utils/net/net_time.c') diff --git a/source4/utils/net/net_time.c b/source4/utils/net/net_time.c index e32ec76293..7668a42b8c 100644 --- a/source4/utils/net/net_time.c +++ b/source4/utils/net/net_time.c @@ -20,6 +20,8 @@ */ #include "includes.h" +#include "libnet/libnet.h" +#include "utils/net/net.h" #include "system/time.h" /* -- cgit From 481bba9e7f6ebfef11c7c7d778a1b465886abfa9 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 6 Nov 2004 12:14:14 +0000 Subject: r3579: with the gcc warning flag from abartlet we don't need sys_strftime() (This used to be commit 041f77b6a19c98599fe18d2eb4e86db00b40014e) --- source4/utils/net/net_time.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/utils/net/net_time.c') diff --git a/source4/utils/net/net_time.c b/source4/utils/net/net_time.c index 7668a42b8c..d2df76bc5d 100644 --- a/source4/utils/net/net_time.c +++ b/source4/utils/net/net_time.c @@ -66,7 +66,7 @@ int net_time(struct net_context *ctx, int argc, const char **argv) ZERO_ARRAY(timestr); tm = localtime(&r.generic.out.time); - sys_strftime(timestr, sizeof(timestr)-1, "%c %Z",tm); + strftime(timestr, sizeof(timestr)-1, "%c %Z",tm); printf("%s\n",timestr); -- cgit From 75ddf59ea110117578acd3a7b889549bfb40473c Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 10 Feb 2005 07:39:14 +0000 Subject: r5308: trimmed back a lot of the old macros from smb_macros.h (This used to be commit bf43c9bdcf9e654d123f6a2b29feb9189ca9e561) --- source4/utils/net/net_time.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/utils/net/net_time.c') diff --git a/source4/utils/net/net_time.c b/source4/utils/net/net_time.c index d2df76bc5d..ec3bc0519f 100644 --- a/source4/utils/net/net_time.c +++ b/source4/utils/net/net_time.c @@ -64,7 +64,7 @@ int net_time(struct net_context *ctx, int argc, const char **argv) return -1; } - ZERO_ARRAY(timestr); + ZERO_STRUCT(timestr); tm = localtime(&r.generic.out.time); strftime(timestr, sizeof(timestr)-1, "%c %Z",tm); -- cgit From 530d46f6748a17ca8500a861f53c0d4f451b2005 Mon Sep 17 00:00:00 2001 From: Rafal Szczesniak Date: Tue, 15 Feb 2005 01:11:20 +0000 Subject: r5400: Slightly better handling of help messages in net tool. rafal (This used to be commit 5cebb4feedf7d6542c497fe55763d66f51b1c989) --- source4/utils/net/net_time.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'source4/utils/net/net_time.c') diff --git a/source4/utils/net/net_time.c b/source4/utils/net/net_time.c index ec3bc0519f..ce7db4ab5c 100644 --- a/source4/utils/net/net_time.c +++ b/source4/utils/net/net_time.c @@ -28,7 +28,6 @@ * Code for getting the remote time */ - int net_time(struct net_context *ctx, int argc, const char **argv) { NTSTATUS status; @@ -41,8 +40,7 @@ int net_time(struct net_context *ctx, int argc, const char **argv) if (argc > 0 && argv[0]) { server_name = argv[0]; } else { - DEBUG(0,("net_time: server name needed!\n")); - return -1; + return net_time_usage(ctx, argc, argv); } libnetctx = libnet_context_init(); @@ -77,12 +75,12 @@ int net_time(struct net_context *ctx, int argc, const char **argv) int net_time_usage(struct net_context *ctx, int argc, const char **argv) { - d_printf("net_time_usage: TODO\n"); + d_printf("net time [options]\n"); return 0; } int net_time_help(struct net_context *ctx, int argc, const char **argv) { - d_printf("net_time_help: TODO\n"); + d_printf("Displays remote server's time.\n"); return 0; } -- cgit From 308c7d26c1f9f91ff6667430a8a1a7b4cf4a3a7e Mon Sep 17 00:00:00 2001 From: Rafal Szczesniak Date: Wed, 16 Feb 2005 21:54:01 +0000 Subject: r5425: Convert function tables to new structure (with description) and remove unnecessary help functions as help is generated automatically. Usage functions with precise information about usage of each leaf node remain. rafal (This used to be commit eb66180d14a14cafbfc0df2b39eeaf4ad7bb43a9) --- source4/utils/net/net_time.c | 6 ------ 1 file changed, 6 deletions(-) (limited to 'source4/utils/net/net_time.c') diff --git a/source4/utils/net/net_time.c b/source4/utils/net/net_time.c index ce7db4ab5c..5f318ac4ea 100644 --- a/source4/utils/net/net_time.c +++ b/source4/utils/net/net_time.c @@ -78,9 +78,3 @@ int net_time_usage(struct net_context *ctx, int argc, const char **argv) d_printf("net time [options]\n"); return 0; } - -int net_time_help(struct net_context *ctx, int argc, const char **argv) -{ - d_printf("Displays remote server's time.\n"); - return 0; -} -- cgit From 02075be0bbc2095073f8898350fded64a7c97c79 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 21 Mar 2005 02:08:38 +0000 Subject: r5917: First step in using the new cli_credentials structure. This patch puts support for it into popt_common, adds a few utility functions (in lib/credentials.c) and the callback functions for the command-line (lib/cmdline/credentials.c). Comments are welcome :-) (This used to be commit 1d49b57c50fe8c2683ea23e9df41ce8ad774db98) --- source4/utils/net/net_time.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source4/utils/net/net_time.c') diff --git a/source4/utils/net/net_time.c b/source4/utils/net/net_time.c index 5f318ac4ea..df3b52a4ab 100644 --- a/source4/utils/net/net_time.c +++ b/source4/utils/net/net_time.c @@ -47,9 +47,9 @@ int net_time(struct net_context *ctx, int argc, const char **argv) if (!libnetctx) { return -1; } - libnetctx->user.account_name = ctx->user.account_name; - libnetctx->user.domain_name = ctx->user.domain_name; - libnetctx->user.password = ctx->user.password; + libnetctx->user.account_name= cli_credentials_get_username(ctx->credentials); + libnetctx->user.domain_name = cli_credentials_get_domain(ctx->credentials); + libnetctx->user.password = cli_credentials_get_password(ctx->credentials); /* prepare to get the time */ r.generic.level = LIBNET_REMOTE_TOD_GENERIC; -- cgit From 34cde065139fdc76f6aa529426cfc1f68a394d54 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 21 Mar 2005 18:42:32 +0000 Subject: r5924: Use cli_credentials in libnet/. (This used to be commit e5bc6f4f1716568ae7022d61b5b35ee047b58414) --- source4/utils/net/net_time.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'source4/utils/net/net_time.c') diff --git a/source4/utils/net/net_time.c b/source4/utils/net/net_time.c index df3b52a4ab..a89f80417c 100644 --- a/source4/utils/net/net_time.c +++ b/source4/utils/net/net_time.c @@ -47,9 +47,7 @@ int net_time(struct net_context *ctx, int argc, const char **argv) if (!libnetctx) { return -1; } - libnetctx->user.account_name= cli_credentials_get_username(ctx->credentials); - libnetctx->user.domain_name = cli_credentials_get_domain(ctx->credentials); - libnetctx->user.password = cli_credentials_get_password(ctx->credentials); + libnetctx->credentials = ctx->credentials; /* prepare to get the time */ r.generic.level = LIBNET_REMOTE_TOD_GENERIC; -- cgit From 0a40093ef39a46b9df82d6d0486b70b354d9dde5 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 3 Jun 2005 21:30:07 +0000 Subject: r7249: Cope with struct member rename (This used to be commit e7549f33f5fb06d8b2a8f31745545cc7b9c8d4f9) --- source4/utils/net/net_time.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/utils/net/net_time.c') diff --git a/source4/utils/net/net_time.c b/source4/utils/net/net_time.c index a89f80417c..507cfd5f6d 100644 --- a/source4/utils/net/net_time.c +++ b/source4/utils/net/net_time.c @@ -47,7 +47,7 @@ int net_time(struct net_context *ctx, int argc, const char **argv) if (!libnetctx) { return -1; } - libnetctx->credentials = ctx->credentials; + libnetctx->cred = ctx->credentials; /* prepare to get the time */ r.generic.level = LIBNET_REMOTE_TOD_GENERIC; -- cgit From af237084ecd4f9928c6c282b9c5c73598d5c73d6 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 16 Jun 2005 11:36:09 +0000 Subject: r7633: this patch started as an attempt to make the dcerpc code use a given event_context for the socket_connect() call, so that when things that use dcerpc are running alongside anything else it doesn't block the whole process during a connect. Then of course I needed to change any code that created a dcerpc connection (such as the auth code) to also take an event context, and anything that called that and so on .... thus the size of the patch. There were 3 places where I punted: - abartlet wanted me to add a gensec_set_event_context() call instead of adding it to the gensec init calls. Andrew, my apologies for not doing this. I didn't do it as adding a new parameter allowed me to catch all the callers with the compiler. Now that its done, we could go back and use gensec_set_event_context() - the ejs code calls auth initialisation, which means it should pass in the event context from the web server. I punted on that. Needs fixing. - I used a NULL event context in dcom_get_pipe(). This is equivalent to what we did already, but should be fixed to use a callers event context. Jelmer, can you think of a clean way to do that? I also cleaned up a couple of things: - libnet_context_destroy() makes no sense. I removed it. - removed some unused vars in various places (This used to be commit 3a3025485bdb8f600ab528c0b4b4eef0c65e3fc9) --- source4/utils/net/net_time.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/utils/net/net_time.c') diff --git a/source4/utils/net/net_time.c b/source4/utils/net/net_time.c index 507cfd5f6d..8bdef1f762 100644 --- a/source4/utils/net/net_time.c +++ b/source4/utils/net/net_time.c @@ -43,7 +43,7 @@ int net_time(struct net_context *ctx, int argc, const char **argv) return net_time_usage(ctx, argc, argv); } - libnetctx = libnet_context_init(); + libnetctx = libnet_context_init(NULL); if (!libnetctx) { return -1; } @@ -66,7 +66,7 @@ int net_time(struct net_context *ctx, int argc, const char **argv) printf("%s\n",timestr); - libnet_context_destroy(&libnetctx); + talloc_free(libnetctx); return 0; } -- cgit From 0479a2f1cbae51fcd8dbdc3c148c808421fb4d25 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 10 Jul 2007 02:07:03 +0000 Subject: r23792: convert Samba4 to GPLv3 There are still a few tidyups of old FSF addresses to come (in both s3 and s4). More commits soon. (This used to be commit fcf38a38ac691abd0fa51b89dc951a08e89fdafa) --- source4/utils/net/net_time.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'source4/utils/net/net_time.c') diff --git a/source4/utils/net/net_time.c b/source4/utils/net/net_time.c index 8bdef1f762..e14b6e5759 100644 --- a/source4/utils/net/net_time.c +++ b/source4/utils/net/net_time.c @@ -6,7 +6,7 @@ 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 + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -15,8 +15,7 @@ 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. + along with this program. If not, see . */ #include "includes.h" -- cgit From 4c4323009fa83f00ed319de59a3aad48fcd65994 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 7 Dec 2007 02:37:04 +0100 Subject: r26327: Explicit loadparm_context for RPC client functions. (This used to be commit eeb2251d22b3d6e0379444a73af69d1014692b07) --- source4/utils/net/net_time.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/utils/net/net_time.c') diff --git a/source4/utils/net/net_time.c b/source4/utils/net/net_time.c index e14b6e5759..1f4bb3ed71 100644 --- a/source4/utils/net/net_time.c +++ b/source4/utils/net/net_time.c @@ -42,7 +42,7 @@ int net_time(struct net_context *ctx, int argc, const char **argv) return net_time_usage(ctx, argc, argv); } - libnetctx = libnet_context_init(NULL); + libnetctx = libnet_context_init(NULL, ctx->lp_ctx); if (!libnetctx) { return -1; } -- cgit From 4f51b0246db3242ee02ee16905cba13a5dc5633a Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Mon, 14 Apr 2008 12:43:37 -0400 Subject: Fix problems with event context not being the parent. (This used to be commit 957c4d893acf9e6db06a3fc3a4687ab6bb238635) --- source4/utils/net/net_time.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'source4/utils/net/net_time.c') diff --git a/source4/utils/net/net_time.c b/source4/utils/net/net_time.c index 1f4bb3ed71..12a8132cea 100644 --- a/source4/utils/net/net_time.c +++ b/source4/utils/net/net_time.c @@ -22,6 +22,7 @@ #include "libnet/libnet.h" #include "utils/net/net.h" #include "system/time.h" +#include "lib/events/events.h" /* * Code for getting the remote time @@ -42,7 +43,7 @@ int net_time(struct net_context *ctx, int argc, const char **argv) return net_time_usage(ctx, argc, argv); } - libnetctx = libnet_context_init(NULL, ctx->lp_ctx); + libnetctx = libnet_context_init(event_context_find(ctx), ctx->lp_ctx); if (!libnetctx) { return -1; } @@ -53,7 +54,7 @@ int net_time(struct net_context *ctx, int argc, const char **argv) r.generic.in.server_name = server_name; /* get the time */ - status = libnet_RemoteTOD(libnetctx, ctx->mem_ctx, &r); + status = libnet_RemoteTOD(libnetctx, ctx, &r); if (!NT_STATUS_IS_OK(status)) { DEBUG(0,("net_time: %s\n",r.generic.out.error_string)); return -1; -- cgit From a5d52174bd993b32d01d26a795a56df4a92eba45 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 16 Apr 2008 22:30:15 +0200 Subject: Avoid event_find_context() when the event context is already available in the net utility. (This used to be commit d40804777edf41889bd461f63f7a07cc1cc60e27) --- source4/utils/net/net_time.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/utils/net/net_time.c') diff --git a/source4/utils/net/net_time.c b/source4/utils/net/net_time.c index 12a8132cea..92e6e77481 100644 --- a/source4/utils/net/net_time.c +++ b/source4/utils/net/net_time.c @@ -43,7 +43,7 @@ int net_time(struct net_context *ctx, int argc, const char **argv) return net_time_usage(ctx, argc, argv); } - libnetctx = libnet_context_init(event_context_find(ctx), ctx->lp_ctx); + libnetctx = libnet_context_init(ctx->event_ctx, ctx->lp_ctx); if (!libnetctx) { return -1; } -- cgit