• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ NT_STATUS_EQUAL函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中NT_STATUS_EQUAL函数的典型用法代码示例。如果您正苦于以下问题:C++ NT_STATUS_EQUAL函数的具体用法?C++ NT_STATUS_EQUAL怎么用?C++ NT_STATUS_EQUAL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了NT_STATUS_EQUAL函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: try_expand

static void try_expand(struct torture_context *tctx, const struct ndr_interface_table *iface, 
		       int opnum, DATA_BLOB *base_in, int insert_ofs, int depth)
{
	DATA_BLOB stub_in, stub_out;
	int n;
	NTSTATUS status;
	struct dcerpc_pipe *p = NULL;

	reopen(tctx, &p, iface);

	/* work out how much to expand to get a non fault */
	for (n=0;n<2000;n++) {
		stub_in = data_blob(NULL, base_in->length + n);
		data_blob_clear(&stub_in);
		memcpy(stub_in.data, base_in->data, insert_ofs);
		memcpy(stub_in.data+insert_ofs+n, base_in->data+insert_ofs, base_in->length-insert_ofs);

		status = dcerpc_request(p, NULL, opnum, tctx, &stub_in, &stub_out);

		if (!NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) {
			print_depth(depth);
			printf("expand by %d gives %s\n", n, nt_errstr(status));
			if (n >= 4) {
				test_ptr_scan(tctx, iface, opnum, &stub_in, 
					      insert_ofs, insert_ofs+n, depth+1);
			}
			return;
		} else {
#if 0
			print_depth(depth);
			printf("expand by %d gives fault %s\n", n, dcerpc_errstr(tctx, p->last_fault_code));
#endif
		}
		if (p->last_fault_code == 5) {
			reopen(tctx, &p, iface);
		}
	}

	talloc_free(p);	
}
开发者ID:AllardJ,项目名称:Tomato,代码行数:40,代码来源:autoidl.c


示例2: smbcli_transport_dead

/*
  mark the transport as dead
*/
void smbcli_transport_dead(struct smbcli_transport *transport, NTSTATUS status)
{
	smbcli_sock_dead(transport->socket);

	if (NT_STATUS_EQUAL(NT_STATUS_UNSUCCESSFUL, status)) {
		status = NT_STATUS_UNEXPECTED_NETWORK_ERROR;
	}

	/* kill only the first pending receive - this is so that if
	 that async function frees the connection we don't die trying
	 to use old memory. The caller has to cope with only one
	 network error */
	if (transport->pending_recv) {
		struct smbcli_request *req = transport->pending_recv;
		req->state = SMBCLI_REQUEST_ERROR;
		req->status = status;
		DLIST_REMOVE(transport->pending_recv, req);
		if (req->async.fn) {
			req->async.fn(req);
		}
	}
}
开发者ID:Alexandr-Galko,项目名称:samba,代码行数:25,代码来源:clitransport.c


示例3: test_ptr_scan

static void test_ptr_scan(struct torture_context *tctx, const struct ndr_interface_table *iface, 
			  int opnum, DATA_BLOB *base_in, int min_ofs, int max_ofs, int depth)
{
	DATA_BLOB stub_in, stub_out;
	int ofs;
	NTSTATUS status;
	struct dcerpc_pipe *p = NULL;

	reopen(tctx, &p, iface);

	stub_in = data_blob(NULL, base_in->length);
	memcpy(stub_in.data, base_in->data, base_in->length);

	/* work out which elements are pointers */
	for (ofs=min_ofs;ofs<=max_ofs-4;ofs+=4) {
		SIVAL(stub_in.data, ofs, 1);
		status = dcerpc_request(p, NULL, opnum, tctx, &stub_in, &stub_out);

		if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) {
			print_depth(depth);
			printf("possible ptr at ofs %d - fault %s\n", 
			       ofs-min_ofs, dcerpc_errstr(tctx, p->last_fault_code));
			if (p->last_fault_code == 5) {
				reopen(tctx, &p, iface);
			}
			if (depth == 0) {
				try_expand(tctx, iface, opnum, &stub_in, ofs+4, depth+1);
			} else {
				try_expand(tctx, iface, opnum, &stub_in, max_ofs, depth+1);
			}
			SIVAL(stub_in.data, ofs, 0);
			continue;
		}
		SIVAL(stub_in.data, ofs, 0);
	}

	talloc_free(p);	
}
开发者ID:AllardJ,项目名称:Tomato,代码行数:38,代码来源:autoidl.c


