Advertisement
Guest User

patch-siproxd_orange-0.2.1

a guest
Feb 13th, 2015
1,288
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 9.72 KB | None | 0 0
  1. diff -ru siproxd_orange-0.2/configure siproxd_orange-0.2.1/configure
  2. --- siproxd_orange-0.2/configure    2014-11-15 12:13:10.000000000 +0100
  3. +++ siproxd_orange-0.2.1/configure  2015-01-07 20:40:45.000000000 +0100
  4. @@ -1,6 +1,6 @@
  5.  #! /bin/sh
  6.  # Guess values for system-dependent variables and create Makefiles.
  7. -# Generated by GNU Autoconf 2.69 for siproxd_orange 0.2.
  8. +# Generated by GNU Autoconf 2.69 for siproxd_orange 0.2.1.
  9.  #
  10.  # Report bugs to <http://code.x0r.fr/siproxd_orange/issues>.
  11.  #
  12. @@ -590,8 +590,8 @@
  13.  # Identity of this package.
  14.  PACKAGE_NAME='siproxd_orange'
  15.  PACKAGE_TARNAME='siproxd_orange'
  16. -PACKAGE_VERSION='0.2'
  17. -PACKAGE_STRING='siproxd_orange 0.2'
  18. +PACKAGE_VERSION='0.2.1'
  19. +PACKAGE_STRING='siproxd_orange 0.2.1'
  20.  PACKAGE_BUGREPORT='http://code.x0r.fr/siproxd_orange/issues'
  21.  PACKAGE_URL='http://code.x0r.fr/siproxd_orange'
  22.  
  23. @@ -1335,7 +1335,7 @@
  24.    # Omit some internal or obsolete options to make the list less imposing.
  25.    # This message is too long to be a string in the A/UX 3.1 sh.
  26.    cat <<_ACEOF
  27. -\`configure' configures siproxd_orange 0.2 to adapt to many kinds of systems.
  28. +\`configure' configures siproxd_orange 0.2.1 to adapt to many kinds of systems.
  29.  
  30.  Usage: $0 [OPTION]... [VAR=VALUE]...
  31.  
  32. @@ -1405,7 +1405,7 @@
  33.  
  34.  if test -n "$ac_init_help"; then
  35.    case $ac_init_help in
  36. -     short | recursive ) echo "Configuration of siproxd_orange 0.2:";;
  37. +     short | recursive ) echo "Configuration of siproxd_orange 0.2.1:";;
  38.     esac
  39.    cat <<\_ACEOF
  40.  
  41. @@ -1526,7 +1526,7 @@
  42.  test -n "$ac_init_help" && exit $ac_status
  43.  if $ac_init_version; then
  44.    cat <<\_ACEOF
  45. -siproxd_orange configure 0.2
  46. +siproxd_orange configure 0.2.1
  47.  generated by GNU Autoconf 2.69
  48.  
  49.  Copyright (C) 2012 Free Software Foundation, Inc.
  50. @@ -2124,7 +2124,7 @@
  51.  This file contains any messages produced by compilers while
  52.  running configure, to aid debugging if configure makes a mistake.
  53.  
  54. -It was created by siproxd_orange $as_me 0.2, which was
  55. +It was created by siproxd_orange $as_me 0.2.1, which was
  56.  generated by GNU Autoconf 2.69.  Invocation command line was
  57.  
  58.    $ $0 $@
  59. @@ -2989,7 +2989,7 @@
  60.  
  61.  # Define the identity of the package.
  62.   PACKAGE='siproxd_orange'
  63. - VERSION='0.2'
  64. + VERSION='0.2.1'
  65.  
  66.  
  67.  cat >>confdefs.h <<_ACEOF
  68. @@ -18020,7 +18020,7 @@
  69.  # report actual input values of CONFIG_FILES etc. instead of their
  70.  # values after options handling.
  71.  ac_log="
  72. -This file was extended by siproxd_orange $as_me 0.2, which was
  73. +This file was extended by siproxd_orange $as_me 0.2.1, which was
  74.  generated by GNU Autoconf 2.69.  Invocation command line was
  75.  
  76.    CONFIG_FILES    = $CONFIG_FILES
  77. @@ -18087,7 +18087,7 @@
  78.  cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
  79.  ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
  80.  ac_cs_version="\\
  81. -siproxd_orange config.status 0.2
  82. +siproxd_orange config.status 0.2.1
  83.  configured by $0, generated by GNU Autoconf 2.69,
  84.    with options \\"\$ac_cs_config\\"
  85.  
  86. diff -ru siproxd_orange-0.2/configure.ac siproxd_orange-0.2.1/configure.ac
  87. --- siproxd_orange-0.2/configure.ac 2014-11-15 12:10:41.000000000 +0100
  88. +++ siproxd_orange-0.2.1/configure.ac   2015-01-07 20:39:43.000000000 +0100
  89. @@ -1,4 +1,4 @@
  90. -AC_INIT([siproxd_orange], [0.2], [http://code.x0r.fr/siproxd_orange/issues], [siproxd_orange], [http://code.x0r.fr/siproxd_orange])
  91. +AC_INIT([siproxd_orange], [0.2.1], [http://code.x0r.fr/siproxd_orange/issues], [siproxd_orange], [http://code.x0r.fr/siproxd_orange])
  92.  AC_CONFIG_AUX_DIR([build-aux])
  93.  AC_CONFIG_HEADERS([src/config.h])
  94.  AM_INIT_AUTOMAKE([foreign -Wall -Werror dist-bzip2 subdir-objects])
  95. diff -ru siproxd_orange-0.2/src/auth.c siproxd_orange-0.2.1/src/auth.c
  96. --- siproxd_orange-0.2/src/auth.c   2014-11-15 11:47:23.000000000 +0100
  97. +++ siproxd_orange-0.2.1/src/auth.c 2015-01-07 17:29:03.000000000 +0100
  98. @@ -394,6 +394,7 @@
  99.        struct sip_params** p_s2r)
  100.  {
  101.     char* postdata;
  102. +   char curl_errbuf[CURL_ERROR_SIZE] = "";
  103.     size_t content_length;
  104.  
  105.     int ret, result = 0;
  106. @@ -401,9 +402,9 @@
  107.     struct safe_string response;
  108.     struct sip_params* s2r;
  109.  
  110. -   const char fake_os_name[] = "Windows";
  111. -   const char fake_os_ver[]  = "XP";
  112. -   const char fake_ua_ver[]  = "2.5.8";
  113. +   const char fake_os_name[] = "Android";
  114. +   const char fake_os_ver[]  = "5.0";
  115. +   const char fake_ua_ver[]  = "2.6.0";
  116.     const char fake_lang[]    = "fr";
  117.     const char fake_mode[]    = "Nominal";
  118.  
  119. @@ -453,9 +454,11 @@
  120.     curl_easy_setopt(curl, CURLOPT_USERAGENT, "");
  121.     curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, auth_step1_write_callback);
  122.     curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response);
  123. +   curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1);
  124. +   curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, curl_errbuf);
  125.  
  126.     if ((ret = curl_easy_perform(curl))) {
  127. -      fprintf(stderr, "auth_step2: %s\n", curl_easy_strerror(ret));
  128. +      fprintf(stderr, "auth_step2: %s\n", curl_errbuf);
  129.        result = 1;
  130.        goto err_2;
  131.     }
  132. diff -ru siproxd_orange-0.2/src/plugin_orange.c siproxd_orange-0.2.1/src/plugin_orange.c
  133. --- siproxd_orange-0.2/src/plugin_orange.c  2014-11-15 11:53:07.000000000 +0100
  134. +++ siproxd_orange-0.2.1/src/plugin_orange.c    2015-01-07 20:39:43.000000000 +0100
  135. @@ -23,6 +23,7 @@
  136.  
  137.  #include "config.h"
  138.  
  139. +#include <assert.h>
  140.  #include <string.h>
  141.  
  142.  #include <sys/types.h>
  143. @@ -54,6 +55,7 @@
  144.  static struct plugin_config {
  145.     char *username;
  146.     char *password;
  147. +   int   force_max_expiry_time;
  148.  } plugin_cfg;
  149.  
  150.  /* SIP parameters storage */
  151. @@ -61,8 +63,12 @@
  152.  
  153.  /* Instructions for config parser */
  154.  static cfgopts_t plugin_cfg_opts[] = {
  155. -   { "plugin_orange_username",      TYP_STRING, &plugin_cfg.username,         {0, NULL} },
  156. -   { "plugin_orange_password",      TYP_STRING, &plugin_cfg.password,         {0, NULL} },
  157. +   { "plugin_orange_username",
  158. +      TYP_STRING, &plugin_cfg.username,            {0, NULL} },
  159. +   { "plugin_orange_password",
  160. +      TYP_STRING, &plugin_cfg.password,            {0, NULL} },
  161. +   { "plugin_orange_force_max_expiry_time",
  162. +      TYP_INT4, &plugin_cfg.force_max_expiry_time, {0, NULL} },
  163.     {0, 0, 0}
  164.  };
  165.  
  166. @@ -117,7 +123,10 @@
  167.        return STS_FAILURE;
  168.     }
  169.  
  170. -
  171. +   if (plugin_cfg.force_max_expiry_time > 3600) {
  172. +      WARN("capping plugin_orange_force_max_expiry_time at 3600 seconds");
  173. +      plugin_cfg.force_max_expiry_time = 3600;
  174. +   }
  175.  
  176.     /* connect to Orange auth server */
  177.     INFO("logging in");
  178. @@ -481,17 +490,19 @@
  179.     osip_uri_t *c_uri;
  180.     osip_generic_param_t *p;
  181.     char *str;
  182. -   int i, j;
  183. +   int num_contacts, i, j;
  184.  
  185.     /* sanitize value */
  186.     value = (value > 3600) ? 3600 : value;
  187.     sprintf(value_str, "%d", value);
  188.  
  189. +
  190.     /* iterate over each Contact header in message */
  191. -   for (i = 0; ; i++) {
  192. +   num_contacts = osip_list_size(&ticket->sipmsg->contacts);
  193. +
  194. +   for (i = 0; i < num_contacts; i++) {
  195.        osip_message_get_contact(ticket->sipmsg, i, &contact);
  196. -      if (contact == NULL)
  197. -         break;
  198. +      assert(contact != NULL);
  199.        
  200.        osip_contact_init(&ct2);
  201.        osip_uri_clone(osip_contact_get_url(contact), &c_uri);
  202. @@ -508,10 +519,12 @@
  203.              osip_contact_param_add(ct2, strdup(p->gname), strdup(p->gvalue));
  204.        }
  205.  
  206. -      osip_list_remove(&ticket->sipmsg->contacts, 0);
  207.        osip_contact_to_str(ct2, &str);
  208.        osip_message_set_contact(ticket->sipmsg, str);
  209. +   }
  210.  
  211. +   for (j = 0; j < num_contacts; j++) {
  212. +      osip_list_remove(&ticket->sipmsg->contacts, 0);
  213.     }
  214.  }
  215.  
  216. @@ -539,6 +552,13 @@
  217.        int i, j;
  218.        osip_contact_t* contact;
  219.  
  220. +      /* if we are forcing a minimum expiry time, use it here too */
  221. +      if (plugin_cfg.force_max_expiry_time > 0) {
  222. +         DEBUGC(DBCLASS_PLUGIN, "forcing minimum expiry time to %d",
  223. +               plugin_cfg.force_max_expiry_time);
  224. +         min_expires = plugin_cfg.force_max_expiry_time;
  225. +      }
  226. +
  227.        /* iterate over each Contact header in message */
  228.        for (i = 0; ; i++)
  229.        {
  230. @@ -571,9 +591,22 @@
  231.           }
  232.        }
  233.  
  234. +      /* force ridiculously short expiry times to 60 seconds (some PBXes really
  235. +       * don't like such short values otherwise), but don't touch if expires=0
  236. +       * since this means a mapping is being removed */
  237. +      if (min_expires > 0 && min_expires < 60) {
  238. +         DEBUGC(DBCLASS_PLUGIN, "forcing expires=60");
  239. +         min_expires = 60;
  240. +      }
  241. +
  242.        if (min_expires == -1)
  243.           DEBUGC(DBCLASS_PLUGIN, "no Contact header with expiry info found");
  244. +      else if (min_expires == 0)
  245. +         DEBUGC(DBCLASS_PLUGIN, "found expires=0, not rewriting");
  246.        else {
  247. +         /* filter silly values */
  248. +         min_expires = (min_expires < 0) ? 3600 : min_expires;
  249. +
  250.           DEBUGC(DBCLASS_PLUGIN, "minimum expiry time is %d s", min_expires);
  251.           plugin_orange_set_contact_expiry(ticket, min_expires);
  252.        }
  253. diff -ru siproxd_orange-0.2/src/utils.c siproxd_orange-0.2.1/src/utils.c
  254. --- siproxd_orange-0.2/src/utils.c  2014-11-15 11:47:23.000000000 +0100
  255. +++ siproxd_orange-0.2.1/src/utils.c    2015-01-07 17:29:03.000000000 +0100
  256. @@ -48,7 +48,7 @@
  257.  {
  258.     uint16_t result;
  259.     result = (i & 0x00ff) << 8
  260. -          | (i & 0xff00) >> 8
  261. +          | (i & 0xff00) >> 8;
  262.     return result;
  263.  }
  264.  
  265. diff -ru siproxd_orange-0.2/src/utils.h siproxd_orange-0.2.1/src/utils.h
  266. --- siproxd_orange-0.2/src/utils.h  2014-11-15 11:47:23.000000000 +0100
  267. +++ siproxd_orange-0.2.1/src/utils.h    2015-01-07 17:29:03.000000000 +0100
  268. @@ -45,7 +45,7 @@
  269.  /* Declare replacement for htole32 and le32toh for older glibcs */
  270.  uint32_t byte_swap_32(uint32_t i);
  271.  /* Declare replacement for htole16 and le16toh for older glibcs */
  272. -uint16_t byte_swap_16(uint16_t i)
  273. +uint16_t byte_swap_16(uint16_t i);
  274.  
  275.  #ifdef WORDS_BIGENDIAN
  276.  #define htole32(x) byte_swap_32(x)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement