struct polldata * udp_server (const char *bindto, struct timeval *timeout, data_cb cb) { struct addrinfo *res; int s = -1; for (res = _resolve (bindto); res; res = _resolve (bindto)) { s = socket (res->ai_family, res->ai_socktype, res->ai_protocol); if (s >= 0) { if (bind (s, res->ai_addr, res->ai_addrlen) == 0) break; /* Done. */ else { close (s); s = -1; } } } if (s >= 0) { struct polldata *data = malloc (sizeof (struct polldata)); assert (data); memset (data, 0, sizeof (struct polldata)); data->s = s; data->cb = cb; if (timeout) { data->timeout = malloc (sizeof (struct timeval)); assert (data->timeout); memcpy (data->timeout, timeout, sizeof (struct timeval)); } return data; } return NULL; }
int open_server( char *hostname, short hostport) { int32 server_ip ; char alertstr[MAXLINELENGTH+1] ; int TCP_IP_resp, cn; /* Look up host */ if( _resolve( hostname, (char **)NULL, &server_ip, 1 ) < 0 ) { /* Resolve error */ sprintf( alertstr, "Cannot find server %s",hostname ) ; alert( alertstr ) ; return -1; } event_loop() ; /* Open socket and bind it to address */ if( ( cn = _TCP_open( server_ip, port, 0, TCPBUFSIZ ) ) < 0 ) { alert( "Could not open a socket") ; return -1; } ndb = (NDB *)NULL; /* Wait for connection to be established */ TCP_IP_resp=_TCP_wait_state( cn, TESTABLISH, TIMEOUT ); if( TCP_IP_resp != E_NORMAL ) { if( TCP_IP_resp=-7 ) { alert( "connection refused by remote server"); } else { alert( "could not connect to remote server, unknown error") ; } _TCP_close( cn, TIMEOUT ) ; byebye(1) ; } return cn ; }
khm_int32 krb4_msg_newcred(khm_int32 msg_type, khm_int32 msg_subtype, khm_ui_4 uparam, void * vparam) { switch(msg_subtype) { case KMSG_CRED_NEW_CREDS: { khui_new_creds * nc; khui_new_creds_by_type * nct; khm_size cbsize; wchar_t wbuf[256]; nc = (khui_new_creds *) vparam; nct = PMALLOC(sizeof(*nct)); #ifdef DEBUG assert(nct); #endif ZeroMemory(nct, sizeof(*nct)); nct->type = credtype_id_krb4; nct->ordinal = 3; LoadString(hResModule, IDS_NC_K4_SHORT, wbuf, ARRAYLENGTH(wbuf)); StringCbLength(wbuf, sizeof(wbuf), &cbsize); cbsize += sizeof(wchar_t); nct->name = PMALLOC(cbsize); StringCbCopy(nct->name, cbsize, wbuf); nct->type_deps[nct->n_type_deps++] = credtype_id_krb5; nct->h_module = hResModule; nct->dlg_proc = k4_nc_dlg_proc; nct->dlg_template = MAKEINTRESOURCE(IDD_NC_KRB4); khui_cw_add_type(nc, nct); } break; case KMSG_CRED_RENEW_CREDS: { khui_new_creds * nc; khui_new_creds_by_type * nct; khm_size cbsize; wchar_t wbuf[256]; khui_action_context * pctx = NULL; nc = (khui_new_creds *) vparam; pctx = khui_cw_get_ctx(nc); if (!pctx->identity) break; nct = PMALLOC(sizeof(*nct)); #ifdef DEBUG assert(nct); #endif ZeroMemory(nct, sizeof(*nct)); nct->type = credtype_id_krb4; nct->ordinal = 3; LoadString(hResModule, IDS_NC_K4_SHORT, wbuf, ARRAYLENGTH(wbuf)); StringCbLength(wbuf, sizeof(wbuf), &cbsize); cbsize += sizeof(wchar_t); nct->name = PMALLOC(cbsize); StringCbCopy(nct->name, cbsize, wbuf); nct->type_deps[nct->n_type_deps++] = credtype_id_krb5; khui_cw_add_type(nc, nct); } break; case KMSG_CRED_DIALOG_SETUP: break; case KMSG_CRED_PROCESS: { khui_new_creds * nc; khui_new_creds_by_type * nct = NULL; khm_handle ident = NULL; khui_action_context * pctx = NULL; k4_dlg_data * d = NULL; long code = 0; wchar_t idname[KCDB_IDENT_MAXCCH_NAME]; khm_size cb; khm_int32 subtype; nc = (khui_new_creds *) vparam; if (KHM_FAILED(khui_cw_find_type(nc, credtype_id_krb4, &nct))) break; subtype = khui_cw_get_subtype(nc); if (subtype == KMSG_CRED_NEW_CREDS || subtype == KMSG_CRED_RENEW_CREDS) { khm_int32 method; if (subtype == KMSG_CRED_NEW_CREDS) { d = (k4_dlg_data *) nct->aux; if (KHM_FAILED(khui_cw_get_primary_id(nc, &ident))) break; if (!d || khui_cw_get_result(nc) != KHUI_NC_RESULT_PROCESS) { khui_cw_set_response(nc, credtype_id_krb4, KHUI_NC_RESPONSE_SUCCESS | KHUI_NC_RESPONSE_EXIT); kcdb_identity_release(ident); break; } if (!d->k4_enabled) { k4_write_identity_data(d); khui_cw_set_response(nc, credtype_id_krb4, KHUI_NC_RESPONSE_SUCCESS | KHUI_NC_RESPONSE_EXIT); kcdb_identity_release(ident); break; } method = d->method; cb = sizeof(idname); kcdb_identity_get_name(ident, idname, &cb); _begin_task(0); _report_sr0(KHERR_NONE, IDS_MSG_K4NEW); _resolve(); _describe(); } else if (subtype == KMSG_CRED_RENEW_CREDS) { pctx = khui_cw_get_ctx(nc); if ((pctx->scope == KHUI_SCOPE_IDENT && pctx->identity != NULL) || (pctx->scope == KHUI_SCOPE_CREDTYPE && pctx->cred_type == credtype_id_krb4 && pctx->identity != NULL) || (pctx->scope == KHUI_SCOPE_CRED && pctx->cred_type == credtype_id_krb4 && pctx->identity != NULL && pctx->cred != NULL)) { ident = pctx->identity; kcdb_identity_hold(ident); if (!k4_should_identity_get_k4(ident)) { _reportf(L"Kerberos 4 is not enabled for this identity. Skipping"); khui_cw_set_response(nc, credtype_id_krb4, KHUI_NC_RESPONSE_FAILED | KHUI_NC_RESPONSE_EXIT); kcdb_identity_release(ident); break; } } else { _reportf(L"Kerberos 4 is not within renewal scope. Skipping"); khui_cw_set_response(nc, credtype_id_krb4, KHUI_NC_RESPONSE_FAILED | KHUI_NC_RESPONSE_EXIT); break; } method = K4_METHOD_K524; /* only k524 is supported for renewals */ _begin_task(0); cb = sizeof(idname); kcdb_identity_get_name(ident, idname, &cb); _report_sr0(KHERR_NONE, IDS_MSG_K4RENEW); _resolve(); _describe(); } else { assert(FALSE); break; } _progress(0,1); if ((method == K4_METHOD_AUTO || method == K4_METHOD_K524) && khui_cw_type_succeeded(nc, credtype_id_krb5)) { khm_handle tgt; FILETIME ft_prev; FILETIME ft_new; khm_size cb; _report_cs0(KHERR_INFO, L"Trying K524..."); tgt = khm_krb4_find_tgt(NULL, ident); _progress(1,3); if (tgt) { cb = sizeof(ft_prev); if (KHM_FAILED(kcdb_cred_get_attr(tgt, KCDB_ATTR_EXPIRE, NULL, &ft_prev, &cb))) ZeroMemory(&ft_prev, sizeof(ft_prev)); kcdb_cred_release(tgt); } code = khm_convert524(ident); _progress(2,3); _reportf(L"khm_convert524 returns code %d", code); if (code == 0) { khui_cw_set_response(nc, credtype_id_krb4, KHUI_NC_RESPONSE_SUCCESS | KHUI_NC_RESPONSE_EXIT); if (subtype == KMSG_CRED_NEW_CREDS) { assert(d != NULL); k4_write_identity_data(d); } else if (subtype == KMSG_CRED_RENEW_CREDS && (pctx->scope == KHUI_SCOPE_CREDTYPE || pctx->scope == KHUI_SCOPE_CRED)) { khm_krb4_list_tickets(); tgt = khm_krb4_find_tgt(NULL, ident); if (tgt) { cb = sizeof(ft_new); ZeroMemory(&ft_new, sizeof(ft_new)); kcdb_cred_get_attr(tgt, KCDB_ATTR_EXPIRE, NULL, &ft_new, &cb); kcdb_cred_release(tgt); } if (!tgt || CompareFileTime(&ft_new, &ft_prev) <= 0) { /* The new TGT wasn't much of an improvement over what we already had. We should go out and try to renew the identity now. */ khui_action_context ctx; _reportf(L"Renewal of Krb4 creds failed to get a longer TGT. Triggering identity renewal"); khui_context_create(&ctx, KHUI_SCOPE_IDENT, pctx->identity, KCDB_CREDTYPE_INVALID, NULL); khui_action_trigger(KHUI_ACTION_RENEW_CRED, &ctx); khui_context_release(&ctx); } } _progress(1,1); _end_task(); if (ident) kcdb_identity_release(ident); break; } else if (method == K4_METHOD_K524) { khui_cw_set_response(nc, credtype_id_krb4, KHUI_NC_RESPONSE_FAILED | KHUI_NC_RESPONSE_EXIT); if (subtype == KMSG_CRED_RENEW_CREDS && (pctx->scope == KHUI_SCOPE_CREDTYPE || pctx->scope == KHUI_SCOPE_CRED)) { /* We were trying to get a new Krb4 TGT for this identity. Sometimes this fails because of restrictions placed on K524d regarding the lifetime of the issued K4 TGT. In this case, we trigger a renewal of the identity in the hope that the new K5 TGT will allow us to successfully get a new K4 TGT next time over using the new K5 TGT. */ khui_action_context ctx; _reportf(L"Renewal of Krb4 creds failed using k524. Triggerring identity renewal."); khui_context_create(&ctx, KHUI_SCOPE_IDENT, pctx->identity, KCDB_CREDTYPE_INVALID, NULL); khui_action_trigger(KHUI_ACTION_RENEW_CRED, &ctx); khui_context_release(&ctx); } _progress(1,1); _end_task(); if (ident) kcdb_identity_release(ident); break; } } /* only supported for new credentials */ if (method == K4_METHOD_AUTO || method == K4_METHOD_PASSWORD) { khm_size n_prompts = 0; khm_size idx; khm_size cb; wchar_t wpwd[KHUI_MAXCCH_PROMPT_VALUE]; char pwd[KHUI_MAXCCH_PROMPT_VALUE]; wchar_t widname[KCDB_IDENT_MAXCCH_NAME]; char idname[KCDB_IDENT_MAXCCH_NAME]; char * aname = NULL; char * inst = NULL; char * realm = NULL; assert(subtype == KMSG_CRED_NEW_CREDS); _report_cs0(KHERR_INFO, L"Trying password ..."); code = TRUE; /* just has to be non-zero */ khui_cw_get_prompt_count(nc, &n_prompts); if (n_prompts == 0) goto _skip_pwd; for (idx = 0; idx < n_prompts; idx++) { khui_new_creds_prompt * p; if (KHM_FAILED(khui_cw_get_prompt(nc, idx, &p))) continue; if (p->type == KHUI_NCPROMPT_TYPE_PASSWORD) break; } if (idx >= n_prompts) { _reportf(L"Password prompt not found"); goto _skip_pwd; } khui_cw_sync_prompt_values(nc); cb = sizeof(wpwd); if (KHM_FAILED(khui_cw_get_prompt_value(nc, idx, wpwd, &cb))) { _reportf(L"Failed to obtain password value"); goto _skip_pwd; } UnicodeStrToAnsi(pwd, sizeof(pwd), wpwd); cb = sizeof(widname); kcdb_identity_get_name(ident, widname, &cb); UnicodeStrToAnsi(idname, sizeof(idname), widname); { char * atsign; atsign = strchr(idname, '@'); if (atsign == NULL) { _reportf(L"Identity name does not contain an '@'"); goto _skip_pwd; } *atsign++ = 0; realm = atsign; } { char * slash; slash = strchr(idname, '/'); if (slash != NULL) { *slash++ = 0; inst = slash; } else { inst = ""; } } aname = idname; code = khm_krb4_kinit(aname, inst, realm, (long) d->lifetime, pwd); _progress(2,3); _reportf(L"khm_krb4_kinit returns code %d", code); _skip_pwd: if (code) { khui_cw_set_response(nc, credtype_id_krb4, KHUI_NC_RESPONSE_EXIT | KHUI_NC_RESPONSE_FAILED); } else { khui_cw_set_response(nc, credtype_id_krb4, KHUI_NC_RESPONSE_EXIT | KHUI_NC_RESPONSE_SUCCESS); if (subtype == KMSG_CRED_NEW_CREDS) { assert(d != NULL); k4_write_identity_data(d); } } } _progress(1,1); _end_task(); } if (ident) kcdb_identity_release(ident); } break; case KMSG_CRED_END: { khui_new_creds * nc; khui_new_creds_by_type * nct = NULL; nc = (khui_new_creds *) vparam; if (KHM_FAILED(khui_cw_find_type(nc, credtype_id_krb4, &nct))) break; khui_cw_del_type(nc, credtype_id_krb4); if (nct->name) PFREE(nct->name); if (nct->credtext) PFREE(nct->credtext); PFREE(nct); } break; } return KHM_ERROR_SUCCESS; }
void resolve(const address_type& addr) noexcept { _resolve(addr); }
void get_command(void) { char com[255]; int text_width, text_startx; allocated_block_t *allocated_block = NULL; int i = 0; int count = 0; WINDOW *command_win = NULL; List allocated_blocks = NULL; ListIterator results_i; if (params.commandline && !params.command) { printf("Configure won't work with commandline mode.\n"); printf("Please remove the -c from the commandline.\n"); bg_configure_ba_fini(); exit(0); } if (working_cluster_rec) { char *cluster_name = slurm_get_cluster_name(); if (strcmp(working_cluster_rec->name, cluster_name)) { xfree(cluster_name); endwin(); printf("To use the configure option you must be on the " "cluster the configure is for.\nCross cluster " "support doesn't exist today.\nSorry for the " "inconvenince.\n"); bg_configure_ba_fini(); exit(0); } xfree(cluster_name); } /* make sure we don't get any noisy debug */ ba_configure_set_ba_debug_flags(0); bg_configure_ba_setup_wires(); color_count = 0; allocated_blocks = list_create(_destroy_allocated_block); if (params.commandline) { snprintf(com, sizeof(com), "%s", params.command); goto run_command; } else { text_width = text_win->_maxx; text_startx = text_win->_begx; command_win = newwin(3, text_width - 1, LINES - 4, text_startx + 1); curs_set(1); echo(); } while (strcmp(com, "quit")) { clear_window(grid_win); print_grid(); clear_window(text_win); box(text_win, 0, 0); box(grid_win, 0, 0); if (!params.no_header) _print_header_command(); if (error_string != NULL) { i = 0; while (error_string[i] != '\0') { if (error_string[i] == '\n') { main_ycord++; main_xcord=1; i++; } mvwprintw(text_win, main_ycord, main_xcord, "%c", error_string[i++]); main_xcord++; } main_ycord++; main_xcord = 1; memset(error_string, 0, 255); } results_i = list_iterator_create(allocated_blocks); count = list_count(allocated_blocks) - (LINES-(main_ycord+5)); if (count<0) count=0; i=0; while ((allocated_block = list_next(results_i)) != NULL) { if (i >= count) _print_text_command(allocated_block); i++; } list_iterator_destroy(results_i); wnoutrefresh(text_win); wnoutrefresh(grid_win); doupdate(); clear_window(command_win); box(command_win, 0, 0); mvwprintw(command_win, 0, 3, "Input Command: (type quit to change view, " "exit to exit)"); wmove(command_win, 1, 1); wgetstr(command_win, com); if (!strcmp(com, "exit")) { endwin(); if (allocated_blocks) list_destroy(allocated_blocks); bg_configure_ba_fini(); exit(0); } run_command: if (!strcmp(com, "quit") || !strcmp(com, "\\q")) { break; } else if (!strncasecmp(com, "layout", 6)) { _set_layout(com); } else if (!strncasecmp(com, "basepartition", 13)) { _set_base_part_cnt(com); } else if (!strncasecmp(com, "nodecard", 8)) { _set_nodecard_cnt(com); } else if (!strncasecmp(com, "resolve", 7) || !strncasecmp(com, "r ", 2)) { _resolve(com); } else if (!strncasecmp(com, "resume", 6)) { mvwprintw(text_win, main_ycord, main_xcord, "%s", com); } else if (!strncasecmp(com, "drain", 5)) { mvwprintw(text_win, main_ycord, main_xcord, "%s", com); } else if (!strncasecmp(com, "alldown", 7)) { _change_state_all_bps(com, NODE_STATE_DOWN); } else if (!strncasecmp(com, "down", 4)) { _change_state_bps(com, NODE_STATE_DOWN); } else if (!strncasecmp(com, "allup", 5)) { _change_state_all_bps(com, NODE_STATE_IDLE); } else if (!strncasecmp(com, "up", 2)) { _change_state_bps(com, NODE_STATE_IDLE); } else if (!strncasecmp(com, "remove", 6) || !strncasecmp(com, "delete", 6) || !strncasecmp(com, "drop", 4)) { _remove_allocation(com, allocated_blocks); } else if (!strncasecmp(com, "create", 6)) { _create_allocation(com, allocated_blocks); } else if (!strncasecmp(com, "copy", 4) || !strncasecmp(com, "c ", 2) || !strncasecmp(com, "c\0", 2)) { _copy_allocation(com, allocated_blocks); } else if (!strncasecmp(com, "save", 4)) { _save_allocation(com, allocated_blocks); } else if (!strncasecmp(com, "load", 4)) { _load_configuration(com, allocated_blocks); } else if (!strncasecmp(com, "clear all", 9) || !strncasecmp(com, "clear", 5)) { list_flush(allocated_blocks); } else { memset(error_string, 0, 255); sprintf(error_string, "Unknown command '%s'",com); } if (params.commandline) { bg_configure_ba_fini(); exit(1); } } if (allocated_blocks) list_destroy(allocated_blocks); params.display = 0; noecho(); clear_window(text_win); main_xcord = 1; main_ycord = 1; curs_set(0); print_date(); get_job(); return; }
/*! \internal \brief Manages a plugin message thread. Each plugin gets its own plugin thread which is used to dispatch messages to the plugin. This acts as the thread function for the plugin thread.*/ DWORD WINAPI kmmint_plugin_broker(LPVOID lpParameter) { DWORD rv = 0; kmm_plugin_i * p = (kmm_plugin_i *) lpParameter; PDESCTHREAD(p->p.name, L"KMM"); _begin_task(0); _report_mr1(KHERR_NONE, MSG_PB_START, _cstr(p->p.name)); _describe(); TlsSetValue(tls_kmm, (LPVOID) p); kmm_hold_plugin(kmm_handle_from_plugin(p)); p->tid_thread = GetCurrentThreadId(); if (IsBadCodePtr(p->p.msg_proc)) { _report_mr0(KHERR_WARNING, MSG_PB_INVALID_CODE_PTR); rv = KHM_ERROR_INVALID_PARAM; } else { rv = (*p->p.msg_proc)(KMSG_SYSTEM, KMSG_SYSTEM_INIT, 0, (void *) &(p->p)); _report_mr1(KHERR_INFO, MSG_PB_INIT_RV, _int32(rv)); } /* if it fails to initialize, we exit the plugin */ if(KHM_FAILED(rv)) { kherr_report(KHERR_ERROR, (wchar_t *) MSG_PB_INIT_FAIL_S, (wchar_t *) KHERR_FACILITY, NULL, (wchar_t *) MSG_PB_INIT_FAIL, (wchar_t *) MSG_PB_INIT_FAIL_G, KHERR_FACILITY_ID, KHERR_SUGGEST_NONE, _cstr(p->p.name), _cstr(p->p.description), _cstr(p->module->path), _cstr(p->module->support), KHERR_RF_MSG_SHORT_DESC | KHERR_RF_MSG_LONG_DESC | KHERR_RF_MSG_SUGGEST #ifdef _WIN32 ,KHERR_HMODULE #endif ); _resolve(); /* exit the plugin first. Otherwise it may not uninitialize correctly */ (*p->p.msg_proc)(KMSG_SYSTEM, KMSG_SYSTEM_EXIT, 0, (void *) &(p->p)); kmmint_remove_from_plugin_queue(p); rv = 1; _end_task(); p->state = KMM_PLUGIN_STATE_FAIL_INIT; goto _exit; } /* subscribe to default message classes by plugin type */ if(p->p.type == KHM_PITYPE_CRED) { kmq_subscribe(KMSG_SYSTEM, p->p.msg_proc); kmq_subscribe(KMSG_KCDB, p->p.msg_proc); kmq_subscribe(KMSG_CRED, p->p.msg_proc); } else if(p->p.type == KHM_PITYPE_IDENT) { khm_handle h = NULL; kmq_subscribe(KMSG_SYSTEM, p->p.msg_proc); kmq_subscribe(KMSG_KCDB, p->p.msg_proc); kmq_create_subscription(p->p.msg_proc, &h); kcdb_identity_set_provider(h); /* kcdb deletes the subscription when it's done with it */ } else if(p->p.type == KHM_PITYPE_CONFIG) { /*TODO: subscribe to configuration provider messages here */ } p->state = KMM_PLUGIN_STATE_RUNNING; _report_mr0(KHERR_INFO, MSG_PB_INIT_DONE); _end_task(); /* if there were any plugins that were waiting for this one to start, we should start them too */ EnterCriticalSection(&cs_kmm); do { kmm_plugin_i * pd; int i; for(i=0; i < p->n_dependants; i++) { pd = p->dependants[i]; pd->n_unresolved--; if(pd->n_unresolved == 0) { kmmint_add_to_plugin_queue(pd); kmm_hold_plugin(kmm_handle_from_plugin(pd)); kmq_post_message(KMSG_KMM, KMSG_KMM_I_REG, KMM_REG_INIT_PLUGIN, (void *) pd); } } } while(FALSE); LeaveCriticalSection(&cs_kmm); kmmint_remove_from_plugin_queue(p); /* main message loop */ while(KHM_SUCCEEDED(kmq_dispatch(INFINITE))); /* unsubscribe from default message classes by plugin type */ if(p->p.type == KHM_PITYPE_CRED) { kmq_unsubscribe(KMSG_SYSTEM, p->p.msg_proc); kmq_unsubscribe(KMSG_KCDB, p->p.msg_proc); kmq_unsubscribe(KMSG_CRED, p->p.msg_proc); } else if (p->p.type == KHM_PITYPE_IDENT) { kmq_unsubscribe(KMSG_KCDB, p->p.msg_proc); kmq_unsubscribe(KMSG_SYSTEM, p->p.msg_proc); kcdb_identity_set_provider(NULL); } else if(p->p.type == KHM_PITYPE_CONFIG) { /*TODO: unsubscribe from configuration provider messages here */ } p->p.msg_proc(KMSG_SYSTEM, KMSG_SYSTEM_EXIT, 0, (void *) &(p->p)); _exit: if (p->state >= 0) p->state = KMM_PLUGIN_STATE_EXITED; /* the following call will automatically release the plugin */ kmq_post_message(KMSG_KMM, KMSG_KMM_I_REG, KMM_REG_EXIT_PLUGIN, (void *) p); TlsSetValue(tls_kmm, (LPVOID) 0); ExitThread(rv); /* not reached */ return rv; }
void khm_cred_dispatch_process_message(khui_new_creds *nc) { khm_size i; BOOL pending; wchar_t wsinsert[512]; khm_size cbsize; /* see if there's anything to do. We can check this without obtaining a lock */ if(nc->n_types == 0 || (nc->subtype == KMSG_CRED_NEW_CREDS && nc->n_identities == 0) || (nc->subtype == KMSG_CRED_PASSWORD && nc->n_identities == 0)) goto _terminate_job; /* check dependencies and stuff first */ EnterCriticalSection(&nc->cs); for(i=0; i<nc->n_types; i++) { nc->types[i]->flags &= ~ KHUI_NCT_FLAG_PROCESSED; } LeaveCriticalSection(&nc->cs); /* Consindering all that can go wrong here and the desire to handle errors here separately from others, we create a new task for the purpose of tracking the credentials acquisition process. */ _begin_task(KHERR_CF_TRANSITIVE); /* Describe the context */ if(nc->subtype == KMSG_CRED_NEW_CREDS) { cbsize = sizeof(wsinsert); kcdb_identity_get_name(nc->identities[0], wsinsert, &cbsize); _report_sr1(KHERR_NONE, IDS_CTX_PROC_NEW_CREDS, _cstr(wsinsert)); _resolve(); } else if (nc->subtype == KMSG_CRED_RENEW_CREDS) { cbsize = sizeof(wsinsert); if (nc->ctx.scope == KHUI_SCOPE_IDENT) kcdb_identity_get_name(nc->ctx.identity, wsinsert, &cbsize); else if (nc->ctx.scope == KHUI_SCOPE_CREDTYPE) { if (nc->ctx.identity != NULL) kcdb_identity_get_name(nc->ctx.identity, wsinsert, &cbsize); else kcdb_credtype_get_name(nc->ctx.cred_type, wsinsert, &cbsize); } else if (nc->ctx.scope == KHUI_SCOPE_CRED) { kcdb_cred_get_name(nc->ctx.cred, wsinsert, &cbsize); } else { StringCbCopy(wsinsert, sizeof(wsinsert), L"(?)"); } _report_sr1(KHERR_NONE, IDS_CTX_PROC_RENEW_CREDS, _cstr(wsinsert)); _resolve(); } else if (nc->subtype == KMSG_CRED_PASSWORD) { cbsize = sizeof(wsinsert); kcdb_identity_get_name(nc->identities[0], wsinsert, &cbsize); _report_sr1(KHERR_NONE, IDS_CTX_PROC_PASSWORD, _cstr(wsinsert)); _resolve(); } else { assert(FALSE); } _describe(); pending = khm_cred_dispatch_process_level(nc); _end_task(); if(!pending) goto _terminate_job; return; _terminate_job: if (nc->subtype == KMSG_CRED_RENEW_CREDS) kmq_post_message(KMSG_CRED, KMSG_CRED_END, 0, (void *) nc); else PostMessage(nc->hwnd, KHUI_WM_NC_NOTIFY, MAKEWPARAM(0, WMNC_DIALOG_PROCESS_COMPLETE), 0); }