示例4: gensec_ntlmssp_session_info

NTSTATUS gensec_ntlmssp_session_info(struct gensec_security *gensec_security,
				     TALLOC_CTX *mem_ctx,
				     struct auth_session_info **session_info)
{
	NTSTATUS nt_status;
	struct gensec_ntlmssp_context *gensec_ntlmssp =
		talloc_get_type_abort(gensec_security->private_data,
				      struct gensec_ntlmssp_context);
	uint32_t session_info_flags = 0;

	if (gensec_security->want_features & GENSEC_FEATURE_UNIX_TOKEN) {
		session_info_flags |= AUTH_SESSION_INFO_UNIX_TOKEN;
	}

	session_info_flags |= AUTH_SESSION_INFO_DEFAULT_GROUPS;

	if (gensec_security->auth_context && gensec_security->auth_context->generate_session_info) {
		nt_status = gensec_security->auth_context->generate_session_info(gensec_security->auth_context, mem_ctx, 
										 gensec_ntlmssp->server_returned_info,
										 gensec_ntlmssp->ntlmssp_state->user,
										 session_info_flags,
										 session_info);
	} else {
		DEBUG(0, ("Cannot generate a session_info without the auth_context\n"));
		return NT_STATUS_INTERNAL_ERROR;
	}

	NT_STATUS_NOT_OK_RETURN(nt_status);

	nt_status = gensec_ntlmssp_session_key(gensec_security, *session_info,
					       &(*session_info)->session_key);
	if (NT_STATUS_EQUAL(nt_status, NT_STATUS_NO_USER_SESSION_KEY)) {
		(*session_info)->session_key = data_blob_null;
		nt_status = NT_STATUS_OK;
	}

	return nt_status;
}
开发者ID:samba-team,项目名称:samba,代码行数:38,代码来源:gensec_ntlmssp_server.c


示例5: rids_to_names

static NTSTATUS rids_to_names(struct winbindd_domain *domain,
			      TALLOC_CTX *mem_ctx,
			      const DOM_SID *sid,
			      uint32 *rids,
			      size_t num_rids,
			      char **domain_name,
			      char ***names,
			      enum lsa_SidType **types)
{
	NTSTATUS result;

	result = msrpc_methods.rids_to_names(domain, mem_ctx, sid,
					     rids, num_rids,
					     domain_name, names, types);
	if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL)) {
		result = msrpc_methods.rids_to_names(domain, mem_ctx, sid,
						     rids, num_rids,
						     domain_name, names,
						     types);
	}

	return result;
}
开发者ID:0x24bin,项目名称:winexe-1,代码行数:23,代码来源:winbindd_reconnect.c


示例6: smb2srv_sesssetup_send

static void smb2srv_sesssetup_send(struct smb2srv_request *req, union smb_sesssetup *io)
{
	uint16_t unknown1;

	if (NT_STATUS_IS_OK(req->status)) {
		unknown1 = 0x0003;
	} else if (NT_STATUS_EQUAL(req->status, NT_STATUS_MORE_PROCESSING_REQUIRED)) {
		unknown1 = 0x0002;
	} else {
		smb2srv_send_error(req, req->status);
		return;
	}

	SMB2SRV_CHECK(smb2srv_setup_reply(req, 0x08, True, io->smb2.out.secblob.length));

	SSVAL(req->out.hdr, SMB2_HDR_UNKNOWN1,	unknown1);
	SBVAL(req->out.hdr, SMB2_HDR_UID,	io->smb2.out.uid);

	SSVAL(req->out.body, 0x02, io->smb2.out._pad);
	SMB2SRV_CHECK(smb2_push_o16s16_blob(&req->out, 0x04, io->smb2.out.secblob));

	smb2srv_send_reply(req);
}
开发者ID:Marvin-Lee,项目名称:libwmiclient,代码行数:23,代码来源:sesssetup.c


示例7: smb2srv_sesssetup_send

