int APY_Provider_Fini(AB_PROVIDER *pro, GWEN_DB_NODE *dbData) { APY_PROVIDER *dp; uint32_t currentVersion; DBG_NOTICE(AQPAYPAL_LOGDOMAIN, "Deinitializing AqPaypal backend"); assert(pro); dp=GWEN_INHERIT_GETDATA(AB_PROVIDER, APY_PROVIDER, pro); assert(dp); currentVersion= (AQBANKING_VERSION_MAJOR<<24) | (AQBANKING_VERSION_MINOR<<16) | (AQBANKING_VERSION_PATCHLEVEL<<8) | AQBANKING_VERSION_BUILD; /* save configuration */ DBG_NOTICE(AQPAYPAL_LOGDOMAIN, "Setting version %08x", currentVersion); GWEN_DB_SetIntValue(dbData, GWEN_DB_FLAGS_OVERWRITE_VARS, "lastVersion", currentVersion); DBG_INFO(AQPAYPAL_LOGDOMAIN, "Deinit done"); return 0; }
/* --------------------------------------------------------------- FUNCTION */ int AH_Job_GetBalance_Exchange(AH_JOB *j, AB_JOB *bj, AH_JOB_EXCHANGE_MODE m, AB_IMEXPORTER_CONTEXT *ctx){ AH_JOB_GETBALANCE *aj; DBG_INFO(AQHBCI_LOGDOMAIN, "Exchanging (%d)", m); assert(j); aj=GWEN_INHERIT_GETDATA(AH_JOB, AH_JOB_GETBALANCE, j); assert(aj); if (AB_Job_GetType(bj)!=AB_Job_TypeGetBalance) { DBG_ERROR(AQHBCI_LOGDOMAIN, "Not a GetBalance job"); return GWEN_ERROR_INVALID; } switch(m) { case AH_Job_ExchangeModeParams: DBG_NOTICE(AQHBCI_LOGDOMAIN, "No params to exchange"); return 0; case AH_Job_ExchangeModeArgs: DBG_NOTICE(AQHBCI_LOGDOMAIN, "No arguments to exchange"); return 0; case AH_Job_ExchangeModeResults: return 0; default: DBG_NOTICE(AQHBCI_LOGDOMAIN, "Unsupported exchange mode"); return GWEN_ERROR_NOT_SUPPORTED; } /* switch */ }
int AB_SetupNewUserDialog_Next(GWEN_DIALOG *dlg) { AB_SETUP_NEWUSER_DIALOG *xdlg; int page; assert(dlg); xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, AB_SETUP_NEWUSER_DIALOG, dlg); assert(xdlg); page=GWEN_Dialog_GetIntProperty(dlg, "wiz_stack", GWEN_DialogProperty_Value, 0, -1); DBG_NOTICE(0, "Value of wiz_stack: %d", page); if (page==PAGE_BEGIN) { DBG_NOTICE(0, "First page"); page++; return AB_SetupNewUserDialog_EnterPage(dlg, page, 1); } if (page==PAGE_BACKEND) { int idx; DBG_NOTICE(0, "Backend page"); idx=AB_SetupNewUserDialog_DetermineBackendIndex(dlg); if (idx!=-1) { page=idx+PAGE_BACKEND+1; return AB_SetupNewUserDialog_EnterPage(dlg, page, 1); } } else if (page>PAGE_BACKEND) return GWEN_DialogEvent_ResultAccept; return GWEN_DialogEvent_ResultHandled; }
int EBC_Provider_Fini(AB_PROVIDER *pro, GWEN_DB_NODE *dbData) { EBC_PROVIDER *dp; uint32_t currentVersion; DBG_NOTICE(AQEBICS_LOGDOMAIN, "Deinitializing AqEBICS backend"); assert(pro); dp=GWEN_INHERIT_GETDATA(AB_PROVIDER, EBC_PROVIDER, pro); assert(dp); currentVersion= (AQEBICS_VERSION_MAJOR<<24) | (AQEBICS_VERSION_MINOR<<16) | (AQEBICS_VERSION_PATCHLEVEL<<8) | AQEBICS_VERSION_BUILD; /* save configuration */ DBG_NOTICE(AQEBICS_LOGDOMAIN, "Setting version %08x", currentVersion); GWEN_DB_SetIntValue(dbData, GWEN_DB_FLAGS_OVERWRITE_VARS, "lastVersion", currentVersion); GWEN_DB_SetIntValue(dbData, GWEN_DB_FLAGS_OVERWRITE_VARS, "connectTimeout", dp->connectTimeout); GWEN_DB_SetIntValue(dbData, GWEN_DB_FLAGS_OVERWRITE_VARS, "transferTimeout", dp->transferTimeout); return 0; }
void GWEN_XMLNode_Path_Dump(GWEN_XMLNODE_PATH *np) { unsigned int i; if (np->pos==0) { DBG_NOTICE(GWEN_LOGDOMAIN, "Empty path"); } for (i=0; i<np->pos; i++) { DBG_NOTICE(GWEN_LOGDOMAIN, "Path entry %d:", i); GWEN_XMLNode_Dump(np->nodes[i], 1); } }
int AB_SetupNewUserDialog_EnterPage(GWEN_DIALOG *dlg, int page, int forwards) { AB_SETUP_NEWUSER_DIALOG *xdlg; assert(dlg); xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, AB_SETUP_NEWUSER_DIALOG, dlg); assert(xdlg); switch(page) { case PAGE_BEGIN: GWEN_Dialog_SetIntProperty(dlg, "wiz_prev_button", GWEN_DialogProperty_Enabled, 0, 0, 0); GWEN_Dialog_SetIntProperty(dlg, "wiz_stack", GWEN_DialogProperty_Value, 0, page, 0); return GWEN_DialogEvent_ResultHandled; case PAGE_BACKEND: GWEN_Dialog_SetCharProperty(dlg, "wiz_next_button", GWEN_DialogProperty_Title, 0, I18N("Next"), 0); GWEN_Dialog_SetIntProperty(dlg, "wiz_prev_button", GWEN_DialogProperty_Enabled, 0, 1, 0); GWEN_Dialog_SetIntProperty(dlg, "wiz_next_button", GWEN_DialogProperty_Enabled, 0, 1, 0); GWEN_Dialog_SetIntProperty(dlg, "wiz_stack", GWEN_DialogProperty_Value, 0, page, 0); return GWEN_DialogEvent_ResultHandled; default: if (forwards){ DBG_NOTICE(0, "About to enter page %d", page); GWEN_Dialog_SetCharProperty(dlg, "wiz_next_button", GWEN_DialogProperty_Title, 0, I18N("Run"), 0); GWEN_Dialog_SetIntProperty(dlg, "wiz_stack", GWEN_DialogProperty_Value, 0, page, 0); return GWEN_DialogEvent_ResultHandled; } return GWEN_DialogEvent_ResultHandled; } return GWEN_DialogEvent_ResultHandled; }
void CTService_Request_free(CTSERVICEREQUEST *rq){ DBG_ENTER; if (rq) { IPCMESSAGE *curr; IPCMESSAGE *next; DBG_INFO("Freeing request"); /* remove message */ if (rq->message) IPCMessage_free(rq->message); /* remove responses */ curr=rq->responses; while(curr) { next=curr->next; IPCMessage_free(curr); curr=next; } /* free request itself */ free(rq); #ifdef MEMORYTRACE CTSERVICEREQUEST__Counter--; DBG_NOTICE("Freed request, now %d",CTSERVICEREQUEST__Counter); #endif } DBG_LEAVE; }
void GWEN_MultiCache_free(GWEN_MULTICACHE *mc) { if (mc) { assert(mc->_refCount); if (mc->_refCount==1) { GWEN_MULTICACHE_ENTRY *ce; ce=GWEN_MultiCache_Entry_List_First(mc->entryList); while(ce) { GWEN_MultiCache_ReleaseEntry(mc, ce); ce=GWEN_MultiCache_Entry_List_First(mc->entryList); } GWEN_MultiCache_Entry_List_free(mc->entryList); GWEN_MultiCache_Type_List_free(mc->typeList); DBG_NOTICE(GWEN_LOGDOMAIN, "MultiCache usage: %lld hits, %lld misses, %lld drops, %lld mb max memory used from %lld mb (%d %%)", (unsigned long long int) mc->cacheHits, (unsigned long long int) mc->cacheMisses, (unsigned long long int) mc->cacheDrops, (unsigned long long int) ((mc->maxSizeUsed)/(1024*1024)), (unsigned long long int) ((mc->maxSize)/(1024*1024)), (int)((mc->maxSizeUsed)*100.0/mc->maxSize)); mc->_refCount=0; GWEN_FREE_OBJECT(mc); } else mc->_refCount--; } }
/* --------------------------------------------------------------- FUNCTION */ int AH_Job_SepaStandingOrdersGet_Exchange(AH_JOB *j, AB_JOB *bj, AH_JOB_EXCHANGE_MODE m, AB_IMEXPORTER_CONTEXT *ctx){ DBG_INFO(AQHBCI_LOGDOMAIN, "Exchanging (%d)", m); assert(j); if (AB_Job_GetType(bj)!=AB_Job_TypeSepaGetStandingOrders) { DBG_ERROR(AQHBCI_LOGDOMAIN, "Not a GetStandingOrders job"); return GWEN_ERROR_INVALID; } switch(m) { case AH_Job_ExchangeModeParams: return 0; case AH_Job_ExchangeModeArgs: return 0; case AH_Job_ExchangeModeResults: return 0; default: DBG_NOTICE(AQHBCI_LOGDOMAIN, "Unsupported exchange mode"); return GWEN_ERROR_NOT_SUPPORTED; } /* switch */ }
int AB_SelectBankInfoDialog_HandleValueChanged(GWEN_DIALOG *dlg, const char *sender) { const char *s; DBG_NOTICE(0, "Changed %s", sender); if (strcasecmp(sender, "blzEdit")==0 || strcasecmp(sender, "bicEdit")==0) { s=GWEN_Dialog_GetCharProperty(dlg, sender, GWEN_DialogProperty_Value, 0, NULL); if (s && strlen(s)>2) { AB_SelectBankInfoDialog_UpdateList(dlg); return GWEN_DialogEvent_ResultHandled; } } else if (strcasecmp(sender, "nameEdit")==0 || strcasecmp(sender, "locationEdit")==0) { s=GWEN_Dialog_GetCharProperty(dlg, sender, GWEN_DialogProperty_Value, 0, NULL); if (s && strlen(s)>3) { AB_SelectBankInfoDialog_UpdateList(dlg); return GWEN_DialogEvent_ResultHandled; } } else if (strcasecmp(sender, "listBox")==0) { return GWEN_DialogEvent_ResultHandled; } return GWEN_DialogEvent_ResultNotHandled; }
int AB_SetupDialog_HandleActivated(GWEN_DIALOG *dlg, const char *sender) { DBG_NOTICE(0, "Activated: %s", sender); if (strcasecmp(sender, "closeButton")==0) return GWEN_DialogEvent_ResultAccept; else if (strcasecmp(sender, "editUserButton")==0) return AB_SetupDialog_EditUser(dlg); else if (strcasecmp(sender, "addUserButton")==0) return AB_SetupDialog_AddUser(dlg); else if (strcasecmp(sender, "delUserButton")==0) return AB_SetupDialog_DelUser(dlg); else if (strcasecmp(sender, "editAccountButton")==0) return AB_SetupDialog_EditAccount(dlg); else if (strcasecmp(sender, "addAccountButton")==0) return AB_SetupDialog_AddAccount(dlg); else if (strcasecmp(sender, "delAccountButton")==0) return AB_SetupDialog_DelAccount(dlg); else if (strcasecmp(sender, "userListBox")==0) return AB_SetupDialog_UserChanged(dlg); else if (strcasecmp(sender, "accountListBox")==0) return AB_SetupDialog_AccountChanged(dlg); else if (strcasecmp(sender, "helpButton")==0) { /* TODO: open a help dialog */ } return GWEN_DialogEvent_ResultNotHandled; }
static int connect_acl_tdb(struct vfs_handle_struct *handle, const char *service, const char *user) { int ret = SMB_VFS_NEXT_CONNECT(handle, service, user); bool ok; struct acl_common_config *config = NULL; if (ret < 0) { return ret; } if (!acl_tdb_init()) { SMB_VFS_NEXT_DISCONNECT(handle); return -1; } ok = init_acl_common_config(handle); if (!ok) { DBG_ERR("init_acl_common_config failed\n"); return -1; } /* Ensure we have the parameters correct if we're * using this module. */ DEBUG(2,("connect_acl_tdb: setting 'inherit acls = true' " "'dos filemode = true' and " "'force unknown acl user = true' for service %s\n", service )); lp_do_parameter(SNUM(handle->conn), "inherit acls", "true"); lp_do_parameter(SNUM(handle->conn), "dos filemode", "true"); lp_do_parameter(SNUM(handle->conn), "force unknown acl user", "true"); SMB_VFS_HANDLE_GET_DATA(handle, config, struct acl_common_config, return -1); if (config->ignore_system_acls) { DBG_NOTICE("setting 'create mask = 0666', " "'directory mask = 0777', " "'store dos attributes = yes' and all " "'map ...' options to 'no'\n"); lp_do_parameter(SNUM(handle->conn), "create mask", "0666"); lp_do_parameter(SNUM(handle->conn), "directory mask", "0777"); lp_do_parameter(SNUM(handle->conn), "map archive", "no"); lp_do_parameter(SNUM(handle->conn), "map hidden", "no"); lp_do_parameter(SNUM(handle->conn), "map readonly", "no"); lp_do_parameter(SNUM(handle->conn), "map system", "no"); lp_do_parameter(SNUM(handle->conn), "store dos attributes", "yes"); } return 0; }
/* handle EOF on the parent-to-all-children pipe in the child */ static void prefork_pipe_handler(struct tevent_context *event_ctx, struct tevent_fd *fde, uint16_t flags, void *private_data) { /* free the fde which removes the event and stops it firing again */ TALLOC_FREE(fde); DBG_NOTICE("Child %d exiting\n", getpid()); talloc_free(event_ctx); exit(0); }
static void sigterm_signal_handler(struct tevent_context *ev, struct tevent_signal *se, int signum, int count, void *siginfo, void *private_data) { #if HAVE_GETPGRP if (getpgrp() == getpid()) { /* * We're the process group leader, send * SIGTERM to our process group. */ DBG_NOTICE("SIGTERM: killing children\n"); kill(-getpgrp(), SIGTERM); } #endif DBG_NOTICE("Exiting pid %d on SIGTERM\n", getpid()); talloc_free(ev); exit(127); }
int AB_SetupNewUserDialog_HandleActivated(GWEN_DIALOG *dlg, const char *sender) { DBG_NOTICE(0, "Activated: %s", sender); if (strcasecmp(sender, "wiz_prev_button")==0) return AB_SetupNewUserDialog_Previous(dlg); else if (strcasecmp(sender, "wiz_next_button")==0) return AB_SetupNewUserDialog_Next(dlg); else if (strcasecmp(sender, "wiz_abort_button")==0) return GWEN_DialogEvent_ResultReject; else if (strcasecmp(sender, "wiz_help_button")==0) { /* TODO: open a help dialog */ } return GWEN_DialogEvent_ResultNotHandled; }
CTSERVICEDATA *CTService_PeerData_new(){ CTSERVICEDATA *pd; DBG_ENTER; pd=(CTSERVICEDATA *)malloc(sizeof(CTSERVICEDATA)); assert(pd); memset(pd,0,sizeof(CTSERVICEDATA)); #ifdef MEMORYTRACE CTSERVICEDATA__Counter++; DBG_NOTICE("Created PeerData. now %d",CTSERVICEDATA__Counter); #endif DBG_LEAVE; return pd; }
CTSERVICEREQUEST *CTService_Request_new(){ CTSERVICEREQUEST *rq; DBG_ENTER; rq=(CTSERVICEREQUEST *)malloc(sizeof(CTSERVICEREQUEST)); assert(rq); memset(rq,0,sizeof(CTSERVICEREQUEST)); #ifdef MEMORYTRACE CTSERVICEREQUEST__Counter++; DBG_NOTICE("Created request, now %d",CTSERVICEREQUEST__Counter); #endif DBG_LEAVE; return rq; }
struct server_id pid_to_procid(pid_t pid) { uint64_t unique = 0; int ret; ret = messaging_dgm_get_unique(pid, &unique); if (ret != 0) { DBG_NOTICE("messaging_dgm_get_unique failed: %s\n", strerror(ret)); } return (struct server_id) { .pid = pid, .unique_id = unique, .vnn = my_vnn }; }
void AH_ChooseUserTypeDialog_Fini(GWEN_DIALOG *dlg) { int i; if (GWEN_Dialog_GetIntProperty(dlg, "hbciPinTanRadio", GWEN_DialogProperty_Value, 0, 0)!=0) i=AqHBCI_NewUserDialog_CodeExistingPinTan; else if (GWEN_Dialog_GetIntProperty(dlg, "hbciUseChipcardRadio", GWEN_DialogProperty_Value, 0, 0)!=0) i=AqHBCI_NewUserDialog_CodeExistingChipcard; else if (GWEN_Dialog_GetIntProperty(dlg, "hbciCreateKeyFileRadio", GWEN_DialogProperty_Value, 0, 0)!=0) i=AqHBCI_NewUserDialog_CodeCreateKeyFile; else if (GWEN_Dialog_GetIntProperty(dlg, "hbciImportKeyFileRadio", GWEN_DialogProperty_Value, 0, 0)!=0) i=AqHBCI_NewUserDialog_CodeExistingKeyFile; else if (GWEN_Dialog_GetIntProperty(dlg, "hbciInitChipcardRadio", GWEN_DialogProperty_Value, 0, 0)!=0) i=AqHBCI_NewUserDialog_CodeCreateChipcard; else i=AqHBCI_NewUserDialog_CodeGeneric; DBG_NOTICE(0, "Setting selected type to %d", i); AB_UserTypePageDialog_SetSelectedType(dlg, i); }
NTSTATUS register_rpc_module(struct rpc_module_fns *fns, const char *name) { struct rpc_module *module = find_rpc_module(name); if (module != NULL) { DBG_ERR("RPC module %s already loaded!\n", name); return NT_STATUS_OBJECT_NAME_COLLISION; } module = SMB_XMALLOC_P(struct rpc_module); module->name = smb_xstrdup(name); module->fns = fns; DLIST_ADD(rpc_modules, module); DBG_NOTICE("Successfully added RPC module '%s'\n", name); return NT_STATUS_OK; }
NTSTATUS gensec_generate_session_info_pac(TALLOC_CTX *mem_ctx, struct gensec_security *gensec_security, struct smb_krb5_context *smb_krb5_context, DATA_BLOB *pac_blob, const char *principal_string, const struct tsocket_address *remote_address, struct auth_session_info **session_info) { 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 (!pac_blob) { if (gensec_setting_bool(gensec_security->settings, "gensec", "require_pac", false)) { DEBUG(1, ("Unable to find PAC in ticket from %s, failing to allow access\n", principal_string)); return NT_STATUS_ACCESS_DENIED; } DBG_NOTICE("Unable to find PAC for %s, resorting to local " "user lookup\n", principal_string); } if (gensec_security->auth_context && gensec_security->auth_context->generate_session_info_pac) { return gensec_security->auth_context->generate_session_info_pac(gensec_security->auth_context, mem_ctx, smb_krb5_context, pac_blob, principal_string, remote_address, session_info_flags, session_info); } else { DEBUG(0, ("Cannot generate a session_info without the auth_context\n")); return NT_STATUS_INTERNAL_ERROR; } }
void GWEN_Process_SignalHandler(int s) { int status; pid_t pid; switch (s) { case SIGCHLD: /* try to get the status */ pid=waitpid(0, &status, WNOHANG); if (pid==-1) { DBG_DEBUG(GWEN_LOGDOMAIN, "waitdpid(%d): %s", 0, strerror(errno)); } else if (pid==0) { /* process still running ?! */ DBG_DEBUG(GWEN_LOGDOMAIN, "Got a SIGCHLD but no child terminated ??"); } else { GWEN_PROCESS *pr; /* som process terminated */ pr=GWEN_Process_FindProcess(pid); if (!pr) { DBG_NOTICE(GWEN_LOGDOMAIN, "No infomation about process \"%d\" available", (int)pid); } else { GWEN_Process_MakeState(pr, status); /* remove from list. If this process data is not used by the * aplication it will now be freed, otherwise only the usage * counter is decremented */ GWEN_Process_free(pr); } } break; default: DBG_ERROR(GWEN_LOGDOMAIN, "Got unhandled signal \"%d\"", s); break; } /* switch */ }
int AH_NewKeyFileDialog_HandleActivatedFileButton(GWEN_DIALOG *dlg) { AH_NEWKEYFILE_DIALOG *xdlg; int rv; const char *s; GWEN_BUFFER *pathBuffer; assert(dlg); xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, AH_NEWKEYFILE_DIALOG, dlg); assert(xdlg); pathBuffer=GWEN_Buffer_new(0, 256, 0, 1); s=GWEN_Dialog_GetCharProperty(dlg, "wiz_filename_edit", GWEN_DialogProperty_Value, 0, NULL); if (s && *s) GWEN_Buffer_AppendString(pathBuffer, s); rv=GWEN_Gui_GetFileName(I18N("Create Keyfile"), GWEN_Gui_FileNameType_SaveFileName, 0, I18N("All Files (*)\tOHBCI Files (*ohbci;*.medium)"), pathBuffer, GWEN_Dialog_GetGuiId(dlg)); if (rv==0) { GWEN_Dialog_SetCharProperty(dlg, "wiz_filename_edit", GWEN_DialogProperty_Value, 0, GWEN_Buffer_GetStart(pathBuffer), 0); rv=AH_NewKeyFileDialog_GetFilePageData(dlg); if (rv<0) GWEN_Dialog_SetIntProperty(dlg, "wiz_next_button", GWEN_DialogProperty_Enabled, 0, 0, 0); else GWEN_Dialog_SetIntProperty(dlg, "wiz_next_button", GWEN_DialogProperty_Enabled, 0, 1, 0); } else { DBG_NOTICE(AQHBCI_LOGDOMAIN, "here (%d)", rv); } GWEN_Buffer_free(pathBuffer); return GWEN_DialogEvent_ResultHandled; }
int AB_SelectBankInfoDialog_HandleActivated(GWEN_DIALOG *dlg, const char *sender) { AB_SELECTBANKINFO_DIALOG *xdlg; assert(dlg); xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, AB_SELECTBANKINFO_DIALOG, dlg); assert(xdlg); DBG_NOTICE(0, "Activated: %s", sender); if (strcasecmp(sender, "blzEdit")==0 || strcasecmp(sender, "bicEdit")==0 || strcasecmp(sender, "nameEdit")==0 || strcasecmp(sender, "locationEdit")==0) { AB_SelectBankInfoDialog_UpdateList(dlg); return GWEN_DialogEvent_ResultHandled; } else if (strcasecmp(sender, "listBox")==0) { AB_BANKINFO *bi; bi=AB_SelectBankInfoDialog_DetermineSelectedBankInfo(dlg); GWEN_Dialog_SetIntProperty(dlg, "okButton", GWEN_DialogProperty_Enabled, 0, bi?1:0, 0); return GWEN_DialogEvent_ResultHandled; } else if (strcasecmp(sender, "okButton")==0) { AB_BANKINFO *bi; bi=AB_SelectBankInfoDialog_DetermineSelectedBankInfo(dlg); if (bi) xdlg->selectedBankInfo=AB_BankInfo_dup(bi); return GWEN_DialogEvent_ResultAccept; } else if (strcasecmp(sender, "abortButton")==0) return GWEN_DialogEvent_ResultReject; else if (strcasecmp(sender, "wiz_help_button")==0) { /* TODO: open a help dialog */ } return GWEN_DialogEvent_ResultNotHandled; }
int AB_Provider_WriteAccountSpecForAccount(AB_PROVIDER *pro, const AB_ACCOUNT *acc, int doLock) { AB_ACCOUNT_SPEC *as; int rv; DBG_NOTICE(AQBANKING_LOGDOMAIN, "Writing account spec for account %u", (unsigned int) AB_Account_GetUniqueId(acc)); as=AB_AccountSpec_new(); rv=AB_Provider_AccountToAccountSpec(pro, acc, as, doLock); if (rv<0) { DBG_INFO(AQBANKING_LOGDOMAIN, "here (%d)", rv); return rv; } rv=AB_Banking_WriteAccountSpec(AB_Provider_GetBanking(pro), as); if (rv<0) { DBG_INFO(AQBANKING_LOGDOMAIN, "here (%d)", rv); AB_AccountSpec_free(as); return rv; } AB_AccountSpec_free(as); return 0; }
void CTService_PeerData_free(CTSERVICEDATA *pd){ CTSERVICEREQUEST *req; DBG_ENTER; if (pd) { /* free user data */ if (pd->freeUserDataPtr) pd->freeUserDataPtr(pd->userData); /* free tempKey */ if (pd->tempKey) Cryp_RsaKey_free(pd->tempKey); /* free sessionKey */ if (pd->sessionKey) Cryp_BlowfishKey_free(pd->sessionKey); /* free requests */ req=pd->requests; while(req) { CTSERVICEREQUEST *next; next=req->next; CTService_Request_free(req); req=next; } /* while */ /* free the service data itself */ free(pd); #ifdef MEMORYTRACE CTSERVICEDATA__Counter--; DBG_NOTICE("Freed PeerData. now %d",CTSERVICEDATA__Counter); #endif } DBG_LEAVE; }
int Gtk2Gui_Dialog_Setup(GWEN_DIALOG *dlg, GtkWidget *parentWindow) { GTK2_GUI_DIALOG *xdlg; GWEN_WIDGET_TREE *wtree; GWEN_WIDGET *w; GtkWindow *gw; int rv; GList *tll; assert(dlg); xdlg=GWEN_INHERIT_GETDATA(GWEN_DIALOG, GTK2_GUI_DIALOG, dlg); assert(xdlg); wtree=GWEN_Dialog_GetWidgets(dlg); if (wtree==NULL) { DBG_ERROR(GWEN_LOGDOMAIN, "No widget tree in dialog"); return GWEN_ERROR_NOT_FOUND; } w=GWEN_Widget_Tree_GetFirst(wtree); if (w==NULL) { DBG_ERROR(GWEN_LOGDOMAIN, "No widgets in dialog"); return GWEN_ERROR_NOT_FOUND; } rv=Gtk2Gui_Dialog_SetupTree(w); if (rv<0) { DBG_INFO(GWEN_LOGDOMAIN, "here (%d)", rv); return rv; } gw=GTK_WINDOW(GWEN_Widget_GetImplData(w, GTK2_DIALOG_WIDGET_REAL)); gtk_window_set_type_hint(GTK_WINDOW(gw), GDK_WINDOW_TYPE_HINT_DIALOG); gtk_window_set_position (GTK_WINDOW (gw), GTK_WIN_POS_CENTER_ON_PARENT); /*gtk_window_set_keep_above(GTK_WINDOW(gw), TRUE);*/ xdlg->mainWidget=GTK_WIDGET(gw); tll=gtk_window_list_toplevels(); if (tll) { GList* element; GtkWindow *topLevel=NULL; for (element = tll; element; element = g_list_next(element)) { GtkWindow* win = GTK_WINDOW(element->data); if (gtk_window_is_active(win)) { topLevel=win; break; } } g_list_free(tll); if (topLevel) { DBG_NOTICE(GWEN_LOGDOMAIN, "Found active window [%s]", gtk_window_get_title(topLevel)); gtk_window_set_transient_for(gw, topLevel); } else { DBG_ERROR(GWEN_LOGDOMAIN, "No active window found..."); } } return 0; }
NDIS_STATUS CardIdentify( IN PHTDSU_ADAPTER Adapter ) /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Functional Description: This routine will attempt to verify that the controller is located in memory where the driver has been configured to expect it. Parameters: Adapter _ A pointer ot our adapter information structure. Return Values: NDIS_STATUS_SUCCESS NDIS_STATUS_ADAPTER_NOT_FOUND ---------------------------------------------------------------------------*/ { DBG_FUNC("CardIdentify") NDIS_STATUS Status; /* // These values are read from the adapter to make sure this driver will // work with the firmware on the adapter. */ USHORT CoProcessorId; USHORT CoProcessorVersion; USHORT DsuId; USHORT DsuVersion; DBG_ENTER(Adapter); /* // Read the configuration values from the card. */ CoProcessorId = READ_REGISTER_USHORT(&Adapter->AdapterRam->CoProcessorId); CoProcessorVersion = READ_REGISTER_USHORT(&Adapter->AdapterRam->CoProcessorVersion); DsuId = READ_REGISTER_USHORT(&Adapter->AdapterRam->DsuId); DsuVersion = READ_REGISTER_USHORT(&Adapter->AdapterRam->DsuVersion); /* // Make sure these values are what we expect. */ if ((CoProcessorId == HTDSU_COPROCESSOR_ID) && (CoProcessorVersion >= HTDSU_COPROCESSOR_VERSION) && ((DsuId & 0x00FF) == HTDSU_DSU_ID) && (DsuVersion >= HTDSU_DSU_VERSION)) { /* // Record the number of lines on this adapter. */ Adapter->NumLineDevs = HTDSU_NUM_LINKS; if ((DsuId & 0xFF00) == 0) { --Adapter->NumLineDevs; } DBG_NOTICE(Adapter,("NumLineDevs=%d\n",Adapter->NumLineDevs)); Status = NDIS_STATUS_SUCCESS; } else { DBG_ERROR(Adapter,("Adapter not found or invalid firmware:\n" "CoProcessorId = %Xh\n" "CoProcessorVersion = %Xh\n" "DsuId = %Xh\n" "DsuVersion = %Xh\n", CoProcessorId, CoProcessorVersion, DsuId, DsuVersion )); Status = NDIS_STATUS_ADAPTER_NOT_FOUND; /* // Log error message and return. */ NdisWriteErrorLogEntry( Adapter->MiniportAdapterHandle, NDIS_ERROR_CODE_ADAPTER_NOT_FOUND, 7, CoProcessorId, CoProcessorVersion, DsuId, DsuVersion, Status, __FILEID__, __LINE__ ); } DBG_LEAVE(Adapter); return (Status); }
NDIS_STATUS CardDoCommand( IN PHTDSU_ADAPTER Adapter, IN USHORT CardLine, /* HTDSU_CMD_LINE1 or HTDSU_CMD_LINE2 */ IN USHORT CommandValue ) /*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Functional Description: This routine routine will execute a command on the card after making sure the previous command has completed properly. Parameters: Adapter _ A pointer ot our adapter information structure. CardLine _ Specifies which line to use for the transmit (HTDSU_LINEx_ID). CommandValue _ HTDSU_CMD_??? command to be executed. Return Values: NDIS_STATUS_SUCCESS NDIS_STATUS_HARD_ERRORS ---------------------------------------------------------------------------*/ { DBG_FUNC("CardDoCommand") ULONG TimeOut = 0; DBG_ENTER(Adapter); DBG_FILTER(Adapter, DBG_PARAMS_ON,("Line=%d, Command=%04X, LineStatus=%Xh\n", CardLine, CommandValue, READ_REGISTER_USHORT(&Adapter->AdapterRam->StatusLine1) )); /* // Wait for command register to go idle - but don't wait too long. // If we timeout here, there's gotta be something wrong with the adapter. */ while ((READ_REGISTER_USHORT(&Adapter->AdapterRam->Command) != HTDSU_CMD_NOP) || (READ_REGISTER_USHORT(&Adapter->AdapterRam->CoProcessorId) != HTDSU_COPROCESSOR_ID)) { if (TimeOut++ > HTDSU_SELFTEST_TIMEOUT) { DBG_ERROR(Adapter,("Timeout waiting for %04X command to clear\n", READ_REGISTER_USHORT(&Adapter->AdapterRam->Command))); /* // Ask for reset, and disable interrupts until we get it. */ Adapter->NeedReset = TRUE; Adapter->InterruptEnableFlag = HTDSU_INTR_DISABLE; CardDisableInterrupt(Adapter); return (NDIS_STATUS_HARD_ERRORS); } NdisStallExecution(_100_MICROSECONDS); } DBG_NOTICE(Adapter,("Timeout=%d waiting to submit %04X\n", TimeOut, CommandValue)); /* // Before starting a reset command, we clear the the co-processor ID // which then gets set to the proper value when the reset is complete. */ if (CommandValue == HTDSU_CMD_RESET) { WRITE_REGISTER_USHORT(&Adapter->AdapterRam->CoProcessorId, 0); } /* // Send the command to the adapter. */ WRITE_REGISTER_USHORT( &Adapter->AdapterRam->Command, (USHORT) (CommandValue + CardLine) ); DBG_LEAVE(Adapter); return (NDIS_STATUS_SUCCESS); }
int AH_Msg_SignPinTan(AH_MSG *hmsg, GWEN_BUFFER *rawBuf, const char *signer) { AH_HBCI *h; GWEN_XMLNODE *node; GWEN_DB_NODE *cfg; GWEN_BUFFER *hbuf; int rv; char ctrlref[15]; const char *p; GWEN_MSGENGINE *e; AB_USER *su; uint32_t uFlags; char pin[64]; uint32_t tm; assert(hmsg); h=AH_Dialog_GetHbci(hmsg->dialog); assert(h); e=AH_Dialog_GetMsgEngine(hmsg->dialog); assert(e); GWEN_MsgEngine_SetMode(e, "pintan"); su=AB_Banking_FindUser(AH_HBCI_GetBankingApi(h), AH_PROVIDER_NAME, "de", "*", signer, "*"); if (!su) { DBG_ERROR(AQHBCI_LOGDOMAIN, "Unknown user \"%s\"", signer); return GWEN_ERROR_NOT_FOUND; } uFlags=AH_User_GetFlags(su); node=GWEN_MsgEngine_FindNodeByPropertyStrictProto(e, "SEG", "id", 0, "SigHead"); if (!node) { DBG_INFO(AQHBCI_LOGDOMAIN, "Segment \"SigHead\" not found"); return GWEN_ERROR_INTERNAL; } /* for iTAN mode: set selected mode (Sicherheitsfunktion, kodiert) */ tm=AH_Msg_GetItanMethod(hmsg); if (tm==0) { tm=AH_Dialog_GetItanMethod(hmsg->dialog); if (tm) /* this is needed by AH_MsgPinTan_PrepareCryptoSeg */ AH_Msg_SetItanMethod(hmsg, tm); } /* prepare config for segment */ cfg=GWEN_DB_Group_new("sighead"); rv=AH_MsgPinTan_PrepareCryptoSeg(hmsg, su, cfg, 0, 1); if (rv) { DBG_INFO(AQHBCI_LOGDOMAIN, "here (%d)", rv); GWEN_DB_Group_free(cfg); return rv; } /* set expected signer */ if (!(uFlags & AH_USER_FLAGS_BANK_DOESNT_SIGN)) { const char *remoteId; remoteId=AH_User_GetPeerId(su); if (!remoteId || *remoteId==0) remoteId=AB_User_GetUserId(su); assert(remoteId); assert(*remoteId); DBG_DEBUG(AQHBCI_LOGDOMAIN, "Expecting \"%s\" to sign the response", remoteId); AH_Msg_SetExpectedSigner(hmsg, remoteId); } /* store system id */ p=NULL; if (!hmsg->noSysId) p=AH_User_GetSystemId(su); if (!p) p="0"; GWEN_DB_SetCharValue(cfg, GWEN_DB_FLAGS_DEFAULT, "SecDetails/SecId", p); if (tm) { GWEN_DB_SetIntValue(cfg, GWEN_DB_FLAGS_DEFAULT, "function", tm); } /* retrieve control reference for sigtail (to be used later) */ p=GWEN_DB_GetCharValue(cfg, "ctrlref", 0, ""); if (strlen(p)>=sizeof(ctrlref)) { DBG_INFO(AQHBCI_LOGDOMAIN, "Control reference too long (14 bytes maximum)"); GWEN_DB_Group_free(cfg); return -1; } strcpy(ctrlref, p); /* create SigHead */ hbuf=GWEN_Buffer_new(0, 128+GWEN_Buffer_GetUsedBytes(rawBuf), 0, 1); GWEN_DB_SetIntValue(cfg, GWEN_DB_FLAGS_DEFAULT, "head/seq", hmsg->firstSegment-1); GWEN_DB_SetIntValue(cfg, GWEN_DB_FLAGS_DEFAULT, "signseq", 1); /* create signature head segment */ rv=GWEN_MsgEngine_CreateMessageFromNode(e, node, hbuf, cfg); GWEN_DB_Group_free(cfg); cfg=0; if (rv) { DBG_INFO(AQHBCI_LOGDOMAIN, "Could not create SigHead"); GWEN_Buffer_free(hbuf); return rv; } /* insert new SigHead at beginning of message buffer */ DBG_DEBUG(AQHBCI_LOGDOMAIN, "Inserting signature head"); GWEN_Buffer_Rewind(hmsg->buffer); GWEN_Buffer_InsertBytes(hmsg->buffer, GWEN_Buffer_GetStart(hbuf), GWEN_Buffer_GetUsedBytes(hbuf)); /* create sigtail */ DBG_DEBUG(AQHBCI_LOGDOMAIN, "Completing signature tail"); cfg=GWEN_DB_Group_new("sigtail"); GWEN_Buffer_Reset(hbuf); GWEN_DB_SetIntValue(cfg, GWEN_DB_FLAGS_DEFAULT, "head/seq", hmsg->lastSegment+1); /* store to DB */ GWEN_DB_SetBinValue(cfg, GWEN_DB_FLAGS_DEFAULT, "signature", "NOSIGNATURE", 11); GWEN_DB_SetCharValue(cfg, GWEN_DB_FLAGS_DEFAULT, "ctrlref", ctrlref); /* handle pin */ memset(pin, 0, sizeof(pin)); rv=AH_User_InputPin(su, pin, 4, sizeof(pin), 0); if (rv<0) { DBG_ERROR(AQHBCI_LOGDOMAIN, "Error getting pin from medium (%d)", rv); GWEN_DB_Group_free(cfg); GWEN_Buffer_free(hbuf); memset(pin, 0, sizeof(pin)); return rv; } GWEN_DB_SetCharValue(cfg, GWEN_DB_FLAGS_DEFAULT, "pin", pin); AH_Msg_SetPin(hmsg, pin); memset(pin, 0, sizeof(pin)); /* handle tan */ if (hmsg->needTan) { DBG_NOTICE(AQHBCI_LOGDOMAIN, "This queue needs a TAN"); if (hmsg->usedTan) { DBG_NOTICE(AQHBCI_LOGDOMAIN, "Using existing TAN"); GWEN_DB_SetCharValue(cfg, GWEN_DB_FLAGS_DEFAULT, "tan", hmsg->usedTan); } else { char tan[16]; memset(tan, 0, sizeof(tan)); DBG_NOTICE(AQHBCI_LOGDOMAIN, "Asking for TAN"); rv=AH_User_InputTan(su, tan, 4, sizeof(tan)); if (rv<0) { DBG_ERROR(AQHBCI_LOGDOMAIN, "Error getting TAN from medium"); GWEN_DB_Group_free(cfg); GWEN_Buffer_free(hbuf); return rv; } GWEN_DB_SetCharValue(cfg, GWEN_DB_FLAGS_DEFAULT, "tan", tan); AH_Msg_SetTan(hmsg, tan); } } else { DBG_NOTICE(AQHBCI_LOGDOMAIN, "This queue doesn't need a TAN"); } /* get node */ node=GWEN_MsgEngine_FindNodeByPropertyStrictProto(e, "SEG", "id", 0, "SigTail"); if (!node) { DBG_INFO(AQHBCI_LOGDOMAIN, "Segment \"SigTail\"not found"); GWEN_Buffer_free(hbuf); GWEN_DB_Group_free(cfg); return GWEN_ERROR_INTERNAL; } rv=GWEN_MsgEngine_CreateMessageFromNode(e, node, hbuf, cfg); if (rv) { DBG_INFO(AQHBCI_LOGDOMAIN, "Could not create SigTail (%d)", rv); GWEN_Buffer_free(hbuf); GWEN_DB_Group_free(cfg); return rv; } /* append sigtail */ DBG_DEBUG(AQHBCI_LOGDOMAIN, "Appending signature tail"); if (GWEN_Buffer_AppendBuffer(hmsg->buffer, hbuf)) { DBG_INFO(AQHBCI_LOGDOMAIN, "here"); GWEN_Buffer_free(hbuf); GWEN_DB_Group_free(cfg); return GWEN_ERROR_MEMORY_FULL; } DBG_DEBUG(AQHBCI_LOGDOMAIN, "Appending signature tail: done"); GWEN_Buffer_free(hbuf); GWEN_DB_Group_free(cfg); /* adjust segment numbers (for next signature and message tail */ hmsg->firstSegment--; hmsg->lastSegment++; return 0; }