From da979c9e7eb0c03ac718eb2c6c50937e52c39292 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 4 Feb 2006 21:44:57 +0000 Subject: r13350: Implement rpccli_samr_set_domain_info. Weird that it was not around :-) Implement 'net rpc shell account' -- An editor for account policies nt_time_to_unix_abs changed its argument which to me seems wrong, and I could not find a caller that depends on this. So I changed it. Applied some more const in time.c. Volker (This used to be commit fc73690a7000d5a3f0f5ad34461c1f3a87edeac5) --- source3/utils/net_rpc_sh_acct.c | 411 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 411 insertions(+) create mode 100644 source3/utils/net_rpc_sh_acct.c (limited to 'source3/utils/net_rpc_sh_acct.c') diff --git a/source3/utils/net_rpc_sh_acct.c b/source3/utils/net_rpc_sh_acct.c new file mode 100644 index 0000000000..91ec6f1335 --- /dev/null +++ b/source3/utils/net_rpc_sh_acct.c @@ -0,0 +1,411 @@ +/* + Samba Unix/Linux SMB client library + Distributed SMB/CIFS Server Management Utility + Copyright (C) 2005 Volker Lendecke (vl@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" +#include "utils/net.h" + +/* + * Do something with the account policies. Read them all, run a function on + * them and possibly write them back. "fn" has to return the container index + * it has modified, it can return 0 for no change. + */ + +static NTSTATUS rpc_sh_acct_do(TALLOC_CTX *mem_ctx, + struct rpc_sh_ctx *ctx, + struct rpc_pipe_client *pipe_hnd, + int argc, const char **argv, + BOOL (*fn)(TALLOC_CTX *mem_ctx, + struct rpc_sh_ctx *ctx, + SAM_UNK_INFO_1 *i1, + SAM_UNK_INFO_3 *i3, + SAM_UNK_INFO_12 *i12, + int argc, const char **argv)) +{ + POLICY_HND connect_pol, domain_pol; + NTSTATUS result = NT_STATUS_UNSUCCESSFUL; + SAM_UNK_CTR ctr1, ctr3, ctr12; + int store; + + ZERO_STRUCT(connect_pol); + ZERO_STRUCT(domain_pol); + + /* Get sam policy handle */ + + result = rpccli_samr_connect(pipe_hnd, mem_ctx, + MAXIMUM_ALLOWED_ACCESS, + &connect_pol); + if (!NT_STATUS_IS_OK(result)) { + goto done; + } + + /* Get domain policy handle */ + + result = rpccli_samr_open_domain(pipe_hnd, mem_ctx, &connect_pol, + MAXIMUM_ALLOWED_ACCESS, + ctx->domain_sid, &domain_pol); + if (!NT_STATUS_IS_OK(result)) { + goto done; + } + + result = rpccli_samr_query_dom_info(pipe_hnd, mem_ctx, &domain_pol, + 1, &ctr1); + + if (!NT_STATUS_IS_OK(result)) { + d_fprintf(stderr, "query_domain_info level 1 failed: %s\n", + nt_errstr(result)); + goto done; + } + + result = rpccli_samr_query_dom_info(pipe_hnd, mem_ctx, &domain_pol, + 3, &ctr3); + + if (!NT_STATUS_IS_OK(result)) { + d_fprintf(stderr, "query_domain_info level 3 failed: %s\n", + nt_errstr(result)); + goto done; + } + + result = rpccli_samr_query_dom_info(pipe_hnd, mem_ctx, &domain_pol, + 12, &ctr12); + + if (!NT_STATUS_IS_OK(result)) { + d_fprintf(stderr, "query_domain_info level 12 failed: %s\n", + nt_errstr(result)); + goto done; + } + + store = fn(mem_ctx, ctx, &ctr1.info.inf1, &ctr3.info.inf3, + &ctr12.info.inf12, argc, argv); + + if (store <= 0) { + /* Don't save anything */ + goto done; + } + + switch (store) { + case 1: + result = rpccli_samr_set_domain_info(pipe_hnd, mem_ctx, + &domain_pol, 1, &ctr1); + break; + case 3: + result = rpccli_samr_set_domain_info(pipe_hnd, mem_ctx, + &domain_pol, 3, &ctr3); + break; + case 12: + result = rpccli_samr_set_domain_info(pipe_hnd, mem_ctx, + &domain_pol, 12, &ctr12); + break; + default: + d_fprintf(stderr, "Got unexpected info level %d\n", store); + result = NT_STATUS_INTERNAL_ERROR; + goto done; + } + + done: + if (is_valid_policy_hnd(&domain_pol)) { + rpccli_samr_close(pipe_hnd, mem_ctx, &domain_pol); + } + if (is_valid_policy_hnd(&connect_pol)) { + rpccli_samr_close(pipe_hnd, mem_ctx, &connect_pol); + } + + return result; +} + +static int account_show(TALLOC_CTX *mem_ctx, struct rpc_sh_ctx *ctx, + SAM_UNK_INFO_1 *i1, SAM_UNK_INFO_3 *i3, + SAM_UNK_INFO_12 *i12, + int argc, const char **argv) +{ + if (argc != 0) { + d_fprintf(stderr, "usage: %s\n", ctx->whoami); + return -1; + } + + d_printf("Minimum password length: %d\n", i1->min_length_password); + d_printf("Password history length: %d\n", i1->password_history); + + d_printf("Minimum password age: "); + if (!nt_time_is_zero(&i1->min_passwordage)) { + time_t t = nt_time_to_unix_abs(&i1->min_passwordage); + d_printf("%d seconds\n", (int)t); + } else { + d_printf("not set\n"); + } + + d_printf("Maximum password age: "); + if (nt_time_is_set(&i1->expire)) { + time_t t = nt_time_to_unix_abs(&i1->expire); + d_printf("%d seconds\n", (int)t); + } else { + d_printf("not set\n"); + } + + d_printf("Bad logon attempts: %d\n", i12->bad_attempt_lockout); + + if (i12->bad_attempt_lockout != 0) { + + d_printf("Account lockout duration: "); + if (nt_time_is_set(&i12->duration)) { + time_t t = nt_time_to_unix_abs(&i12->duration); + d_printf("%d seconds\n", (int)t); + } else { + d_printf("not set\n"); + } + + d_printf("Bad password count reset after: "); + if (nt_time_is_set(&i12->reset_count)) { + time_t t = nt_time_to_unix_abs(&i12->reset_count); + d_printf("%d seconds\n", (int)t); + } else { + d_printf("not set\n"); + } + } + + d_printf("Disconnect users when logon hours expire: %s\n", + nt_time_is_zero(&i3->logout) ? "yes" : "no"); + + d_printf("User must logon to change password: %s\n", + (i1->password_properties & 0x2) ? "yes" : "no"); + + return 0; /* Don't save */ +} + +static NTSTATUS rpc_sh_acct_pol_show(TALLOC_CTX *mem_ctx, + struct rpc_sh_ctx *ctx, + struct rpc_pipe_client *pipe_hnd, + int argc, const char **argv) { + return rpc_sh_acct_do(mem_ctx, ctx, pipe_hnd, argc, argv, + account_show); +} + +static int account_set_badpw(TALLOC_CTX *mem_ctx, struct rpc_sh_ctx *ctx, + SAM_UNK_INFO_1 *i1, SAM_UNK_INFO_3 *i3, + SAM_UNK_INFO_12 *i12, + int argc, const char **argv) +{ + if (argc != 1) { + d_fprintf(stderr, "usage: %s \n", ctx->whoami); + return -1; + } + + i12->bad_attempt_lockout = atoi(argv[0]); + d_printf("Setting bad password count to %d\n", + i12->bad_attempt_lockout); + + return 12; +} + +static NTSTATUS rpc_sh_acct_set_badpw(TALLOC_CTX *mem_ctx, + struct rpc_sh_ctx *ctx, + struct rpc_pipe_client *pipe_hnd, + int argc, const char **argv) +{ + return rpc_sh_acct_do(mem_ctx, ctx, pipe_hnd, argc, argv, + account_set_badpw); +} + +static int account_set_lockduration(TALLOC_CTX *mem_ctx, + struct rpc_sh_ctx *ctx, + SAM_UNK_INFO_1 *i1, SAM_UNK_INFO_3 *i3, + SAM_UNK_INFO_12 *i12, + int argc, const char **argv) +{ + if (argc != 1) { + d_fprintf(stderr, "usage: %s \n", ctx->whoami); + return -1; + } + + unix_to_nt_time_abs(&i12->duration, atoi(argv[0])); + d_printf("Setting lockout duration to %d seconds\n", + (int)nt_time_to_unix_abs(&i12->duration)); + + return 12; +} + +static NTSTATUS rpc_sh_acct_set_lockduration(TALLOC_CTX *mem_ctx, + struct rpc_sh_ctx *ctx, + struct rpc_pipe_client *pipe_hnd, + int argc, const char **argv) +{ + return rpc_sh_acct_do(mem_ctx, ctx, pipe_hnd, argc, argv, + account_set_lockduration); +} + +static int account_set_resetduration(TALLOC_CTX *mem_ctx, + struct rpc_sh_ctx *ctx, + SAM_UNK_INFO_1 *i1, SAM_UNK_INFO_3 *i3, + SAM_UNK_INFO_12 *i12, + int argc, const char **argv) +{ + if (argc != 1) { + d_fprintf(stderr, "usage: %s \n", ctx->whoami); + return -1; + } + + unix_to_nt_time_abs(&i12->reset_count, atoi(argv[0])); + d_printf("Setting bad password reset duration to %d seconds\n", + (int)nt_time_to_unix_abs(&i12->reset_count)); + + return 12; +} + +static NTSTATUS rpc_sh_acct_set_resetduration(TALLOC_CTX *mem_ctx, + struct rpc_sh_ctx *ctx, + struct rpc_pipe_client *pipe_hnd, + int argc, const char **argv) +{ + return rpc_sh_acct_do(mem_ctx, ctx, pipe_hnd, argc, argv, + account_set_resetduration); +} + +static int account_set_minpwage(TALLOC_CTX *mem_ctx, + struct rpc_sh_ctx *ctx, + SAM_UNK_INFO_1 *i1, SAM_UNK_INFO_3 *i3, + SAM_UNK_INFO_12 *i12, + int argc, const char **argv) +{ + if (argc != 1) { + d_fprintf(stderr, "usage: %s \n", ctx->whoami); + return -1; + } + + unix_to_nt_time_abs(&i1->min_passwordage, atoi(argv[0])); + d_printf("Setting minimum password age to %d seconds\n", + (int)nt_time_to_unix_abs(&i1->min_passwordage)); + + return 1; +} + +static NTSTATUS rpc_sh_acct_set_minpwage(TALLOC_CTX *mem_ctx, + struct rpc_sh_ctx *ctx, + struct rpc_pipe_client *pipe_hnd, + int argc, const char **argv) +{ + return rpc_sh_acct_do(mem_ctx, ctx, pipe_hnd, argc, argv, + account_set_minpwage); +} + +static int account_set_maxpwage(TALLOC_CTX *mem_ctx, + struct rpc_sh_ctx *ctx, + SAM_UNK_INFO_1 *i1, SAM_UNK_INFO_3 *i3, + SAM_UNK_INFO_12 *i12, + int argc, const char **argv) +{ + if (argc != 1) { + d_fprintf(stderr, "usage: %s \n", ctx->whoami); + return -1; + } + + unix_to_nt_time_abs(&i1->expire, atoi(argv[0])); + d_printf("Setting maximum password age to %d seconds\n", + (int)nt_time_to_unix_abs(&i1->expire)); + + return 1; +} + +static NTSTATUS rpc_sh_acct_set_maxpwage(TALLOC_CTX *mem_ctx, + struct rpc_sh_ctx *ctx, + struct rpc_pipe_client *pipe_hnd, + int argc, const char **argv) +{ + return rpc_sh_acct_do(mem_ctx, ctx, pipe_hnd, argc, argv, + account_set_maxpwage); +} + +static int account_set_minpwlen(TALLOC_CTX *mem_ctx, + struct rpc_sh_ctx *ctx, + SAM_UNK_INFO_1 *i1, SAM_UNK_INFO_3 *i3, + SAM_UNK_INFO_12 *i12, + int argc, const char **argv) +{ + if (argc != 1) { + d_fprintf(stderr, "usage: %s \n", ctx->whoami); + return -1; + } + + i1->min_length_password = atoi(argv[0]); + d_printf("Setting minimum password length to %d\n", + i1->min_length_password); + + return 1; +} + +static NTSTATUS rpc_sh_acct_set_minpwlen(TALLOC_CTX *mem_ctx, + struct rpc_sh_ctx *ctx, + struct rpc_pipe_client *pipe_hnd, + int argc, const char **argv) +{ + return rpc_sh_acct_do(mem_ctx, ctx, pipe_hnd, argc, argv, + account_set_minpwlen); +} + +static int account_set_pwhistlen(TALLOC_CTX *mem_ctx, + struct rpc_sh_ctx *ctx, + SAM_UNK_INFO_1 *i1, SAM_UNK_INFO_3 *i3, + SAM_UNK_INFO_12 *i12, + int argc, const char **argv) +{ + if (argc != 1) { + d_fprintf(stderr, "usage: %s \n", ctx->whoami); + return -1; + } + + i1->password_history = atoi(argv[0]); + d_printf("Setting password history length to %d\n", + i1->password_history); + + return 1; +} + +static NTSTATUS rpc_sh_acct_set_pwhistlen(TALLOC_CTX *mem_ctx, + struct rpc_sh_ctx *ctx, + struct rpc_pipe_client *pipe_hnd, + int argc, const char **argv) +{ + return rpc_sh_acct_do(mem_ctx, ctx, pipe_hnd, argc, argv, + account_set_pwhistlen); +} + +struct rpc_sh_cmd *net_rpc_acct_cmds(TALLOC_CTX *mem_ctx, + struct rpc_sh_ctx *ctx) +{ + static struct rpc_sh_cmd cmds[9] = { + { "show", NULL, PI_SAMR, rpc_sh_acct_pol_show, + "Show current account policy settings" }, + { "badpw", NULL, PI_SAMR, rpc_sh_acct_set_badpw, + "Set bad password count before lockout" }, + { "lockduration", NULL, PI_SAMR, rpc_sh_acct_set_lockduration, + "Set account lockout duration" }, + { "resetduration", NULL, PI_SAMR, + rpc_sh_acct_set_resetduration, + "Set bad password count reset duration" }, + { "minpwage", NULL, PI_SAMR, rpc_sh_acct_set_minpwage, + "Set minimum password age" }, + { "maxpwage", NULL, PI_SAMR, rpc_sh_acct_set_maxpwage, + "Set maximum password age" }, + { "minpwlen", NULL, PI_SAMR, rpc_sh_acct_set_minpwlen, + "Set minimum password length" }, + { "pwhistlen", NULL, PI_SAMR, rpc_sh_acct_set_pwhistlen, + "Set the password history length" }, + { NULL, NULL, 0, NULL, NULL } + }; + + return cmds; +} -- cgit From aa2e8f6b2ce4b9586a6aea1305bc03166cb9b565 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 4 Feb 2006 22:01:30 +0000 Subject: r13351: Fix copyright (This used to be commit 70114f509c821a4bc932ff76d9fc19a7d4ad1e84) --- source3/utils/net_rpc_sh_acct.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/utils/net_rpc_sh_acct.c') diff --git a/source3/utils/net_rpc_sh_acct.c b/source3/utils/net_rpc_sh_acct.c index 91ec6f1335..5d0ce73664 100644 --- a/source3/utils/net_rpc_sh_acct.c +++ b/source3/utils/net_rpc_sh_acct.c @@ -1,7 +1,7 @@ /* Samba Unix/Linux SMB client library Distributed SMB/CIFS Server Management Utility - Copyright (C) 2005 Volker Lendecke (vl@samba.org) + Copyright (C) 2006 Volker Lendecke (vl@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 -- cgit From d824b98f80ba186030cbb70b3a1e5daf80469ecd Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 9 Jul 2007 19:25:36 +0000 Subject: r23779: Change from v2 or later to v3 or later. Jeremy. (This used to be commit 407e6e695b8366369b7c76af1ff76869b45347b3) --- source3/utils/net_rpc_sh_acct.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/utils/net_rpc_sh_acct.c') diff --git a/source3/utils/net_rpc_sh_acct.c b/source3/utils/net_rpc_sh_acct.c index 5d0ce73664..4f9a03890e 100644 --- a/source3/utils/net_rpc_sh_acct.c +++ b/source3/utils/net_rpc_sh_acct.c @@ -5,7 +5,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, -- cgit From 5e54558c6dea67b56bbfaba5698f3a434d3dffb6 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 10 Jul 2007 00:52:41 +0000 Subject: r23784: use the GPLv3 boilerplate as recommended by the FSF and the license text (This used to be commit b0132e94fc5fef936aa766fb99a306b3628e9f07) --- source3/utils/net_rpc_sh_acct.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source3/utils/net_rpc_sh_acct.c') diff --git a/source3/utils/net_rpc_sh_acct.c b/source3/utils/net_rpc_sh_acct.c index 4f9a03890e..5acc2fb7bc 100644 --- a/source3/utils/net_rpc_sh_acct.c +++ b/source3/utils/net_rpc_sh_acct.c @@ -14,8 +14,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" #include "utils/net.h" -- cgit From 30191d1a5704ad2b158386b511558972d539ce47 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 18 Oct 2007 17:40:25 -0700 Subject: RIP BOOL. Convert BOOL -> bool. I found a few interesting bugs in various places whilst doing this (places that assumed BOOL == int). I also need to fix the Samba4 pidl generation (next checkin). Jeremy. (This used to be commit f35a266b3cbb3e5fa6a86be60f34fe340a3ca71f) --- source3/utils/net_rpc_sh_acct.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/utils/net_rpc_sh_acct.c') diff --git a/source3/utils/net_rpc_sh_acct.c b/source3/utils/net_rpc_sh_acct.c index 5acc2fb7bc..ac0ffca1f3 100644 --- a/source3/utils/net_rpc_sh_acct.c +++ b/source3/utils/net_rpc_sh_acct.c @@ -29,7 +29,7 @@ static NTSTATUS rpc_sh_acct_do(TALLOC_CTX *mem_ctx, struct rpc_sh_ctx *ctx, struct rpc_pipe_client *pipe_hnd, int argc, const char **argv, - BOOL (*fn)(TALLOC_CTX *mem_ctx, + int (*fn)(TALLOC_CTX *mem_ctx, struct rpc_sh_ctx *ctx, SAM_UNK_INFO_1 *i1, SAM_UNK_INFO_3 *i3, -- cgit From 5334b364c21599fe055b32bbbd1e8cf7488b1fa7 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 30 Jan 2008 12:39:20 +0100 Subject: Remove rpccli_samr_close and use pidl generated function instead. Guenther (This used to be commit 64f0889401855ab76953bfae5db4fe4df19ad8a5) --- source3/utils/net_rpc_sh_acct.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/utils/net_rpc_sh_acct.c') diff --git a/source3/utils/net_rpc_sh_acct.c b/source3/utils/net_rpc_sh_acct.c index ac0ffca1f3..f5b0c2e0d7 100644 --- a/source3/utils/net_rpc_sh_acct.c +++ b/source3/utils/net_rpc_sh_acct.c @@ -118,10 +118,10 @@ static NTSTATUS rpc_sh_acct_do(TALLOC_CTX *mem_ctx, done: if (is_valid_policy_hnd(&domain_pol)) { - rpccli_samr_close(pipe_hnd, mem_ctx, &domain_pol); + rpccli_samr_Close(pipe_hnd, mem_ctx, &domain_pol); } if (is_valid_policy_hnd(&connect_pol)) { - rpccli_samr_close(pipe_hnd, mem_ctx, &connect_pol); + rpccli_samr_Close(pipe_hnd, mem_ctx, &connect_pol); } return result; -- cgit From 42960f817a9fd439557d1be2f3ca3603a35489ce Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 1 Feb 2008 11:12:05 +0100 Subject: Use rpccli_samr_OpenDomain() all over the place. Guenther (This used to be commit e4e9d72724d547e1405b2ed4cec509d50ec88c8d) --- source3/utils/net_rpc_sh_acct.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'source3/utils/net_rpc_sh_acct.c') diff --git a/source3/utils/net_rpc_sh_acct.c b/source3/utils/net_rpc_sh_acct.c index f5b0c2e0d7..12da031d4b 100644 --- a/source3/utils/net_rpc_sh_acct.c +++ b/source3/utils/net_rpc_sh_acct.c @@ -54,10 +54,12 @@ static NTSTATUS rpc_sh_acct_do(TALLOC_CTX *mem_ctx, } /* Get domain policy handle */ - - result = rpccli_samr_open_domain(pipe_hnd, mem_ctx, &connect_pol, - MAXIMUM_ALLOWED_ACCESS, - ctx->domain_sid, &domain_pol); + + result = rpccli_samr_OpenDomain(pipe_hnd, mem_ctx, + &connect_pol, + MAXIMUM_ALLOWED_ACCESS, + ctx->domain_sid, + &domain_pol); if (!NT_STATUS_IS_OK(result)) { goto done; } -- cgit From 270ba9c238400f49d32c57a9a1bbde6ad63bb555 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 4 Feb 2008 19:43:07 +0100 Subject: Use rpccli_samr_Connect2() all over the place. Guenther (This used to be commit bdf8d562621e1a09bf83e2009dec24966e7fdf22) --- source3/utils/net_rpc_sh_acct.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'source3/utils/net_rpc_sh_acct.c') diff --git a/source3/utils/net_rpc_sh_acct.c b/source3/utils/net_rpc_sh_acct.c index 12da031d4b..5d5f7ad485 100644 --- a/source3/utils/net_rpc_sh_acct.c +++ b/source3/utils/net_rpc_sh_acct.c @@ -45,10 +45,11 @@ static NTSTATUS rpc_sh_acct_do(TALLOC_CTX *mem_ctx, ZERO_STRUCT(domain_pol); /* Get sam policy handle */ - - result = rpccli_samr_connect(pipe_hnd, mem_ctx, - MAXIMUM_ALLOWED_ACCESS, - &connect_pol); + + result = rpccli_samr_Connect2(pipe_hnd, mem_ctx, + pipe_hnd->cli->desthost, + MAXIMUM_ALLOWED_ACCESS, + &connect_pol); if (!NT_STATUS_IS_OK(result)) { goto done; } -- cgit From 99bff2fc72319764269624d0bfbf2d8f1dbb4ba9 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 5 Feb 2008 15:56:05 +0100 Subject: Use rpccli_samr_QueryDomainInfo() in net_rpc_sh_acct.c. Guenther (This used to be commit 65e978eacc30e6c400c8b76ba5f861883ff1c16a) --- source3/utils/net_rpc_sh_acct.c | 144 +++++++++++++++++++++++----------------- 1 file changed, 83 insertions(+), 61 deletions(-) (limited to 'source3/utils/net_rpc_sh_acct.c') diff --git a/source3/utils/net_rpc_sh_acct.c b/source3/utils/net_rpc_sh_acct.c index 5d5f7ad485..57640ca3a8 100644 --- a/source3/utils/net_rpc_sh_acct.c +++ b/source3/utils/net_rpc_sh_acct.c @@ -31,14 +31,16 @@ static NTSTATUS rpc_sh_acct_do(TALLOC_CTX *mem_ctx, int argc, const char **argv, int (*fn)(TALLOC_CTX *mem_ctx, struct rpc_sh_ctx *ctx, - SAM_UNK_INFO_1 *i1, - SAM_UNK_INFO_3 *i3, - SAM_UNK_INFO_12 *i12, + struct samr_DomInfo1 *i1, + struct samr_DomInfo3 *i3, + struct samr_DomInfo12 *i12, int argc, const char **argv)) { POLICY_HND connect_pol, domain_pol; NTSTATUS result = NT_STATUS_UNSUCCESSFUL; - SAM_UNK_CTR ctr1, ctr3, ctr12; + union samr_DomainInfo *info1 = NULL; + union samr_DomainInfo *info3 = NULL; + union samr_DomainInfo *info12 = NULL; int store; ZERO_STRUCT(connect_pol); @@ -65,8 +67,10 @@ static NTSTATUS rpc_sh_acct_do(TALLOC_CTX *mem_ctx, goto done; } - result = rpccli_samr_query_dom_info(pipe_hnd, mem_ctx, &domain_pol, - 1, &ctr1); + result = rpccli_samr_QueryDomainInfo(pipe_hnd, mem_ctx, + &domain_pol, + 1, + &info1); if (!NT_STATUS_IS_OK(result)) { d_fprintf(stderr, "query_domain_info level 1 failed: %s\n", @@ -74,8 +78,10 @@ static NTSTATUS rpc_sh_acct_do(TALLOC_CTX *mem_ctx, goto done; } - result = rpccli_samr_query_dom_info(pipe_hnd, mem_ctx, &domain_pol, - 3, &ctr3); + result = rpccli_samr_QueryDomainInfo(pipe_hnd, mem_ctx, + &domain_pol, + 3, + &info3); if (!NT_STATUS_IS_OK(result)) { d_fprintf(stderr, "query_domain_info level 3 failed: %s\n", @@ -83,8 +89,10 @@ static NTSTATUS rpc_sh_acct_do(TALLOC_CTX *mem_ctx, goto done; } - result = rpccli_samr_query_dom_info(pipe_hnd, mem_ctx, &domain_pol, - 12, &ctr12); + result = rpccli_samr_QueryDomainInfo(pipe_hnd, mem_ctx, + &domain_pol, + 12, + &info12); if (!NT_STATUS_IS_OK(result)) { d_fprintf(stderr, "query_domain_info level 12 failed: %s\n", @@ -92,8 +100,8 @@ static NTSTATUS rpc_sh_acct_do(TALLOC_CTX *mem_ctx, goto done; } - store = fn(mem_ctx, ctx, &ctr1.info.inf1, &ctr3.info.inf3, - &ctr12.info.inf12, argc, argv); + store = fn(mem_ctx, ctx, &info1->info1, &info3->info3, + &info12->info12, argc, argv); if (store <= 0) { /* Don't save anything */ @@ -102,16 +110,22 @@ static NTSTATUS rpc_sh_acct_do(TALLOC_CTX *mem_ctx, switch (store) { case 1: - result = rpccli_samr_set_domain_info(pipe_hnd, mem_ctx, - &domain_pol, 1, &ctr1); + result = rpccli_samr_SetDomainInfo(pipe_hnd, mem_ctx, + &domain_pol, + 1, + info1); break; case 3: - result = rpccli_samr_set_domain_info(pipe_hnd, mem_ctx, - &domain_pol, 3, &ctr3); + result = rpccli_samr_SetDomainInfo(pipe_hnd, mem_ctx, + &domain_pol, + 3, + info3); break; case 12: - result = rpccli_samr_set_domain_info(pipe_hnd, mem_ctx, - &domain_pol, 12, &ctr12); + result = rpccli_samr_SetDomainInfo(pipe_hnd, mem_ctx, + &domain_pol, + 12, + info12); break; default: d_fprintf(stderr, "Got unexpected info level %d\n", store); @@ -131,8 +145,9 @@ static NTSTATUS rpc_sh_acct_do(TALLOC_CTX *mem_ctx, } static int account_show(TALLOC_CTX *mem_ctx, struct rpc_sh_ctx *ctx, - SAM_UNK_INFO_1 *i1, SAM_UNK_INFO_3 *i3, - SAM_UNK_INFO_12 *i12, + struct samr_DomInfo1 *i1, + struct samr_DomInfo3 *i3, + struct samr_DomInfo12 *i12, int argc, const char **argv) { if (argc != 0) { @@ -140,40 +155,40 @@ static int account_show(TALLOC_CTX *mem_ctx, struct rpc_sh_ctx *ctx, return -1; } - d_printf("Minimum password length: %d\n", i1->min_length_password); - d_printf("Password history length: %d\n", i1->password_history); + d_printf("Minimum password length: %d\n", i1->min_password_length); + d_printf("Password history length: %d\n", i1->password_history_length); d_printf("Minimum password age: "); - if (!nt_time_is_zero(&i1->min_passwordage)) { - time_t t = nt_time_to_unix_abs(&i1->min_passwordage); + if (!nt_time_is_zero((NTTIME *)&i1->min_password_age)) { + time_t t = nt_time_to_unix_abs((NTTIME *)&i1->min_password_age); d_printf("%d seconds\n", (int)t); } else { d_printf("not set\n"); } d_printf("Maximum password age: "); - if (nt_time_is_set(&i1->expire)) { - time_t t = nt_time_to_unix_abs(&i1->expire); + if (nt_time_is_set((NTTIME *)&i1->max_password_age)) { + time_t t = nt_time_to_unix_abs((NTTIME *)&i1->max_password_age); d_printf("%d seconds\n", (int)t); } else { d_printf("not set\n"); } - d_printf("Bad logon attempts: %d\n", i12->bad_attempt_lockout); + d_printf("Bad logon attempts: %d\n", i12->lockout_threshold); - if (i12->bad_attempt_lockout != 0) { + if (i12->lockout_threshold != 0) { d_printf("Account lockout duration: "); - if (nt_time_is_set(&i12->duration)) { - time_t t = nt_time_to_unix_abs(&i12->duration); + if (nt_time_is_set(&i12->lockout_duration)) { + time_t t = nt_time_to_unix_abs(&i12->lockout_duration); d_printf("%d seconds\n", (int)t); } else { d_printf("not set\n"); } d_printf("Bad password count reset after: "); - if (nt_time_is_set(&i12->reset_count)) { - time_t t = nt_time_to_unix_abs(&i12->reset_count); + if (nt_time_is_set(&i12->lockout_window)) { + time_t t = nt_time_to_unix_abs(&i12->lockout_window); d_printf("%d seconds\n", (int)t); } else { d_printf("not set\n"); @@ -181,7 +196,7 @@ static int account_show(TALLOC_CTX *mem_ctx, struct rpc_sh_ctx *ctx, } d_printf("Disconnect users when logon hours expire: %s\n", - nt_time_is_zero(&i3->logout) ? "yes" : "no"); + nt_time_is_zero(&i3->force_logoff_time) ? "yes" : "no"); d_printf("User must logon to change password: %s\n", (i1->password_properties & 0x2) ? "yes" : "no"); @@ -198,8 +213,9 @@ static NTSTATUS rpc_sh_acct_pol_show(TALLOC_CTX *mem_ctx, } static int account_set_badpw(TALLOC_CTX *mem_ctx, struct rpc_sh_ctx *ctx, - SAM_UNK_INFO_1 *i1, SAM_UNK_INFO_3 *i3, - SAM_UNK_INFO_12 *i12, + struct samr_DomInfo1 *i1, + struct samr_DomInfo3 *i3, + struct samr_DomInfo12 *i12, int argc, const char **argv) { if (argc != 1) { @@ -207,9 +223,9 @@ static int account_set_badpw(TALLOC_CTX *mem_ctx, struct rpc_sh_ctx *ctx, return -1; } - i12->bad_attempt_lockout = atoi(argv[0]); + i12->lockout_threshold = atoi(argv[0]); d_printf("Setting bad password count to %d\n", - i12->bad_attempt_lockout); + i12->lockout_threshold); return 12; } @@ -225,8 +241,9 @@ static NTSTATUS rpc_sh_acct_set_badpw(TALLOC_CTX *mem_ctx, static int account_set_lockduration(TALLOC_CTX *mem_ctx, struct rpc_sh_ctx *ctx, - SAM_UNK_INFO_1 *i1, SAM_UNK_INFO_3 *i3, - SAM_UNK_INFO_12 *i12, + struct samr_DomInfo1 *i1, + struct samr_DomInfo3 *i3, + struct samr_DomInfo12 *i12, int argc, const char **argv) { if (argc != 1) { @@ -234,9 +251,9 @@ static int account_set_lockduration(TALLOC_CTX *mem_ctx, return -1; } - unix_to_nt_time_abs(&i12->duration, atoi(argv[0])); + unix_to_nt_time_abs(&i12->lockout_duration, atoi(argv[0])); d_printf("Setting lockout duration to %d seconds\n", - (int)nt_time_to_unix_abs(&i12->duration)); + (int)nt_time_to_unix_abs(&i12->lockout_duration)); return 12; } @@ -252,8 +269,9 @@ static NTSTATUS rpc_sh_acct_set_lockduration(TALLOC_CTX *mem_ctx, static int account_set_resetduration(TALLOC_CTX *mem_ctx, struct rpc_sh_ctx *ctx, - SAM_UNK_INFO_1 *i1, SAM_UNK_INFO_3 *i3, - SAM_UNK_INFO_12 *i12, + struct samr_DomInfo1 *i1, + struct samr_DomInfo3 *i3, + struct samr_DomInfo12 *i12, int argc, const char **argv) { if (argc != 1) { @@ -261,9 +279,9 @@ static int account_set_resetduration(TALLOC_CTX *mem_ctx, return -1; } - unix_to_nt_time_abs(&i12->reset_count, atoi(argv[0])); + unix_to_nt_time_abs(&i12->lockout_window, atoi(argv[0])); d_printf("Setting bad password reset duration to %d seconds\n", - (int)nt_time_to_unix_abs(&i12->reset_count)); + (int)nt_time_to_unix_abs(&i12->lockout_window)); return 12; } @@ -279,8 +297,9 @@ static NTSTATUS rpc_sh_acct_set_resetduration(TALLOC_CTX *mem_ctx, static int account_set_minpwage(TALLOC_CTX *mem_ctx, struct rpc_sh_ctx *ctx, - SAM_UNK_INFO_1 *i1, SAM_UNK_INFO_3 *i3, - SAM_UNK_INFO_12 *i12, + struct samr_DomInfo1 *i1, + struct samr_DomInfo3 *i3, + struct samr_DomInfo12 *i12, int argc, const char **argv) { if (argc != 1) { @@ -288,9 +307,9 @@ static int account_set_minpwage(TALLOC_CTX *mem_ctx, return -1; } - unix_to_nt_time_abs(&i1->min_passwordage, atoi(argv[0])); + unix_to_nt_time_abs((NTTIME *)&i1->min_password_age, atoi(argv[0])); d_printf("Setting minimum password age to %d seconds\n", - (int)nt_time_to_unix_abs(&i1->min_passwordage)); + (int)nt_time_to_unix_abs((NTTIME *)&i1->min_password_age)); return 1; } @@ -306,8 +325,9 @@ static NTSTATUS rpc_sh_acct_set_minpwage(TALLOC_CTX *mem_ctx, static int account_set_maxpwage(TALLOC_CTX *mem_ctx, struct rpc_sh_ctx *ctx, - SAM_UNK_INFO_1 *i1, SAM_UNK_INFO_3 *i3, - SAM_UNK_INFO_12 *i12, + struct samr_DomInfo1 *i1, + struct samr_DomInfo3 *i3, + struct samr_DomInfo12 *i12, int argc, const char **argv) { if (argc != 1) { @@ -315,9 +335,9 @@ static int account_set_maxpwage(TALLOC_CTX *mem_ctx, return -1; } - unix_to_nt_time_abs(&i1->expire, atoi(argv[0])); + unix_to_nt_time_abs((NTTIME *)&i1->max_password_age, atoi(argv[0])); d_printf("Setting maximum password age to %d seconds\n", - (int)nt_time_to_unix_abs(&i1->expire)); + (int)nt_time_to_unix_abs((NTTIME *)&i1->max_password_age)); return 1; } @@ -333,8 +353,9 @@ static NTSTATUS rpc_sh_acct_set_maxpwage(TALLOC_CTX *mem_ctx, static int account_set_minpwlen(TALLOC_CTX *mem_ctx, struct rpc_sh_ctx *ctx, - SAM_UNK_INFO_1 *i1, SAM_UNK_INFO_3 *i3, - SAM_UNK_INFO_12 *i12, + struct samr_DomInfo1 *i1, + struct samr_DomInfo3 *i3, + struct samr_DomInfo12 *i12, int argc, const char **argv) { if (argc != 1) { @@ -342,9 +363,9 @@ static int account_set_minpwlen(TALLOC_CTX *mem_ctx, return -1; } - i1->min_length_password = atoi(argv[0]); + i1->min_password_length = atoi(argv[0]); d_printf("Setting minimum password length to %d\n", - i1->min_length_password); + i1->min_password_length); return 1; } @@ -360,8 +381,9 @@ static NTSTATUS rpc_sh_acct_set_minpwlen(TALLOC_CTX *mem_ctx, static int account_set_pwhistlen(TALLOC_CTX *mem_ctx, struct rpc_sh_ctx *ctx, - SAM_UNK_INFO_1 *i1, SAM_UNK_INFO_3 *i3, - SAM_UNK_INFO_12 *i12, + struct samr_DomInfo1 *i1, + struct samr_DomInfo3 *i3, + struct samr_DomInfo12 *i12, int argc, const char **argv) { if (argc != 1) { @@ -369,9 +391,9 @@ static int account_set_pwhistlen(TALLOC_CTX *mem_ctx, return -1; } - i1->password_history = atoi(argv[0]); + i1->password_history_length = atoi(argv[0]); d_printf("Setting password history length to %d\n", - i1->password_history); + i1->password_history_length); return 1; } -- cgit From 2a2188591b5ed922d09dc723adcf10f8b8f5e5a0 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 19 Apr 2008 21:56:43 +0200 Subject: Add "desthost" to rpc_pipe_client This reduces the dependency on cli_state (This used to be commit 783afab9c891dd7bcb78895b2a639b6f3a0edf5b) --- source3/utils/net_rpc_sh_acct.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/utils/net_rpc_sh_acct.c') diff --git a/source3/utils/net_rpc_sh_acct.c b/source3/utils/net_rpc_sh_acct.c index 57640ca3a8..00a7967f07 100644 --- a/source3/utils/net_rpc_sh_acct.c +++ b/source3/utils/net_rpc_sh_acct.c @@ -49,7 +49,7 @@ static NTSTATUS rpc_sh_acct_do(TALLOC_CTX *mem_ctx, /* Get sam policy handle */ result = rpccli_samr_Connect2(pipe_hnd, mem_ctx, - pipe_hnd->cli->desthost, + pipe_hnd->desthost, MAXIMUM_ALLOWED_ACCESS, &connect_pol); if (!NT_STATUS_IS_OK(result)) { -- cgit From f5769109447d8da0f09b102d444a816ad97a00dc Mon Sep 17 00:00:00 2001 From: Kai Blin Date: Fri, 9 May 2008 23:22:12 +0200 Subject: net: Remove globals (This used to be commit 1e9319cf88b65a2a8d4f5099a1fe5297e405ed2e) --- source3/utils/net_rpc_sh_acct.c | 78 +++++++++++++++++++++++++---------------- 1 file changed, 48 insertions(+), 30 deletions(-) (limited to 'source3/utils/net_rpc_sh_acct.c') diff --git a/source3/utils/net_rpc_sh_acct.c b/source3/utils/net_rpc_sh_acct.c index 00a7967f07..15a20891f2 100644 --- a/source3/utils/net_rpc_sh_acct.c +++ b/source3/utils/net_rpc_sh_acct.c @@ -14,8 +14,8 @@ 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, see . */ - + along with this program. If not, see . +*/ #include "includes.h" #include "utils/net.h" @@ -25,11 +25,13 @@ * it has modified, it can return 0 for no change. */ -static NTSTATUS rpc_sh_acct_do(TALLOC_CTX *mem_ctx, +static NTSTATUS rpc_sh_acct_do(struct net_context *c, + TALLOC_CTX *mem_ctx, struct rpc_sh_ctx *ctx, struct rpc_pipe_client *pipe_hnd, int argc, const char **argv, - int (*fn)(TALLOC_CTX *mem_ctx, + int (*fn)(struct net_context *c, + TALLOC_CTX *mem_ctx, struct rpc_sh_ctx *ctx, struct samr_DomInfo1 *i1, struct samr_DomInfo3 *i3, @@ -100,7 +102,7 @@ static NTSTATUS rpc_sh_acct_do(TALLOC_CTX *mem_ctx, goto done; } - store = fn(mem_ctx, ctx, &info1->info1, &info3->info3, + store = fn(c, mem_ctx, ctx, &info1->info1, &info3->info3, &info12->info12, argc, argv); if (store <= 0) { @@ -144,7 +146,8 @@ static NTSTATUS rpc_sh_acct_do(TALLOC_CTX *mem_ctx, return result; } -static int account_show(TALLOC_CTX *mem_ctx, struct rpc_sh_ctx *ctx, +static int account_show(struct net_context *c, + TALLOC_CTX *mem_ctx, struct rpc_sh_ctx *ctx, struct samr_DomInfo1 *i1, struct samr_DomInfo3 *i3, struct samr_DomInfo12 *i12, @@ -204,15 +207,17 @@ static int account_show(TALLOC_CTX *mem_ctx, struct rpc_sh_ctx *ctx, return 0; /* Don't save */ } -static NTSTATUS rpc_sh_acct_pol_show(TALLOC_CTX *mem_ctx, +static NTSTATUS rpc_sh_acct_pol_show(struct net_context *c, + TALLOC_CTX *mem_ctx, struct rpc_sh_ctx *ctx, struct rpc_pipe_client *pipe_hnd, int argc, const char **argv) { - return rpc_sh_acct_do(mem_ctx, ctx, pipe_hnd, argc, argv, + return rpc_sh_acct_do(c, mem_ctx, ctx, pipe_hnd, argc, argv, account_show); } -static int account_set_badpw(TALLOC_CTX *mem_ctx, struct rpc_sh_ctx *ctx, +static int account_set_badpw(struct net_context *c, + TALLOC_CTX *mem_ctx, struct rpc_sh_ctx *ctx, struct samr_DomInfo1 *i1, struct samr_DomInfo3 *i3, struct samr_DomInfo12 *i12, @@ -230,16 +235,18 @@ static int account_set_badpw(TALLOC_CTX *mem_ctx, struct rpc_sh_ctx *ctx, return 12; } -static NTSTATUS rpc_sh_acct_set_badpw(TALLOC_CTX *mem_ctx, +static NTSTATUS rpc_sh_acct_set_badpw(struct net_context *c, + TALLOC_CTX *mem_ctx, struct rpc_sh_ctx *ctx, struct rpc_pipe_client *pipe_hnd, int argc, const char **argv) { - return rpc_sh_acct_do(mem_ctx, ctx, pipe_hnd, argc, argv, + return rpc_sh_acct_do(c, mem_ctx, ctx, pipe_hnd, argc, argv, account_set_badpw); } -static int account_set_lockduration(TALLOC_CTX *mem_ctx, +static int account_set_lockduration(struct net_context *c, + TALLOC_CTX *mem_ctx, struct rpc_sh_ctx *ctx, struct samr_DomInfo1 *i1, struct samr_DomInfo3 *i3, @@ -258,16 +265,18 @@ static int account_set_lockduration(TALLOC_CTX *mem_ctx, return 12; } -static NTSTATUS rpc_sh_acct_set_lockduration(TALLOC_CTX *mem_ctx, +static NTSTATUS rpc_sh_acct_set_lockduration(struct net_context *c, + TALLOC_CTX *mem_ctx, struct rpc_sh_ctx *ctx, struct rpc_pipe_client *pipe_hnd, int argc, const char **argv) { - return rpc_sh_acct_do(mem_ctx, ctx, pipe_hnd, argc, argv, + return rpc_sh_acct_do(c, mem_ctx, ctx, pipe_hnd, argc, argv, account_set_lockduration); } -static int account_set_resetduration(TALLOC_CTX *mem_ctx, +static int account_set_resetduration(struct net_context *c, + TALLOC_CTX *mem_ctx, struct rpc_sh_ctx *ctx, struct samr_DomInfo1 *i1, struct samr_DomInfo3 *i3, @@ -286,16 +295,18 @@ static int account_set_resetduration(TALLOC_CTX *mem_ctx, return 12; } -static NTSTATUS rpc_sh_acct_set_resetduration(TALLOC_CTX *mem_ctx, +static NTSTATUS rpc_sh_acct_set_resetduration(struct net_context *c, + TALLOC_CTX *mem_ctx, struct rpc_sh_ctx *ctx, struct rpc_pipe_client *pipe_hnd, int argc, const char **argv) { - return rpc_sh_acct_do(mem_ctx, ctx, pipe_hnd, argc, argv, + return rpc_sh_acct_do(c, mem_ctx, ctx, pipe_hnd, argc, argv, account_set_resetduration); } -static int account_set_minpwage(TALLOC_CTX *mem_ctx, +static int account_set_minpwage(struct net_context *c, + TALLOC_CTX *mem_ctx, struct rpc_sh_ctx *ctx, struct samr_DomInfo1 *i1, struct samr_DomInfo3 *i3, @@ -314,16 +325,18 @@ static int account_set_minpwage(TALLOC_CTX *mem_ctx, return 1; } -static NTSTATUS rpc_sh_acct_set_minpwage(TALLOC_CTX *mem_ctx, +static NTSTATUS rpc_sh_acct_set_minpwage(struct net_context *c, + TALLOC_CTX *mem_ctx, struct rpc_sh_ctx *ctx, struct rpc_pipe_client *pipe_hnd, int argc, const char **argv) { - return rpc_sh_acct_do(mem_ctx, ctx, pipe_hnd, argc, argv, + return rpc_sh_acct_do(c, mem_ctx, ctx, pipe_hnd, argc, argv, account_set_minpwage); } -static int account_set_maxpwage(TALLOC_CTX *mem_ctx, +static int account_set_maxpwage(struct net_context *c, + TALLOC_CTX *mem_ctx, struct rpc_sh_ctx *ctx, struct samr_DomInfo1 *i1, struct samr_DomInfo3 *i3, @@ -342,16 +355,18 @@ static int account_set_maxpwage(TALLOC_CTX *mem_ctx, return 1; } -static NTSTATUS rpc_sh_acct_set_maxpwage(TALLOC_CTX *mem_ctx, +static NTSTATUS rpc_sh_acct_set_maxpwage(struct net_context *c, + TALLOC_CTX *mem_ctx, struct rpc_sh_ctx *ctx, struct rpc_pipe_client *pipe_hnd, int argc, const char **argv) { - return rpc_sh_acct_do(mem_ctx, ctx, pipe_hnd, argc, argv, + return rpc_sh_acct_do(c, mem_ctx, ctx, pipe_hnd, argc, argv, account_set_maxpwage); } -static int account_set_minpwlen(TALLOC_CTX *mem_ctx, +static int account_set_minpwlen(struct net_context *c, + TALLOC_CTX *mem_ctx, struct rpc_sh_ctx *ctx, struct samr_DomInfo1 *i1, struct samr_DomInfo3 *i3, @@ -370,16 +385,18 @@ static int account_set_minpwlen(TALLOC_CTX *mem_ctx, return 1; } -static NTSTATUS rpc_sh_acct_set_minpwlen(TALLOC_CTX *mem_ctx, +static NTSTATUS rpc_sh_acct_set_minpwlen(struct net_context *c, + TALLOC_CTX *mem_ctx, struct rpc_sh_ctx *ctx, struct rpc_pipe_client *pipe_hnd, int argc, const char **argv) { - return rpc_sh_acct_do(mem_ctx, ctx, pipe_hnd, argc, argv, + return rpc_sh_acct_do(c, mem_ctx, ctx, pipe_hnd, argc, argv, account_set_minpwlen); } -static int account_set_pwhistlen(TALLOC_CTX *mem_ctx, +static int account_set_pwhistlen(struct net_context *c, + TALLOC_CTX *mem_ctx, struct rpc_sh_ctx *ctx, struct samr_DomInfo1 *i1, struct samr_DomInfo3 *i3, @@ -398,16 +415,17 @@ static int account_set_pwhistlen(TALLOC_CTX *mem_ctx, return 1; } -static NTSTATUS rpc_sh_acct_set_pwhistlen(TALLOC_CTX *mem_ctx, +static NTSTATUS rpc_sh_acct_set_pwhistlen(struct net_context *c, + TALLOC_CTX *mem_ctx, struct rpc_sh_ctx *ctx, struct rpc_pipe_client *pipe_hnd, int argc, const char **argv) { - return rpc_sh_acct_do(mem_ctx, ctx, pipe_hnd, argc, argv, + return rpc_sh_acct_do(c, mem_ctx, ctx, pipe_hnd, argc, argv, account_set_pwhistlen); } -struct rpc_sh_cmd *net_rpc_acct_cmds(TALLOC_CTX *mem_ctx, +struct rpc_sh_cmd *net_rpc_acct_cmds(struct net_context *c, TALLOC_CTX *mem_ctx, struct rpc_sh_ctx *ctx) { static struct rpc_sh_cmd cmds[9] = { -- cgit From 4206d9754486d2c1e18217cbcdbaad8f31f5244b Mon Sep 17 00:00:00 2001 From: Kai Blin Date: Thu, 8 May 2008 11:23:38 +0200 Subject: net: more whitespace cleanup (This used to be commit ef0184d580500734fc7af51e1c790b075180a3d0) --- source3/utils/net_rpc_sh_acct.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'source3/utils/net_rpc_sh_acct.c') diff --git a/source3/utils/net_rpc_sh_acct.c b/source3/utils/net_rpc_sh_acct.c index 15a20891f2..ba2a8e28a0 100644 --- a/source3/utils/net_rpc_sh_acct.c +++ b/source3/utils/net_rpc_sh_acct.c @@ -1,18 +1,18 @@ -/* - Samba Unix/Linux SMB client library - Distributed SMB/CIFS Server Management Utility +/* + Samba Unix/Linux SMB client library + Distributed SMB/CIFS Server Management Utility Copyright (C) 2006 Volker Lendecke (vl@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 3 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, see . */ @@ -57,7 +57,7 @@ static NTSTATUS rpc_sh_acct_do(struct net_context *c, if (!NT_STATUS_IS_OK(result)) { goto done; } - + /* Get domain policy handle */ result = rpccli_samr_OpenDomain(pipe_hnd, mem_ctx, @@ -203,7 +203,7 @@ static int account_show(struct net_context *c, d_printf("User must logon to change password: %s\n", (i1->password_properties & 0x2) ? "yes" : "no"); - + return 0; /* Don't save */ } -- cgit From d86ff599892608cf739c96e8add9b6ff9f9e5e43 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 20 Jul 2008 18:40:31 +0200 Subject: Refactoring: net_sh_run uses ndr_syntax_id instead of pipe_idx (This used to be commit 85c8363d5179e7053adc05e8abce2fb26cf9b968) --- source3/utils/net_rpc_sh_acct.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'source3/utils/net_rpc_sh_acct.c') diff --git a/source3/utils/net_rpc_sh_acct.c b/source3/utils/net_rpc_sh_acct.c index ba2a8e28a0..977e1e2a0a 100644 --- a/source3/utils/net_rpc_sh_acct.c +++ b/source3/utils/net_rpc_sh_acct.c @@ -429,22 +429,22 @@ struct rpc_sh_cmd *net_rpc_acct_cmds(struct net_context *c, TALLOC_CTX *mem_ctx, struct rpc_sh_ctx *ctx) { static struct rpc_sh_cmd cmds[9] = { - { "show", NULL, PI_SAMR, rpc_sh_acct_pol_show, + { "show", NULL, &ndr_table_samr.syntax_id, rpc_sh_acct_pol_show, "Show current account policy settings" }, - { "badpw", NULL, PI_SAMR, rpc_sh_acct_set_badpw, + { "badpw", NULL, &ndr_table_samr.syntax_id, rpc_sh_acct_set_badpw, "Set bad password count before lockout" }, - { "lockduration", NULL, PI_SAMR, rpc_sh_acct_set_lockduration, + { "lockduration", NULL, &ndr_table_samr.syntax_id, rpc_sh_acct_set_lockduration, "Set account lockout duration" }, - { "resetduration", NULL, PI_SAMR, + { "resetduration", NULL, &ndr_table_samr.syntax_id, rpc_sh_acct_set_resetduration, "Set bad password count reset duration" }, - { "minpwage", NULL, PI_SAMR, rpc_sh_acct_set_minpwage, + { "minpwage", NULL, &ndr_table_samr.syntax_id, rpc_sh_acct_set_minpwage, "Set minimum password age" }, - { "maxpwage", NULL, PI_SAMR, rpc_sh_acct_set_maxpwage, + { "maxpwage", NULL, &ndr_table_samr.syntax_id, rpc_sh_acct_set_maxpwage, "Set maximum password age" }, - { "minpwlen", NULL, PI_SAMR, rpc_sh_acct_set_minpwlen, + { "minpwlen", NULL, &ndr_table_samr.syntax_id, rpc_sh_acct_set_minpwlen, "Set minimum password length" }, - { "pwhistlen", NULL, PI_SAMR, rpc_sh_acct_set_pwhistlen, + { "pwhistlen", NULL, &ndr_table_samr.syntax_id, rpc_sh_acct_set_pwhistlen, "Set the password history length" }, { NULL, NULL, 0, NULL, NULL } }; -- cgit