static void smb2srv_sesssetup_send(struct smb2srv_request *req, union smb_sesssetup *io)
{
	uint16_t credit;

	if (NT_STATUS_IS_OK(req->status)) {
		credit = 0x0003;
	} else if (NT_STATUS_EQUAL(req->status, NT_STATUS_MORE_PROCESSING_REQUIRED)) {
		credit = 0x0002;
	} else {
		smb2srv_send_error(req, req->status);
		return;
	}

	SMB2SRV_CHECK(smb2srv_setup_reply(req, 0x08, true, io->smb2.out.secblob.length));

	SSVAL(req->out.hdr, SMB2_HDR_CREDIT,	credit);
	SBVAL(req->out.hdr, SMB2_HDR_SESSION_ID,	io->smb2.out.uid);

	SSVAL(req->out.body, 0x02, io->smb2.out.session_flags);
	SMB2SRV_CHECK(smb2_push_o16s16_blob(&req->out, 0x04, io->smb2.out.secblob));

	smb2srv_send_reply(req);
}
开发者ID:endisd,项目名称:samba,代码行数:23,代码来源:sesssetup.c


示例8: auth_generic_server_authtype_start_as_root

static NTSTATUS auth_generic_server_authtype_start_as_root(TALLOC_CTX *mem_ctx,
							   uint8_t auth_type, uint8_t auth_level,
							   DATA_BLOB *token_in,
							   DATA_BLOB *token_out,
							   const struct tsocket_address *remote_address,
							   struct gensec_security **ctx)
{
	struct gensec_security *gensec_security = NULL;
	NTSTATUS status;

	status = auth_generic_prepare(talloc_tos(), remote_address, &gensec_security);
	if (!NT_STATUS_IS_OK(status)) {
		DEBUG(0, (__location__ ": auth_generic_prepare failed: %s\n",
			  nt_errstr(status)));
		return status;
	}

	status = gensec_start_mech_by_authtype(gensec_security, auth_type, auth_level);
	if (!NT_STATUS_IS_OK(status)) {
		DEBUG(0, (__location__ ": auth_generic_start failed: %s\n",
			  nt_errstr(status)));
		TALLOC_FREE(gensec_security);
		return status;
	}

	status = gensec_update(gensec_security, mem_ctx, NULL, *token_in, token_out);
	if (!NT_STATUS_IS_OK(status) && !NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED)) {
		DEBUG(2, (__location__ ": gensec_update failed: %s\n",
			  nt_errstr(status)));
		TALLOC_FREE(gensec_security);
		return status;
	}

	/* steal gensec context to the caller */
	*ctx = talloc_move(mem_ctx, &gensec_security);
	return NT_STATUS_OK;
}
开发者ID:AIdrifter,项目名称:samba,代码行数:37,代码来源:dcesrv_auth_generic.c


示例9: init_domain_recv_lsa_pipe

/* We should now have either an authenticated LSA pipe, or an error.  
 * On success, open a policy handle
 */	
static void init_domain_recv_lsa_pipe(struct composite_context *ctx)
{
	struct rpc_request *req;
	struct init_domain_state *state =
		talloc_get_type(ctx->async.private_data,
				struct init_domain_state);

	state->ctx->status = dcerpc_secondary_auth_connection_recv(ctx, state->domain,
								   &state->domain->libnet_ctx->lsa.pipe);
	if (NT_STATUS_EQUAL(state->ctx->status, NT_STATUS_LOGON_FAILURE)) {
		if (retry_with_schannel(state, state->domain->lsa_binding, 
					&ndr_table_lsarpc,
					init_domain_recv_lsa_pipe)) {
			return;
		}
	}
	if (!composite_is_ok(state->ctx)) return;

	talloc_steal(state->domain->libnet_ctx, state->domain->libnet_ctx->lsa.pipe);
	talloc_reparent(state, state->domain->libnet_ctx->lsa.pipe, state->domain->lsa_binding);
	state->domain->libnet_ctx->lsa.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
	state->domain->libnet_ctx->lsa.name = state->domain->info->name;

	ZERO_STRUCT(state->domain->libnet_ctx->lsa.handle);
	state->lsa_openpolicy.in.system_name =
		talloc_asprintf(state, "\\\\%s",
				dcerpc_server_name(state->domain->libnet_ctx->lsa.pipe));
	ZERO_STRUCT(state->objectattr);
	state->lsa_openpolicy.in.attr = &state->objectattr;
	state->lsa_openpolicy.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
	state->lsa_openpolicy.out.handle = &state->domain->libnet_ctx->lsa.handle;

	req = dcerpc_lsa_OpenPolicy2_send(state->domain->libnet_ctx->lsa.pipe, state,
					  &state->lsa_openpolicy);

	composite_continue_rpc(state->ctx, req, init_domain_recv_lsa_policy, state);
}
开发者ID:AllardJ,项目名称:Tomato,代码行数:40,代码来源:wb_init_domain.c


