您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ talloc_init函数代码示例

51自学网 2021-06-03 08:39:48
  C++
这篇教程C++ talloc_init函数代码示例写得很实用,希望能帮到您。

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

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

示例1: torture_raw_streams

/*    basic testing of streams calls*/BOOL torture_raw_streams(struct torture_context *torture){	struct smbcli_state *cli;	BOOL ret = True;	TALLOC_CTX *mem_ctx;	if (!torture_open_connection(&cli, 0)) {		return False;	}	mem_ctx = talloc_init("torture_raw_streams");	if (!torture_setup_dir(cli, BASEDIR)) {		return False;	}	ret &= test_stream_io(cli, mem_ctx);	smb_raw_exit(cli->session);	smbcli_deltree(cli->tree, BASEDIR);	torture_close_connection(cli);	talloc_free(mem_ctx);	return ret;}
开发者ID:Marvin-Lee,项目名称:libwmiclient,代码行数:28,


示例2: atalk_chmod

static int atalk_chmod(struct vfs_handle_struct *handle, const char *path, mode_t mode){	int ret = 0;	char *adbl_path = 0;	char *orig_path = 0;	SMB_STRUCT_STAT adbl_info;	SMB_STRUCT_STAT orig_info;	TALLOC_CTX *ctx;	ret = SMB_VFS_NEXT_CHMOD(handle, path, mode);	if (!path) return ret;	if (!(ctx = talloc_init("chmod_file")))		return ret;	if (atalk_build_paths(ctx, handle->conn->origpath, path, &adbl_path,			      &orig_path, &adbl_info, &orig_info,			      false) != 0)		goto exit_chmod;	if (!S_ISDIR(orig_info.st_ex_mode) && !S_ISREG(orig_info.st_ex_mode)) {		DEBUG(3, ("ATALK: %s has passed../n", orig_path));				goto exit_chmod;	}	chmod(adbl_path, ADOUBLEMODE);exit_chmod:		talloc_destroy(ctx);	return ret;}
开发者ID:Alexandr-Galko,项目名称:samba,代码行数:32,


示例3: atalk_rmdir

static int atalk_rmdir(struct vfs_handle_struct *handle,			const struct smb_filename *smb_fname){	bool add = False;	TALLOC_CTX *ctx = 0;	const char *path = smb_fname->base_name;	char *dpath;	if (!handle->conn->cwd || !path) goto exit_rmdir;	/* due to there is no way to change bDeleteVetoFiles variable	 * from this module, gotta use talloc stuff..	 */	strstr_m(path, APPLEDOUBLE) ? (add = False) : (add = True);	if (!(ctx = talloc_init("remove_directory")))		goto exit_rmdir;	if (!(dpath = talloc_asprintf(ctx, "%s/%s%s", 	  handle->conn->cwd, path, add ? "/"APPLEDOUBLE : "")))		goto exit_rmdir;	atalk_rrmdir(ctx, dpath);exit_rmdir:	talloc_destroy(ctx);	return SMB_VFS_NEXT_RMDIR(handle, smb_fname);}
开发者ID:DanilKorotenko,项目名称:samba,代码行数:29,


示例4: atalk_lchown

static int atalk_lchown(struct vfs_handle_struct *handle,			const struct smb_filename *smb_fname,			uid_t uid,			gid_t gid){	int ret = 0;	char *adbl_path = 0;	char *orig_path = 0;	SMB_STRUCT_STAT adbl_info;	SMB_STRUCT_STAT orig_info;	TALLOC_CTX *ctx;	ret = SMB_VFS_NEXT_LCHOWN(handle, smb_fname, uid, gid);	if (!(ctx = talloc_init("lchown_file")))		return ret;	if (atalk_build_paths(ctx, handle->conn->cwd, smb_fname->base_name,			      &adbl_path, &orig_path,			      &adbl_info, &orig_info) != 0)		goto exit_lchown;	if (!S_ISDIR(orig_info.st_ex_mode) && !S_ISREG(orig_info.st_ex_mode)) {		DEBUG(3, ("ATALK: %s has passed../n", orig_path));				goto exit_lchown;	}	if (lchown(adbl_path, uid, gid) == -1) {		DEBUG(3, ("ATALK: lchown error %s/n", strerror(errno)));	}exit_lchown:		talloc_destroy(ctx);	return ret;}
开发者ID:DanilKorotenko,项目名称:samba,代码行数:35,


