这篇教程C++ talloc_unlink函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中talloc_unlink函数的典型用法代码示例。如果您正苦于以下问题:C++ talloc_unlink函数的具体用法?C++ talloc_unlink怎么用?C++ talloc_unlink使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了talloc_unlink函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: test_lifelessstatic bool test_lifeless(const struct torture_context *ctx){ void *top = talloc_new(ctx); char *parent, *child; void *child_owner = talloc_new(ctx); parent = talloc_strdup(top, "parent"); if (!parent) return false; child = talloc_strdup(parent, "child"); if (!child) { talloc_free(parent); return false; } if (!talloc_reference(child, parent)) { talloc_free(parent); return false; } if (!talloc_reference(child_owner, child)) { talloc_unlink(child, parent); talloc_free(parent); return false; } talloc_unlink(top, parent); talloc_free(child); talloc_free(top); talloc_free(child_owner); talloc_free(child); return true;}
开发者ID:HSchroeder,项目名称:ccan,代码行数:33,
示例2: GetMaildirChildCount/* * Get number of childs of actual Folder */int GetMaildirChildCount(struct EasyLinuxFolder *elFolder, uint32_t table_type){int Val=0;DIR *dDir;char *sDir;struct dirent *dEntry;switch( table_type ) { case 2: // MAPISTORE_MESSAGE_TABLE // Find Messages in cur & new sDir = talloc_asprintf(elFolder->elContext->mem_ctx, "%scur", elFolder->FullPath); dDir = opendir(sDir); while ((dEntry = readdir(dDir))) { if ( dEntry->d_type == isFile) { Val++; } } closedir(dDir); talloc_unlink(elFolder->elContext->mem_ctx, sDir); sDir = talloc_asprintf(elFolder->elContext->mem_ctx, "%snew", elFolder->FullPath); dDir = opendir(sDir); while ((dEntry = readdir(dDir))) { if ( dEntry->d_type == isFile) { Val++; } } closedir(dDir); DEBUG(0,("MAPIEasyLinux : Find %i Messages in %s/n",Val,elFolder->FullPath)); talloc_unlink(elFolder->elContext->mem_ctx, sDir); break; case 3: // MAPISTORE_FAI_TABLE DEBUG(0,("MAPIEasyLinux : Ask for GetMaildirChildCount/n")); break; case 1: // MAPISTORE_FOLDER_TABLE dDir = opendir(elFolder->FullPath); while ((dEntry = readdir(dDir))) { if ( dEntry->d_type == isDir) Val += OmmitSpecialFolder(elFolder,dEntry->d_name); } closedir(dDir); DEBUG(0,("MAPIEasyLinux : Find %i Folders in %s/n",Val,elFolder->FullPath)); break; } return Val;}
开发者ID:EasyLinux,项目名称:Openchange,代码行数:57,
示例3: PyErr_LDB_OR_RAISEstatic PyObject *py_dsdb_get_wellknown_dn(PyObject *self, PyObject *args){ struct ldb_context *ldb; struct ldb_dn *nc_dn, *wk_dn; char *wkguid; PyObject *py_ldb, *py_nc_dn, *py_wk_dn; int ret; if (!PyArg_ParseTuple(args, "OOs", &py_ldb, &py_nc_dn, &wkguid)) return NULL; PyErr_LDB_OR_RAISE(py_ldb, ldb); PyErr_LDB_DN_OR_RAISE(py_nc_dn, nc_dn); ret = dsdb_wellknown_dn(ldb, ldb, nc_dn, wkguid, &wk_dn); if (ret == LDB_ERR_NO_SUCH_OBJECT) { PyErr_Format(PyExc_KeyError, "Failed to find well known DN for GUID %s", wkguid); return NULL; } PyErr_LDB_ERROR_IS_ERR_RAISE(py_ldb_get_exception(), ret, ldb); py_wk_dn = pyldb_Dn_FromDn(wk_dn); talloc_unlink(ldb, wk_dn); return py_wk_dn;}
开发者ID:285858315,项目名称:samba,代码行数:26,
示例4: serverid_parent_initbool serverid_parent_init(TALLOC_CTX *mem_ctx){ struct tdb_wrap *db; struct loadparm_context *lp_ctx; lp_ctx = loadparm_init_s3(mem_ctx, loadparm_s3_context()); if (lp_ctx == NULL) { DEBUG(0, ("loadparm_init_s3 failed/n")); return false; } /* * Open the tdb in the parent process (smbd) so that our * CLEAR_IF_FIRST optimization in tdb_reopen_all can properly * work. */ db = tdb_wrap_open(mem_ctx, lock_path("serverid.tdb"), 0, TDB_DEFAULT|TDB_CLEAR_IF_FIRST|TDB_INCOMPATIBLE_HASH, O_RDWR|O_CREAT, 0644, lp_ctx); talloc_unlink(mem_ctx, lp_ctx); if (db == NULL) { DEBUG(1, ("could not open serverid.tdb: %s/n", strerror(errno))); return false; } return true;}
开发者ID:sprymak,项目名称:samba,代码行数:28,
示例5: loadparm_init_s3struct imessaging_context *winbind_imessaging_context(void){ static struct imessaging_context *msg = NULL; struct loadparm_context *lp_ctx; if (msg != NULL) { return msg; } lp_ctx = loadparm_init_s3(NULL, loadparm_s3_helpers()); if (lp_ctx == NULL) { smb_panic("Could not load smb.conf to init winbindd's imessaging context./n"); } /* * Note we MUST use the NULL context here, not the autofree context, * to avoid side effects in forked children exiting. */ msg = imessaging_init(NULL, lp_ctx, procid_self(), winbind_event_context(), false); talloc_unlink(NULL, lp_ctx); if (msg == NULL) { smb_panic("Could not init winbindd's messaging context./n"); } return msg;}
开发者ID:hef,项目名称:samba,代码行数:26,
示例6: posix_eadb_initstatic bool posix_eadb_init(int snum, struct tdb_wrap **p_db){ struct tdb_wrap *db; struct loadparm_context *lp_ctx; const char *eadb = lp_parm_const_string(snum, "posix", "eadb", NULL); if (!eadb) { DEBUG(0, ("Can not use vfs_posix_eadb without posix:eadb set/n")); return false; } lp_ctx = loadparm_init_s3(NULL, loadparm_s3_helpers()); become_root(); db = tdb_wrap_open(NULL, eadb, 50000, TDB_DEFAULT, O_RDWR|O_CREAT, 0600, lp_ctx); unbecome_root(); talloc_unlink(NULL, lp_ctx); /* now we know dbname is not NULL */ if (db == NULL) {#if defined(ENOTSUP) errno = ENOTSUP;#else errno = ENOSYS;#endif return false; } *p_db = db; return true;}
开发者ID:AIdrifter,项目名称:samba,代码行数:34,
示例7: emsmdbp_source_key_from_fmid_PUBLIC_ int emsmdbp_source_key_from_fmid(TALLOC_CTX *mem_ctx, struct emsmdbp_context *emsmdbp_ctx, const char *username, uint64_t fmid, struct Binary_r **source_keyP){ struct Binary_r *source_key; uint64_t gc; uint16_t replid; uint8_t *bytes; int i; replid = fmid & 0xffff; source_key = talloc_zero(NULL, struct Binary_r); source_key->cb = 22; source_key->lpb = talloc_array(source_key, uint8_t, source_key->cb); if (emsmdbp_replid_to_guid(emsmdbp_ctx, username, replid, (struct GUID *) source_key->lpb)) { talloc_free(source_key); return MAPISTORE_ERROR; } (void) talloc_reference(mem_ctx, source_key); talloc_unlink(NULL, source_key); gc = fmid >> 16; bytes = source_key->lpb + 16; for (i = 0; i < 6; i++) { bytes[i] = gc & 0xff; gc >>= 8; } *source_keyP = source_key; return MAPISTORE_SUCCESS;}
开发者ID:EasyLinux,项目名称:Openchange,代码行数:32,
示例8: dsdb_reference_schema/** * Make this ldb use a specified schema, already fully calculated and belonging to another ldb */int dsdb_reference_schema(struct ldb_context *ldb, struct dsdb_schema *schema, bool write_attributes){ int ret; struct dsdb_schema *old_schema; old_schema = ldb_get_opaque(ldb, "dsdb_schema"); ret = ldb_set_opaque(ldb, "dsdb_schema", schema); if (ret != LDB_SUCCESS) { return ret; } /* Remove the reference to the schema we just overwrote - if there was * none, NULL is harmless here */ talloc_unlink(ldb, old_schema); if (talloc_reference(ldb, schema) == NULL) { return ldb_oom(ldb); } /* Make this ldb use local schema preferably */ ret = ldb_set_opaque(ldb, "dsdb_use_global_schema", NULL); if (ret != LDB_SUCCESS) { return ret; } ret = dsdb_schema_set_attributes(ldb, schema, write_attributes); if (ret != LDB_SUCCESS) { return ret; } return LDB_SUCCESS;}
开发者ID:sprymak,项目名称:samba,代码行数:35,
示例9: smb_krb5_context_set_event_ctxkrb5_error_code smb_krb5_context_set_event_ctx(struct smb_krb5_context *smb_krb5_context, struct tevent_context *ev, struct tevent_context **previous_ev){ int ret; if (!ev) { return EINVAL; } *previous_ev = smb_krb5_context->current_ev; smb_krb5_context->current_ev = talloc_reference(smb_krb5_context, ev); if (!smb_krb5_context->current_ev) { return ENOMEM; } /* Set use of our socket lib */ ret = krb5_set_send_to_kdc_func(smb_krb5_context->krb5_context, smb_krb5_send_and_recv_func, ev); if (ret) { TALLOC_CTX *tmp_ctx = talloc_new(NULL); DEBUG(1,("krb5_set_send_recv_func failed (%s)/n", smb_get_krb5_error_message(smb_krb5_context->krb5_context, ret, tmp_ctx))); talloc_free(tmp_ctx); talloc_unlink(smb_krb5_context, smb_krb5_context->current_ev); smb_krb5_context->current_ev = NULL; return ret; } return 0;}
开发者ID:dmitry-shavyrin,项目名称:samba4_embedded_build,代码行数:31,
示例10: test_unref_reparentstatic bool test_unref_reparent(void){ void *root, *p1, *p2, *c1; printf("test: unref_reparent/n# UNREFERENCE AFTER PARENT FREED/n"); root = talloc_named_const(NULL, 0, "root"); p1 = talloc_named_const(root, 1, "orig parent"); p2 = talloc_named_const(root, 1, "parent by reference"); c1 = talloc_named_const(p1, 1, "child"); talloc_reference(p2, c1); CHECK_PARENT("unref_reparent", c1, p1); talloc_free(p1); CHECK_PARENT("unref_reparent", c1, p2); talloc_unlink(p2, c1); CHECK_SIZE("unref_reparent", root, 1); talloc_free(p2); talloc_free(root); printf("success: unref_reparent/n"); return true;}
开发者ID:urisimchoni,项目名称:samba,代码行数:29,
示例11: dsdb_create_prefix_mapping/* * this function is called from within a ldb transaction from the schema_fsmo module */WERROR dsdb_create_prefix_mapping(struct ldb_context *ldb, struct dsdb_schema *schema, const char *full_oid){ WERROR status; uint32_t attid; TALLOC_CTX *mem_ctx; struct dsdb_schema_prefixmap *pfm; mem_ctx = talloc_new(ldb); W_ERROR_HAVE_NO_MEMORY(mem_ctx); /* Read prefixes from disk*/ status = dsdb_read_prefixes_from_ldb(ldb, mem_ctx, &pfm); if (!W_ERROR_IS_OK(status)) { DEBUG(0,("dsdb_create_prefix_mapping: dsdb_read_prefixes_from_ldb: %s/n", win_errstr(status))); talloc_free(mem_ctx); return status; } /* Check if there is a prefix for the oid in the prefixes array*/ status = dsdb_schema_pfm_find_oid(pfm, full_oid, NULL); if (W_ERROR_IS_OK(status)) { /* prefix found*/ talloc_free(mem_ctx); return status; } else if (!W_ERROR_EQUAL(status, WERR_NOT_FOUND)) { /* error */ DEBUG(0,("dsdb_create_prefix_mapping: dsdb_find_prefix_for_oid: %s/n", win_errstr(status))); talloc_free(mem_ctx); return status; } /* Create the new mapping for the prefix of full_oid */ status = dsdb_schema_pfm_make_attid(pfm, full_oid, &attid); if (!W_ERROR_IS_OK(status)) { DEBUG(0,("dsdb_create_prefix_mapping: dsdb_schema_pfm_make_attid: %s/n", win_errstr(status))); talloc_free(mem_ctx); return status; } talloc_unlink(schema, schema->prefixmap); schema->prefixmap = talloc_steal(schema, pfm); /* Update prefixMap in ldb*/ status = dsdb_write_prefixes_from_schema_to_ldb(mem_ctx, ldb, schema); if (!W_ERROR_IS_OK(status)) { DEBUG(0,("dsdb_create_prefix_mapping: dsdb_write_prefixes_to_ldb: %s/n", win_errstr(status))); talloc_free(mem_ctx); return status; } DEBUG(2,(__location__ " Added prefixMap %s - now have %u prefixes/n", full_oid, schema->prefixmap->length)); talloc_free(mem_ctx); return status;}
开发者ID:srimalik,项目名称:samba,代码行数:63,
示例12: talloc_ref_finalizervoid talloc_ref_finalizer(void *ctx, void *ptr){ int res = talloc_unlink(ctx, ptr); if (res != 0) { fprintf(stderr, "Failed to unlink reference of %p on %p/n", ctx, ptr); }}
开发者ID:bgamari,项目名称:notmuch-haskell,代码行数:7,
示例13: cli_credentials_unconditionally_invalidate_client_gss_creds/* We have good reason to think the ccache in these credentials is invalid - blow it away */static void cli_credentials_unconditionally_invalidate_client_gss_creds(struct cli_credentials *cred){ if (cred->client_gss_creds_obtained > CRED_UNINITIALISED) { talloc_unlink(cred, cred->client_gss_creds); cred->client_gss_creds = NULL; } cred->client_gss_creds_obtained = CRED_UNINITIALISED;}
开发者ID:285858315,项目名称:samba,代码行数:9,
示例14: py_MAPIStoreFolder_deallocstatic void py_MAPIStoreFolder_dealloc(PyObject *_self){ PyMAPIStoreFolderObject *self = (PyMAPIStoreFolderObject *)_self; talloc_unlink(NULL, self->folder_object); Py_XDECREF(self->context); PyObject_Del(_self);}
开发者ID:icandigitbaby,项目名称:openchange,代码行数:9,
示例15: language_set_linkerint language_set_linker(struct language *l, char *cmd){ if (l->link_cmd != NULL) { talloc_unlink(l, l->link_cmd); l->link_cmd = NULL; } l->link_cmd = talloc_reference(l, cmd); return 0;}
开发者ID:zhemao,项目名称:pconfigure,代码行数:10,
示例16: test_ref1/* test references */static bool test_ref1(void){ void *root, *p1, *p2, *ref, *r1; printf("test: ref1/n# SINGLE REFERENCE FREE/n"); root = talloc_named_const(NULL, 0, "root"); p1 = talloc_named_const(root, 1, "p1"); p2 = talloc_named_const(p1, 1, "p2"); talloc_named_const(p1, 1, "x1"); talloc_named_const(p1, 2, "x2"); talloc_named_const(p1, 3, "x3"); r1 = talloc_named_const(root, 1, "r1"); ref = talloc_reference(r1, p2); talloc_report_full(root, stderr); CHECK_BLOCKS("ref1", p1, 5); CHECK_BLOCKS("ref1", p2, 1); CHECK_BLOCKS("ref1", ref, 1); CHECK_BLOCKS("ref1", r1, 2); fprintf(stderr, "Freeing p2/n"); talloc_unlink(r1, p2); talloc_report_full(root, stderr); CHECK_BLOCKS("ref1", p1, 5); CHECK_BLOCKS("ref1", p2, 1); CHECK_BLOCKS("ref1", r1, 1); fprintf(stderr, "Freeing p1/n"); talloc_free(p1); talloc_report_full(root, stderr); CHECK_BLOCKS("ref1", r1, 1); fprintf(stderr, "Freeing r1/n"); talloc_free(r1); talloc_report_full(NULL, stderr); fprintf(stderr, "Testing NULL/n"); if (talloc_reference(root, NULL)) { return false; } CHECK_BLOCKS("ref1", root, 1); CHECK_SIZE("ref1", root, 0); talloc_free(root); printf("success: ref1/n"); return true;}
开发者ID:urisimchoni,项目名称:samba,代码行数:56,
示例17: notify_internal_parent_initbool notify_internal_parent_init(TALLOC_CTX *mem_ctx){ struct tdb_wrap *db1, *db2; struct loadparm_context *lp_ctx; if (lp_clustering()) { return true; } lp_ctx = loadparm_init_s3(mem_ctx, loadparm_s3_context()); if (lp_ctx == NULL) { DEBUG(0, ("loadparm_init_s3 failed/n")); return false; } /* * Open the tdbs in the parent process (smbd) so that our * CLEAR_IF_FIRST optimization in tdb_reopen_all can properly * work. */ db1 = tdb_wrap_open(mem_ctx, lock_path("notify.tdb"), 0, TDB_SEQNUM|TDB_CLEAR_IF_FIRST|TDB_INCOMPATIBLE_HASH, O_RDWR|O_CREAT, 0644, lp_ctx); if (db1 == NULL) { talloc_unlink(mem_ctx, lp_ctx); DEBUG(1, ("could not open notify.tdb: %s/n", strerror(errno))); return false; } db2 = tdb_wrap_open(mem_ctx, lock_path("notify_onelevel.tdb"), 0, TDB_CLEAR_IF_FIRST|TDB_INCOMPATIBLE_HASH, O_RDWR|O_CREAT, 0644, lp_ctx); talloc_unlink(mem_ctx, lp_ctx); if (db2 == NULL) { DEBUG(1, ("could not open notify_onelevel.tdb: %s/n", strerror(errno))); TALLOC_FREE(db1); return false; } return true;}
开发者ID:srimalik,项目名称:samba,代码行数:39,
示例18: emsmdbp_destructor_PUBLIC_ bool emsmdbp_destructor(void *data){ struct emsmdbp_context *emsmdbp_ctx = (struct emsmdbp_context *)data; if (!emsmdbp_ctx) return false; talloc_unlink(emsmdbp_ctx, emsmdbp_ctx->oc_ctx); talloc_free(emsmdbp_ctx->mem_ctx); OC_DEBUG(0, "emsmdbp_ctx found and released/n"); return true;}
开发者ID:javierag,项目名称:openchange,代码行数:13,
示例19: emsmdbp_destructor_PUBLIC_ bool emsmdbp_destructor(void *data){ struct emsmdbp_context *emsmdbp_ctx = (struct emsmdbp_context *)data; if (!emsmdbp_ctx) return false; talloc_unlink(emsmdbp_ctx, emsmdbp_ctx->oc_ctx); talloc_free(emsmdbp_ctx->mem_ctx); DEBUG(0, ("[%s:%d]: emsmdbp_ctx found and released/n", __FUNCTION__, __LINE__)); return true;}
开发者ID:EasyLinux,项目名称:Openchange,代码行数:13,
示例20: test_ref2/* test references */static bool test_ref2(void){ void *root, *p1, *p2, *ref, *r1; printf("test: ref2/n# DOUBLE REFERENCE FREE/n"); root = talloc_named_const(NULL, 0, "root"); p1 = talloc_named_const(root, 1, "p1"); talloc_named_const(p1, 1, "x1"); talloc_named_const(p1, 1, "x2"); talloc_named_const(p1, 1, "x3"); p2 = talloc_named_const(p1, 1, "p2"); r1 = talloc_named_const(root, 1, "r1"); ref = talloc_reference(r1, p2); talloc_report_full(root, stderr); CHECK_BLOCKS("ref2", p1, 5); CHECK_BLOCKS("ref2", p2, 1); CHECK_BLOCKS("ref2", r1, 2); fprintf(stderr, "Freeing ref/n"); talloc_unlink(r1, ref); talloc_report_full(root, stderr); CHECK_BLOCKS("ref2", p1, 5); CHECK_BLOCKS("ref2", p2, 1); CHECK_BLOCKS("ref2", r1, 1); fprintf(stderr, "Freeing p2/n"); talloc_free(p2); talloc_report_full(root, stderr); CHECK_BLOCKS("ref2", p1, 4); CHECK_BLOCKS("ref2", r1, 1); fprintf(stderr, "Freeing p1/n"); talloc_free(p1); talloc_report_full(root, stderr); CHECK_BLOCKS("ref2", r1, 1); fprintf(stderr, "Freeing r1/n"); talloc_free(r1); talloc_report_full(root, stderr); CHECK_SIZE("ref2", root, 0); talloc_free(root); printf("success: ref2/n"); return true;}
开发者ID:urisimchoni,项目名称:samba,代码行数:54,
示例21: test_lifelessstatic bool test_lifeless(void){ void *top = talloc_new(NULL); char *parent, *child; void *child_owner = talloc_new(NULL); printf("test: lifeless/n# TALLOC_UNLINK LOOP/n"); parent = talloc_strdup(top, "parent"); child = talloc_strdup(parent, "child"); (void)talloc_reference(child, parent); (void)talloc_reference(child_owner, child); talloc_report_full(top, stderr); talloc_unlink(top, parent); talloc_unlink(top, child); talloc_report_full(top, stderr); talloc_free(top); talloc_free(child_owner); talloc_free(child); printf("success: lifeless/n"); return true;}
开发者ID:urisimchoni,项目名称:samba,代码行数:23,
示例22: talloc_zerostruct db_context *db_open_tdb(TALLOC_CTX *mem_ctx, const char *name, int hash_size, int tdb_flags, int open_flags, mode_t mode){ struct db_context *result = NULL; struct db_tdb_ctx *db_tdb; struct loadparm_context *lp_ctx; result = talloc_zero(mem_ctx, struct db_context); if (result == NULL) { DEBUG(0, ("talloc failed/n")); goto fail; } lp_ctx = loadparm_init_s3(result, loadparm_s3_context()); result->private_data = db_tdb = talloc(result, struct db_tdb_ctx); if (db_tdb == NULL) { DEBUG(0, ("talloc failed/n")); goto fail; } db_tdb->wtdb = tdb_wrap_open(db_tdb, name, hash_size, tdb_flags, open_flags, mode, lp_ctx); talloc_unlink(result, lp_ctx); if (db_tdb->wtdb == NULL) { DEBUG(3, ("Could not open tdb: %s/n", strerror(errno))); goto fail; } result->fetch_locked = db_tdb_fetch_locked; result->traverse = db_tdb_traverse; result->traverse_read = db_tdb_traverse_read; result->parse_record = db_tdb_parse; result->get_seqnum = db_tdb_get_seqnum; result->get_flags = db_tdb_get_flags; result->persistent = ((tdb_flags & TDB_CLEAR_IF_FIRST) == 0); result->transaction_start = db_tdb_transaction_start; result->transaction_commit = db_tdb_transaction_commit; result->transaction_cancel = db_tdb_transaction_cancel; result->exists = db_tdb_exists; result->wipe = db_tdb_wipe; return result; fail: if (result != NULL) { TALLOC_FREE(result); } return NULL;}
开发者ID:ekohl,项目名称:samba,代码行数:50,
示例23: cli_credentials_set_krb5_context/* For most predictable behaviour, this needs to be called directly after the cli_credentials_init(), * otherwise we may still have references to the old smb_krb5_context in a credential cache etc */_PUBLIC_ NTSTATUS cli_credentials_set_krb5_context(struct cli_credentials *cred, struct smb_krb5_context *smb_krb5_context){ if (smb_krb5_context == NULL) { talloc_unlink(cred, cred->smb_krb5_context); cred->smb_krb5_context = NULL; return NT_STATUS_OK; } if (!talloc_reference(cred, smb_krb5_context)) { return NT_STATUS_NO_MEMORY; } cred->smb_krb5_context = smb_krb5_context; return NT_STATUS_OK;}
开发者ID:285858315,项目名称:samba,代码行数:18,
示例24: dsdb_make_schema_globalvoid dsdb_make_schema_global(struct ldb_context *ldb, struct dsdb_schema *schema){ if (!schema) { return; } if (global_schema) { talloc_unlink(talloc_autofree_context(), global_schema); } /* we want the schema to be around permanently */ talloc_reparent(ldb, talloc_autofree_context(), schema); global_schema = schema; /* This calls the talloc_reference() of the global schema back onto the ldb */ dsdb_set_global_schema(ldb);}
开发者ID:sprymak,项目名称:samba,代码行数:17,
示例25: context_set_srcdirint context_set_srcdir(struct context *c, char *opt){ if (c == NULL) return -1; if (opt == NULL) return -1; assert(c->src_dir != NULL); /* FIXME: This cast is probably bad, is the talloc API broken? */ talloc_unlink(c, (char *)c->src_dir); c->src_dir = talloc_reference(c, opt); if (c->src_dir == NULL) return -1; return 0;}
开发者ID:palmer-dabbelt,项目名称:pconfigure,代码行数:17,
示例26: SetUserInformation/* * /detail Find AD to get User informations * * EasyLinux backend is heavily based on AD, Maildir is stored into homeDir of user * we need to get back this information */int SetUserInformation(struct EasyLinuxContext *elContext, TALLOC_CTX *mem_ctx, char *User, struct ldb_context *ldb){//DEBUG(3, ("MAPIEasyLinux : Searching for user(%s) data's/n",User));const char *expression = "(uid=%s)";char *Search;const char * const Attribs[] = {"unixHomeDirectory","gidNumber","uidNumber","displayName",NULL};struct ldb_result *resultMsg;struct ldb_message_element *MessageElement;int i,j;Search = talloc_asprintf(mem_ctx,expression,User);if( LDB_SUCCESS != ldb_search(ldb, mem_ctx, &resultMsg, NULL, LDB_SCOPE_DEFAULT, Attribs, "%s", Search) ) { DEBUG(0, ("ERROR - MAPIEasyLinux - user informations unavailable !/n")); return MAPISTORE_ERROR; }elContext->User.uid = talloc_strdup(mem_ctx, User);for (i = 0; i < resultMsg->count; ++i) { for( j=0 ; j<resultMsg->msgs[i]->num_elements ; j++) { MessageElement = &resultMsg->msgs[i]->elements[j]; if( strcmp(MessageElement->name,"displayName") == 0 ) elContext->User.displayName = talloc_strdup(mem_ctx, (char *)MessageElement->values[0].data); if( strcmp(MessageElement->name,"uidNumber") == 0 ) elContext->User.uidNumber = atoi( (char *)MessageElement->values[0].data) ; if( strcmp(MessageElement->name,"gidNumber") == 0 ) elContext->User.gidNumber = atoi((char *)MessageElement->values[0].data); if( strcmp(MessageElement->name,"unixHomeDirectory") == 0 ) elContext->User.homeDirectory = talloc_strdup(mem_ctx, (char *)MessageElement->values[0].data); } }if( elContext->User.homeDirectory == NULL ) { DEBUG(0, ("ERROR - MAPIEasyLinux - user informations unavailable ! No homeDirectory/n")); return MAPISTORE_ERROR; } DEBUG(0, ("MAPIEasyLinux : User (uid:%i gid:%i displayName:%s homeDirectory:%s) /n", elContext->User.uidNumber, elContext->User.gidNumber, elContext->User.displayName, elContext->User.homeDirectory));talloc_unlink(mem_ctx, Search);return MAPISTORE_SUCCESS;}
开发者ID:EasyLinux,项目名称:Openchange,代码行数:51,
示例27: PyCredentials_AsCliCredentialsstatic PyObject *py_creds_get_named_ccache(PyObject *self, PyObject *args){ PyObject *py_lp_ctx = Py_None; char *ccache_name; struct loadparm_context *lp_ctx; struct ccache_container *ccc; struct tevent_context *event_ctx; int ret; const char *error_string; struct cli_credentials *creds; TALLOC_CTX *mem_ctx; creds = PyCredentials_AsCliCredentials(self); if (!PyArg_ParseTuple(args, "|Os", &py_lp_ctx, &ccache_name)) return NULL; mem_ctx = talloc_new(NULL); if (mem_ctx == NULL) { PyErr_NoMemory(); return NULL; } lp_ctx = lpcfg_from_py_object(mem_ctx, py_lp_ctx); if (lp_ctx == NULL) { talloc_free(mem_ctx); return NULL; } event_ctx = samba_tevent_context_init(mem_ctx); ret = cli_credentials_get_named_ccache(creds, event_ctx, lp_ctx, ccache_name, &ccc, &error_string); talloc_unlink(mem_ctx, lp_ctx); if (ret == 0) { talloc_steal(ccc, event_ctx); talloc_free(mem_ctx); return PyCredentialCacheContainer_from_ccache_container(ccc); } PyErr_SetString(PyExc_RuntimeError, error_string?error_string:"NULL"); talloc_free(mem_ctx); return NULL;}
开发者ID:samba-team,项目名称:samba,代码行数:45,
示例28: dsdb_make_schema_globalvoid dsdb_make_schema_global(struct ldb_context *ldb){ struct dsdb_schema *schema = dsdb_get_schema(ldb); if (!schema) { return; } if (global_schema) { talloc_unlink(talloc_autofree_context(), global_schema); } /* we want the schema to be around permanently */ talloc_reparent(talloc_parent(schema), talloc_autofree_context(), schema); global_schema = schema; dsdb_set_global_schema(ldb);}
开发者ID:0x24bin,项目名称:winexe-1,代码行数:18,
注:本文中的talloc_unlink函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ talloc_zero函数代码示例 C++ talloc_tos函数代码示例 |