这篇教程C++ DLIST_ADD函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中DLIST_ADD函数的典型用法代码示例。如果您正苦于以下问题:C++ DLIST_ADD函数的具体用法?C++ DLIST_ADD怎么用?C++ DLIST_ADD使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了DLIST_ADD函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: hbin_prs_keystatic bool hbin_prs_key( REGF_FILE *file, REGF_HBIN *hbin, REGF_NK_REC *nk ){ int depth = 0; REGF_HBIN *sub_hbin; depth++; /* get the initial nk record */ if (!prs_nk_rec("nk_rec", &hbin->ps, depth, nk)) return false; /* fill in values */ if ( nk->num_values && (nk->values_off!=REGF_OFFSET_NONE) ) { sub_hbin = hbin; if ( !hbin_contains_offset( hbin, nk->values_off ) ) { sub_hbin = lookup_hbin_block( file, nk->values_off ); if ( !sub_hbin ) { /*DEBUG(0,("hbin_prs_key: Failed to find HBIN block containing value_list_offset [0x%x]/n", nk->values_off));*/ return false; } } if(!hbin_prs_vk_records("vk_rec", sub_hbin, depth, nk, file)) return false; } /* now get subkeys */ if ( nk->num_subkeys && (nk->subkeys_off!=REGF_OFFSET_NONE) ) { sub_hbin = hbin; if ( !hbin_contains_offset( hbin, nk->subkeys_off ) ) { sub_hbin = lookup_hbin_block( file, nk->subkeys_off ); if ( !sub_hbin ) { /*DEBUG(0,("hbin_prs_key: Failed to find HBIN block containing subkey_offset [0x%x]/n", nk->subkeys_off));*/ return false; } } if (!hbin_prs_lf_records("lf_rec", sub_hbin, depth, nk)) return false; } /* get the to the security descriptor. First look if we have already parsed it */ if ((nk->sk_off!=REGF_OFFSET_NONE) && !(nk->sec_desc = find_sk_record_by_offset( file, nk->sk_off ))) { sub_hbin = hbin; if (!hbin_contains_offset(hbin, nk->sk_off)) { sub_hbin = lookup_hbin_block( file, nk->sk_off ); if ( !sub_hbin ) { /*DEBUG(0,("hbin_prs_key: Failed to find HBIN block containing sk_offset [0x%x]/n", nk->subkeys_off));*/ return false; } } if ( !(nk->sec_desc = (REGF_SK_REC*)zalloc(sizeof(REGF_SK_REC) )) ) return false; nk->sec_desc->sk_off = nk->sk_off; if ( !hbin_prs_sk_rec( "sk_rec", sub_hbin, depth, nk->sec_desc )) return false; /* add to the list of security descriptors (ref_count has been read from the files) */ nk->sec_desc->sk_off = nk->sk_off; /* XXX: this kind of caching needs to be re-evaluated */ DLIST_ADD( file->sec_desc_list, nk->sec_desc ); } return true;}
开发者ID:coriolis,项目名称:vminspection,代码行数:80,
示例2: SMBC_attr_server//.........这里部分代码省略......... *pp_workgroup, *pp_password, flags, signing_state); if (! NT_STATUS_IS_OK(nt_status)) { DEBUG(1,("cli_full_connection failed! (%s)/n", nt_errstr(nt_status))); errno = ENOTSUP; return NULL; } if (context->internal->smb_encryption_level) { /* Attempt encryption. */ nt_status = cli_cm_force_encryption(ipc_cli, *pp_username, *pp_password, *pp_workgroup, "IPC$"); if (!NT_STATUS_IS_OK(nt_status)) { /* * context->smb_encryption_level == * 1 means don't fail if encryption can't be * negotiated, == 2 means fail if encryption * can't be negotiated. */ DEBUG(4,(" SMB encrypt failed on IPC$/n")); if (context->internal->smb_encryption_level == 2) { cli_shutdown(ipc_cli); errno = EPERM; return NULL; } } DEBUG(4,(" SMB encrypt ok on IPC$/n")); } ipc_srv = SMB_MALLOC_P(SMBCSRV); if (!ipc_srv) { errno = ENOMEM; cli_shutdown(ipc_cli); return NULL; } ZERO_STRUCTP(ipc_srv); DLIST_ADD(ipc_srv->cli, ipc_cli); nt_status = cli_rpc_pipe_open_noauth( ipc_srv->cli, &ndr_table_lsarpc, &pipe_hnd); if (!NT_STATUS_IS_OK(nt_status)) { DEBUG(1, ("cli_nt_session_open fail!/n")); errno = ENOTSUP; cli_shutdown(ipc_srv->cli); free(ipc_srv); return NULL; } /* * Some systems don't support * SEC_FLAG_MAXIMUM_ALLOWED, but NT sends 0x2000000 * so we might as well do it too. */ nt_status = rpccli_lsa_open_policy( pipe_hnd, talloc_tos(), True, GENERIC_EXECUTE_ACCESS, &ipc_srv->pol); if (!NT_STATUS_IS_OK(nt_status)) { errno = SMBC_errno(context, ipc_srv->cli); cli_shutdown(ipc_srv->cli); free(ipc_srv); return NULL; } /* now add it to the cache (internal or external) */ errno = 0; /* let cache function set errno if it likes */ if (smbc_getFunctionAddCachedServer(context)(context, ipc_srv, server, "*IPC$", *pp_workgroup, *pp_username)) { DEBUG(3, (" Failed to add server to cache/n")); if (errno == 0) { errno = ENOMEM; } cli_shutdown(ipc_srv->cli); free(ipc_srv); return NULL; } DLIST_ADD(context->internal->servers, ipc_srv); } return ipc_srv;}
开发者ID:encukou,项目名称:samba,代码行数:101,
示例3: SMB_ASSERTstruct tdb_print_db *get_print_db_byname(const char *printername){ struct tdb_print_db *p = NULL, *last_entry = NULL; size_t num_open = 0; char *printdb_path = NULL; bool done_become_root = False; char *print_cache_path; int ret; SMB_ASSERT(printername != NULL); for (p = print_db_head, last_entry = print_db_head; p; p = p->next) { /* Ensure the list terminates... JRA. */ SMB_ASSERT(p->next != print_db_head); if (p->tdb && strequal(p->printer_name, printername)) { DLIST_PROMOTE(print_db_head, p); p->ref_count++; return p; } num_open++; last_entry = p; } /* Not found. */ if (num_open >= MAX_PRINT_DBS_OPEN) { /* Try and recycle the last entry. */ if (print_db_head && last_entry) { DLIST_PROMOTE(print_db_head, last_entry); } for (p = print_db_head; p; p = p->next) { if (p->ref_count) continue; if (p->tdb) { if (tdb_close(p->tdb)) { DEBUG(0,("get_print_db: Failed to close tdb for printer %s/n", p->printer_name )); return NULL; } } p->tdb = NULL; p->ref_count = 0; memset(p->printer_name, '/0', sizeof(p->printer_name)); break; } if (p && print_db_head) { DLIST_PROMOTE(print_db_head, p); p = print_db_head; } } if (!p) { /* Create one. */ p = SMB_MALLOC_P(struct tdb_print_db); if (!p) { DEBUG(0,("get_print_db: malloc fail !/n")); return NULL; } ZERO_STRUCTP(p); DLIST_ADD(print_db_head, p); }
开发者ID:Alexander--,项目名称:samba,代码行数:62,
示例4: add_subnetstatic void add_subnet(struct subnet_record *subrec){ DLIST_ADD(subnetlist, subrec);}
开发者ID:AllardJ,项目名称:Tomato,代码行数:4,
示例5: cli_list_user_quotaBOOL cli_list_user_quota(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_LIST **pqt_list){ BOOL ret = False; uint16 setup; char params[16]; char *rparam=NULL, *rdata=NULL; unsigned int rparam_count=0, rdata_count=0; unsigned int offset; const char *curdata = NULL; unsigned int curdata_count = 0; TALLOC_CTX *mem_ctx = NULL; SMB_NTQUOTA_STRUCT qt; SMB_NTQUOTA_LIST *tmp_list_ent; if (!cli||!pqt_list) smb_panic("cli_list_user_quota() called with NULL Pointer!"); setup = NT_TRANSACT_GET_USER_QUOTA; SSVAL(params, 0,quota_fnum); SSVAL(params, 2,TRANSACT_GET_USER_QUOTA_LIST_START); SIVAL(params, 4,0x00000000); SIVAL(params, 8,0x00000000); SIVAL(params,12,0x00000000); if (!cli_send_nt_trans(cli, NT_TRANSACT_GET_USER_QUOTA, 0, &setup, 1, 0, params, 16, 4, NULL, 0, 2048)) { DEBUG(1,("Failed to send NT_TRANSACT_GET_USER_QUOTA/n")); goto cleanup; } if (!cli_receive_nt_trans(cli, &rparam, &rparam_count, &rdata, &rdata_count)) { DEBUG(1,("Failed to recv NT_TRANSACT_GET_USER_QUOTA/n")); goto cleanup; } if (cli_is_error(cli)) { ret = False; goto cleanup; } else { ret = True; } if (rdata_count == 0) { *pqt_list = NULL; return True; } if ((mem_ctx=talloc_init("SMB_USER_QUOTA_LIST"))==NULL) { DEBUG(0,("talloc_init() failed/n")); return (-1); } offset = 1; for (curdata=rdata,curdata_count=rdata_count; ((curdata)&&(curdata_count>=8)&&(offset>0)); curdata +=offset,curdata_count -= offset) { ZERO_STRUCT(qt); if (!parse_user_quota_record(curdata, curdata_count, &offset, &qt)) { DEBUG(1,("Failed to parse the quota record/n")); goto cleanup; } if ((tmp_list_ent=TALLOC_ZERO_P(mem_ctx,SMB_NTQUOTA_LIST))==NULL) { DEBUG(0,("talloc_zero() failed/n")); return (-1); } if ((tmp_list_ent->quotas=TALLOC_ZERO_P(mem_ctx,SMB_NTQUOTA_STRUCT))==NULL) { DEBUG(0,("talloc_zero() failed/n")); return (-1); } memcpy(tmp_list_ent->quotas,&qt,sizeof(qt)); tmp_list_ent->mem_ctx = mem_ctx; DLIST_ADD((*pqt_list),tmp_list_ent); } SSVAL(params, 2,TRANSACT_GET_USER_QUOTA_LIST_CONTINUE); while(1) { if (!cli_send_nt_trans(cli, NT_TRANSACT_GET_USER_QUOTA, 0, &setup, 1, 0, params, 16, 4, NULL, 0, 2048)) { DEBUG(1,("Failed to send NT_TRANSACT_GET_USER_QUOTA/n")); goto cleanup; } SAFE_FREE(rparam); SAFE_FREE(rdata);//.........这里部分代码省略.........
开发者ID:DeezNuts12,项目名称:freestyledash,代码行数:101,
示例6: server//.........这里部分代码省略......... cli_shutdown(&c); if (strcmp(called.name, "*SMBSERVER")) { make_nmb_name(&called , "*SMBSERVER", 0x20); goto again; } errno = ENOENT; return NULL; } DEBUG(4,(" session request ok/n")); if (!cli_negprot(&c)) { cli_shutdown(&c); errno = ENOENT; return NULL; } if (!cli_session_setup(&c, username, password, strlen(password), password, strlen(password), workgroup) && /* try an anonymous login if it failed */ !cli_session_setup(&c, "", "", 1,"", 0, workgroup)) { cli_shutdown(&c); errno = EPERM; return NULL; } DEBUG(4,(" session setup ok/n")); if (!cli_send_tconX(&c, share, "?????", password, strlen(password)+1)) { errno = smbw_errno(&c); cli_shutdown(&c); return NULL; } smbw_setshared(ipenv,inet_ntoa(ip)); DEBUG(4,(" tconx ok/n")); srv = (struct smbw_server *)malloc(sizeof(*srv)); if (!srv) { errno = ENOMEM; goto failed; } ZERO_STRUCTP(srv); srv->cli = c; srv->dev = (dev_t)(str_checksum(server) ^ str_checksum(share)); srv->server_name = strdup(server); if (!srv->server_name) { errno = ENOMEM; goto failed; } srv->share_name = strdup(share); if (!srv->share_name) { errno = ENOMEM; goto failed; } srv->workgroup = strdup(workgroup); if (!srv->workgroup) { errno = ENOMEM; goto failed; } srv->username = strdup(username); if (!srv->username) { errno = ENOMEM; goto failed; } /* some programs play with file descriptors fairly intimately. We try to get out of the way by duping to a high fd number */ if (fcntl(SMBW_CLI_FD + srv->cli.fd, F_GETFD) && errno == EBADF) { if (dup2(srv->cli.fd,SMBW_CLI_FD+srv->cli.fd) == srv->cli.fd+SMBW_CLI_FD) { close(srv->cli.fd); srv->cli.fd += SMBW_CLI_FD; } } DLIST_ADD(smbw_srvs, srv); return srv; failed: cli_shutdown(&c); if (!srv) return NULL; SAFE_FREE(srv->server_name); SAFE_FREE(srv->share_name); SAFE_FREE(srv); return NULL;}
开发者ID:livebox,项目名称:livebox2,代码行数:101,
示例7: SMBC_open_ctx//.........这里部分代码省略......... /* Hmmm, the test for a directory is suspect here ... FIXME */ if (strlen(path) > 0 && path[strlen(path) - 1] == '//') { status = NT_STATUS_OBJECT_PATH_INVALID; } else { file = SMB_MALLOC_P(SMBCFILE); if (!file) { errno = ENOMEM; TALLOC_FREE(frame); return NULL; } ZERO_STRUCTP(file); /*d_printf(">>>open: resolving %s/n", path);*/ status = cli_resolve_path( frame, "", context->internal->auth_info, srv->cli, path, &targetcli, &targetpath); if (!NT_STATUS_IS_OK(status)) { d_printf("Could not resolve %s/n", path); errno = ENOENT; SAFE_FREE(file); TALLOC_FREE(frame); return NULL; } /*d_printf(">>>open: resolved %s as %s/n", path, targetpath);*/ status = cli_open(targetcli, targetpath, flags, context->internal->share_mode, &fd); if (!NT_STATUS_IS_OK(status)) { /* Handle the error ... */ SAFE_FREE(file); errno = SMBC_errno(context, targetcli); TALLOC_FREE(frame); return NULL; } /* Fill in file struct */ file->cli_fd = fd; file->fname = SMB_STRDUP(fname); file->srv = srv; file->offset = 0; file->file = True; DLIST_ADD(context->internal->files, file); /* * If the file was opened in O_APPEND mode, all write * operations should be appended to the file. To do that, * though, using this protocol, would require a getattrE() * call for each and every write, to determine where the end * of the file is. (There does not appear to be an append flag * in the protocol.) Rather than add all of that overhead of * retrieving the current end-of-file offset prior to each * write operation, we'll assume that most append operations * will continuously write, so we'll just set the offset to * the end of the file now and hope that's adequate. * * Note to self: If this proves inadequate, and O_APPEND * should, in some cases, be forced for each write, add a * field in the context options structure, for * "strict_append_mode" which would select between the current * behavior (if FALSE) or issuing a getattrE() prior to each * write and forcing the write to the end of the file (if * TRUE). Adding that capability will likely require adding * an "append" flag into the _SMBCFILE structure to track * whether a file was opened in O_APPEND mode. -- djl */ if (flags & O_APPEND) { if (SMBC_lseek_ctx(context, file, 0, SEEK_END) < 0) { (void) SMBC_close_ctx(context, file); errno = ENXIO; TALLOC_FREE(frame); return NULL; } } TALLOC_FREE(frame); return file; } /* Check if opendir needed ... */ if (!NT_STATUS_IS_OK(status)) { int eno = 0; eno = SMBC_errno(context, srv->cli); file = smbc_getFunctionOpendir(context)(context, fname); if (!file) errno = eno; TALLOC_FREE(frame); return file; } errno = EINVAL; /* FIXME, correct errno ? */ TALLOC_FREE(frame); return NULL;}
开发者ID:AIdrifter,项目名称:samba,代码行数:101,
示例8: add_ccache_to_list//.........这里部分代码省略......... entry = talloc(NULL, struct WINBINDD_CCACHE_ENTRY); if (!entry) { return NT_STATUS_NO_MEMORY; } ZERO_STRUCTP(entry); if (username) { entry->username = talloc_strdup(entry, username); if (!entry->username) { goto no_mem; } } if (princ_name) { entry->principal_name = talloc_strdup(entry, princ_name); if (!entry->principal_name) { goto no_mem; } } if (service) { entry->service = talloc_strdup(entry, service); if (!entry->service) { goto no_mem; } } entry->ccname = talloc_strdup(entry, ccname); if (!entry->ccname) { goto no_mem; } entry->realm = talloc_strdup(entry, realm); if (!entry->realm) { goto no_mem; } entry->create_time = create_time; entry->renew_until = renew_until; entry->uid = uid; entry->ref_count = 1; if (!lp_winbind_refresh_tickets() || renew_until <= 0) { goto add_entry; } if (postponed_request) { t = timeval_current_ofs(MAX(30, lp_winbind_cache_time()), 0); add_krb5_ticket_gain_handler_event(entry, t); } else { /* Renew at 1/2 the ticket expiration time */#if defined(DEBUG_KRB5_TKT_RENEWAL) t = timeval_set(time(NULL)+30, 0);#else t = timeval_set(krb5_event_refresh_time(ticket_end), 0);#endif if (entry->refresh_time == 0) { entry->refresh_time = t.tv_sec; } entry->event = tevent_add_timer(winbind_event_context(), entry, t, krb5_ticket_refresh_handler, entry); } if (!entry->event) { goto no_mem; } DEBUG(10,("add_ccache_to_list: added krb5_ticket handler/n")); add_entry: DLIST_ADD(ccache_list, entry); DEBUG(10,("add_ccache_to_list: " "added ccache [%s] for user [%s] to the list/n", ccname, username)); if (entry->event) { /* * If we're set up to renew our krb5 tickets, we must * cache the credentials in memory for the ticket * renew function. Fix inspired by patch from * Ian Gordon <[email C++ DLIST_REMOVE函数代码示例 C++ DLEYNA_LOG_DEBUG函数代码示例
|