示例5: torture_rpc_epmapper

BOOL torture_rpc_epmapper(struct torture_context *torture){        NTSTATUS status;        struct dcerpc_pipe *p;	TALLOC_CTX *mem_ctx;	BOOL ret = True;	mem_ctx = talloc_init("torture_rpc_epmapper");	status = torture_rpc_connection(mem_ctx, &p, &dcerpc_table_epmapper);	if (!NT_STATUS_IS_OK(status)) {		talloc_free(mem_ctx);		return False;	}	if (!test_Lookup(p, mem_ctx)) {		ret = False;	}	if (!test_Insert(p, mem_ctx)) {		ret = False;	}	if (!test_InqObject(p, mem_ctx)) {		ret = False;	}	talloc_free(mem_ctx);	return ret;}
开发者ID:Marvin-Lee,项目名称:libwmiclient,代码行数:31,


示例6: dcerpc_floor_get_lhs_data

_PUBLIC_ NTSTATUS dcerpc_floor_get_lhs_data(const struct epm_floor *epm_floor,					    struct ndr_syntax_id *syntax){	TALLOC_CTX *mem_ctx = talloc_init("floor_get_lhs_data");	struct ndr_pull *ndr;	enum ndr_err_code ndr_err;	uint16_t if_version=0;	ndr = ndr_pull_init_blob(&epm_floor->lhs.lhs_data, mem_ctx);	if (ndr == NULL) {		talloc_free(mem_ctx);		return NT_STATUS_NO_MEMORY;	}	ndr->flags |= LIBNDR_FLAG_NOALIGN;	ndr_err = ndr_pull_GUID(ndr, NDR_SCALARS | NDR_BUFFERS, &syntax->uuid);	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {		talloc_free(mem_ctx);		return ndr_map_error2ntstatus(ndr_err);	}	ndr_err = ndr_pull_uint16(ndr, NDR_SCALARS, &if_version);	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {		talloc_free(mem_ctx);		return ndr_map_error2ntstatus(ndr_err);	}	syntax->if_version = if_version;	talloc_free(mem_ctx);	return NT_STATUS_OK;}
开发者ID:andrew-aladev,项目名称:samba-talloc-debug,代码行数:33,


示例7: msg_pool_usage

/** * Respond to a POOL_USAGE message by sending back string form of memory * usage stats. **/static void msg_pool_usage(struct messaging_context *msg_ctx,			   void *private_data, 			   uint32_t msg_type, 			   struct server_id src,			   DATA_BLOB *data){	struct msg_pool_usage_state state;	SMB_ASSERT(msg_type == MSG_REQ_POOL_USAGE);		DEBUG(2,("Got POOL_USAGE/n"));	state.mem_ctx = talloc_init("msg_pool_usage");	if (!state.mem_ctx) {		return;	}	state.len	= 0;	state.buflen	= 512;	state.s		= NULL;	talloc_report_depth_cb(NULL, 0, -1, msg_pool_usage_helper, &state);	if (!state.s) {		talloc_destroy(state.mem_ctx);		return;	}		messaging_send_buf(msg_ctx, src, MSG_POOL_USAGE,			   (uint8 *)state.s, strlen(state.s)+1);	talloc_destroy(state.mem_ctx);}
开发者ID:jameshilliard,项目名称:WECB-BH-GPL,代码行数:36,


示例8: security_token_debug

/**************************************************************************** prints a struct security_token to debug output.****************************************************************************/void security_token_debug(int dbg_lev, const struct security_token *token){	TALLOC_CTX *mem_ctx;	int i;	if (!token) {		DEBUG(dbg_lev, ("Security token: (NULL)/n"));		return;	}	mem_ctx = talloc_init("security_token_debug()");	if (!mem_ctx) {		return;	}	DEBUG(dbg_lev, ("Security token of user %s/n",				    dom_sid_string(mem_ctx, token->user_sid) ));	DEBUGADD(dbg_lev, (" SIDs (%lu):/n", 				       (unsigned long)token->num_sids));	for (i = 0; i < token->num_sids; i++) {		DEBUGADD(dbg_lev, ("  SID[%3lu]: %s/n", (unsigned long)i, 			   dom_sid_string(mem_ctx, token->sids[i])));	}	security_token_debug_privileges(dbg_lev, token);	talloc_free(mem_ctx);}
开发者ID:gojdic,项目名称:samba,代码行数:31,


