~ubuntu-branches/ubuntu/lucid/libaqbanking/lucid

« back to all changes in this revision

Viewing changes to src/plugins/backends/aqhbci/plugin/banking/provider.c

  • Committer: Bazaar Package Importer
  • Author(s): Micha Lenk
  • Date: 2009-12-31 13:00:26 UTC
  • mfrom: (1.1.18 upstream) (4.1.10 sid)
  • Revision ID: james.westby@ubuntu.com-20091231130026-wvsfhd6i6hutk5kc
Tags: 4.2.1-1
* New upstream release
* Fix typo in libaqbanking-data's package description (closes: #557493).
  Thanks to Pascal De Vuyst for pointing it out.
* Fix typos in manpages of qb-help and aqbanking-config (thanks lintian).
* Ignore parallel=N in DEB_BUILD_OPTIONS -- upstream doesn't support it.

Show diffs side-by-side

added added

removed removed

Lines of Context:
566
566
        /* create new job */
567
567
        mj=AH_Job_MultiTransfer_new(mu, ma);
568
568
        if (!mj) {
569
 
          DBG_ERROR(AQHBCI_LOGDOMAIN,
 
569
          DBG_WARN(AQHBCI_LOGDOMAIN,
570
570
                    "Multi-job not supported with this account, "
571
571
                    "using single-job");
572
572
        }
1031
1031
 
1032
1032
  job=AH_Job_UpdateBank_new(u);
1033
1033
  if (!job) {
1034
 
    DBG_ERROR(0, "Job not supported, should not happen");
 
1034
    DBG_ERROR(AQHBCI_LOGDOMAIN, "Job not supported, should not happen");
1035
1035
    return GWEN_ERROR_GENERIC;
1036
1036
  }
1037
1037
  AH_Job_AddSigner(job, AB_User_GetUserId(u));
1041
1041
 
1042
1042
  rv=AH_Outbox_Execute(ob, ctx, 1, 1, 1, guiid);
1043
1043
  if (rv) {
1044
 
    DBG_ERROR(0, "Could not execute outbox.\n");
 
1044
    DBG_ERROR(AQHBCI_LOGDOMAIN, "Could not execute outbox.\n");
1045
1045
    if (!nounmount)
1046
1046
      AB_Banking_ClearCryptTokenList(AH_HBCI_GetBankingApi(h), guiid);
1047
1047
    return rv;
1116
1116
  for (i=0; ; i++) {
1117
1117
    job=AH_Job_GetSysId_new(u);
1118
1118
    if (!job) {
1119
 
      DBG_ERROR(0, "Job not supported, should not happen");
 
1119
      DBG_ERROR(AQHBCI_LOGDOMAIN, "Job not supported, should not happen");
1120
1120
      AB_Banking_EndExclUseUser(ab, u, 1, guiid);
1121
1121
      return GWEN_ERROR_GENERIC;
1122
1122
    }
1127
1127
 
1128
1128
    rv=AH_Outbox_Execute(ob, ctx, 1, 1, 0, guiid);
1129
1129
    if (rv) {
1130
 
      DBG_ERROR(0, "Could not execute outbox.\n");
 
1130
      DBG_ERROR(AQHBCI_LOGDOMAIN, "Could not execute outbox.\n");
1131
1131
      if (!nounmount)
1132
1132
        AB_Banking_ClearCryptTokenList(AH_HBCI_GetBankingApi(h), guiid);
1133
1133
      return rv;
1289
1289
  }
1290
1290
 
1291
1291
  if (AH_Job_GetKeys_GetCryptKeyInfo(job)==NULL) {
1292
 
    DBG_ERROR(0, "No crypt key received");
 
1292
    DBG_ERROR(AQHBCI_LOGDOMAIN, "No crypt key received");
1293
1293
    GWEN_Gui_ProgressLog(guiid,
1294
1294
                         GWEN_LoggerLevel_Error,
1295
1295
                         I18N("No crypt key received."));
1301
1301
  else {
1302
1302
    rv=AH_Job_Commit(job, 1, guiid);
1303
1303
    if (rv) {
1304
 
      DBG_ERROR(0, "Could not commit result.\n");
 
1304
      DBG_ERROR(AQHBCI_LOGDOMAIN, "Could not commit result.\n");
1305
1305
      GWEN_Gui_ProgressLog(guiid,
1306
1306
                           GWEN_LoggerLevel_Error,
1307
1307
                           I18N("Could not commit result"));
1653
1653
 
1654
1654
  /* check result */
1655
1655
  if (AH_Job_HasErrors(job)) {
1656
 
    DBG_ERROR(0, "Job has errors");
 
1656
    DBG_ERROR(AQHBCI_LOGDOMAIN, "Job has errors");
1657
1657
    GWEN_Gui_ProgressLog(guiid,
1658
1658
                         GWEN_LoggerLevel_Error,
1659
1659
                         I18N("Job contains errors."));
1665
1665
  else {
1666
1666
    rv=AH_Job_Commit(job, 1, guiid);
1667
1667
    if (rv) {
1668
 
      DBG_ERROR(0, "Could not commit result.\n");
 
1668
      DBG_ERROR(AQHBCI_LOGDOMAIN, "Could not commit result.\n");
1669
1669
      GWEN_Gui_ProgressLog(guiid,
1670
1670
                           GWEN_LoggerLevel_Error,
1671
1671
                           I18N("Could not commit result"));
1737
1737
  AH_Dialog_free(dialog);
1738
1738
 
1739
1739
  if (rv) {
1740
 
    DBG_ERROR(0, "Could not connect to server (%d)", rv);
 
1740
    DBG_ERROR(AQHBCI_LOGDOMAIN, "Could not connect to server (%d)", rv);
1741
1741
    GWEN_Gui_ProgressLog(pid,
1742
1742
                         GWEN_LoggerLevel_Error,
1743
1743
                         I18N("Could not connect to server"));
1797
1797
 
1798
1798
  job=AH_Job_GetItanModes_new(u);
1799
1799
  if (!job) {
1800
 
    DBG_ERROR(0, "Job not supported, should not happen");
 
1800
    DBG_ERROR(AQHBCI_LOGDOMAIN, "Job not supported, should not happen");
1801
1801
    return GWEN_ERROR_GENERIC;
1802
1802
  }
1803
1803
  AH_Job_AddSigner(job, AB_User_GetUserId(u));
1917
1917
 
1918
1918
  job=AH_Job_ChangePin_new(u, pwbuf);
1919
1919
  if (!job) {
1920
 
    DBG_ERROR(0, "Job not supported, should not happen");
 
1920
    DBG_ERROR(AQHBCI_LOGDOMAIN, "Job not supported, should not happen");
1921
1921
    return GWEN_ERROR_GENERIC;
1922
1922
  }
1923
1923
  AH_Job_AddSigner(job, AB_User_GetUserId(u));
1927
1927
 
1928
1928
  rv=AH_Outbox_Execute(ob, ctx, 1, 1, 1, guiid);
1929
1929
  if (rv) {
1930
 
    DBG_ERROR(0, "Could not execute outbox.\n");
 
1930
    DBG_ERROR(AQHBCI_LOGDOMAIN, "Could not execute outbox.\n");
1931
1931
    if (!nounmount)
1932
1932
      AB_Banking_ClearCryptTokenList(AH_HBCI_GetBankingApi(h), guiid);
1933
1933
    return rv;
2195
2195
        !(GWEN_Crypt_Token_KeyInfo_GetFlags(ki) & GWEN_CRYPT_TOKEN_KEYFLAGS_HASEXPONENT)) {
2196
2196
      if (!nounmount)
2197
2197
        AB_Banking_ClearCryptTokenList(AH_HBCI_GetBankingApi(h), guiid);
2198
 
      DBG_ERROR(0, "Server keys missing, please get them first");
 
2198
      DBG_ERROR(AQHBCI_LOGDOMAIN, "Server keys missing, please get them first");
2199
2199
      GWEN_Gui_ProgressLog(guiid,
2200
2200
                           GWEN_LoggerLevel_Error,
2201
2201
                           I18N("Server keys missing, "
2219
2219
        !(GWEN_Crypt_Token_KeyInfo_GetFlags(ki) & GWEN_CRYPT_TOKEN_KEYFLAGS_HASEXPONENT)) {
2220
2220
      if (!nounmount)
2221
2221
        AB_Banking_ClearCryptTokenList(AH_HBCI_GetBankingApi(h), guiid);
2222
 
      DBG_ERROR(0, "User keys missing, please generate them first");
 
2222
      DBG_ERROR(AQHBCI_LOGDOMAIN, "User keys missing, please generate them first");
2223
2223
      GWEN_Gui_ProgressLog(guiid,
2224
2224
                           GWEN_LoggerLevel_Error,
2225
2225
                           I18N("User keys missing, "
2308
2308
  for (i=0; i<6; i++) {
2309
2309
    GWEN_Buffer_AppendString(lbuf, "  ");
2310
2310
    if (GWEN_Text_ToHexBuffer(p, 16, lbuf, 2, ' ', 0)) {
2311
 
      DBG_ERROR(0, "Error converting to hex??");
 
2311
      DBG_ERROR(AQHBCI_LOGDOMAIN, "Error converting to hex??");
2312
2312
      abort();
2313
2313
    }
2314
2314
    p+=16;
2344
2344
  for (i=0; i<6; i++) {
2345
2345
    GWEN_Buffer_AppendString(lbuf, "  ");
2346
2346
    if (GWEN_Text_ToHexBuffer(p, 16, lbuf, 2, ' ', 0)) {
2347
 
      DBG_ERROR(0, "Error converting to hex??");
 
2347
      DBG_ERROR(AQHBCI_LOGDOMAIN, "Error converting to hex??");
2348
2348
      abort();
2349
2349
    }
2350
2350
    p+=16;
2371
2371
 
2372
2372
  GWEN_Buffer_AppendString(lbuf, "  ");
2373
2373
  if (GWEN_Text_ToHexBuffer(hashbuffer, 20, lbuf, 2, ' ', 0)) {
2374
 
    DBG_ERROR(0, "Error converting to hex??");
 
2374
    DBG_ERROR(AQHBCI_LOGDOMAIN, "Error converting to hex??");
2375
2375
    abort();
2376
2376
  }
2377
2377
  GWEN_Buffer_AppendString(lbuf, "\n");
2496
2496
        !(GWEN_Crypt_Token_KeyInfo_GetFlags(ki) & GWEN_CRYPT_TOKEN_KEYFLAGS_HASEXPONENT)) {
2497
2497
      if (!nounmount)
2498
2498
        AB_Banking_ClearCryptTokenList(AH_HBCI_GetBankingApi(h), guiid);
2499
 
      DBG_ERROR(0, "Server keys missing, please get them first");
 
2499
      DBG_ERROR(AQHBCI_LOGDOMAIN, "Server keys missing, please get them first");
2500
2500
      GWEN_Gui_ProgressLog(guiid,
2501
2501
                           GWEN_LoggerLevel_Error,
2502
2502
                           I18N("Server keys missing, "
2520
2520
        !(GWEN_Crypt_Token_KeyInfo_GetFlags(ki) & GWEN_CRYPT_TOKEN_KEYFLAGS_HASEXPONENT)) {
2521
2521
      if (!nounmount)
2522
2522
        AB_Banking_ClearCryptTokenList(AH_HBCI_GetBankingApi(h), guiid);
2523
 
      DBG_ERROR(0, "User keys missing, please generate them first");
 
2523
      DBG_ERROR(AQHBCI_LOGDOMAIN, "User keys missing, please generate them first");
2524
2524
      GWEN_Gui_ProgressLog(guiid,
2525
2525
                           GWEN_LoggerLevel_Error,
2526
2526
                           I18N("User keys missing, "
2615
2615
  for (i=0; i<6; i++) {
2616
2616
    GWEN_Buffer_AppendString(lbuf, "  ");
2617
2617
    if (GWEN_Text_ToHexBuffer(p, 16, lbuf, 2, ' ', 0)) {
2618
 
      DBG_ERROR(0, "Error converting to hex??");
 
2618
      DBG_ERROR(AQHBCI_LOGDOMAIN, "Error converting to hex??");
2619
2619
      abort();
2620
2620
    }
2621
2621
    p+=16;
2653
2653
  for (i=0; i<6; i++) {
2654
2654
    GWEN_Buffer_AppendString(lbuf, "  ");
2655
2655
    if (GWEN_Text_ToHexBuffer(p, 16, lbuf, 2, ' ', 0)) {
2656
 
      DBG_ERROR(0, "Error converting to hex??");
 
2656
      DBG_ERROR(AQHBCI_LOGDOMAIN, "Error converting to hex??");
2657
2657
      abort();
2658
2658
    }
2659
2659
    p+=16;
2681
2681
 
2682
2682
  GWEN_Buffer_AppendString(lbuf, "  ");
2683
2683
  if (GWEN_Text_ToHexBuffer(hashbuffer, 20, lbuf, 2, ' ', 0)) {
2684
 
    DBG_ERROR(0, "Error converting to hex??");
 
2684
    DBG_ERROR(AQHBCI_LOGDOMAIN, "Error converting to hex??");
2685
2685
    abort();
2686
2686
  }
2687
2687
  GWEN_Buffer_AppendString(lbuf, "</font>\n");
2814
2814
        !(GWEN_Crypt_Token_KeyInfo_GetFlags(ki) & GWEN_CRYPT_TOKEN_KEYFLAGS_HASEXPONENT)) {
2815
2815
      if (!nounmount)
2816
2816
        AB_Banking_ClearCryptTokenList(AH_HBCI_GetBankingApi(h), guiid);
2817
 
      DBG_ERROR(0, "Server keys missing, please get them first");
 
2817
      DBG_ERROR(AQHBCI_LOGDOMAIN, "Server keys missing, please get them first");
2818
2818
      GWEN_Gui_ProgressLog(guiid,
2819
2819
                           GWEN_LoggerLevel_Error,
2820
2820
                           I18N("Server keys missing, "
2838
2838
        !(GWEN_Crypt_Token_KeyInfo_GetFlags(ki) & GWEN_CRYPT_TOKEN_KEYFLAGS_HASEXPONENT)) {
2839
2839
      if (!nounmount)
2840
2840
        AB_Banking_ClearCryptTokenList(AH_HBCI_GetBankingApi(h), guiid);
2841
 
      DBG_ERROR(0, "User keys missing, please generate them first");
 
2841
      DBG_ERROR(AQHBCI_LOGDOMAIN, "User keys missing, please generate them first");
2842
2842
      GWEN_Gui_ProgressLog(guiid,
2843
2843
                           GWEN_LoggerLevel_Error,
2844
2844
                           I18N("User keys missing, "
2937
2937
 
2938
2938
    GWEN_Buffer_AppendString(lbuf, "  ");
2939
2939
    if (GWEN_Text_ToHexBuffer(p, rl, lbuf, 2, ' ', 0)) {
2940
 
      DBG_ERROR(0, "Error converting to hex??");
 
2940
      DBG_ERROR(AQHBCI_LOGDOMAIN, "Error converting to hex??");
2941
2941
      abort();
2942
2942
    }
2943
2943
    p+=rl;
2974
2974
 
2975
2975
    GWEN_Buffer_AppendString(lbuf, "  ");
2976
2976
    if (GWEN_Text_ToHexBuffer(p, rl, lbuf, 2, ' ', 0)) {
2977
 
      DBG_ERROR(0, "Error converting to hex??");
 
2977
      DBG_ERROR(AQHBCI_LOGDOMAIN, "Error converting to hex??");
2978
2978
      abort();
2979
2979
    }
2980
2980
    p+=rl;
2999
2999
 
3000
3000
  GWEN_Buffer_AppendString(lbuf, "  ");
3001
3001
  if (GWEN_Text_ToHexBuffer(hashbuffer, 10, lbuf, 2, ' ', 0)) {
3002
 
    DBG_ERROR(0, "Error converting to hex??");
 
3002
    DBG_ERROR(AQHBCI_LOGDOMAIN, "Error converting to hex??");
3003
3003
    abort();
3004
3004
  }
3005
3005
  GWEN_Buffer_AppendString(lbuf, "\n  ");
3006
3006
  if (GWEN_Text_ToHexBuffer(hashbuffer+10, 10, lbuf, 2, ' ', 0)) {
3007
 
    DBG_ERROR(0, "Error converting to hex??");
 
3007
    DBG_ERROR(AQHBCI_LOGDOMAIN, "Error converting to hex??");
3008
3008
    abort();
3009
3009
  }
3010
3010
  GWEN_Buffer_AppendString(lbuf, "\n");
3025
3025
 
3026
3026
  GWEN_Buffer_AppendString(lbuf, "  ");
3027
3027
  if (GWEN_Text_ToHexBuffer(hashbuffer, 16, lbuf, 2, ' ', 0)) {
3028
 
    DBG_ERROR(0, "Error converting to hex??");
 
3028
    DBG_ERROR(AQHBCI_LOGDOMAIN, "Error converting to hex??");
3029
3029
    abort();
3030
3030
  }
3031
3031
  GWEN_Buffer_AppendString(lbuf, "\n  ");
3032
3032
  if (GWEN_Text_ToHexBuffer(hashbuffer+16, 16, lbuf, 2, ' ', 0)) {
3033
 
    DBG_ERROR(0, "Error converting to hex??");
 
3033
    DBG_ERROR(AQHBCI_LOGDOMAIN, "Error converting to hex??");
3034
3034
    abort();
3035
3035
  }
3036
3036
  GWEN_Buffer_AppendString(lbuf, "\n");
3155
3155
        !(GWEN_Crypt_Token_KeyInfo_GetFlags(ki) & GWEN_CRYPT_TOKEN_KEYFLAGS_HASEXPONENT)) {
3156
3156
      if (!nounmount)
3157
3157
        AB_Banking_ClearCryptTokenList(AH_HBCI_GetBankingApi(h), guiid);
3158
 
      DBG_ERROR(0, "Server keys missing, please get them first");
 
3158
      DBG_ERROR(AQHBCI_LOGDOMAIN, "Server keys missing, please get them first");
3159
3159
      GWEN_Gui_ProgressLog(guiid,
3160
3160
                           GWEN_LoggerLevel_Error,
3161
3161
                           I18N("Server keys missing, "
3179
3179
        !(GWEN_Crypt_Token_KeyInfo_GetFlags(ki) & GWEN_CRYPT_TOKEN_KEYFLAGS_HASEXPONENT)) {
3180
3180
      if (!nounmount)
3181
3181
        AB_Banking_ClearCryptTokenList(AH_HBCI_GetBankingApi(h), guiid);
3182
 
      DBG_ERROR(0, "User keys missing, please generate them first");
 
3182
      DBG_ERROR(AQHBCI_LOGDOMAIN, "User keys missing, please generate them first");
3183
3183
      GWEN_Gui_ProgressLog(guiid,
3184
3184
                           GWEN_LoggerLevel_Error,
3185
3185
                           I18N("User keys missing, "
3285
3285
 
3286
3286
    GWEN_Buffer_AppendString(lbuf, "  ");
3287
3287
    if (GWEN_Text_ToHexBuffer(p, rl, lbuf, 2, ' ', 0)) {
3288
 
      DBG_ERROR(0, "Error converting to hex??");
 
3288
      DBG_ERROR(AQHBCI_LOGDOMAIN, "Error converting to hex??");
3289
3289
      abort();
3290
3290
    }
3291
3291
    p+=rl;
3324
3324
 
3325
3325
    GWEN_Buffer_AppendString(lbuf, "  ");
3326
3326
    if (GWEN_Text_ToHexBuffer(p, rl, lbuf, 2, ' ', 0)) {
3327
 
      DBG_ERROR(0, "Error converting to hex??");
 
3327
      DBG_ERROR(AQHBCI_LOGDOMAIN, "Error converting to hex??");
3328
3328
      abort();
3329
3329
    }
3330
3330
    p+=rl;
3350
3350
 
3351
3351
  GWEN_Buffer_AppendString(lbuf, "  ");
3352
3352
  if (GWEN_Text_ToHexBuffer(hashbuffer, 20, lbuf, 2, ' ', 0)) {
3353
 
    DBG_ERROR(0, "Error converting to hex??");
 
3353
    DBG_ERROR(AQHBCI_LOGDOMAIN, "Error converting to hex??");
3354
3354
    abort();
3355
3355
  }
3356
3356
  GWEN_Buffer_AppendString(lbuf, "</font>\n");
3371
3371
 
3372
3372
  GWEN_Buffer_AppendString(lbuf, "  ");
3373
3373
  if (GWEN_Text_ToHexBuffer(hashbuffer, 32, lbuf, 2, ' ', 0)) {
3374
 
    DBG_ERROR(0, "Error converting to hex??");
 
3374
    DBG_ERROR(AQHBCI_LOGDOMAIN, "Error converting to hex??");
3375
3375
    abort();
3376
3376
  }
3377
3377
  GWEN_Buffer_AppendString(lbuf, "</font>\n");
3556
3556
        n++;
3557
3557
      GWEN_Crypt_CryptAlgo_SetChunkSize(algo, n);
3558
3558
      GWEN_Crypt_CryptAlgo_SetKeySizeInBits(algo, maxServerKeySizeInBits);
3559
 
      /*DBG_ERROR(0, "Creating keys of size: %d bytes, %d bits", n, maxServerKeySizeInBits);*/
 
3559
      /*DBG_ERROR(AQHBCI_LOGDOMAIN, "Creating keys of size: %d bytes, %d bits", n, maxServerKeySizeInBits);*/
3560
3560
    }
3561
3561
    else {
3562
3562
      GWEN_Crypt_CryptAlgo_SetChunkSize(algo, 512);
3756
3756
 
3757
3757
  job=AH_Job_ForeignTransferWH_new(u, a);
3758
3758
  if (!job) {
3759
 
    DBG_ERROR(0, "Job not supported, should not happen");
 
3759
    DBG_ERROR(AQHBCI_LOGDOMAIN, "Job not supported, should not happen");
3760
3760
    return GWEN_ERROR_GENERIC;
3761
3761
  }
3762
3762
 
3774
3774
 
3775
3775
  rv=AH_Outbox_Execute(ob, ctx, 1, 1, 1, guiid);
3776
3776
  if (rv) {
3777
 
    DBG_ERROR(0, "Could not execute outbox.\n");
 
3777
    DBG_ERROR(AQHBCI_LOGDOMAIN, "Could not execute outbox.\n");
3778
3778
    if (!nounmount)
3779
3779
      AB_Banking_ClearCryptTokenList(AH_HBCI_GetBankingApi(h), guiid);
3780
3780
    AH_Job_free(job);
3833
3833
 
3834
3834
      i=fread(buffer, 1, sizeof(buffer), f);
3835
3835
      if (i<1) {
3836
 
        DBG_ERROR(0, "Error on read: %d (%s)",
 
3836
        DBG_ERROR(AQHBCI_LOGDOMAIN, "Error on read: %d (%s)",
3837
3837
                  errno, strerror(errno));
3838
3838
        return -1;
3839
3839
      }
3930
3930
 
3931
3931
      i=fread(buffer, 1, sizeof(buffer), f);
3932
3932
      if (i<1) {
3933
 
        DBG_ERROR(0, "Error on read: %d (%s)",
 
3933
        DBG_ERROR(AQHBCI_LOGDOMAIN, "Error on read: %d (%s)",
3934
3934
                  errno, strerror(errno));
3935
3935
        return -1;
3936
3936
      }