示例10: test_widea

/*
  see if the server recognises wide-a characters
*/
static BOOL test_widea(struct torture_context *tctx, 
					   struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
{
	const uint32_t name1[] = {'a'};
	const uint32_t name2[] = {0xff41};
	const uint32_t name3[] = {0xff21};
	NTSTATUS status;

	printf("Testing wide-a\n");
	
	status = unicode_open(tctx, cli->tree, mem_ctx, NTCREATEX_DISP_CREATE, name1, 1);

	if (!NT_STATUS_IS_OK(status)) {
		printf("Failed to create 'a' - %s\n",
		       nt_errstr(status));
		return False;
	}

	status = unicode_open(tctx, cli->tree, mem_ctx, NTCREATEX_DISP_CREATE, name2, 1);

	if (!NT_STATUS_IS_OK(status)) {
		printf("Failed to create wide-a - %s\n",
		       nt_errstr(status));
		return False;
	}

	status = unicode_open(tctx, cli->tree, mem_ctx, NTCREATEX_DISP_CREATE, name3, 1);

	if (!NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_COLLISION)) {
		printf("Expected %s creating wide-A - %s\n",
		       nt_errstr(NT_STATUS_OBJECT_NAME_COLLISION),
		       nt_errstr(status));
		return False;
	}

	return True;
}
开发者ID:Marvin-Lee,项目名称:libwmiclient,代码行数:40,代码来源:charset.c


示例11: posix_eadb_getattr

static ssize_t posix_eadb_getattr(struct tdb_wrap *db_ctx,
				 const char *fname, int fd,
				 const char *name, void *value, size_t size)
{
	ssize_t result = -1;
	NTSTATUS status;
	DATA_BLOB blob;

	DEBUG(10, ("posix_eadb_getattr called for file %s/fd %d, name %s\n",
		   fname, fd, name));

	status = pull_xattr_blob_tdb_raw(db_ctx, talloc_tos(), name, fname, fd, size, &blob);

	if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_FOUND)) {
		errno = ENOATTR;
		return -1;
	}

	if (!NT_STATUS_IS_OK(status)) {
		DEBUG(10, ("posix_eadb_fetch_attrs failed: %s\n",
			   nt_errstr(status)));
		errno = EINVAL;
		return -1;
	}

	if (blob.length > size) {
		errno = ERANGE;
		goto fail;
	}

	memcpy(value, blob.data, blob.length);
	result = blob.length;

 fail:
	return result;
}
开发者ID:AIdrifter,项目名称:samba,代码行数:36,代码来源:vfs_posix_eadb.c


示例12: auth_get_user_info_dc_principal

/****************************************************************************
Used in the gensec_gssapi and gensec_krb5 server-side code, where the
PAC isn't available, and for tokenGroups in the DSDB stack.

 Supply either a principal or a DN
****************************************************************************/
_PUBLIC_ NTSTATUS auth_get_user_info_dc_principal(TALLOC_CTX *mem_ctx,
						 struct auth_context *auth_ctx,
						 const char *principal,
						 struct ldb_dn *user_dn,
						 struct auth_user_info_dc **user_info_dc)
{
	NTSTATUS nt_status;
	struct auth_method_context *method;

	for (method = auth_ctx->methods; method; method = method->next) {
		if (!method->ops->get_user_info_dc_principal) {
			continue;
		}

		nt_status = method->ops->get_user_info_dc_principal(mem_ctx, auth_ctx, principal, user_dn, user_info_dc);
		if (NT_STATUS_EQUAL(nt_status, NT_STATUS_NOT_IMPLEMENTED)) {
			continue;
		}

		return nt_status;
	}

	return NT_STATUS_NOT_IMPLEMENTED;
}
开发者ID:Alexandr-Galko,项目名称:samba,代码行数:30,代码来源:auth.c