示例9:

static PyObject *samr_delete_dom_user(PyObject *self, PyObject *args, 				      PyObject *kw){	samr_user_hnd_object *user_hnd = (samr_user_hnd_object *)self;	static char *kwlist[] = { NULL };	NTSTATUS ntstatus;	TALLOC_CTX *mem_ctx;	PyObject *result = NULL;		if (!PyArg_ParseTupleAndKeywords(		    args, kw, "", kwlist))		return NULL;	if (!(mem_ctx = talloc_init("samr_delete_dom_user"))) {		PyErr_SetString(samr_error, "unable to init talloc context");		return NULL;	}	ntstatus = rpccli_samr_delete_dom_user(		user_hnd->cli, mem_ctx, &user_hnd->user_pol);	if (!NT_STATUS_IS_OK(ntstatus)) {		PyErr_SetObject(samr_ntstatus, py_ntstatus_tuple(ntstatus));		goto done;	}	Py_INCREF(Py_None);	result = Py_None;done:	talloc_destroy(mem_ctx);	return result;}
开发者ID:AllardJ,项目名称:Tomato,代码行数:34,


示例10: DEBUG

struct _FAKE_FILE_HANDLE *init_fake_file_handle(enum FAKE_FILE_TYPE type){    TALLOC_CTX *mem_ctx = NULL;    FAKE_FILE_HANDLE *fh = NULL;    int i;    for (i=0; fake_files[i].name!=NULL; i++) {        if (fake_files[i].type==type) {            DEBUG(5,("init_fake_file_handle: for [%s]/n",fake_files[i].name));            if ((mem_ctx=talloc_init("fake_file_handle"))==NULL) {                DEBUG(0,("talloc_init(fake_file_handle) failed./n"));                return NULL;            }            if ((fh =TALLOC_ZERO_P(mem_ctx, FAKE_FILE_HANDLE))==NULL) {                DEBUG(0,("talloc_zero() failed./n"));                talloc_destroy(mem_ctx);                return NULL;            }            fh->type = type;            fh->mem_ctx = mem_ctx;            if (fake_files[i].init_pd)                fh->pd = fake_files[i].init_pd(fh->mem_ctx);            fh->free_pd = fake_files[i].free_pd;            return fh;        }    }    return NULL;}
开发者ID:hajuuk,项目名称:R7000,代码行数:35,


示例11: torture_usermod

bool torture_usermod(struct torture_context *torture){	NTSTATUS status;	struct dcerpc_pipe *p;	struct policy_handle h;	struct lsa_String domain_name;	struct dom_sid2 sid;	uint32_t rid;	int i;	char *name;	TALLOC_CTX *mem_ctx;	bool ret = true;	struct dcerpc_binding_handle *b;	mem_ctx = talloc_init("test_userdel");	status = torture_rpc_connection(torture,					&p,					&ndr_table_samr);	torture_assert_ntstatus_ok(torture, status, "RPC connect");	b = p->binding_handle;	domain_name.string = lpcfg_workgroup(torture->lp_ctx);	name = talloc_strdup(mem_ctx, TEST_USERNAME);	if (!test_domain_open(torture, b, &domain_name, mem_ctx, &h, &sid)) {		ret = false;		goto done;	}	if (!test_user_create(torture, b, mem_ctx, &h, name, &rid)) {		ret = false;		goto done;	}	for (i = USER_FIELD_FIRST; i <= USER_FIELD_LAST; i++) {		struct libnet_rpc_usermod m;		if (!test_usermod(torture, p, mem_ctx, &h, i, &m, &name)) {			ret = false;			goto cleanup;		}		if (!test_compare(torture, p, mem_ctx, &h, &m, name)) {			ret = false;			goto cleanup;		}	}cleanup:	if (!test_user_cleanup(torture, b, mem_ctx, &h, TEST_USERNAME)) {		ret = false;		goto done;	}done:	talloc_free(mem_ctx);	return ret;}
开发者ID:AIdrifter,项目名称:samba,代码行数:60,


