merge fixes to sofia-sip including double free causing segfault or assert in sres

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4201 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2007-02-12 16:01:22 +00:00
parent 4099d4c351
commit 215b751d92
9 changed files with 126 additions and 131 deletions

View File

@ -31,40 +31,22 @@ TESTS = test_auth_digest
BUILT_SOURCES = auth_tag_ref.c 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 = \ nobase_include_sofia_HEADERS = \
sofia-sip/auth_common.h \ sofia-sip/auth_common.h \
sofia-sip/auth_client.h sofia-sip/auth_digest.h \ sofia-sip/auth_client.h sofia-sip/auth_digest.h \
sofia-sip/auth_module.h sofia-sip/auth_plugin.h \ sofia-sip/auth_module.h sofia-sip/auth_plugin.h \
sofia-sip/auth_client_plugin.h \ sofia-sip/auth_client_plugin.h
$(NTLM_HEADER)
libiptsec_la_SOURCES = iptsec_debug.h \ libiptsec_la_SOURCES = iptsec_debug.h \
auth_client.c auth_common.c auth_digest.c \ auth_client.c auth_common.c auth_digest.c \
auth_module.c auth_tag.c auth_tag_ref.c \ auth_module.c auth_tag.c auth_tag_ref.c \
auth_plugin.c auth_plugin_delayed.c \ auth_plugin.c auth_plugin_delayed.c \
auth_module_sip.c \ auth_module_sip.c \
$(NTLM_SOURCE) \
$(USE_HTTP_SOURCE) \
iptsec_debug.c 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) COVERAGE_INPUT = $(libiptsec_la_SOURCES) $(include_sofia_HEADERS)
LDADD = libiptsec.la \ LDADD = libiptsec.la \
$(OPT_LDADD) \
../nta/libnta.la \ ../nta/libnta.la \
../sip/libsip.la \ ../sip/libsip.la \
../msg/libmsg.la \ ../msg/libmsg.la \
@ -75,11 +57,28 @@ LDADD = libiptsec.la \
test_auth_digest_LDFLAGS = -static 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 # Install and distribution rules
EXTRA_DIST = Doxyfile iptsec.docs testpasswd \ EXTRA_DIST = Doxyfile iptsec.docs testpasswd $(BUILT_SOURCES)
auth_module_sip.c $(HTTP_SRC) $(BUILT_SOURCES)
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
# Sofia specific rules # Sofia specific rules

View File