示例13: lookup_groupmem

/* Lookup group membership given a rid.   */
static NTSTATUS lookup_groupmem(struct winbindd_domain *domain,
				TALLOC_CTX *mem_ctx,
				const DOM_SID *group_sid,
				enum lsa_SidType type,
				uint32 *num_names,
				DOM_SID **sid_mem, char ***names, 
				uint32 **name_types)
{
	NTSTATUS result;

	result = msrpc_methods.lookup_groupmem(domain, mem_ctx,
					       group_sid, type, num_names,
					       sid_mem, names,
					       name_types);

	if (NT_STATUS_EQUAL(result, NT_STATUS_UNSUCCESSFUL))
		result = msrpc_methods.lookup_groupmem(domain, mem_ctx,
						       group_sid, type,
						       num_names,
						       sid_mem, names,
						       name_types);

	return result;
}
开发者ID:0x24bin,项目名称:winexe-1,代码行数:25,代码来源:winbindd_reconnect.c


示例14: smb2_session_setup_recv

/**
  recv a session setup reply
*/
NTSTATUS smb2_session_setup_recv(struct smb2_request *req, TALLOC_CTX *mem_ctx, 
				 struct smb2_session_setup *io)
{
	NTSTATUS status;

	if (!smb2_request_receive(req) || 
	    (smb2_request_is_error(req) && 
	     !NT_STATUS_EQUAL(req->status, NT_STATUS_MORE_PROCESSING_REQUIRED))) {
		return smb2_request_destroy(req);
	}

	SMB2_CHECK_PACKET_RECV(req, 0x08, true);

	io->out.session_flags = SVAL(req->in.body, 0x02);
	io->out.uid           = BVAL(req->in.hdr,  SMB2_HDR_SESSION_ID);
	
	status = smb2_pull_o16s16_blob(&req->in, mem_ctx, req->in.body+0x04, &io->out.secblob);
	if (!NT_STATUS_IS_OK(status)) {
		smb2_request_destroy(req);
		return status;
	}

	return smb2_request_destroy(req);
}
开发者ID:0x24bin,项目名称:winexe-1,代码行数:27,代码来源:session.c


示例15: nfs4acl_xattr_get_nt_acl

static NTSTATUS nfs4acl_xattr_get_nt_acl(struct vfs_handle_struct *handle,
				  const char *name, uint32_t security_info,
				  TALLOC_CTX *mem_ctx,
				  struct security_descriptor **ppdesc)
{
	struct SMB4ACL_T *pacl;
	NTSTATUS status;
	TALLOC_CTX *frame = talloc_stackframe();

	status = nfs4_get_nfs4_acl(handle, frame, name, &pacl);
	if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_FOUND)) {
		pacl = nfs4acls_inheritacl(handle, name, frame);
	}
	else if (!NT_STATUS_IS_OK(status)) {
		TALLOC_FREE(frame);
		return status;
	}

	status = smb_get_nt_acl_nfs4(handle->conn, name, security_info,
				     mem_ctx, ppdesc,
				     pacl);
	TALLOC_FREE(frame);
	return status;
}
开发者ID:Distrotech,项目名称:samba,代码行数:24,代码来源:vfs_nfs4acl_xattr.c


示例16: samba_kdc_map_policy_err

/* function to map policy errors */
krb5_error_code samba_kdc_map_policy_err(NTSTATUS nt_status)
{
	krb5_error_code ret;

	if (NT_STATUS_EQUAL(nt_status, NT_STATUS_PASSWORD_MUST_CHANGE))
		ret = KRB5KDC_ERR_KEY_EXPIRED;
	else if (NT_STATUS_EQUAL(nt_status, NT_STATUS_PASSWORD_EXPIRED))
		ret = KRB5KDC_ERR_KEY_EXPIRED;
	else if (NT_STATUS_EQUAL(nt_status, NT_STATUS_ACCOUNT_EXPIRED))
		ret = KRB5KDC_ERR_CLIENT_REVOKED;
	else if (NT_STATUS_EQUAL(nt_status, NT_STATUS_ACCOUNT_DISABLED))
		ret = KRB5KDC_ERR_CLIENT_REVOKED;
	else if (NT_STATUS_EQUAL(nt_status, NT_STATUS_INVALID_LOGON_HOURS))
		ret = KRB5KDC_ERR_CLIENT_REVOKED;
	else if (NT_STATUS_EQUAL(nt_status, NT_STATUS_ACCOUNT_LOCKED_OUT))
		ret = KRB5KDC_ERR_CLIENT_REVOKED;
	else if (NT_STATUS_EQUAL(nt_status, NT_STATUS_INVALID_WORKSTATION))
		ret = KRB5KDC_ERR_POLICY;
	else
		ret = KRB5KDC_ERR_POLICY;

	return ret;
}
开发者ID:Alexandr-Galko,项目名称:samba,代码行数:24,代码来源:pac-glue.c


