~ubuntu-branches/ubuntu/raring/gnupg2/raring-proposed

« back to all changes in this revision

Viewing changes to g10/skclist.c

  • Committer: Bazaar Package Importer
  • Author(s): Eric Dorland
  • Date: 2009-09-07 20:38:23 UTC
  • mfrom: (1.1.13 upstream)
  • Revision ID: james.westby@ubuntu.com-20090907203823-d7hsk7lnfqoc4yom
Tags: 2.0.13-1
* New upstream release.
* debian/control: Depend instead of Recommend gnupg-agent. (Closes:
  #538947)

Show diffs side-by-side

added added

removed removed

Lines of Context:
128
128
        if( (rc = get_seckey_byname( sk, NULL, unlock )) ) {
129
129
          free_secret_key( sk ); sk = NULL;
130
130
          log_error("no default secret key: %s\n", g10_errstr(rc) );
 
131
          write_status_text (STATUS_INV_SGNR,
 
132
                             get_inv_recpsgnr_code (GPG_ERR_NO_SECKEY));
131
133
        }
132
134
        else if( !(rc=openpgp_pk_test_algo2 (sk->pubkey_algo, use)) )
133
135
          {
138
140
                log_info(_("key is not flagged as insecure - "
139
141
                           "can't use it with the faked RNG!\n"));
140
142
                free_secret_key( sk ); sk = NULL;
 
143
                write_status_text (STATUS_INV_SGNR, 
 
144
                                   get_inv_recpsgnr_code (GPG_ERR_NOT_TRUSTED));
141
145
              }
142
146
            else
143
147
              {
152
156
          {
153
157
            free_secret_key( sk ); sk = NULL;
154
158
            log_error("invalid default secret key: %s\n", g10_errstr(rc) );
 
159
            write_status_text (STATUS_INV_SGNR, get_inv_recpsgnr_code (rc));
155
160
          }
156
161
      }
157
162
    else {
176
181
                free_secret_key( sk ); sk = NULL;
177
182
                log_error(_("skipped \"%s\": %s\n"),
178
183
                          locusr->d, g10_errstr(rc) );
 
184
                write_status_text_and_buffer 
 
185
                  (STATUS_INV_SGNR, get_inv_recpsgnr_code (rc), 
 
186
                   locusr->d, strlen (locusr->d), -1);
179
187
              }
180
188
            else if ( key_present_in_sk_list(sk_list, sk) == 0) {
181
189
                free_secret_key(sk); sk = NULL;
186
194
                free_secret_key( sk ); sk = NULL;
187
195
                log_error(_("skipped \"%s\": %s\n"),
188
196
                          locusr->d, g10_errstr(rc) );
 
197
                write_status_text_and_buffer 
 
198
                  (STATUS_INV_SGNR, get_inv_recpsgnr_code (rc), 
 
199
                   locusr->d, strlen (locusr->d), -1);
189
200
              }
190
201
            else if( !(rc=openpgp_pk_test_algo2 (sk->pubkey_algo, use)) ) {
191
202
                SK_LIST r;
197
208
                             _("this is a PGP generated Elgamal key which"
198
209
                               " is not secure for signatures!"));
199
210
                    free_secret_key( sk ); sk = NULL;
 
211
                    write_status_text_and_buffer 
 
212
                      (STATUS_INV_SGNR, 
 
213
                       get_inv_recpsgnr_code (GPG_ERR_WRONG_KEY_USAGE), 
 
214
                       locusr->d, strlen (locusr->d), -1);
200
215
                  }
201
216
                else if( random_is_faked() && !is_insecure( sk ) ) {
202
217
                    log_info(_("key is not flagged as insecure - "
203
218
                               "can't use it with the faked RNG!\n"));
204
219
                    free_secret_key( sk ); sk = NULL;
 
220
                    write_status_text_and_buffer 
 
221
                      (STATUS_INV_SGNR, 
 
222
                       get_inv_recpsgnr_code (GPG_ERR_NOT_TRUSTED), 
 
223
                       locusr->d, strlen (locusr->d), -1);
205
224
                }
206
225
                else {
207
226
                    r = xmalloc( sizeof *r );
214
233
            else {
215
234
                free_secret_key( sk ); sk = NULL;
216
235
                log_error("skipped \"%s\": %s\n", locusr->d, g10_errstr(rc) );
 
236
                write_status_text_and_buffer 
 
237
                  (STATUS_INV_SGNR, get_inv_recpsgnr_code (rc), 
 
238
                   locusr->d, strlen (locusr->d), -1);
217
239
            }
218
240
        }
219
241
    }
221
243
 
222
244
    if( !rc && !sk_list ) {
223
245
        log_error("no valid signators\n");
 
246
        write_status_text (STATUS_NO_SGNR, "0");
224
247
        rc = G10ERR_NO_USER_ID;
225
248
    }
226
249