~ubuntu-branches/debian/sid/alpine/sid

« back to all changes in this revision

Viewing changes to pith/send.c

  • Committer: Package Import Robot
  • Author(s): Unit 193
  • Date: 2015-05-01 19:52:36 UTC
  • mfrom: (1.1.12)
  • Revision ID: package-import@ubuntu.com-20150501195236-e2xjytpbb7ik352w
Tags: 2.20+dfsg1-1
* Imported Upstream version 2.20+dfsg1
  - Drop patches applied upstream.
  - Refresh remaining patches.
  - d/rules: Update SHA256 for alpine 2.20.
* Update Standards-Version to 3.9.6.
* d/watch: Narrow the regex to only match source tarballs.
* d/alpine-doc.docs: tech-notes.txt moved to under the tech-notes/ dir.
* d/control: Update Vcs-Browser for cgit.
* d/p/10_alpine_1.10_spooldir.patch: Fix a few more references.
* d/p/40_fix_browser_hardcoded_paths.patch:
  - Fix hardcoded paths to specific browsers.
* d/p/40_fix_tech_notes_hardcoded_paths.patch, d/rules:
  - Drop patch in favor of changing paths after the build.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
 
5
5
/*
6
6
 * ========================================================================
7
 
 * Copyright 2013 Eduardo Chappa
 
7
 * Copyright 2013-2015 Eduardo Chappa
8
8
 * Copyright 2006-2008 University of Washington
9
9
 *
10
10
 * Licensed under the Apache License, Version 2.0 (the "License");
429
429
        fields[++i]   = "X-Our-ReplyTo";        /* ReplyTo is real */
430
430
        fields[++i]   = "Lcc";          /* Lcc: too... */
431
431
        if(++i != FIELD_COUNT)
432
 
          panic("Fix FIELD_COUNT");
 
432
          alpine_panic("Fix FIELD_COUNT");
433
433
 
434
434
        for(pf = *custom; pf && pf->name; pf = pf->next)
435
435
          if(!pf->standard)
890
890
        else{
891
891
            *body         = mail_newbody();
892
892
            (*body)->type = TYPETEXT;
893
 
            if(b->subtype)
 
893
            if(b->subtype       /* these types are transformed to text/plain */
 
894
                && strucmp(b->subtype, "richtext")
 
895
                && strucmp(b->subtype, "enriched")
 
896
                && strucmp(b->subtype, "html"))
894
897
              (*body)->subtype = cpystr(b->subtype);
895
898
 
896
899
            if((charset = parameter_val(b->parameter,"charset")) != NULL){
1563
1566
              pf->textbuf = cpystr(value);
1564
1567
        }
1565
1568
    }
 
1569
    return pf;
1566
1570
}
1567
1571
 
1568
1572
 
1719
1723
#ifdef SMIME
1720
1724
    if(ps_global->smime && (ps_global->smime->do_encrypt || ps_global->smime->do_sign)){
1721
1725
        int result;
1722
 
        
 
1726
 
1723
1727
        STORE_S *so = lmc.so;
1724
1728
        lmc.so = NULL;
1725
 
    
 
1729
 
1726
1730
        result = 1;
1727
 
    
1728
 
        if(ps_global->smime->do_encrypt)
 
1731
 
 
1732
        if(ps_global->smime->do_sign){
 
1733
          bp = F_ON(F_ENABLE_8BIT, ps_global) ? first_text_8bit(body) : NULL;
 
1734
          result = sign_outgoing_message(header, &body, 0, &bp);
 
1735
        }
 
1736
 
 
1737
        /* need to free new body from encrypt if sign fails? */
 
1738
        if(result && ps_global->smime->do_encrypt)
1729
1739
          result = encrypt_outgoing_message(header, &body);
1730
 
        
1731
 
        /* need to free new body from encrypt if sign fails? */
1732
 
        if(result && ps_global->smime->do_sign)
1733
 
          result = sign_outgoing_message(header, &body, ps_global->smime->do_encrypt);
1734
 
        
 
1740
 
1735
1741
        lmc.so = so;
1736
 
        
 
1742
 
1737
1743
        if(!result)
1738
1744
          return 0;
1739
1745
    }
1956
1962
                body_encodings[added_encoding] = body_encodings[ENC8BIT];
1957
1963
                save_encoding = bp->encoding;
1958
1964
                bp->encoding = added_encoding;
 
1965
#ifdef SMIME
 
1966
            if(ps_global->smime && ps_global->smime->do_sign 
 
1967
                && body->nested.part->next
 
1968
                && body->nested.part->next->body.contents.text.data
 
1969
                && body->nested.part->next->body.mime.text.data){
 
1970
                  STORE_S *so;
 
1971
 
 
1972
                  so = (STORE_S *) body->nested.part->next->body.contents.text.data;
 
1973
                  so_give(&so);
 
1974
                  body->nested.part->next->body.contents.text.data = body->nested.part->next->body.mime.text.data;
 
1975
                  body->nested.part->next->body.mime.text.data = NULL;
 
1976
                }
 
1977
#endif /* SMIME */
1959
1978
            }
1960
1979
        }
1961
1980
 
3047
3066
      return((char *)s);
3048
3067
    
3049
3068
    if(dlen < SIZEOF_20KBUF)
3050
 
      panic("bad call to encode_header_value");
 
3069
      alpine_panic("bad call to encode_header_value");
3051
3070
 