@ -79,12 +79,17 @@ build_triplet = @build@
host_triplet = @host@ host_triplet = @host@
target_triplet = @target@ target_triplet = @target@
check_PROGRAMS = test_auth_digest$(EXEEXT) check_PROGRAMS = test_auth_digest$(EXEEXT)
DIST_COMMON = $(nobase_include_sofia_HEADERS) $(srcdir)/Makefile.am \ @HAVE_NTLM_TRUE@am__append_1 = $(NTLM_HEADER)
$(srcdir)/Makefile.in $(top_srcdir)/rules/sofia.am \ @HAVE_NTLM_TRUE@am__append_2 = $(NTLM_SOURCE)
$(top_srcdir)/rules/valcheck.am ChangeLog @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 # Use with --enable-ndebug
@NDEBUG_TRUE@am__append_1 = -DNDEBUG @NDEBUG_TRUE@am__append_5 = -DNDEBUG
subdir = libsofia-sip-ua/iptsec subdir = libsofia-sip-ua/iptsec
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/sac-general.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 \ am__libiptsec_la_SOURCES_DIST = iptsec_debug.h auth_client.c \
auth_common.c auth_digest.c auth_module.c auth_tag.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_tag_ref.c auth_plugin.c auth_plugin_delayed.c \
auth_module_sip.c auth_ntlm.c auth_client_ntlm.c \ auth_module_sip.c iptsec_debug.c auth_ntlm.c \
auth_plugin_ntlm.c iptsec_debug.c auth_client_ntlm.c auth_plugin_ntlm.c auth_module_http.c
@HAVE_NTLM_TRUE@am__objects_1 = auth_ntlm.lo auth_client_ntlm.lo \ am__objects_1 = auth_ntlm.lo auth_client_ntlm.lo auth_plugin_ntlm.lo
@HAVE_NTLM_TRUE@ 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 \ 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_module.lo auth_tag.lo auth_tag_ref.lo auth_plugin.lo \
auth_plugin_delayed.lo auth_module_sip.lo $(am__objects_1) \ auth_plugin_delayed.lo auth_module_sip.lo iptsec_debug.lo \
iptsec_debug.lo $(am__objects_2) $(am__objects_4)
libiptsec_la_OBJECTS = $(am_libiptsec_la_OBJECTS) libiptsec_la_OBJECTS = $(am_libiptsec_la_OBJECTS)
test_auth_digest_SOURCES = test_auth_digest.c test_auth_digest_SOURCES = test_auth_digest.c
test_auth_digest_OBJECTS = test_auth_digest.$(OBJEXT) test_auth_digest_OBJECTS = test_auth_digest.$(OBJEXT)
test_auth_digest_LDADD = $(LDADD) test_auth_digest_LDADD = $(LDADD)
@HAVE_NTH_TRUE@am__DEPENDENCIES_1 = ../http/libhttp.la
test_auth_digest_DEPENDENCIES = libiptsec.la ../nta/libnta.la \ test_auth_digest_DEPENDENCIES = libiptsec.la ../nta/libnta.la \
../sip/libsip.la ../msg/libmsg.la ../url/liburl.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 DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -I$(top_builddir)/libsofia-sip-ua/su/sofia-sip
depcomp = $(SHELL) $(top_srcdir)/depcomp depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles am__depfiles_maybe = depfiles
@ -132,6 +141,10 @@ SOURCES = $(libiptsec_la_SOURCES) $(EXTRA_libiptsec_la_SOURCES) \
test_auth_digest.c test_auth_digest.c
DIST_SOURCES = $(am__libiptsec_la_SOURCES_DIST) \ DIST_SOURCES = $(am__libiptsec_la_SOURCES_DIST) \
$(EXTRA_libiptsec_la_SOURCES) test_auth_digest.c $(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_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \ am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@ -314,50 +327,31 @@ TESTS = test_auth_digest
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
# Rules for building the targets # Rules for building the targets
BUILT_SOURCES = auth_tag_ref.c BUILT_SOURCES = auth_tag_ref.c
HTTP_SRC = auth_module_http.c nobase_include_sofia_HEADERS = sofia-sip/auth_common.h \
@HAVE_NTH_TRUE@USE_HTTP_SRC = $(HTTP_SRC) sofia-sip/auth_client.h sofia-sip/auth_digest.h \
@HAVE_NTH_TRUE@OPT_LDDD = ../http/libhttp.la sofia-sip/auth_module.h sofia-sip/auth_plugin.h \
nobase_include_sofia_HEADERS = \ sofia-sip/auth_client_plugin.h $(am__append_1)
sofia-sip/auth_common.h \ libiptsec_la_SOURCES = iptsec_debug.h auth_client.c auth_common.c \
sofia-sip/auth_client.h sofia-sip/auth_digest.h \ auth_digest.c auth_module.c auth_tag.c auth_tag_ref.c \
sofia-sip/auth_module.h sofia-sip/auth_plugin.h \ auth_plugin.c auth_plugin_delayed.c auth_module_sip.c \
sofia-sip/auth_client_plugin.h \ iptsec_debug.c $(am__append_2) $(am__append_3)
$(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
NTLM_HEADER = sofia-sip/auth_ntlm.h
@HAVE_NTLM_TRUE@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
COVERAGE_INPUT = $(libiptsec_la_SOURCES) $(include_sofia_HEADERS) COVERAGE_INPUT = $(libiptsec_la_SOURCES) $(include_sofia_HEADERS)
LDADD = libiptsec.la \ LDADD = libiptsec.la ../nta/libnta.la ../sip/libsip.la \
$(OPT_LDADD) \ ../msg/libmsg.la ../url/liburl.la ../bnf/libbnf.la \
../nta/libnta.la \ ../ipt/libipt.la ../su/libsu.la $(am__append_4)
../sip/libsip.la \
../msg/libmsg.la \
../url/liburl.la \
../bnf/libbnf.la \
../ipt/libipt.la \
../su/libsu.la
test_auth_digest_LDFLAGS = -static test_auth_digest_LDFLAGS = -static
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 # Install and distribution rules
EXTRA_DIST = Doxyfile iptsec.docs testpasswd \ EXTRA_DIST = Doxyfile iptsec.docs testpasswd $(BUILT_SOURCES)
auth_module_sip.c $(HTTP_SRC) $(BUILT_SOURCES)
AM_CFLAGS = $(CWFLAG) $(SOFIA_COVERAGE) $(SOFIA_CFLAGS) \ AM_CFLAGS = $(CWFLAG) $(SOFIA_COVERAGE) $(SOFIA_CFLAGS) \
$(am__append_1) $(am__append_5)
DISTCLEANFILES = $(BUILT_SOURCES) DISTCLEANFILES = $(BUILT_SOURCES)
# rules for building tag files # 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_common.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/auth_digest.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.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_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_ntlm.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/auth_plugin.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/auth_plugin.Plo@am__quote@

View 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; status = rel->rel_callback(rel->rel_magic, rel, pr_irq, sip); rel = NULL;
irq->irq_in_callback = pr_irq->irq_in_callback = 0; irq->irq_in_callback = pr_irq->irq_in_callback = 0;
if (pr_irq->irq_destroyed && pr_irq->irq_terminated) { if (pr_irq->irq_completed) { /* Already sent final response */
incoming_free(pr_irq); if (pr_irq->irq_terminated && pr_irq->irq_destroyed)
incoming_free(pr_irq);
} }
else if (status != 0) { else if (status != 0) {
if (status < 200 || status > 299) { 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_prev = NULL, tagged->orq_next = NULL, tagged->orq_queue = NULL;
tagged->orq_rprev = NULL, tagged->orq_rnext = NULL; tagged->orq_rprev = NULL, tagged->orq_rnext = NULL;
#if HAVE_SOFIA_SRESOLV
tagged->orq_resolver = NULL;
#endif
if (tagged->orq_cc) if (tagged->orq_cc)
nta_compartment_ref(tagged->orq_cc); nta_compartment_ref(tagged->orq_cc);

View File

@ -2465,7 +2465,7 @@ int nua_prack_server_report(nua_server_request_t *sr, tagi_t const *tags)
break; break;
if (sri) { if (sri) {
SR_STATUS1(sr, SIP_180_RINGING); SR_STATUS1(sri, SIP_180_RINGING);
nua_server_respond(sri, NULL); nua_server_respond(sri, NULL);
nua_server_report(sri); nua_server_report(sri);
} }

View File

@ -284,10 +284,11 @@ su_port_t *su_osx_runloop_create(void)
CFRunLoopObserverCreate(NULL, CFRunLoopObserverCreate(NULL,
kCFRunLoopAfterWaiting | kCFRunLoopBeforeWaiting, kCFRunLoopAfterWaiting | kCFRunLoopBeforeWaiting,
TRUE, 0, cf_observer_cb, self->sup_observer_cntx); TRUE, 0, cf_observer_cb, self->sup_observer_cntx);
#if 0
CFRunLoopAddObserver(CFRunLoopGetCurrent(), CFRunLoopAddObserver(CFRunLoopGetCurrent(),
self->sup_observer, self->sup_observer,
kCFRunLoopDefaultMode); kCFRunLoopDefaultMode);
#endif
} }
else else
return su_home_unref(su_port_home(self)), NULL; 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; CFAbsoluteTime start;
int ret, timeout = tout > INT32_MAX ? INT32_MAX : tout; int ret, timeout = tout > INT32_MAX ? INT32_MAX : tout;
// XXX - mela assert(SU_OSX_PORT_OWN_THREAD(self));
rl = CFRunLoopGetCurrent(); rl = CFRunLoopGetCurrent();
if (!rl) 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) if (self->sup_base->sup_head)
tout = 0; tout = 0;
start = CFAbsoluteTimeGetCurrent(); ret = CFRunLoopRunInMode(kCFRunLoopDefaultMode,
for (;;) { tout/1000000.0,
/* Run loop with only one pass, indicate if a source was processed */ true);
ret = CFRunLoopRunInMode(kCFRunLoopDefaultMode,
0,
TRUE);
/* Ok, one of our sources was fired */ CFRunLoopWakeUp(rl);
if (self->sup_source_fired == 1) {
self->sup_source_fired = 0;
break;
}
#if 0
/* Check how long to run this loop */
if (CFAbsoluteTimeGetCurrent() >= start + timeout / 10000)
#else
break;
#endif
}
if (self->sup_base->sup_head) if (self->sup_base->sup_head)
su_base_port_getmsgs(self); su_base_port_getmsgs(self);

View File

@ -34,29 +34,32 @@
#ifndef URL_H_TYPES #ifndef URL_H_TYPES
#define 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 { enum url_type_e {
url_invalid = -2, /**< Invalid url. */ url_invalid = -2, /**< Invalid url. */
url_unknown = -1, /**< Unknown scheme. */ url_unknown = -1, /**< Unknown scheme. */
url_any = 0, /**< @c "*" */ url_any = 0, /**< "*" */
url_sip, /**< @c "sip:" */ url_sip, /**< "sip:". @sa @RFC3261 */
url_sips, /**< @c "sips:" */ url_sips, /**< "sips:". @sa @RFC3261 */
url_tel, /**< @c "tel:" */ url_tel, /**< "tel:" @sa RFC3966 */
url_fax, /**< @c "fax:" */ url_fax, /**< "fax:". @note Obsolete. @sa @RFC2806 */
url_modem, /**< @c "modem:" */ url_modem, /**< "modem:". @note Obsolete. @sa @RFC2806 */
url_http, /**< @c "http:" */ url_http, /**< "http:". @sa @RFC2616, @RFC3986 */
url_https, /**< @c "https:" */ url_https, /**< "https:". @sa @RFC2618, @RFC3986 */
url_ftp, /**< @c "ftp:" */ url_ftp, /**< "ftp:". @sa @RFC1738 */
url_file, /**< @c "file:" */ url_file, /**< "file:" @sa @RFC1738 */
url_rtsp, /**< @c "rtsp:" */ url_rtsp, /**< "rtsp:" @sa @RFC2326 */
url_rtspu, /**< @c "rtspu:" */ url_rtspu, /**< "rtspu:" @sa @RFC2326 */
url_mailto, /**< @c "mailto:" */ url_mailto, /**< "mailto:" @sa @RFC2368 */
url_im, /**< @c "im:" (simple instant messaging) */ url_im, /**< "im:" (simple instant messaging). @sa @RFC3860 */
url_pres, /**< @c "pres:" (simple presence) */ url_pres, /**< "pres:" (simple presence). @sa @RFC3859 */
url_cid, /**< @c "cid:" (Content-ID) */ url_cid, /**< "cid:" (Content-ID). @sa @RFC2392 */
url_msrp, /**< @c "msrp:" (message session relay) */ url_msrp, /**< "msrp:" (message session relay) */
url_msrps, /**< @c "msrps:" (new in @VERSION_1_12_2) */ url_msrps, /**< "msrps:" (new in @VERSION_1_12_2) */
url_wv, /**< @c "wv:" (Wireless village) */ url_wv, /**< "wv:" (Wireless village) */
_url_none _url_none
}; };