示例12: msg_pool_usage

/** * Respond to a POOL_USAGE message by sending back string form of memory * usage stats. **/void msg_pool_usage(int msg_type, struct process_id src_pid,		    void *UNUSED(buf), size_t UNUSED(len),		    void *private_data){	struct msg_pool_usage_state state;	SMB_ASSERT(msg_type == MSG_REQ_POOL_USAGE);		DEBUG(2,("Got POOL_USAGE/n"));	state.mem_ctx = talloc_init("msg_pool_usage");	if (!state.mem_ctx) {		return;	}	state.len	= 0;	state.buflen	= 512;	state.s		= NULL;	talloc_report_depth_cb(NULL, 0, -1, msg_pool_usage_helper, &state);	if (!state.s) {		talloc_destroy(state.mem_ctx);		return;	}		message_send_pid(src_pid, MSG_POOL_USAGE,			 state.s, strlen(state.s)+1, True);	talloc_destroy(state.mem_ctx);}
开发者ID:AllardJ,项目名称:Tomato,代码行数:34,


示例13: net_groupmap_memberships

static int net_groupmap_memberships(struct net_context *c, int argc, const char **argv){	TALLOC_CTX *mem_ctx;	DOM_SID *domain_sid, member;	if ( (argc != 1) ||	     c->display_usage ||	     !string_to_sid(&member, argv[0]) ) {		d_printf("%s/n%s",			 _("Usage:"),			 _("net groupmap memberof sid/n"));		return -1;	}	mem_ctx = talloc_init("net_groupmap_memberships");	if (mem_ctx == NULL) {		d_fprintf(stderr, _("talloc_init failed/n"));		return -1;	}	domain_sid = get_global_sam_sid();	if (domain_sid == NULL) {		d_fprintf(stderr, _("Could not get domain sid/n"));		return -1;	}	if (!print_alias_memberships(mem_ctx, domain_sid, &member) ||	    !print_alias_memberships(mem_ctx, &global_sid_Builtin, &member))		return -1;	talloc_destroy(mem_ctx);	return 0;}
开发者ID:endisd,项目名称:samba,代码行数:34,


示例14: raw_smbcli_ntcreate

static NTSTATUS raw_smbcli_ntcreate(struct smbcli_tree *tree, const char *fname, int *fnum){        union smb_open io;        TALLOC_CTX *mem_ctx;        NTSTATUS status;        mem_ctx = talloc_init("raw_t2open");        if (!mem_ctx) return NT_STATUS_NO_MEMORY;	memset(&io, '/0', sizeof(io));        io.generic.level = RAW_OPEN_NTCREATEX;	io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED;	io.ntcreatex.in.root_fid.fnum = 0;	io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;	io.ntcreatex.in.alloc_size = 0;	io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;	io.ntcreatex.in.share_access = NTCREATEX_SHARE_ACCESS_READ | NTCREATEX_SHARE_ACCESS_WRITE;	io.ntcreatex.in.open_disposition = NTCREATEX_DISP_CREATE;	io.ntcreatex.in.create_options = 0;	io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS;	io.ntcreatex.in.security_flags = 0;	io.ntcreatex.in.fname = fname;        status = smb_raw_open(tree, mem_ctx, &io);        talloc_free(mem_ctx);        if (fnum && NT_STATUS_IS_OK(status)) {                *fnum = io.openx.out.file.fnum;        }        return status;}
开发者ID:DavidMulder,项目名称:samba,代码行数:32,


示例15: enum_local_groups

