[SCM] Samba Shared Repository - branch v3-2-test updated - initial-v3-2-test-1920-g65e978e

Günther Deschner gd at samba.org
Wed Feb 6 01:10:29 GMT 2008


The branch, v3-2-test has been updated
       via  65e978eacc30e6c400c8b76ba5f861883ff1c16a (commit)
       via  82073db9f717249ccf108b238ed64170163fc4a7 (commit)
      from  ed16b2f63b532a7b1a3c227a6045326a2e57a344 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -----------------------------------------------------------------
commit 65e978eacc30e6c400c8b76ba5f861883ff1c16a
Author: Günther Deschner <gd at samba.org>
Date:   Tue Feb 5 15:56:05 2008 +0100

    Use rpccli_samr_QueryDomainInfo() in net_rpc_sh_acct.c.
    
    Guenther

commit 82073db9f717249ccf108b238ed64170163fc4a7
Author: Günther Deschner <gd at samba.org>
Date:   Tue Feb 5 15:55:11 2008 +0100

    Use rpccli_samr_QueryDomainInfo() in net rpc.
    
    Guenther

-----------------------------------------------------------------------

Summary of changes:
 source/utils/net_rpc.c         |   22 +++---
 source/utils/net_rpc_sh_acct.c |  144 +++++++++++++++++++++++-----------------
 2 files changed, 94 insertions(+), 72 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/utils/net_rpc.c b/source/utils/net_rpc.c
index 2d4302f..a1e093a 100644
--- a/source/utils/net_rpc.c
+++ b/source/utils/net_rpc.c
@@ -445,7 +445,7 @@ NTSTATUS rpc_info_internals(const DOM_SID *domain_sid,
 {
 	POLICY_HND connect_pol, domain_pol;
 	NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
-	SAM_UNK_CTR ctr;
+	union samr_DomainInfo *info = NULL;
 	fstring sid_str;
 
 	sid_to_fstring(sid_str, domain_sid);
@@ -471,18 +471,18 @@ NTSTATUS rpc_info_internals(const DOM_SID *domain_sid,
 		goto done;
 	}
 
-	ZERO_STRUCT(ctr);
-	result = rpccli_samr_query_dom_info(pipe_hnd, mem_ctx, &domain_pol,
-					 2, &ctr);
+	result = rpccli_samr_QueryDomainInfo(pipe_hnd, mem_ctx,
+					     &domain_pol,
+					     2,
+					     &info);
 	if (NT_STATUS_IS_OK(result)) {
-		TALLOC_CTX *ctx = talloc_init("rpc_info_internals");
-		d_printf("Domain Name: %s\n", unistr2_to_ascii_talloc(ctx, &ctr.info.inf2.uni_domain));
+		d_printf("Domain Name: %s\n", info->info2.domain_name.string);
 		d_printf("Domain SID: %s\n", sid_str);
-		d_printf("Sequence number: %llu\n", (unsigned long long)ctr.info.inf2.seq_num);
-		d_printf("Num users: %u\n", ctr.info.inf2.num_domain_usrs);
-		d_printf("Num domain groups: %u\n", ctr.info.inf2.num_domain_grps);
-		d_printf("Num local groups: %u\n", ctr.info.inf2.num_local_grps);
-		talloc_destroy(ctx);
+		d_printf("Sequence number: %llu\n",
+			(unsigned long long)info->info2.sequence_num);
+		d_printf("Num users: %u\n", info->info2.num_users);
+		d_printf("Num domain groups: %u\n", info->info2.num_groups);
+		d_printf("Num local groups: %u\n", info->info2.num_aliases);
 	}
 
  done:
diff --git a/source/utils/net_rpc_sh_acct.c b/source/utils/net_rpc_sh_acct.c
index 5d5f7ad..57640ca 100644
--- a/source/utils/net_rpc_sh_acct.c
+++ b/source/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;
 }


-- 
Samba Shared Repository


More information about the samba-cvs mailing list