View File

@ -639,7 +639,7 @@ int test_modem(void)
int test_file(void) int test_file(void)
{ {
/* Test a url with path like file:/foo/bar */ /* 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) }; url_t file[1] = { URL_INIT_AS(file) };
su_home_t home[1] = { SU_HOME_INIT(home) }; su_home_t home[1] = { SU_HOME_INIT(home) };
char *tst; char *tst;
@ -653,7 +653,9 @@ int test_file(void)
TEST_1(tst = su_strdup(home, fileurl)); TEST_1(tst = su_strdup(home, fileurl));
TEST(url_d(url, tst), 0); TEST(url_d(url, tst), 0);
TEST_S(url->url_host, "");
file->url_root = '/'; file->url_root = '/';
file->url_host = "";
file->url_path = "foo/bar"; file->url_path = "foo/bar";
TEST(url_cmp(file, url), 0); TEST(url_cmp(file, url), 0);
TEST(url->url_type, url_file); TEST(url->url_type, url_file);

View File

@ -669,10 +669,18 @@ int _url_d(url_t *url, char *s)
else { else {
n = strcspn(host, ":"); 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] == ':') { if (host[n] == ':') {
char *port = host + n + 1; char *port = host + n + 1;
url->url_port = port; url->url_port = port;

View File

@ -12,15 +12,15 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires: pkgconfig BuildRequires: pkgconfig
%{!?bcond_with:%define bcond_with() %{expand:%%{?_with_%{1}:%%global with_%{1} 1}}} %define opt_with() %{expand:%%global with_%{1} %%{?_with_%{1}:1}%%{?!_with_%{1}:0}}
%{!?bcond_without:%define bcond_without() %{expand:%%{!?_without_%{1}:%%global with_%{1} 1}}} %define opt_without() %{expand:%%global with_%{1} %%{!?_without_%{1}:1}%%{?_without_%{1}:0}}
# Options: # Options:
%bcond_with doxygen - Generate documents using doxygen and dot %opt_with doxygen - Generate documents using doxygen and dot
%bcond_with check - Run tests %opt_with check - Run tests
%bcond_with openssl - Always use OpenSSL (TLS) %opt_with openssl - Always use OpenSSL (TLS)
%bcond_with glib - Always use glib-2.0 (>= 2.2) %opt_with glib - Always use glib-2.0 (>= 2.2)
%bcond_with sctp - Include SCTP transport %opt_with sctp - Include SCTP transport
%define have_doxygen %{?_with_doxygen:1}%{!?_with_doxygen:0} %define have_doxygen %{?_with_doxygen:1}%{!?_with_doxygen:0}
%define have_openssl %(%{?!_with_openssl:pkg-config 'openssl >= 0.9.7'&&}echo 1||echo 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} %if !%{have_glib}
options="$options --without-glib" options="$options --without-glib"
%endif %endif
%if %{with sctp} %if %{with_sctp}
options="$options --enable-sctp" options="$options --enable-sctp"
%endif %endif
@ -62,7 +62,7 @@ make doxygen
# XXX comment next line to build with non-check aware rpmbuild. # XXX comment next line to build with non-check aware rpmbuild.
%check %check
%if %{with check} %if %{with_check}
make check make check
%endif %endif
@ -126,7 +126,7 @@ Requires: pkgconfig
Development package for Sofia SIP UA library. This package includes Development package for Sofia SIP UA library. This package includes
static libraries and include files. static libraries and include files.
%if %{without doxygen} %if !%{with_doxygen}
The reference documentation for Sofia SIP UA library is available at The reference documentation for Sofia SIP UA library is available at
<http://sofia-sip.sourceforge.net/development.html> <http://sofia-sip.sourceforge.net/development.html>
%endif %endif