static NTSTATUS enum_local_groups(struct winbindd_domain *domain,				TALLOC_CTX *mem_ctx,				uint32 *num_entries, 				struct acct_info **info){	uint32 des_access = SEC_RIGHTS_MAXIMUM_ALLOWED;	CLI_POLICY_HND *hnd;	POLICY_HND dom_pol;	NTSTATUS result;	int retry;	*num_entries = 0;	*info = NULL;	retry = 0;	do {		if ( !NT_STATUS_IS_OK(result = cm_get_sam_handle(domain, &hnd)) )			return result;		result = cli_samr_open_domain( hnd->cli, mem_ctx, &hnd->pol, 						des_access, &domain->sid, &dom_pol);	} while (!NT_STATUS_IS_OK(result) && (retry++ < 1) && hnd && hnd->cli && hnd->cli->fd == -1);	if ( !NT_STATUS_IS_OK(result))		return result;	do {		struct acct_info *info2 = NULL;		uint32 count = 0, start = *num_entries;		TALLOC_CTX *mem_ctx2;		mem_ctx2 = talloc_init("enum_dom_local_groups[rpc]");		result = cli_samr_enum_als_groups( hnd->cli, mem_ctx2, &dom_pol,					  &start, 0xFFFF, &info2, &count);					  		if ( !NT_STATUS_IS_OK(result) 			&& !NT_STATUS_EQUAL(result, STATUS_MORE_ENTRIES) ) 		{			talloc_destroy(mem_ctx2);			break;		}		(*info) = TALLOC_REALLOC_ARRAY(mem_ctx, *info, struct acct_info, (*num_entries) + count);		if (! *info) {			talloc_destroy(mem_ctx2);			cli_samr_close(hnd->cli, mem_ctx, &dom_pol);			return NT_STATUS_NO_MEMORY;		}		memcpy(&(*info)[*num_entries], info2, count*sizeof(*info2));		(*num_entries) += count;		talloc_destroy(mem_ctx2);	} while (NT_STATUS_EQUAL(result, STATUS_MORE_ENTRIES));	cli_samr_close(hnd->cli, mem_ctx, &dom_pol);	return result;}
开发者ID:hajuuk,项目名称:R7000,代码行数:59,


示例16: talloc_init

static TALLOC_CTX *get_ctx(io_struct *ps){	if (ps->ctx == NULL)	{		ps->ctx = talloc_init();	}	return ps->ctx;}
开发者ID:pombredanne,项目名称:cliffs,代码行数:8,


示例17: main

int main(int argc, char **argv) {   CacServerHandle *hnd = NULL;   TALLOC_CTX *mem_ctx = NULL;   struct SamOpenUser ou;   fstring tmp;   mem_ctx = talloc_init("cac_samgroup");   hnd = cac_NewServerHandle(True);   cac_SetAuthDataFn(hnd, cactest_GetAuthDataFn);   cac_parse_cmd_line(argc, argv, hnd);   if(!cac_Connect(hnd, NULL)) {      fprintf(stderr, "Could not connect to server %s. Error: %s/n", hnd->server, nt_errstr(hnd->status));      exit(-1);   }   struct SamOpenDomain sod;   ZERO_STRUCT(sod);   sod.in.access = MAXIMUM_ALLOWED_ACCESS;    if(!cac_SamOpenDomain(hnd, mem_ctx, &sod)) {      fprintf(stderr, "Could not open domain. Error: %s/n", nt_errstr(hnd->status));      goto done;   }   ZERO_STRUCT(ou);   printf("Enter username: ");   cactest_readline(stdin, tmp);   ou.in.name = talloc_strdup(mem_ctx, tmp);   ou.in.access = MAXIMUM_ALLOWED_ACCESS;   ou.in.dom_hnd = sod.out.dom_hnd;   if(!cac_SamOpenUser(hnd, mem_ctx, &ou)) {      fprintf(stderr, "Could not open user. Error: %s/n", nt_errstr(hnd->status));      goto done;   }   /*enable the user*/   if(!cac_SamEnableUser(hnd, mem_ctx, ou.out.user_hnd)) {      fprintf(stderr, "Could not enable user: %s/n", nt_errstr(hnd->status));   }done:   cac_SamClose(hnd, mem_ctx, sod.out.dom_hnd);   cac_FreeHandle(hnd);   talloc_destroy(mem_ctx);      return 0;}
开发者ID:AllardJ,项目名称:Tomato,代码行数:58,


示例18: net_lookup_dsgetdcname