3052
3071
    if(!encode_all){
3053
3072
        /*
4202
4221
long
4203
4222
pine_rfc822_output_body(struct mail_bodystruct *body, soutr_t f, void *s)
4204
4223
{
 
4224
    STORE_S *bodyso;
4205
4225
    PART *part;
4206
4226
    PARAMETER *param;
4207
4227
    char *t, *cookie = NIL, *encode_error;
4212
4232
 
4213
4233
    dprint((4, "-- pine_rfc822_output_body: %d\n",
4214
4234
               body ? body->type : 0));
 
4235
 
 
4236
    bodyso = (STORE_S *) body->contents.text.data;
 
4237
 
4215
4238
    if(body->type == TYPEMULTIPART) {   /* multipart gets special handling */
4216
4239
        part = body->nested.part;       /* first body part */
4217
4240
                                        /* find cookie */
4222
4245
        /*
4223
4246
         * Output a bit of text before the first multipart delimiter
4224
4247
         * to warn unsuspecting users of non-mime-aware ua's that
4225
 
         * they should expect weirdness...
 
4248
         * they should expect weirdness. We do not add this when signing a
 
4249
         * message, though...
4226
4250
         */
 
4251
#ifdef SMIME
 
4252
        if(ps_global->smime && !ps_global->smime->do_sign)
 
4253
#endif
4227
4254
        if(f && !(*f)(s, "  This message is in MIME format.  The first part should be readable text,\015\012  while the remaining parts are likely unreadable without MIME-aware tools.\015\012\015\012"))
4228
4255
          return(0);
4229
4256
 
4241
4268
                                        /* output trailing cookie */
4242
4269
        snprintf (t = tmp, sizeof(tmp), "--%s--",cookie);
4243
4270
        tmp[sizeof(tmp)-1] = '\0';
 
4271
#ifdef SMIME
 
4272
        if(ps_global->smime && ps_global->smime->do_sign 
 
4273
                && strlen(tmp) < sizeof(tmp)-2)
 
4274
           strncat(tmp, "\r\n", 2);
 
4275
#endif
4244
4276
        if(lmc.so && !lmc.all_written){
4245
4277
            so_puts(lmc.so, t);
4246
4278
            so_puts(lmc.so, "\015\012");
4255
4287
    dprint((4, "-- pine_rfc822_output_body: segment %ld bytes\n",
4256
4288
               body->size.bytes));
4257
4289
 
4258
 
    if(body->contents.text.data)
4259
 
      gf_set_so_readc(&gc, (STORE_S *) body->contents.text.data);
 
4290
    if(bodyso)
 
4291
      gf_set_so_readc(&gc, bodyso);
4260
4292
    else
4261
4293
      return(1);
4262
4294
 
4264
4296
     * Don't add trailing line if it is ExternalText, which already guarantees
4265
4297
     * a trailing newline.
4266
4298
     */
4267
 
    add_trailing_crlf = !(((STORE_S *) body->contents.text.data)->src == ExternalText);
 
4299
    add_trailing_crlf = !(bodyso->src == ExternalText);
4268
4300
 
4269
 
    so_seek((STORE_S *) body->contents.text.data, 0L, 0);
 
4301
    so_seek(bodyso, 0L, 0);
4270
4302
 
4271
4303
    if(body->type != TYPEMESSAGE){      /* NOT encapsulated message */
4272
4304
        char *charset;
4273
4305
 
4274
4306
        if(body->type == TYPETEXT
4275
 
           && so_attr((STORE_S *) body->contents.text.data, "edited", NULL)
 
4307
           && so_attr(bodyso, "edited", NULL)
4276
4308
           && (charset = parameter_val(body->parameter, "charset"))){
4277
4309
            if(strucmp(charset, "utf-8") && strucmp(charset, "us-ascii")){
4278
4310
                if(!strucmp(charset, "iso-2022-jp")){
4304
4336
         */
4305
4337
        if(body->type == TYPETEXT
4306
4338
           && body->encoding != ENCBASE64
4307
 
           && !so_attr((STORE_S *) body->contents.text.data, "rawbody", NULL)){
 
4339
           && !so_attr(bodyso, "rawbody", NULL)){
4308
4340
            gf_link_filter(gf_local_nvtnl, NULL);
4309
4341
        }
4310
4342
 
4328
4360
        display_message('x');
4329
4361
    }
4330
4362
 
4331
 
    gf_clear_so_readc((STORE_S *) body->contents.text.data);
 
4363
    gf_clear_so_readc(bodyso);
4332
4364
 
4333
4365
    if(encode_error || !l_flush_net(TRUE))
4334
4366
      return(0);
4377
4409
      return(1);
4378
4410
}
4379
4411
 
 
4412
char *
 
4413
ToLower(char *s, char *t)
 
4414
{
 
4415
 int i;
 
4416
 
 
4417
 for(i = 0; s != NULL && s[i] != '\0'; i++)
 
4418
   t[i] = s[i] + ((s[i] >= 'A' && s[i] <= 'Z') ? ('a' - 'A') : 0);
 
4419
 t[i] = '\0';
 
4420
 
 
4421
 return t;
 
4422
}
4380
4423
 
4381
4424
/*
4382
4425
 * pine_write_body_header - another c-client clone.  This time
4399
4442
 
4400
4443
    if((so = so_get(CharStar, NULL, WRITE_ACCESS)) != NULL){
4401
4444
        if(!(so_puts(so, "Content-Type: ")
4402
 
             && so_puts(so, body_types[body->type])
 
4445
             && so_puts(so, ToLower(body_types[body->type], tmp))
4403
4446
             && so_puts(so, "/")
4404
 
             && so_puts(so, body->subtype
4405
 
                              ? body->subtype
4406
 
                              : rfc822_default_subtype (body->type))))
 
4447
             && so_puts(so, ToLower(body->subtype
 
4448
                                ? body->subtype
 
4449
                                : rfc822_default_subtype (body->type),tmp))))
4407
4450
          return(pwbh_finish(0, so));
4408
4451
            
4409
4452
        if(body->parameter){