]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
merge fixes to sofia-sip including double free causing segfault or assert in sres
authorMichael Jerris <mike@jerris.com>
Mon, 12 Feb 2007 16:01:22 +0000 (16:01 +0000)
committerMichael Jerris <mike@jerris.com>
Mon, 12 Feb 2007 16:01:22 +0000 (16:01 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4201 d0543943-73ff-0310-b7d9-9358b9ac24b2

libs/sofia-sip/libsofia-sip-ua/iptsec/Makefile.am
libs/sofia-sip/libsofia-sip-ua/iptsec/Makefile.in
libs/sofia-sip/libsofia-sip-ua/nta/nta.c
libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c
libs/sofia-sip/libsofia-sip-ua/su/su_osx_runloop.c
libs/sofia-sip/libsofia-sip-ua/url/sofia-sip/url.h
libs/sofia-sip/libsofia-sip-ua/url/torture_url.c
libs/sofia-sip/libsofia-sip-ua/url/url.c
libs/sofia-sip/packages/sofia-sip.spec.in

index 7a9c9316e93b56433925faeaa1ec1afecea3d56b..aa3424098dea917724cf9c1025a2c0d3d9c9ce1f 100644 (file)
@@ -31,40 +31,22 @@ TESTS =             test_auth_digest
 
 BUILT_SOURCES =        auth_tag_ref.c
 
-HTTP_SRC =             auth_module_http.c
-if HAVE_NTH
-USE_HTTP_SRC =                 $(HTTP_SRC)
-OPT_LDDD =             ../http/libhttp.la
-endif
-
 nobase_include_sofia_HEADERS = \
                        sofia-sip/auth_common.h \
                        sofia-sip/auth_client.h sofia-sip/auth_digest.h \
                        sofia-sip/auth_module.h sofia-sip/auth_plugin.h \
-                       sofia-sip/auth_client_plugin.h \
-                       $(NTLM_HEADER)
+                       sofia-sip/auth_client_plugin.h
 
 libiptsec_la_SOURCES =         iptsec_debug.h \
                        auth_client.c auth_common.c auth_digest.c \
                        auth_module.c auth_tag.c auth_tag_ref.c \
                        auth_plugin.c auth_plugin_delayed.c \
                        auth_module_sip.c \
-                       $(NTLM_SOURCE) \
-                       $(USE_HTTP_SOURCE) \
                        iptsec_debug.c
 
-NTLM_HEADER =          sofia-sip/auth_ntlm.h
-if HAVE_NTLM
-NTLM_SOURCE =          auth_ntlm.c auth_client_ntlm.c auth_plugin_ntlm.c
-endif
-
-EXTRA_libiptsec_la_SOURCES = \
-                       auth_ntlm.c auth_client_ntlm.c auth_plugin_ntlm.c
-
 COVERAGE_INPUT =       $(libiptsec_la_SOURCES) $(include_sofia_HEADERS)
 
 LDADD =                libiptsec.la \
-                       $(OPT_LDADD) \
                        ../nta/libnta.la \
                        ../sip/libsip.la \
                        ../msg/libmsg.la \
@@ -75,11 +57,28 @@ LDADD =             libiptsec.la \
 
 test_auth_digest_LDFLAGS = -static
 
+if HAVE_NTLM
+nobase_include_sofia_HEADERS += $(NTLM_HEADER)
+libiptsec_la_SOURCES += $(NTLM_SOURCE)
+endif
+
+if HAVE_NTH
+libiptsec_la_SOURCES += $(HTTP_SOURCE)
+LDADD +=               ../http/libhttp.la
+endif
+
+HTTP_SOURCE =          auth_module_http.c
+
+NTLM_HEADER =          sofia-sip/auth_ntlm.h
+NTLM_SOURCE =          auth_ntlm.c auth_client_ntlm.c auth_plugin_ntlm.c
+
+EXTRA_libiptsec_la_SOURCES = \
+                       $(NTLM_HEADER) $(NTLM_SOURCE) $(HTTP_SOURCE)
+
 # ----------------------------------------------------------------------
 # Install and distribution rules
 
-EXTRA_DIST =           Doxyfile iptsec.docs testpasswd \
-                       auth_module_sip.c $(HTTP_SRC) $(BUILT_SOURCES)
+EXTRA_DIST =           Doxyfile iptsec.docs testpasswd $(BUILT_SOURCES)
 
 # ----------------------------------------------------------------------
 # Sofia specific rules
index b041f783a93c387999f8f379e09ce80c72157a18..9240d264937695a8e37c3779287f1cabf573fbc0 100644 (file)
@@ -79,12 +79,17 @@ build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
 check_PROGRAMS = test_auth_digest$(EXEEXT)
-DIST_COMMON = $(nobase_include_sofia_HEADERS) $(srcdir)/Makefile.am \
-       $(srcdir)/Makefile.in $(top_srcdir)/rules/sofia.am \
-       $(top_srcdir)/rules/valcheck.am ChangeLog
+@HAVE_NTLM_TRUE@am__append_1 = $(NTLM_HEADER)
+@HAVE_NTLM_TRUE@am__append_2 = $(NTLM_SOURCE)
+@HAVE_NTH_TRUE@am__append_3 = $(HTTP_SOURCE)
+@HAVE_NTH_TRUE@am__append_4 = ../http/libhttp.la
+DIST_COMMON = $(am__nobase_include_sofia_HEADERS_DIST) \
+       $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+       $(top_srcdir)/rules/sofia.am $(top_srcdir)/rules/valcheck.am \
+       ChangeLog
 
 # Use with --enable-ndebug
-@NDEBUG_TRUE@am__append_1 = -DNDEBUG
+@NDEBUG_TRUE@am__append_5 = -DNDEBUG
 subdir = libsofia-sip-ua/iptsec
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/sac-general.m4 \
@@ -102,21 +107,25 @@ libiptsec_la_LIBADD =
 am__libiptsec_la_SOURCES_DIST = iptsec_debug.h auth_client.c \
        auth_common.c auth_digest.c auth_module.c auth_tag.c \
        auth_tag_ref.c auth_plugin.c auth_plugin_delayed.c \
-       auth_module_sip.c auth_ntlm.c auth_client_ntlm.c \
-       auth_plugin_ntlm.c iptsec_debug.c
-@HAVE_NTLM_TRUE@am__objects_1 = auth_ntlm.lo auth_client_ntlm.lo \
-@HAVE_NTLM_TRUE@       auth_plugin_ntlm.lo
+       auth_module_sip.c iptsec_debug.c auth_ntlm.c \
+       auth_client_ntlm.c auth_plugin_ntlm.c auth_module_http.c
+am__objects_1 = auth_ntlm.lo auth_client_ntlm.lo auth_plugin_ntlm.lo
+@HAVE_NTLM_TRUE@am__objects_2 = $(am__objects_1)
+am__objects_3 = auth_module_http.lo
+@HAVE_NTH_TRUE@am__objects_4 = $(am__objects_3)
 am_libiptsec_la_OBJECTS = auth_client.lo auth_common.lo auth_digest.lo \
        auth_module.lo auth_tag.lo auth_tag_ref.lo auth_plugin.lo \
-       auth_plugin_delayed.lo auth_module_sip.lo $(am__objects_1) \
-       iptsec_debug.lo
+       auth_plugin_delayed.lo auth_module_sip.lo iptsec_debug.lo \
+       $(am__objects_2) $(am__objects_4)
 libiptsec_la_OBJECTS = $(am_libiptsec_la_OBJECTS)
 test_auth_digest_SOURCES = test_auth_digest.c
 test_auth_digest_OBJECTS = test_auth_digest.$(OBJEXT)
 test_auth_digest_LDADD = $(LDADD)
+@HAVE_NTH_TRUE@am__DEPENDENCIES_1 = ../http/libhttp.la
 test_auth_digest_DEPENDENCIES = libiptsec.la ../nta/libnta.la \
        ../sip/libsip.la ../msg/libmsg.la ../url/liburl.la \
-       ../bnf/libbnf.la ../ipt/libipt.la ../su/libsu.la
+       ../bnf/libbnf.la ../ipt/libipt.la ../su/libsu.la \
+       $(am__DEPENDENCIES_1)
 DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -I$(top_builddir)/libsofia-sip-ua/su/sofia-sip
 depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__depfiles_maybe = depfiles
@@ -132,6 +141,10 @@ SOURCES = $(libiptsec_la_SOURCES) $(EXTRA_libiptsec_la_SOURCES) \
        test_auth_digest.c
 DIST_SOURCES = $(am__libiptsec_la_SOURCES_DIST) \
        $(EXTRA_libiptsec_la_SOURCES) test_auth_digest.c
+am__nobase_include_sofia_HEADERS_DIST = sofia-sip/auth_common.h \
+       sofia-sip/auth_client.h sofia-sip/auth_digest.h \
+       sofia-sip/auth_module.h sofia-sip/auth_plugin.h \
+       sofia-sip/auth_client_plugin.h sofia-sip/auth_ntlm.h
 am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
 am__vpath_adj = case $$p in \
     $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@@ -314,50 +327,31 @@ TESTS = test_auth_digest
 # ----------------------------------------------------------------------
 # Rules for building the targets
 BUILT_SOURCES = auth_tag_ref.c
-HTTP_SRC = auth_module_http.c
-@HAVE_NTH_TRUE@USE_HTTP_SRC = $(HTTP_SRC)
-@HAVE_NTH_TRUE@OPT_LDDD = ../http/libhttp.la
-nobase_include_sofia_HEADERS = \
-                       sofia-sip/auth_common.h \
-                       sofia-sip/auth_client.h sofia-sip/auth_digest.h \
-                       sofia-sip/auth_module.h sofia-sip/auth_plugin.h \
-                       sofia-sip/auth_client_plugin.h \
-                       $(NTLM_HEADER)
-
-libiptsec_la_SOURCES = iptsec_debug.h \
-                       auth_client.c auth_common.c auth_digest.c \
-                       auth_module.c auth_tag.c auth_tag_ref.c \
-                       auth_plugin.c auth_plugin_delayed.c \
-                       auth_module_sip.c \
-                       $(NTLM_SOURCE) \
-                       $(USE_HTTP_SOURCE) \
-                       iptsec_debug.c
-
+nobase_include_sofia_HEADERS = sofia-sip/auth_common.h \
+       sofia-sip/auth_client.h sofia-sip/auth_digest.h \
+       sofia-sip/auth_module.h sofia-sip/auth_plugin.h \
+       sofia-sip/auth_client_plugin.h $(am__append_1)
+libiptsec_la_SOURCES = iptsec_debug.h auth_client.c auth_common.c \
+       auth_digest.c auth_module.c auth_tag.c auth_tag_ref.c \
+       auth_plugin.c auth_plugin_delayed.c auth_module_sip.c \
+       iptsec_debug.c $(am__append_2) $(am__append_3)
+COVERAGE_INPUT = $(libiptsec_la_SOURCES) $(include_sofia_HEADERS)
+LDADD = libiptsec.la ../nta/libnta.la ../sip/libsip.la \
+       ../msg/libmsg.la ../url/liburl.la ../bnf/libbnf.la \
+       ../ipt/libipt.la ../su/libsu.la $(am__append_4)
+test_auth_digest_LDFLAGS = -static
+HTTP_SOURCE = auth_module_http.c
 NTLM_HEADER = sofia-sip/auth_ntlm.h
-@HAVE_NTLM_TRUE@NTLM_SOURCE = auth_ntlm.c auth_client_ntlm.c auth_plugin_ntlm.c
+NTLM_SOURCE = auth_ntlm.c auth_client_ntlm.c auth_plugin_ntlm.c
 EXTRA_libiptsec_la_SOURCES = \
-                       auth_ntlm.c auth_client_ntlm.c auth_plugin_ntlm.c
+                       $(NTLM_HEADER) $(NTLM_SOURCE) $(HTTP_SOURCE)
 
-COVERAGE_INPUT = $(libiptsec_la_SOURCES) $(include_sofia_HEADERS)
-LDADD = libiptsec.la \
-                       $(OPT_LDADD) \
-                       ../nta/libnta.la \
-                       ../sip/libsip.la \
-                       ../msg/libmsg.la \
-                       ../url/liburl.la \
-                       ../bnf/libbnf.la \
-                       ../ipt/libipt.la \
-                       ../su/libsu.la
-
-test_auth_digest_LDFLAGS = -static
 
 # ----------------------------------------------------------------------
 # Install and distribution rules
-EXTRA_DIST = Doxyfile iptsec.docs testpasswd \
-                       auth_module_sip.c $(HTTP_SRC) $(BUILT_SOURCES)
-
+EXTRA_DIST = Doxyfile iptsec.docs testpasswd $(BUILT_SOURCES)
 AM_CFLAGS = $(CWFLAG) $(SOFIA_COVERAGE) $(SOFIA_CFLAGS) \
-       $(am__append_1)
+       $(am__append_5)
 DISTCLEANFILES = $(BUILT_SOURCES)
 
 # rules for building tag files
@@ -452,6 +446,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/auth_common.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/auth_digest.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/auth_module.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/auth_module_http.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/auth_module_sip.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/auth_ntlm.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/auth_plugin.Plo@am__quote@
index 6ce0f7c95ae13427f204cc285562f7661ca3758b..7eb7f5edffafe07b7872048481f2b9afab253564 100644 (file)
@@ -9651,8 +9651,9 @@ int reliable_recv(nta_incoming_t *irq, msg_t *msg, sip_t *sip, tport_t *tp)
   status = rel->rel_callback(rel->rel_magic, rel, pr_irq, sip); rel = NULL;
   irq->irq_in_callback = pr_irq->irq_in_callback = 0;
 
-  if (pr_irq->irq_destroyed && pr_irq->irq_terminated) {
-    incoming_free(pr_irq);
+  if (pr_irq->irq_completed) { /* Already sent final response */
+    if (pr_irq->irq_terminated && pr_irq->irq_destroyed)
+      incoming_free(pr_irq);
   }
   else if (status != 0) {
     if (status < 200 || status > 299) {
@@ -9915,6 +9916,9 @@ nta_outgoing_t *nta_outgoing_tagged(nta_outgoing_t *orq,
 
   tagged->orq_prev = NULL, tagged->orq_next = NULL, tagged->orq_queue = NULL;
   tagged->orq_rprev = NULL, tagged->orq_rnext = NULL;
+#if HAVE_SOFIA_SRESOLV
+  tagged->orq_resolver = NULL;
+#endif
 
   if (tagged->orq_cc)
     nta_compartment_ref(tagged->orq_cc);
index f7e862e367327b215052f7697c0b9dae79975914..9d2a5be360f151dec70a93a98cad08262cac2f47 100644 (file)
@@ -2465,7 +2465,7 @@ int nua_prack_server_report(nua_server_request_t *sr, tagi_t const *tags)
        break;
 
     if (sri) {
-      SR_STATUS1(sr, SIP_180_RINGING);
+      SR_STATUS1(sri, SIP_180_RINGING);
       nua_server_respond(sri, NULL);
       nua_server_report(sri);
     }
index 5cbbfcba713046c369b6f25a6906b432f8c408df..94c04c2d8d21d37df86d5c0a8026b9075565c88f 100644 (file)
@@ -284,10 +284,11 @@ su_port_t *su_osx_runloop_create(void)
       CFRunLoopObserverCreate(NULL, 
                              kCFRunLoopAfterWaiting | kCFRunLoopBeforeWaiting,
                              TRUE, 0, cf_observer_cb, self->sup_observer_cntx);
-    
+#if 0
     CFRunLoopAddObserver(CFRunLoopGetCurrent(),
                         self->sup_observer,
                         kCFRunLoopDefaultMode);
+#endif
   }
   else
     return su_home_unref(su_port_home(self)), NULL;
@@ -1234,8 +1235,6 @@ su_duration_t su_osx_port_step(su_port_t *self, su_duration_t tout)
   CFAbsoluteTime start;
   int ret, timeout = tout > INT32_MAX ? INT32_MAX : tout;
 
-  // XXX - mela assert(SU_OSX_PORT_OWN_THREAD(self));
-
   rl = CFRunLoopGetCurrent();
 
   if (!rl)
@@ -1259,27 +1258,12 @@ su_duration_t su_osx_port_step(su_port_t *self, su_duration_t tout)
   if (self->sup_base->sup_head)
     tout = 0;
 
-  start = CFAbsoluteTimeGetCurrent();
-  for (;;) {
-    /* Run loop with only one pass, indicate if a source was processed */
-    ret = CFRunLoopRunInMode(kCFRunLoopDefaultMode,
-                            0,
-                            TRUE);
+  ret = CFRunLoopRunInMode(kCFRunLoopDefaultMode,
+                          tout/1000000.0,
+                          true);
 
-    /* Ok, one of our sources was fired */
-    if (self->sup_source_fired == 1) {
-      self->sup_source_fired = 0;
-      break;
-    }
+  CFRunLoopWakeUp(rl);
 
-#if 0
-    /* Check how long to run this loop */
-    if (CFAbsoluteTimeGetCurrent() >= start + timeout / 10000)
-#else
-      break;
-#endif
-  }
-  
   if (self->sup_base->sup_head)
     su_base_port_getmsgs(self);
 
index cb2e30bbe7cee8c9aadcdea5d3b52d62bbdb91be..5a351f9f456b9ab25fadb8dffb6acff1b7a07554 100644 (file)
 #ifndef URL_H_TYPES
 #define URL_H_TYPES
 
-/** Recognized URL schemes (value of url_t.url_type). */
+/** Recognized URL schemes (value of url_t.url_type). 
+ *
+ * @sa &lt;<a href="http://www.iana.org/assignments/uri-schemes.html">http://www.iana.org/assignments/uri-schemes.html</a>&gt;
+ */
 enum url_type_e {
-  url_invalid = -2,            /**< Invalid url. */
-  url_unknown = -1,            /**< Unknown scheme. */
-  url_any = 0,                 /**< @c "*" */
-  url_sip,                     /**< @c "sip:" */
-  url_sips,                    /**< @c "sips:" */
-  url_tel,                     /**< @c "tel:" */
-  url_fax,                     /**< @c "fax:" */
-  url_modem,                   /**< @c "modem:" */
-  url_http,                    /**< @c "http:" */
-  url_https,                   /**< @c "https:" */
-  url_ftp,                     /**< @c "ftp:" */
-  url_file,                    /**< @c "file:" */
-  url_rtsp,                    /**< @c "rtsp:" */
-  url_rtspu,                   /**< @c "rtspu:" */
-  url_mailto,                  /**< @c "mailto:" */
-  url_im,                      /**< @c "im:" (simple instant messaging) */
-  url_pres,                    /**< @c "pres:" (simple presence) */
-  url_cid,                     /**< @c "cid:" (Content-ID) */
-  url_msrp,                    /**< @c "msrp:" (message session relay)  */
-  url_msrps,                   /**< @c "msrps:" (new in @VERSION_1_12_2) */
-  url_wv,                      /**< @c "wv:" (Wireless village) */
+  url_invalid = -2,    /**< Invalid url. */
+  url_unknown = -1,    /**< Unknown scheme. */
+  url_any = 0,         /**< "*" */
+  url_sip,             /**< "sip:". @sa @RFC3261 */
+  url_sips,            /**< "sips:". @sa @RFC3261 */
+  url_tel,             /**< "tel:" @sa RFC3966 */
+  url_fax,             /**< "fax:". @note Obsolete. @sa @RFC2806 */
+  url_modem,           /**< "modem:". @note Obsolete. @sa @RFC2806  */
+  url_http,            /**< "http:". @sa @RFC2616, @RFC3986 */
+  url_https,           /**< "https:". @sa @RFC2618, @RFC3986 */
+  url_ftp,             /**< "ftp:". @sa @RFC1738 */
+  url_file,            /**< "file:" @sa @RFC1738 */
+  url_rtsp,            /**< "rtsp:" @sa @RFC2326 */
+  url_rtspu,           /**< "rtspu:" @sa @RFC2326 */
+  url_mailto,          /**< "mailto:" @sa @RFC2368 */
+  url_im,              /**< "im:" (simple instant messaging). @sa @RFC3860 */
+  url_pres,            /**< "pres:" (simple presence). @sa @RFC3859  */
+  url_cid,             /**< "cid:" (Content-ID). @sa @RFC2392 */
+  url_msrp,            /**< "msrp:" (message session relay)  */
+  url_msrps,           /**< "msrps:" (new in @VERSION_1_12_2) */
+  url_wv,              /**< "wv:" (Wireless village) */
   _url_none
 };
 
index e6b78e9ad3c56edfd4d8d00540004ebba3d542c8..8b5aa0621502045ba27536271185242cf01cbe5f 100644 (file)
@@ -639,7 +639,7 @@ int test_modem(void)
 int test_file(void)
 {
   /* Test a url with path like file:/foo/bar  */
-  char fileurl[] = "file:/foo/bar";
+  char fileurl[] = "file:///foo/bar";
   url_t file[1] = { URL_INIT_AS(file) };
   su_home_t home[1] = { SU_HOME_INIT(home) };
   char *tst;
@@ -653,7 +653,9 @@ int test_file(void)
 
   TEST_1(tst = su_strdup(home, fileurl));
   TEST(url_d(url, tst), 0);
+  TEST_S(url->url_host, "");
   file->url_root = '/';
+  file->url_host = "";
   file->url_path = "foo/bar";
   TEST(url_cmp(file, url), 0);
   TEST(url->url_type, url_file);
index 4bad0207a03c70ca15cce5fdfc351531d2aebfda..5e94237b6a388821b344b301405b5155c065fe7f 100644 (file)
@@ -669,10 +669,18 @@ int _url_d(url_t *url, char *s)
     else {
       n = strcspn(host, ":");
     }
-    
-    if (n == 0 && url->url_type != url_unknown)
-      return -1;
 
+    /* We allow empty host by default */
+    if (n == 0) switch (url->url_type) {
+    case url_sip:
+    case url_sips:
+    case url_im:
+    case url_pres:
+      return -1;
+    default:
+      break;
+    }
+    
     if (host[n] == ':') {
       char *port = host + n + 1;
       url->url_port = port;
index 9ba9ff19a87429b9f5eb90ea2d1a757e2582b77b..01c14c023576d1e53be75b87f8ffa011de4b3e3d 100644 (file)
@@ -12,15 +12,15 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
 
 BuildRequires: pkgconfig
 
-%{!?bcond_with:%define bcond_with() %{expand:%%{?_with_%{1}:%%global with_%{1} 1}}}
-%{!?bcond_without:%define bcond_without() %{expand:%%{!?_without_%{1}:%%global with_%{1} 1}}}
+%define opt_with() %{expand:%%global with_%{1} %%{?_with_%{1}:1}%%{?!_with_%{1}:0}}
+%define opt_without() %{expand:%%global with_%{1} %%{!?_without_%{1}:1}%%{?_without_%{1}:0}}
 
 # Options: 
-%bcond_with doxygen    - Generate documents using doxygen and dot
-%bcond_with check      - Run tests
-%bcond_with openssl    - Always use OpenSSL (TLS)
-%bcond_with glib       - Always use glib-2.0 (>= 2.2)
-%bcond_with sctp       - Include SCTP transport
+%opt_with doxygen      - Generate documents using doxygen and dot
+%opt_with check                - Run tests
+%opt_with openssl      - Always use OpenSSL (TLS)
+%opt_with glib         - Always use glib-2.0 (>= 2.2)
+%opt_with sctp         - Include SCTP transport
 
 %define have_doxygen %{?_with_doxygen:1}%{!?_with_doxygen:0}
 %define have_openssl %(%{?!_with_openssl:pkg-config 'openssl >= 0.9.7'&&}echo 1||echo 0)
@@ -49,7 +49,7 @@ options="$options --with-pic --enable-shared --disable-static"
 %if !%{have_glib}
 options="$options --without-glib"
 %endif
-%if %{with sctp}
+%if %{with_sctp}
 options="$options --enable-sctp"
 %endif
 
@@ -62,7 +62,7 @@ make doxygen
 
 # XXX comment next line to build with non-check aware rpmbuild.
 %check
-%if %{with check}
+%if %{with_check}
 make check
 %endif
 
@@ -126,7 +126,7 @@ Requires:   pkgconfig
 Development package for Sofia SIP UA library. This package includes 
 static libraries and include files.
 
-%if %{without doxygen}
+%if !%{with_doxygen}
 The reference documentation for Sofia SIP UA library is available at 
 <http://sofia-sip.sourceforge.net/development.html>
 %endif