static int net_lookup_dsgetdcname(struct net_context *c, int argc, const char **argv){	NTSTATUS status;	const char *domain_name = NULL;	const char *site_name = NULL;	uint32_t flags = 0;	struct netr_DsRGetDCNameInfo *info = NULL;	TALLOC_CTX *mem_ctx;	char *s = NULL;	if (argc < 1 || argc > 3) {		d_printf("%s/n%s",			 _("Usage:"),			 _(" net lookup dsgetdcname "			   "<name> <flags> <sitename>/n"));		return -1;	}	mem_ctx = talloc_init("net_lookup_dsgetdcname");	if (!mem_ctx) {		return -1;	}	domain_name = argv[0];	if (argc >= 2) {		sscanf(argv[1], "%x", &flags);	}	if (flags == 0) {		flags = DS_DIRECTORY_SERVICE_REQUIRED;	}	if (argc == 3) {		site_name = argv[2];	}        if (!c->msg_ctx) {		d_fprintf(stderr, _("Could not initialise message context. "			"Try running as root/n"));		return -1;        }	status = dsgetdcname(mem_ctx, c->msg_ctx, domain_name, NULL, site_name,			     flags, &info);	if (!NT_STATUS_IS_OK(status)) {		d_printf(_("failed with: %s/n"), nt_errstr(status));		TALLOC_FREE(mem_ctx);		return -1;	}	s = NDR_PRINT_STRUCT_STRING(mem_ctx, netr_DsRGetDCNameInfo, info);	printf("%s/n", s);	TALLOC_FREE(s);	TALLOC_FREE(mem_ctx);	return 0;}
开发者ID:DavidMulder,项目名称:samba,代码行数:58,


示例19: torture_async_bind

BOOL torture_async_bind(struct torture_context *torture){	NTSTATUS status;	TALLOC_CTX *mem_ctx;	struct event_context *evt_ctx;	int i;	const char *binding_string;	struct cli_credentials *creds;	extern int torture_numasync;	struct composite_context **bind_req;	struct dcerpc_pipe **pipe;	const struct dcerpc_interface_table **table;	if (!torture_setting_bool(torture, "async", False)) {		printf("async bind test disabled - enable async tests to use/n");		return True;	}		binding_string = torture_setting_string(torture, "binding", NULL);	/* talloc context */	mem_ctx = talloc_init("torture_async_bind");	if (mem_ctx == NULL) return False;	bind_req = talloc_array(torture, struct composite_context*, torture_numasync);	if (bind_req == NULL) return False;	pipe     = talloc_array(torture, struct dcerpc_pipe*, torture_numasync);	if (pipe == NULL) return False;	table    = talloc_array(torture, const struct dcerpc_interface_table*, torture_numasync);	if (table == NULL) return False;		/* event context */	evt_ctx = event_context_init(mem_ctx);	if (evt_ctx == NULL) return False;	/* credentials */	creds = cmdline_credentials;	/* send bind requests */	for (i = 0; i < torture_numasync; i++) {		table[i] = &dcerpc_table_lsarpc;		bind_req[i] = dcerpc_pipe_connect_send(mem_ctx, binding_string,						       table[i], creds, evt_ctx);	}	/* recv bind requests */	for (i = 0; i < torture_numasync; i++) {		status = dcerpc_pipe_connect_recv(bind_req[i], mem_ctx, &pipe[i]);		if (!NT_STATUS_IS_OK(status)) {			printf("async rpc connection failed: %s/n", nt_errstr(status));			return False;		}	}	talloc_free(mem_ctx);	return True;}
开发者ID:Marvin-Lee,项目名称:libwmiclient,代码行数:58,


示例20: test_generate_random_str

static bool test_generate_random_str(struct torture_context *tctx){	TALLOC_CTX *mem_ctx = talloc_init(__FUNCTION__);	char *r = generate_random_str(mem_ctx, 10);	torture_assert_int_equal(tctx, strlen(r), 10, "right length generated");	r = generate_random_str(mem_ctx, 5);	torture_assert_int_equal(tctx, strlen(r), 5, "right length generated");	return true;}
开发者ID:Alexander--,项目名称:samba,代码行数:9,


示例21: torture_domain_open_samr