示例17: connect_to_service

NTSTATUS connect_to_service(struct net_context *c,
					struct cli_state **cli_ctx,
					struct sockaddr_storage *server_ss,
					const char *server_name,
					const char *service_name,
					const char *service_type)
{
	NTSTATUS nt_status;
	int flags = 0;

	c->opt_password = net_prompt_pass(c, c->opt_user_name);

	if (c->opt_kerberos) {
		flags |= CLI_FULL_CONNECTION_USE_KERBEROS;
	}

	if (c->opt_kerberos && c->opt_password) {
		flags |= CLI_FULL_CONNECTION_FALLBACK_AFTER_KERBEROS;
	}

	if (c->opt_ccache) {
		flags |= CLI_FULL_CONNECTION_USE_CCACHE;
	}

	nt_status = cli_full_connection(cli_ctx, NULL, server_name,
					server_ss, c->opt_port,
					service_name, service_type,
					c->opt_user_name, c->opt_workgroup,
					c->opt_password, flags, Undefined);
	if (!NT_STATUS_IS_OK(nt_status)) {
		d_fprintf(stderr, _("Could not connect to server %s\n"),
			  server_name);

		/* Display a nicer message depending on the result */

		if (NT_STATUS_V(nt_status) ==
		    NT_STATUS_V(NT_STATUS_LOGON_FAILURE))
			d_fprintf(stderr,
				  _("The username or password was not "
				    "correct.\n"));

		if (NT_STATUS_V(nt_status) ==
		    NT_STATUS_V(NT_STATUS_ACCOUNT_LOCKED_OUT))
			d_fprintf(stderr, _("The account was locked out.\n"));

		if (NT_STATUS_V(nt_status) ==
		    NT_STATUS_V(NT_STATUS_ACCOUNT_DISABLED))
			d_fprintf(stderr, _("The account was disabled.\n"));
		return nt_status;
	}

	if (c->smb_encrypt) {
		nt_status = cli_force_encryption(*cli_ctx,
					c->opt_user_name,
					c->opt_password,
					c->opt_workgroup);

		if (NT_STATUS_EQUAL(nt_status,NT_STATUS_NOT_SUPPORTED)) {
			d_printf(_("Encryption required and "
				"server that doesn't support "
				"UNIX extensions - failing connect\n"));
		} else if (NT_STATUS_EQUAL(nt_status,NT_STATUS_UNKNOWN_REVISION)) {
			d_printf(_("Encryption required and "
				"can't get UNIX CIFS extensions "
				"version from server.\n"));
		} else if (NT_STATUS_EQUAL(nt_status,NT_STATUS_UNSUPPORTED_COMPRESSION)) {
			d_printf(_("Encryption required and "
				"share %s doesn't support "
				"encryption.\n"), service_name);
		} else if (!NT_STATUS_IS_OK(nt_status)) {
			d_printf(_("Encryption required and "
				"setup failed with error %s.\n"),
				nt_errstr(nt_status));
		}

		if (!NT_STATUS_IS_OK(nt_status)) {
			cli_shutdown(*cli_ctx);
			*cli_ctx = NULL;
		}
	}

	return nt_status;
}
开发者ID:Alexandr-Galko,项目名称:samba,代码行数:83,代码来源:net_util.c


示例18: process_lockingX

