コード例 #1
0
ファイル: adduser.c プロジェクト: cstim/aqbanking
static int getBankUrl(AB_BANKING *ab,
                      const char *bankId,
                      GWEN_BUFFER *bufServer)
{
  AB_BANKINFO *bi;

  bi=AB_Banking_GetBankInfo(ab, "de", 0, bankId);
  if (bi) {
    AB_BANKINFO_SERVICE_LIST *l;
    AB_BANKINFO_SERVICE *sv;

    l=AB_BankInfo_GetServices(bi);
    assert(l);
    sv=AB_BankInfoService_List_First(l);
    while (sv) {
      const char *st;

      st=AB_BankInfoService_GetType(sv);
      if (st && *st && strcasecmp(st, "ebics")==0) {
        const char *addr;

        addr=AB_BankInfoService_GetAddress(sv);
        if (addr && *addr) {
          GWEN_Buffer_Reset(bufServer);
          GWEN_Buffer_AppendString(bufServer, addr);
          return 0;
        }
      }
      sv=AB_BankInfoService_List_Next(sv);
    }
    AB_BankInfo_free(bi);
  } /* if bank info */

  return -1;
}
コード例 #2
0
ファイル: user.c プロジェクト: maduhu/aqbanking-1
int AH_User_InputTan(AB_USER *u,
		     char *pwbuffer,
		     int minLen,
                     int maxLen){
  int rv;
  char buffer[512];
  const char *un;
  const char *bn=NULL;
  GWEN_BUFFER *nbuf;
  AB_BANKINFO *bi;

  assert(u);
  un=AB_User_GetUserId(u);
  /* find bank name */
  bi=AB_Banking_GetBankInfo(AB_User_GetBanking(u),
			    "de",
                            "*",
			    AB_User_GetBankCode(u));
  if (bi)
    bn=AB_BankInfo_GetBankName(bi);
  if (!bn)
    AB_User_GetBankCode(u);

  buffer[0]=0;
  buffer[sizeof(buffer)-1]=0;
  snprintf(buffer, sizeof(buffer)-1,
	   I18N("Please enter the next TAN\n"
		"for user %s at %s."
		"<html>"
		"Please enter the next TAN for user <i>%s</i> at "
		"<i>%s</i>."
		"</html>"),
	   un, bn,
           un, bn);
  buffer[sizeof(buffer)-1]=0;

  nbuf=GWEN_Buffer_new(0, 256 ,0 ,1);
  AH_User_MkTanName(u, NULL, nbuf);

  rv=GWEN_Gui_GetPassword(GWEN_GUI_INPUT_FLAGS_TAN |
			  /*GWEN_GUI_INPUT_FLAGS_NUMERIC |*/
			  GWEN_GUI_INPUT_FLAGS_SHOW,
			  GWEN_Buffer_GetStart(nbuf),
			  I18N("Enter TAN"),
			  buffer,
			  pwbuffer,
			  minLen,
			  maxLen,
			  0);
  GWEN_Buffer_free(nbuf);
  AB_BankInfo_free(bi);
  return rv;
}
コード例 #3
0
ファイル: adduser.c プロジェクト: Zauberstuhl/aqbanking
int getBankUrl(AB_BANKING *ab,
               AH_CRYPT_MODE cm,
	       const char *bankId,
	       GWEN_BUFFER *bufServer) {
  AB_BANKINFO *bi;
  
  bi=AB_Banking_GetBankInfo(ab, "de", 0, bankId);
  if (bi) {
    AB_BANKINFO_SERVICE_LIST *l;
    AB_BANKINFO_SERVICE *sv;
  
    l=AB_BankInfo_GetServices(bi);
    assert(l);
    sv=AB_BankInfoService_List_First(l);
    while(sv) {
      const char *st;
  
      st=AB_BankInfoService_GetType(sv);
      if (st && *st && strcasecmp(st, "hbci")==0) {
	const char *svm;
  
	svm=AB_BankInfoService_GetMode(sv);
	if (svm && *svm) {
	  if (!
	      ((strcasecmp(svm, "pintan")==0) ^
               (cm==AH_CryptMode_Pintan))){
            const char *addr;

            addr=AB_BankInfoService_GetAddress(sv);
	    if (addr && *addr) {
	      GWEN_Buffer_Reset(bufServer);
	      GWEN_Buffer_AppendString(bufServer, addr);
              return 0;
	    }
	  }
	}
      }
      sv=AB_BankInfoService_List_Next(sv);
    }
    AB_BankInfo_free(bi);
  } /* if bank info */

  return -1;
}
コード例 #4
0
ファイル: user.c プロジェクト: maduhu/aqbanking-1
int AH_User_InputTanWithChallenge2(AB_USER *u,
				   const char *challenge,
				   const char *challengeHhd,
				   char *pwbuffer,
				   int minLen,
				   int maxLen){
  int rv;
  char buffer[1024];
  const char *un;
  const char *bn=NULL;
  GWEN_BUFFER *nbuf;
  GWEN_BUFFER *xbuf;
  AB_BANKINFO *bi;
  uint32_t iflags=0;

  assert(u);
  un=AB_User_GetUserId(u);
  /* find bank name */
  bi=AB_Banking_GetBankInfo(AB_User_GetBanking(u),
			    "de",
                            "*",
			    AB_User_GetBankCode(u));
  if (bi)
    bn=AB_BankInfo_GetBankName(bi);
  if (!bn)
    AB_User_GetBankCode(u);

  iflags=GWEN_GUI_INPUT_FLAGS_TAN | GWEN_GUI_INPUT_FLAGS_SHOW;

  buffer[0]=0;
  buffer[sizeof(buffer)-1]=0;

  xbuf=GWEN_Buffer_new(0, 256, 0, 1);

  if (challengeHhd && *challengeHhd) {
    DBG_ERROR(AQHBCI_LOGDOMAIN, "ChallengeHHD is [%s]", challengeHhd);
    GWEN_Buffer_AppendString(xbuf, "$OBEGIN$");
    rv=AH_HHD14_Translate(challengeHhd, xbuf);
    if (rv<0) {
      GWEN_Buffer_free(xbuf);
      AB_BankInfo_free(bi);
      return rv;
    }
    GWEN_Buffer_AppendString(xbuf, "$OEND$");
    iflags|=GWEN_GUI_INPUT_FLAGS_OPTICAL;

    /* text version */
    snprintf(buffer, sizeof(buffer)-1,
	     I18N("Please enter the TAN\n"
		  "for user %s at %s.\n"), un, bn);
    buffer[sizeof(buffer)-1]=0;
    GWEN_Buffer_AppendString(xbuf, buffer);
    if (challenge && *challenge) {
      GWEN_Buffer_AppendString(xbuf, challenge);
      GWEN_Buffer_AppendString(xbuf, "\n");
    }
    else {
      GWEN_Buffer_AppendString(xbuf, I18N("Please enter the TAN from the device."));
    }
  }
  else if (challenge && *challenge) {
    const char *s;

    /* look for "CHLGUC" */
    s=GWEN_Text_StrCaseStr(challenge, "CHLGUC");
    if (s) {
      DBG_ERROR(AQHBCI_LOGDOMAIN, "Challenge contains CHLGUC");
      GWEN_Buffer_AppendString(xbuf, "$OBEGIN$");
      rv=AH_HHD14_Translate(s, xbuf);
      if (rv<0) {
	GWEN_Buffer_free(xbuf);
	AB_BankInfo_free(bi);
	return rv;
      }
      GWEN_Buffer_AppendString(xbuf, "$OEND$");
      iflags|=GWEN_GUI_INPUT_FLAGS_OPTICAL;

      /* text version */
      snprintf(buffer, sizeof(buffer)-1,
               I18N("Please enter the TAN\n"
                    "for user %s at %s.\n"), un, bn);
      buffer[sizeof(buffer)-1]=0;
      GWEN_Buffer_AppendString(xbuf, buffer);

      /* extract text */
      s=GWEN_Text_StrCaseStr(challenge, "CHLGTEXT");
      if (s) {
	/* skip "CHLGTEXT" and 4 digits */
	s+=12;
	/* add rest of the message (replace HTML tags, if any) */
	AH_User_AddTextWithoutTags(s, xbuf);
      }
      else {
	/* create own text */
	GWEN_Buffer_AppendString(xbuf, I18N("Please enter the TAN from the device."));
      }
    }
    else {
      /* no optical challenge */
      DBG_ERROR(AQHBCI_LOGDOMAIN, "Challenge contains no optical data");
      GWEN_Buffer_AppendString(xbuf, I18N("The server provided the following challenge:"));
      GWEN_Buffer_AppendString(xbuf, "\n");
      GWEN_Buffer_AppendString(xbuf, challenge);
    }
  }

  nbuf=GWEN_Buffer_new(0, 256 ,0 ,1);
  AH_User_MkTanName(u, challenge, nbuf);
  rv=GWEN_Gui_GetPassword(iflags,
			  GWEN_Buffer_GetStart(nbuf),
			  I18N("Enter TAN"),
			  GWEN_Buffer_GetStart(xbuf),
			  pwbuffer,
			  minLen,
			  maxLen,
			  0);
  GWEN_Buffer_free(xbuf);
  GWEN_Buffer_free(nbuf);
  AB_BankInfo_free(bi);
  return rv;
}
コード例 #5
0
ファイル: user.c プロジェクト: maduhu/aqbanking-1
int AH_User_InputTanWithChallenge(AB_USER *u,
				  const char *challenge,
				  char *pwbuffer,
				  int minLen,
                                  int maxLen){
  int rv;
  char buffer[1024];
  const char *un;
  const char *bn=NULL;
  GWEN_BUFFER *nbuf;
  GWEN_BUFFER *xbuf;
  AB_BANKINFO *bi;

  assert(u);
  un=AB_User_GetUserId(u);
  /* find bank name */
  bi=AB_Banking_GetBankInfo(AB_User_GetBanking(u),
			    "de",
                            "*",
			    AB_User_GetBankCode(u));
  if (bi)
    bn=AB_BankInfo_GetBankName(bi);
  if (!bn)
    AB_User_GetBankCode(u);

  buffer[0]=0;
  buffer[sizeof(buffer)-1]=0;

  xbuf=GWEN_Buffer_new(0, 256, 0, 1);

  /* text version */
  snprintf(buffer, sizeof(buffer)-1,
           I18N("Please enter the TAN\n"
                "for user %s at %s.\n"), un, bn);
  buffer[sizeof(buffer)-1]=0;
  GWEN_Buffer_AppendString(xbuf, buffer);
  if (challenge && *challenge) {
    GWEN_Buffer_AppendString(xbuf, I18N("The server provided the following challenge:"));
    GWEN_Buffer_AppendString(xbuf, "\n");
    GWEN_Buffer_AppendString(xbuf, challenge);
  }

  /* html version */
  GWEN_Buffer_AppendString(xbuf,
                           "<html>"
                           "<p>");
  snprintf(buffer, sizeof(buffer)-1,
           I18N("Please enter the TAN for user <i>%s</i> at <i>%s</i>."), un, bn);
  buffer[sizeof(buffer)-1]=0;
  GWEN_Buffer_AppendString(xbuf, buffer);
  GWEN_Buffer_AppendString(xbuf, "</p>");
  if (challenge && *challenge) {
    GWEN_Buffer_AppendString(xbuf, "<p>");
    GWEN_Buffer_AppendString(xbuf, I18N("The server provided the following challenge:"));
    GWEN_Buffer_AppendString(xbuf, "</p>"
                             "<p align=\"center\" >"
                             "<font color=\"blue\">");
    GWEN_Buffer_AppendString(xbuf, challenge);
    GWEN_Buffer_AppendString(xbuf,
                             "</font>"
                             "</p>"
                             "</html>");
  }

  nbuf=GWEN_Buffer_new(0, 256 ,0 ,1);
  AH_User_MkTanName(u, challenge, nbuf);
  rv=GWEN_Gui_GetPassword(GWEN_GUI_INPUT_FLAGS_TAN |
			  /*GWEN_GUI_INPUT_FLAGS_NUMERIC |*/
                          GWEN_GUI_INPUT_FLAGS_SHOW,
			  GWEN_Buffer_GetStart(nbuf),
                          I18N("Enter TAN"),
                          GWEN_Buffer_GetStart(xbuf),
                          pwbuffer,
			  minLen,
			  maxLen,
			  0);
  GWEN_Buffer_free(xbuf);
  GWEN_Buffer_free(nbuf);
  AB_BankInfo_free(bi);
  return rv;
}
コード例 #6
0
ファイル: user.c プロジェクト: maduhu/aqbanking-1
int AH_User_InputPasswd(AB_USER *u,
			char *pwbuffer,
			int minLen, int maxLen,
                        int flags){
  GWEN_BUFFER *nbuf;
  int rv;
  const char *numeric_warning = "";
  char buffer[512];
  const char *un;
  const char *bn=NULL;
  AB_BANKINFO *bi;

  assert(u);
  un=AB_User_GetUserId(u);

  /* find bank name */
  bi=AB_Banking_GetBankInfo(AB_User_GetBanking(u),
			    "de",
                            "*",
			    AB_User_GetBankCode(u));
  if (bi)
    bn=AB_BankInfo_GetBankName(bi);
  if (!bn)
    AB_User_GetBankCode(u);

  buffer[0]=0;
  buffer[sizeof(buffer)-1]=0;
  if (flags & GWEN_GUI_INPUT_FLAGS_NUMERIC) {
    numeric_warning = I18N(" You must only enter numbers, not letters.");
  }
  if (flags & GWEN_GUI_INPUT_FLAGS_CONFIRM) {
    snprintf(buffer, sizeof(buffer)-1,
	     I18N("Please enter a new password for \n"
		  "user %s at %s\n"
		  "The input must be at least %d characters long.%s"
		  "<html>"
		  "<p>"
		  "Please enter a new password for user <i>%s</i> at "
		  "<i>%s</i>."
		  "</p>"
		  "<p>"
		  "The input must be at least %d characters long.%s"
		  "</p>"
		  "</html>"),
	     un, bn,
	     minLen,
	     numeric_warning,
	     un, bn,
	     minLen,
	     numeric_warning);
  }
  else {
    snprintf(buffer, sizeof(buffer)-1,
	     I18N("Please enter the password for \n"
		  "user %s at %s\n"
		  "%s"
		  "<html>"
		  "Please enter the password for user <i>%s</i> at"
		  "<i>%s</i>.<br>"
		  "%s"
		  "</html>"),
	     un, bn,
	     numeric_warning,
	     un, bn,
	     numeric_warning);
  }
  buffer[sizeof(buffer)-1]=0;

  AB_BankInfo_free(bi);

  nbuf=GWEN_Buffer_new(0, 256 ,0 ,1);
  AH_User_MkPasswdName(u, nbuf);

  rv=GWEN_Gui_GetPassword(flags,
			  GWEN_Buffer_GetStart(nbuf),
			  I18N("Enter Password"),
			  buffer,
			  pwbuffer,
			  minLen,
			  maxLen,
			  0);
  GWEN_Buffer_free(nbuf);

  return rv;
}