bool torture_domain_open_samr(struct torture_context *torture){	NTSTATUS status;	struct libnet_context *ctx;	TALLOC_CTX *mem_ctx;	struct policy_handle domain_handle, handle;	struct libnet_DomainOpen io;	struct samr_Close r;	const char *domain_name;	bool ret = true;	mem_ctx = talloc_init("test_domainopen_lsa");	ctx = libnet_context_init(torture->ev, torture->lp_ctx);	ctx->cred = cmdline_credentials;	/* we're accessing domain controller so the domain name should be	   passed (it's going to be resolved to dc name and address) instead	   of specific server name. */	domain_name = lp_workgroup(torture->lp_ctx);	/*	 * Testing synchronous version	 */	printf("opening domain/n");		io.in.type         = DOMAIN_SAMR;	io.in.domain_name  = domain_name;	io.in.access_mask  = SEC_FLAG_MAXIMUM_ALLOWED;	status = libnet_DomainOpen(ctx, mem_ctx, &io);	if (!NT_STATUS_IS_OK(status)) {		printf("Composite domain open failed - %s/n", nt_errstr(status));		ret = false;		goto done;	}	domain_handle = ctx->samr.handle;	r.in.handle   = &domain_handle;	r.out.handle  = &handle;		printf("closing domain handle/n");		status = dcerpc_samr_Close(ctx->samr.pipe, mem_ctx, &r);	if (!NT_STATUS_IS_OK(status)) {		printf("Close failed - %s/n", nt_errstr(status));		ret = false;		goto done;	}done:	talloc_free(mem_ctx);	talloc_free(ctx);	return ret;}
开发者ID:AllardJ,项目名称:Tomato,代码行数:57,


示例22: torture_domain_open_samr

BOOL torture_domain_open_samr(struct torture_context *torture){	NTSTATUS status;	const char *binding;	struct libnet_context *ctx;	struct event_context *evt_ctx=NULL;	TALLOC_CTX *mem_ctx;	struct policy_handle domain_handle, handle;	struct lsa_String name;	struct libnet_DomainOpen io;	struct samr_Close r;	BOOL ret = True;	mem_ctx = talloc_init("test_domainopen_lsa");	binding = torture_setting_string(torture, "binding", NULL);	ctx = libnet_context_init(evt_ctx);	ctx->cred = cmdline_credentials;	name.string = lp_workgroup();	/*	 * Testing synchronous version	 */	printf("opening domain/n");		io.in.type         = DOMAIN_SAMR;	io.in.domain_name  = name.string;	io.in.access_mask  = SEC_FLAG_MAXIMUM_ALLOWED;	status = libnet_DomainOpen(ctx, mem_ctx, &io);	if (!NT_STATUS_IS_OK(status)) {		printf("Composite domain open failed - %s/n", nt_errstr(status));		ret = False;		goto done;	}	domain_handle = ctx->samr.handle;	r.in.handle   = &domain_handle;	r.out.handle  = &handle;		printf("closing domain handle/n");		status = dcerpc_samr_Close(ctx->samr.pipe, mem_ctx, &r);	if (!NT_STATUS_IS_OK(status)) {		printf("Close failed - %s/n", nt_errstr(status));		ret = False;		goto done;	}done:	talloc_free(mem_ctx);	talloc_free(ctx);	return ret;}
开发者ID:Marvin-Lee,项目名称:libwmiclient,代码行数:57,


示例23: torture_useradd

bool torture_useradd(struct torture_context *torture){	NTSTATUS status;	struct dcerpc_pipe *p;	struct policy_handle h;	struct lsa_String domain_name;	struct dom_sid2 sid;	const char *name = TEST_USERNAME;	TALLOC_CTX *mem_ctx;	bool ret = true;	struct dcerpc_binding_handle *b;	mem_ctx = talloc_init("test_useradd");	status = torture_rpc_connection(torture,					&p,					&ndr_table_samr);	torture_assert_ntstatus_ok(torture, status, "RPC connect failed");	b = p->binding_handle;	domain_name.string = lpcfg_workgroup(torture->lp_ctx);	if (!test_domain_open(torture, b, &domain_name, mem_ctx, &h, &sid)) {		ret = false;		goto done;	}	if (!test_useradd(torture, p, mem_ctx, &h, name)) {		ret = false;		goto done;	}	if (!test_user_cleanup(torture, b, mem_ctx, &h, name)) {		ret = false;		goto done;	}	if (!test_domain_open(torture, b, &domain_name, mem_ctx, &h, &sid)) {		ret = false;		goto done;	}	if (!test_useradd_async(torture, p, mem_ctx, &h, name)) {		ret = false;		goto done;	}	if (!test_user_cleanup(torture, b, mem_ctx, &h, name)) {		ret = false;		goto done;	}done:	talloc_free(mem_ctx);	return ret;}
开发者ID:rchicoli,项目名称:samba,代码行数:56,