static bool process_lockingX(struct blocking_lock_record *blr)
{
	unsigned char locktype = CVAL(blr->req->vwv+3, 0);
	files_struct *fsp = blr->fsp;
	uint16 num_ulocks = SVAL(blr->req->vwv+6, 0);
	uint16 num_locks = SVAL(blr->req->vwv+7, 0);
	uint64_t count = (uint64_t)0, offset = (uint64_t)0;
	uint32 lock_pid;
	bool large_file_format = (locktype & LOCKING_ANDX_LARGE_FILES);
	uint8_t *data;
	NTSTATUS status = NT_STATUS_OK;

	data = (uint8_t *)blr->req->buf
		+ ((large_file_format ? 20 : 10)*num_ulocks);

	/* 
	 * Data now points at the beginning of the list
	 * of smb_lkrng structs.
	 */

	for(; blr->lock_num < num_locks; blr->lock_num++) {
		struct byte_range_lock *br_lck = NULL;
		bool err;

		lock_pid = get_lock_pid( data, blr->lock_num, large_file_format);
		count = get_lock_count( data, blr->lock_num, large_file_format);
		offset = get_lock_offset( data, blr->lock_num, large_file_format, &err);

		/*
		 * We know err cannot be set as if it was the lock
		 * request would never have been queued. JRA.
		 */
		errno = 0;
		br_lck = do_lock(smbd_messaging_context(),
				fsp,
				lock_pid,
				count,
				offset, 
				((locktype & LOCKING_ANDX_SHARED_LOCK) ?
					READ_LOCK : WRITE_LOCK),
				WINDOWS_LOCK,
				True,
				&status,
				&blr->blocking_pid,
				blr);

		TALLOC_FREE(br_lck);

		if (NT_STATUS_IS_ERR(status)) {
			break;
		}
	}

	if(blr->lock_num == num_locks) {
		/*
		 * Success - we got all the locks.
		 */

		DEBUG(3,("process_lockingX file = %s, fnum=%d type=%d num_locks=%d\n",
			 fsp->fsp_name, fsp->fnum, (unsigned int)locktype, num_locks) );

		reply_lockingX_success(blr);
		return True;
	}

	if (!NT_STATUS_EQUAL(status,NT_STATUS_LOCK_NOT_GRANTED) &&
	    !NT_STATUS_EQUAL(status,NT_STATUS_FILE_LOCK_CONFLICT)) {
		/*
		 * We have other than a "can't get lock"
		 * error. Free any locks we had and return an error.
		 * Return True so we get dequeued.
		 */
		blocking_lock_reply_error(blr, status);
		return True;
	}

	/*
	 * Still can't get all the locks - keep waiting.
	 */

	DEBUG(10,("process_lockingX: only got %d locks of %d needed for file %s, fnum = %d. \
Waiting....\n", 
		  blr->lock_num, num_locks, fsp->fsp_name, fsp->fnum));

	return False;
}
开发者ID:gojdic,项目名称:samba,代码行数:86,代码来源:blocking.c


示例19: net_rpc_join_ok

/**
 * confirm that a domain join is still valid
 *
 * @return A shell status integer (0 for success)
 *
 **/
