Changeset 35cdda2


Ignore:
Timestamp:
Feb 3, 2019, 9:00:15 PM (5 years ago)
Author:
GitHub <noreply@github.com>
Parents:
9a0d25d (diff), f0bd871 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Adam Glasgall <adam@crossproduct.net> (02/03/19 21:00:15)
git-committer:
GitHub <noreply@github.com> (02/03/19 21:00:15)
Message:
Merge f0bd8711665d2a12e30c1b1e3a5f055a410afa4f into 9a0d25d1513e92f2b0c99d89ab5fc5ae2c061151
Files:
4 added
8 edited

Legend:

Unmodified
Added
Removed
  • perl/lib/BarnOwl.pm

    reea7bed4 r6ee496b  
    99                    zephyr_getsender zephyr_getrealm zephyr_zwrite
    1010                    zephyr_stylestrip zephyr_smartstrip_user zephyr_getsubs
    11                     queue_message admin_message
     11                    queue_message get_message_by_id admin_message
    1212                    start_edit
    1313                    start_question start_password start_edit_win
  • perl/lib/BarnOwl/Message.pm

    r4fd3c04 rcc6de81  
    102102    my $s;
    103103    for my $f (keys %$this) {
    104         my $val = $this->{$f};
    105         if (ref($val) eq "ARRAY") {
    106             for my $i (0..@$val-1) {
    107                 my $aval;
    108                 $aval = $val->[$i];
    109                 $aval =~ s/\n/\n$f.$i: /g;
    110                 $s .= "$f.$i: $aval\n";
    111             }
    112         } else {
    113             $val =~ s/\n/\n$f: /g;
    114             $s .= "$f: $val\n";
    115         }
     104        my $val = $this->{$f};
     105        if (ref($val) eq "ARRAY") {
     106            for my $i (0..@$val-1) {
     107                my $aval;
     108                $aval = $val->[$i];
     109                $aval =~ s/\n/\n$f.$i: /g;
     110                $s .= "$f.$i: $aval\n";
     111            }
     112        } else {
     113            $val =~ s/\n/\n$f: /g;
     114            $s .= "$f: $val\n";
     115        }
    116116    }
    117117    return $s;
     
    304304    $BarnOwl::auth       = $m->auth      ;
    305305    if ($m->fields) {
    306         @BarnOwl::fields = @{$m->fields};
    307         @main::fields = @{$m->fields};
     306        @BarnOwl::fields = @{$m->fields};
     307        @main::fields = @{$m->fields};
    308308    } else {
    309         @BarnOwl::fields = undef;
    310         @main::fields = undef;
     309        @BarnOwl::fields = undef;
     310        @main::fields = undef;
    311311    }
    312312}
     
    331331
    3323321;
     333
     334# Local Variables:
     335# indent-tabs-mode: nil
     336# End:
  • perl/modules/Makefile.am

    r268c7e8 r20fb602  
    1 MODULES = Jabber IRC WordWrap Twitter Facebook Kerberos
     1MODULES = Jabber IRC WordWrap Twitter Facebook Kerberos Zulip
    22
    33EXTRA_DIST = $(MODULES:=/Makefile.PL) $(MODULES:=/lib)
  • perlglue.xs

    rd2ba33c r6ee496b  
    6060        OUTPUT:
    6161                RETVAL
    62 
     62       
    6363int
    6464getnumcols()
     
    156156                RETVAL
    157157
     158SV *
     159get_message_by_id(id)
     160    int id
     161    PREINIT:
     162           owl_message *m;
     163           owl_messagelist *ml;
     164    CODE:
     165    {
     166            ml = owl_global_get_msglist(&g);
     167            m = owl_messagelist_get_by_id(ml, id);
     168            if(!m) {
     169                    croak("No message with id %d!", id);
     170            }
     171            RETVAL = owl_perlconfig_message2hashref(m);
     172    }
     173OUTPUT:
     174        RETVAL
     175
     176               
    158177void
    159178admin_message(header, body)
  • configure.ac

    r4fd3c04 r9a0d25d  
    5454  [with_zephyr=check])
    5555
    56 AC_ARG_WITH([krb4],
    57   AS_HELP_STRING([--with-krb4],
    58                  [Build with kerberos IV]))
    59 
    6056AS_IF([test "x$with_zephyr" != xno],
    61   [have_krb4=no
    62 
    63    AS_IF([test "x$with_krb4" != "xno"],
    64    [AC_MSG_CHECKING([for Kerberos IV])
    65     AS_IF([krb5-config krb4 --libs >/dev/null 2>&1],
    66       [AC_MSG_RESULT([yes])
    67        have_krb4=yes
    68        AC_DEFINE([HAVE_KERBEROS_IV], [1], [Define if you have kerberos IV])
    69        AM_CFLAGS="${AM_CFLAGS} `krb5-config krb4 --cflags`"
    70        LIBS="${LIBS} `krb5-config krb4 --libs`"
    71       ],
    72       [AC_MSG_RESULT([no])
    73        AS_IF([test "x$with_krb4" = "xyes"],
    74              [AC_MSG_ERROR([Kerberos IV requested but not found])])])])
    75 
    76    AS_IF([test "x$have_krb4" != xyes],
    77      [PKG_CHECK_MODULES([LIBCRYPTO], [libcrypto],
    78         [AM_CFLAGS="${AM_CFLAGS} ${LIBCRYPTO_CFLAGS}"
    79          LIBS="${LIBS} ${LIBCRYPTO_LIBS}"
    80         ],
    81         [PKG_CHECK_MODULES([OPENSSL], [openssl],
    82            [AM_CFLAGS="${AM_CFLAGS} ${OPENSSL_CFLAGS}"
    83             LIBS="${LIBS} ${OPENSSL_LIBS}"
    84            ])])])
     57  [PKG_CHECK_MODULES([LIBCRYPTO], [libcrypto],
     58     [AM_CFLAGS="${AM_CFLAGS} ${LIBCRYPTO_CFLAGS}"
     59      LIBS="${LIBS} ${LIBCRYPTO_LIBS}"
     60     ],
     61     [PKG_CHECK_MODULES([OPENSSL], [openssl],
     62        [AM_CFLAGS="${AM_CFLAGS} ${OPENSSL_CFLAGS}"
     63         LIBS="${LIBS} ${OPENSSL_LIBS}"
     64        ])])
    8565
    8666   AC_CHECK_LIB([zephyr], [ZGetSender],
     
    10282AC_CHECK_FUNCS([use_default_colors])
    10383AC_CHECK_FUNCS([resizeterm], [], [AC_MSG_ERROR([No resizeterm found])])
    104 AC_CHECK_FUNCS([des_string_to_key DES_string_to_key], [HAVE_DES_STRING_TO_KEY=1])
    105 AC_CHECK_FUNCS([des_ecb_encrypt DES_ecb_encrypt], [HAVE_DES_ECB_ENCRYPT=1])
    106 AC_CHECK_FUNCS([des_key_sched DES_key_sched], [HAVE_DES_KEY_SCHED=1])
     84AC_CHECK_FUNCS([DES_string_to_key], [HAVE_DES_STRING_TO_KEY=1])
     85AC_CHECK_FUNCS([DES_ecb_encrypt], [HAVE_DES_ECB_ENCRYPT=1])
     86AC_CHECK_FUNCS([DES_key_sched], [HAVE_DES_KEY_SCHED=1])
    10787
    10888dnl Checks for header files.
     
    181161
    182162AM_CFLAGS="$AM_CFLAGS -D_XOPEN_SOURCE=600"
    183 dnl Define _BSD_SOURCE because zephyr needs caddr_t.
    184 AM_CFLAGS="$AM_CFLAGS -D_BSD_SOURCE"
     163dnl Define _BSD_SOURCE/_DEFAULT_SOURCE because zephyr needs caddr_t.
     164AM_CFLAGS="$AM_CFLAGS -D_BSD_SOURCE -D_DEFAULT_SOURCE"
    185165dnl Define __EXTENSIONS__ for strcasecmp on Solaris.
    186166AM_CFLAGS="$AM_CFLAGS -D__EXTENSIONS__"
  • filter.c

    r7dcef03 r9e596f5  
    1616owl_filter *owl_filter_new(const char *name, int argc, const char *const *argv)
    1717{
     18  return owl_filter_new_colored(name, argc, argv, OWL_COLOR_DEFAULT, OWL_COLOR_DEFAULT);
     19}
     20
     21owl_filter *owl_filter_new_colored(const char *name, int argc, const char *const *argv, int fgcolor, int bgcolor)
     22{
    1823  owl_filter *f;
    1924
     
    2126
    2227  f->name=g_strdup(name);
    23   f->fgcolor=OWL_COLOR_DEFAULT;
    24   f->bgcolor=OWL_COLOR_DEFAULT;
    25 
    26   /* first take arguments that have to come first */
    27   /* set the color */
    28   while ( argc>=2 && ( !strcmp(argv[0], "-c") ||
    29                        !strcmp(argv[0], "-b") ) ) {
    30     if (owl_util_string_to_color(argv[1])==OWL_COLOR_INVALID) {
    31       owl_function_error("The color '%s' is not available, using default.", argv[1]);
    32     } else {
    33       switch (argv[0][1]) {
    34       case 'c':
    35         f->fgcolor=owl_util_string_to_color(argv[1]);
    36         break;
    37       case 'b':
    38         f->bgcolor=owl_util_string_to_color(argv[1]);
    39         break;
    40       }
    41     }
    42     argc-=2;
    43     argv+=2;
    44   }
     28  f->fgcolor = fgcolor;
     29  f->bgcolor = bgcolor;
    4530
    4631  if (!(f->root = owl_filter_parse_expression(argc, argv, NULL))) {
  • functions.c

    r4fd3c04 r9e596f5  
    19801980  const owl_view *v;
    19811981  int inuse = 0;
     1982  int i = 2;
     1983  int fgcolor = OWL_COLOR_DEFAULT;
     1984  bool set_fgcolor = false;
     1985  int bgcolor = OWL_COLOR_DEFAULT;
     1986  bool set_bgcolor = false;
    19821987
    19831988  if (argc < 2) {
     
    19962001  }
    19972002
    1998   /* deal with the case of trying change the filter color */
    1999   if (argc==4 && !strcmp(argv[2], "-c")) {
     2003  /* set the color */
     2004  while (i + 2 <= argc && (!strcmp(argv[i], "-c") ||
     2005                           !strcmp(argv[i], "-b"))) {
     2006    int color = owl_util_string_to_color(argv[i + 1]);
     2007    if (color == OWL_COLOR_INVALID) {
     2008      owl_function_error("The color '%s' is not available.", argv[i + 1]);
     2009    } else if (argv[i][1] == 'c') {
     2010      fgcolor = color;
     2011      set_fgcolor = true;
     2012    } else {
     2013      bgcolor = color;
     2014      set_bgcolor = true;
     2015    }
     2016    i += 2;
     2017  }
     2018
     2019  if (i > 2 && i == argc) {
    20002020    f=owl_global_get_filter(&g, argv[1]);
    20012021    if (!f) {
     
    20032023      return false;
    20042024    }
    2005     if (owl_util_string_to_color(argv[3])==OWL_COLOR_INVALID) {
    2006       owl_function_error("The color '%s' is not available.", argv[3]);
     2025    if (!set_fgcolor && !set_bgcolor)
    20072026      return false;
    2008     }
    2009     owl_filter_set_fgcolor(f, owl_util_string_to_color(argv[3]));
    2010     owl_mainwin_redisplay(owl_global_get_mainwin(&g));
    2011     return false;
    2012   }
    2013   if (argc==4 && !strcmp(argv[2], "-b")) {
    2014     f=owl_global_get_filter(&g, argv[1]);
    2015     if (!f) {
    2016       owl_function_error("The filter '%s' does not exist.", argv[1]);
    2017       return false;
    2018     }
    2019     if (owl_util_string_to_color(argv[3])==OWL_COLOR_INVALID) {
    2020       owl_function_error("The color '%s' is not available.", argv[3]);
    2021       return false;
    2022     }
    2023     owl_filter_set_bgcolor(f, owl_util_string_to_color(argv[3]));
     2027    if (set_fgcolor)
     2028      owl_filter_set_fgcolor(f, fgcolor);
     2029    if (set_bgcolor)
     2030      owl_filter_set_bgcolor(f, bgcolor);
    20242031    owl_mainwin_redisplay(owl_global_get_mainwin(&g));
    20252032    return true;
     
    20272034
    20282035  /* create the filter and check for errors */
    2029   f = owl_filter_new(argv[1], argc-2, argv+2);
     2036  f = owl_filter_new_colored(argv[1], argc - i, argv + i, fgcolor, bgcolor);
    20302037  if (f == NULL) {
    20312038    owl_function_error("Invalid filter: %s", argv[1]);
  • zcrypt.c

    rca1fb26a r9a0d25d  
    2121#include <config.h>
    2222
    23 #ifdef HAVE_KERBEROS_IV
    24 #include <kerberosIV/des.h>
    25 #else
    2623#include <openssl/des.h>
    27 #endif
    2824
    2925#include "filterproc.h"
     
    9995};
    10096
    101 static void owl_zcrypt_string_to_schedule(char *keystring, des_key_schedule *schedule) {
    102 #ifdef HAVE_KERBEROS_IV
    103   des_cblock key;
    104 #else
    105   des_cblock _key, *key = &_key;
    106 #endif
    107 
    108   des_string_to_key(keystring, key);
    109   des_key_sched(key, *schedule);
     97static void owl_zcrypt_string_to_schedule(char *keystring, DES_key_schedule *schedule) {
     98  DES_cblock key;
     99
     100  DES_string_to_key(keystring, &key);
     101  DES_key_sched(&key, schedule);
    110102}
    111103
     
    728720int do_encrypt_des(const char *keyfile, const char *in, int length, FILE *outfile)
    729721{
    730   des_key_schedule schedule;
     722  DES_key_schedule schedule;
    731723  unsigned char input[8], output[8];
    732724  const char *inptr;
     
    774766
    775767    /* Encrypt and output the block */
    776     des_ecb_encrypt(&input, &output, schedule, TRUE);
     768    DES_ecb_encrypt(&input, &output, &schedule, TRUE);
    777769    block_to_ascii(output, outfile);
    778770
     
    790782  char *out;
    791783  int err, status;
     784  int tried_gpg1 = FALSE;
    792785  const char *argv[] = {
    793     "gpg",
     786    "gpg1",
    794787    "--symmetric",
    795788    "--no-options",
     
    805798    NULL
    806799  };
    807   err = call_filter(argv, in, &out, &status);
     800  while ((err = call_filter(argv, in, &out, &status)) && !out && !tried_gpg1) {
     801    tried_gpg1 = TRUE;
     802    argv[0] = "gpg";
     803  }
    808804  if(err || status) {
    809805    g_free(out);
     
    874870  char *in, *out;
    875871  int length;
     872  int tried_gpg1 = FALSE;
    876873  const char *argv[] = {
    877     "gpg",
     874    "gpg1",
    878875    "--decrypt",
    879876    "--no-options",
     
    892889  if(!in) return FALSE;
    893890
    894   err = call_filter(argv, in, &out, &status);
     891  while ((err = call_filter(argv, in, &out, &status)) && !out && !tried_gpg1) {
     892    tried_gpg1 = TRUE;
     893    argv[0] = "gpg";
     894  }
    895895  free(in);
    896896  if(err || status) {
     
    905905
    906906int do_decrypt_des(const char *keyfile) {
    907   des_key_schedule schedule;
     907  DES_key_schedule schedule;
    908908  unsigned char input[8], output[8];
    909909  char tmp[9];
     
    915915    have a NULL-terminated string we can call printf/strlen on.
    916916
    917     We don't pass 'tmp' to des_ecb_encrypt directly, because it's
     917    We don't pass 'tmp' to DES_ecb_encrypt directly, because it's
    918918    prototyped as taking 'unsigned char[8]', and this avoids a stupid
    919919    cast.
     
    933933  while (read_ascii_block(input))
    934934  {
    935     des_ecb_encrypt(&input, &output, schedule, FALSE);
     935    DES_ecb_encrypt(&input, &output, &schedule, FALSE);
    936936    memcpy(tmp, output, 8);
    937937    printf("%s", tmp);
Note: See TracChangeset for help on using the changeset viewer.