示例24: talloc_init

TALLOC_CTX *main_loop_talloc_get(void){    if (!main_loop_talloc) {        main_loop_talloc = talloc_init("main loop talloc (mainly parse_misc)");        if (!main_loop_talloc)            smb_panic("main_loop_talloc: malloc fail/n");    }    return main_loop_talloc;}
开发者ID:DeezNuts12,项目名称:freestyledash,代码行数:10,


示例25: init_afs_acl

static BOOL init_afs_acl(struct afs_acl *acl){	ZERO_STRUCT(*acl);	acl->ctx = talloc_init("afs_acl");	if (acl->ctx == NULL) {		DEBUG(10, ("Could not init afs_acl"));		return False;	}	return True;}
开发者ID:AllardJ,项目名称:Tomato,代码行数:10,


示例26: create_send_ctx

static bool create_send_ctx(void){	if (!send_ctx)		send_ctx = talloc_init("print notify queue");	if (!send_ctx)		return False;	return True;}
开发者ID:AIdrifter,项目名称:samba,代码行数:10,


示例27: atalk_unlink

static int atalk_unlink(struct vfs_handle_struct *handle, struct connection_struct *conn, const char *path){	int ret = 0, i;	char *adbl_path = 0;	char *orig_path = 0;	SMB_STRUCT_STAT adbl_info;	SMB_STRUCT_STAT orig_info;	TALLOC_CTX *ctx;	ret = SMB_VFS_NEXT_UNLINK(handle, conn, path);	if (!conn || !path) return ret;	/* no .AppleDouble sync if veto or hide list is empty,	 * otherwise "Cannot find the specified file" error will be caused	 */	if (!conn->veto_list) return ret;	if (!conn->hide_list) return ret;	for (i = 0; conn->veto_list[i].name; i ++) {		if (strstr(conn->veto_list[i].name, APPLEDOUBLE))			break;	}	if (!conn->veto_list[i].name) {		for (i = 0; conn->hide_list[i].name; i ++) {			if (strstr(conn->hide_list[i].name, APPLEDOUBLE))				break;			else {				DEBUG(3, ("ATALK: %s is not hidden, skipped../n",				  APPLEDOUBLE));						return ret;			}		}	}	if (!(ctx = talloc_init("unlink_file")))		return ret;	if (atalk_build_paths(ctx, conn->origpath, path, &adbl_path, &orig_path, 	  &adbl_info, &orig_info) != 0)		return ret;	if (S_ISDIR(orig_info.st_mode) || S_ISREG(orig_info.st_mode)) {		DEBUG(3, ("ATALK: %s has passed../n", adbl_path));		goto exit_unlink;	}	atalk_unlink_file(adbl_path);exit_unlink:		talloc_destroy(ctx);	return ret;}
开发者ID:jameshilliard,项目名称:WECB-BH-GPL,代码行数:55,


示例28: free_pipe_context

void free_pipe_context(pipes_struct *p){	if (p->mem_ctx) {		DEBUG(3,("free_pipe_context: destroying talloc pool of size %lu/n", (unsigned long)talloc_pool_size(p->mem_ctx) ));		talloc_destroy_pool(p->mem_ctx);	} else {		p->mem_ctx = talloc_init("pipe %s %p", p->name, p);		if (p->mem_ctx == NULL)			p->fault_state = True;	}}
开发者ID:niubl,项目名称:camera_project,代码行数:11,


示例29: on_connect_activate

static void on_connect_activate(GtkMenuItem *menuitem, gpointer user_data){	TALLOC_CTX *mem_ctx = talloc_init("gwsvcctl_connect");	svcctl_pipe = gtk_connect_rpc_interface(mem_ctx, ev_ctx, lp_ctx, &ndr_table_svcctl);	if (svcctl_pipe == NULL)		return;	gtk_widget_set_sensitive (new_service, TRUE);	/* FIXME: Fetch list of services and display */}
开发者ID:ei-grad,项目名称:samba-gtk,代码行数:12,



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


C++ talloc_memdup函数代码示例
C++ talloc_get_type_abort函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。