NTSTATUS net_rpc_join_ok(struct net_context *c, const char *domain,
			 const char *server, struct sockaddr_storage *pss)
{
	enum security_types sec;
	unsigned int conn_flags = NET_FLAGS_PDC;
	uint32_t neg_flags = NETLOGON_NEG_AUTH2_ADS_FLAGS;
	struct cli_state *cli = NULL;
	struct rpc_pipe_client *pipe_hnd = NULL;
	struct rpc_pipe_client *netlogon_pipe = NULL;
	NTSTATUS ntret = NT_STATUS_UNSUCCESSFUL;

	sec = (enum security_types)lp_security();

	if (sec == SEC_ADS) {
		/* Connect to IPC$ using machine account's credentials. We don't use anonymous
		   connection here, as it may be denied by server's local policy. */
		net_use_machine_account(c);

	} else {
		/* some servers (e.g. WinNT) don't accept machine-authenticated
		   smb connections */
		conn_flags |= NET_FLAGS_ANONYMOUS;
	}

	/* Connect to remote machine */
	ntret = net_make_ipc_connection_ex(c, domain, server, pss, conn_flags,
					   &cli);
	if (!NT_STATUS_IS_OK(ntret)) {
		return ntret;
	}

	/* Setup the creds as though we're going to do schannel... */
	ntret = get_schannel_session_key(cli, domain, &neg_flags,
					 &netlogon_pipe);

	/* We return NT_STATUS_INVALID_NETWORK_RESPONSE if the server is refusing
	   to negotiate schannel, but the creds were set up ok. That'll have to do. */

        if (!NT_STATUS_IS_OK(ntret)) {
		if (NT_STATUS_EQUAL(ntret, NT_STATUS_INVALID_NETWORK_RESPONSE)) {
			cli_shutdown(cli);
			return NT_STATUS_OK;
		} else {
			DEBUG(0,("net_rpc_join_ok: failed to get schannel session "
					"key from server %s for domain %s. Error was %s\n",
				cli->desthost, domain, nt_errstr(ntret) ));
			cli_shutdown(cli);
			return ntret;
		}
	}

	/* Only do the rest of the schannel test if the client is allowed to do this. */
	if (!lp_client_schannel()) {
		cli_shutdown(cli);
		/* We're good... */
		return ntret;
	}

	ntret = cli_rpc_pipe_open_schannel_with_key(
		cli, &ndr_table_netlogon.syntax_id, NCACN_NP,
		DCERPC_AUTH_LEVEL_PRIVACY,
		domain, &netlogon_pipe->dc, &pipe_hnd);

	if (!NT_STATUS_IS_OK(ntret)) {
		DEBUG(0,("net_rpc_join_ok: failed to open schannel session "
				"on netlogon pipe to server %s for domain %s. Error was %s\n",
			cli->desthost, domain, nt_errstr(ntret) ));
		/*
		 * Note: here, we have:
		 * (pipe_hnd != NULL) if and only if NT_STATUS_IS_OK(ntret)
		 */
	}

	cli_shutdown(cli);
	return ntret;
}
开发者ID:nikatshun,项目名称:asuswrt-merlin,代码行数:82,代码来源:net_rpc_join.c


示例20: net_rpc_join_newstyle


//.........这里部分代码省略.........
						&result),
		      "could not open domain");

	/* Create domain user */
	if ((acct_name = talloc_asprintf(mem_ctx, "%s$", global_myname())) == NULL) {
		status = NT_STATUS_NO_MEMORY;
		goto done;
	}
	strlower_m(acct_name);

	init_lsa_String(&lsa_acct_name, acct_name);

	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;

	DEBUG(10, ("Creating account with flags: %d\n",acct_flags));

	status = dcerpc_samr_CreateUser2(b, mem_ctx,
					 &domain_pol,
					 &lsa_acct_name,
					 acb_info,
					 acct_flags,
					 &user_pol,
					 &access_granted,
					 &user_rid,
					 &result);
	if (!NT_STATUS_IS_OK(status)) {
		goto done;
	}
	if (!NT_STATUS_IS_OK(result) &&
	    !NT_STATUS_EQUAL(result, NT_STATUS_USER_EXISTS)) {
		status = result;
		d_fprintf(stderr,_("Creation of workstation account failed\n"));

		/* If NT_STATUS_ACCESS_DENIED then we have a valid
		   username/password combo but the user does not have
		   administrator access. */

		if (NT_STATUS_V(result) == NT_STATUS_V(NT_STATUS_ACCESS_DENIED))
			d_fprintf(stderr, _("User specified does not have "
					    "administrator privileges\n"));

		goto done;
	}

	/* We *must* do this.... don't ask... */

	if (NT_STATUS_IS_OK(result)) {
		dcerpc_samr_Close(b, mem_ctx, &user_pol, &result);
	}

	CHECK_DCERPC_ERR_DEBUG(dcerpc_samr_LookupNames(b, mem_ctx,
						       &domain_pol,
						       1,
						       &lsa_acct_name,
						       &user_rids,
						       &name_types,
						       &result),
			    ("error looking up rid for user %s: %s/%s\n",
			     acct_name, nt_errstr(status), nt_errstr(result)));

	if (user_rids.count != 1) {
		status = NT_STATUS_INVALID_NETWORK_RESPONSE;
开发者ID:nikatshun,项目名称:asuswrt-merlin,代码行数:67,代码来源:net_rpc_join.c



注:本文中的NT_STATUS_EQUAL函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ NT_STATUS_HAVE_NO_MEMORY函数代码示例发布时间:2022-05-30
下一篇:
C++ NT_ASSERT函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap