[SCM] Samba Shared Repository - branch v3-2-test updated - release-3-2-0pre2-940-ge68daef

Günther Deschner gd at samba.org
Wed Apr 16 08:11:10 GMT 2008


The branch, v3-2-test has been updated
       via  e68daef0ee051515c8f489820fde9110747e8aa6 (commit)
      from  4868b4ea1a18d4218330c49bf57818c4b5117d1d (commit)

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


- Log -----------------------------------------------------------------
commit e68daef0ee051515c8f489820fde9110747e8aa6
Author: Günther Deschner <gd at samba.org>
Date:   Wed Apr 16 02:45:00 2008 +0200

    net: Remove unused rpc_user_add/del_internals code.
    
    Guenther

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

Summary of changes:
 source/utils/net_rpc.c |  257 ------------------------------------------------
 1 files changed, 0 insertions(+), 257 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/utils/net_rpc.c b/source/utils/net_rpc.c
index d0e0487..9394779 100644
--- a/source/utils/net_rpc.c
+++ b/source/utils/net_rpc.c
@@ -571,156 +571,6 @@ static int rpc_user_usage(int argc, const char **argv)
 /** 
  * Add a new user to a remote RPC server
  *
- * All parameters are provided by the run_rpc_command function, except for
- * argc, argv which are passes through. 
- *
- * @param domain_sid The domain sid acquired from the remote server
- * @param cli A cli_state connected to the server.
- * @param mem_ctx Talloc context, destoyed on completion of the function.
- * @param argc  Standard main() style argc
- * @param argv  Standard main() style argv.  Initial components are already
- *              stripped
- *
- * @return Normal NTSTATUS return.
- **/
-
-static NTSTATUS rpc_user_add_internals(const DOM_SID *domain_sid,
-				const char *domain_name, 
-				struct cli_state *cli,
-				struct rpc_pipe_client *pipe_hnd,
-				TALLOC_CTX *mem_ctx, 
-				int argc, const char **argv)
-{
-	
-	POLICY_HND connect_pol, domain_pol, user_pol;
-	NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
-	const char *acct_name;
-	struct lsa_String lsa_acct_name;
-	uint32 acb_info;
-	uint32 acct_flags, user_rid;
-	uint32_t access_granted = 0;
-	struct samr_Ids user_rids, name_types;
-
-	if (argc < 1) {
-		d_printf("User must be specified\n");
-		rpc_user_usage(argc, argv);
-		return NT_STATUS_OK;
-	}
-
-	acct_name = argv[0];
-	init_lsa_String(&lsa_acct_name, acct_name);
-
-	/* Get sam policy handle */
-
-	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;
-	}
-	
-	/* Get domain policy handle */
-
-	result = rpccli_samr_OpenDomain(pipe_hnd, mem_ctx,
-					&connect_pol,
-					MAXIMUM_ALLOWED_ACCESS,
-					CONST_DISCARD(struct dom_sid2 *, domain_sid),
-					&domain_pol);
-	if (!NT_STATUS_IS_OK(result)) {
-		goto done;
-	}
-
-	/* Create domain user */
-
-	acb_info = ACB_NORMAL;
-	acct_flags = SEC_GENERIC_READ | SEC_GENERIC_WRITE | SEC_GENERIC_EXECUTE |
-		     SEC_STD_WRITE_DAC | SEC_STD_DELETE |
-		     SAMR_USER_ACCESS_SET_PASSWORD |
-		     SAMR_USER_ACCESS_GET_ATTRIBUTES |
-		     SAMR_USER_ACCESS_SET_ATTRIBUTES;
-
-	result = rpccli_samr_CreateUser2(pipe_hnd, mem_ctx,
-					 &domain_pol,
-					 &lsa_acct_name,
-					 acb_info,
-					 acct_flags,
-					 &user_pol,
-					 &access_granted,
-					 &user_rid);
-
-	if (!NT_STATUS_IS_OK(result)) {
-		goto done;
-	}
-
-	if (argc == 2) {
-
-		union samr_UserInfo info;
-		uchar pwbuf[516];
-
-		result = rpccli_samr_LookupNames(pipe_hnd, mem_ctx,
-						 &domain_pol,
-						 1,
-						 &lsa_acct_name,
-						 &user_rids,
-						 &name_types);
-
-		if (!NT_STATUS_IS_OK(result)) {
-			goto done;
-		}
-
-		result = rpccli_samr_OpenUser(pipe_hnd, mem_ctx,
-					      &domain_pol,
-					      MAXIMUM_ALLOWED_ACCESS,
-					      user_rids.ids[0],
-					      &user_pol);
-
-		if (!NT_STATUS_IS_OK(result)) {
-			goto done;
-		}
-
-		/* Set password on account */
-
-		encode_pw_buffer(pwbuf, argv[1], STR_UNICODE);
-
-		init_samr_user_info24(&info.info24, pwbuf, 24);
-
-		SamOEMhashBlob(info.info24.password.data, 516,
-			       &cli->user_session_key);
-
-		result = rpccli_samr_SetUserInfo2(pipe_hnd, mem_ctx,
-						  &user_pol,
-						  24,
-						  &info);
-
-		if (!NT_STATUS_IS_OK(result)) {
-			d_fprintf(stderr, "Failed to set password for user %s - %s\n", 
-				 acct_name, nt_errstr(result));
-
-			result = rpccli_samr_DeleteUser(pipe_hnd, mem_ctx,
-							&user_pol);
-
-			if (!NT_STATUS_IS_OK(result)) {
-				d_fprintf(stderr, "Failed to delete user %s - %s\n", 
-					 acct_name, nt_errstr(result));
-				 return result;
-			}
-		}
-
-	}
- done:
-	if (!NT_STATUS_IS_OK(result)) {
-		d_fprintf(stderr, "Failed to add user '%s' with %s.\n",
-			  acct_name, nt_errstr(result));
-	} else {
-		d_printf("Added user '%s'.\n", acct_name);
-	}
-	return result;
-}
-
-/** 
- * Add a new user to a remote RPC server
- *
  * @param argc  Standard main() style argc
  * @param argv  Standard main() style argv.  Initial components are already
  *              stripped
@@ -761,113 +611,6 @@ static int rpc_user_add(int argc, const char **argv)
 }
 
 /** 
- * Delete a user from a remote RPC server
- *
- * All parameters are provided by the run_rpc_command function, except for
- * argc, argv which are passes through. 
- *
- * @param domain_sid The domain sid acquired from the remote server
- * @param cli A cli_state connected to the server.
- * @param mem_ctx Talloc context, destoyed on completion of the function.
- * @param argc  Standard main() style argc
- * @param argv  Standard main() style argv.  Initial components are already
- *              stripped
- *
- * @return Normal NTSTATUS return.
- **/
-
-static NTSTATUS rpc_user_del_internals(const DOM_SID *domain_sid, 
-					const char *domain_name, 
-					struct cli_state *cli, 
-					struct rpc_pipe_client *pipe_hnd,
-					TALLOC_CTX *mem_ctx, 
-					int argc,
-					const char **argv)
-{
-	NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
-	POLICY_HND connect_pol, domain_pol, user_pol;
-	const char *acct_name;
-
-	if (argc < 1) {
-		d_printf("User must be specified\n");
-		rpc_user_usage(argc, argv);
-		return NT_STATUS_OK;
-	}
-
-	acct_name = argv[0];
-
-	/* Get sam policy and domain handles */
-
-	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;
-	}
-
-	result = rpccli_samr_OpenDomain(pipe_hnd, mem_ctx,
-					&connect_pol,
-					MAXIMUM_ALLOWED_ACCESS,
-					CONST_DISCARD(struct dom_sid2 *, domain_sid),
-					&domain_pol);
-
-	if (!NT_STATUS_IS_OK(result)) {
-		goto done;
-	}
-
-	/* Get handle on user */
-
-	{
-		struct samr_Ids user_rids, name_types;
-		struct lsa_String lsa_acct_name;
-
-		init_lsa_String(&lsa_acct_name, acct_name);
-
-		result = rpccli_samr_LookupNames(pipe_hnd, mem_ctx,
-						 &domain_pol,
-						 1,
-						 &lsa_acct_name,
-						 &user_rids,
-						 &name_types);
-
-		if (!NT_STATUS_IS_OK(result)) {
-			goto done;
-		}
-
-		result = rpccli_samr_OpenUser(pipe_hnd, mem_ctx,
-					      &domain_pol,
-					      MAXIMUM_ALLOWED_ACCESS,
-					      user_rids.ids[0],
-					      &user_pol);
-
-		if (!NT_STATUS_IS_OK(result)) {
-			goto done;
-		}
-	}
-
-	/* Delete user */
-
-	result = rpccli_samr_DeleteUser(pipe_hnd, mem_ctx,
-					&user_pol);
-
-	if (!NT_STATUS_IS_OK(result)) {
-		goto done;
-	}
-
- done:
-	if (!NT_STATUS_IS_OK(result)) {
-                d_fprintf(stderr, "Failed to delete user '%s' with %s.\n",
-			  acct_name, nt_errstr(result));
-        } else {
-                d_printf("Deleted user '%s'.\n", acct_name);
-        }
-
-	return result;
-}
-
-/** 
  * Rename a user on a remote RPC server
  *
  * All parameters are provided by the run_rpc_command function, except for


-- 
Samba Shared Repository


More information about the samba-cvs mailing list