Skip to content
This repository was archived by the owner on Oct 29, 2021. It is now read-only.

Commit 4eb3642

Browse files
committed
Merge branch 'libstrophe-0.9.2' into libstrophe-0.9.2-merge
Conflicts: Makefile.am configure.ac mesode.h rpm/README rpm/libstrophe.spec src/auth.c src/conn.c src/parser_libxml2.c src/resolver.c src/stanza.c src/thread.c src/thread.h src/tls.h src/tls_gnutls.c src/tls_openssl.c src/tls_schannel.c
2 parents b91872c + a4b05cf commit 4eb3642

33 files changed

+1358
-682
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ examples/bot
3636
examples/component
3737
examples/roster
3838
examples/uuid
39+
examples/vcard
3940
test_stamp
4041
test-suite.log
4142
tests/*.o

.travis.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@ language: c
22
install:
33
- sudo apt-get update
44
- sudo apt-get -y install libtool pkg-config libexpat1-dev libxml2-dev libssl-dev check
5-
script:
5+
before_script:
66
- ./bootstrap.sh
7-
- ./configure --without-libxml2 && make CFLAGS="-Wall -Werror" && make CFLAGS="-Wall -Werror" check-TESTS
8-
- make clean
9-
- ./configure --with-libxml2 && make CFLAGS="-Wall -Werror" && make CFLAGS="-Wall -Werror" check-TESTS
10-
- make clean
11-
- ./configure --disable-tls && make CFLAGS="-Wall -Werror" && make CFLAGS="-Wall -Werror" check-TESTS
7+
script:
8+
- ./configure ${CONFIGURE_OPT} && make && make check-TESTS
9+
env:
10+
- CONFIGURE_OPT="--without-libxml2"
11+
- CONFIGURE_OPT="--with-libxml2"
12+
- CONFIGURE_OPT="--disable-tls --without-libxml2"
13+
- CONFIGURE_OPT="--disable-tls --with-libxml2"
14+
matrix:
15+
fast_finish: true

ChangeLog

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
0.9.2
2+
- OpenSSL tls module verifies certificate by default. Set flag
3+
XMPP_CONN_FLAG_TRUST_TLS to ignore result of the verification
4+
- Certificate hostname verification is forced for openssl-1.0.2 and
5+
newer
6+
- OpenSSL tls module disables insecure SSLv2 SSLv3 and TLSv1
7+
- Support of handlers with the same callback function, but different
8+
userdata
9+
- System handlers are deleted on xmpp_conn_t reconnection. Old system
10+
handlers could cause problems
11+
- Default timeout for xmpp_run() is increased from 1 millisecond to 1
12+
second in order to reduce CPU consumption
13+
- Reduced memory usage in expat module
14+
- New functions:
15+
- xmpp_ctx_set_timeout()
16+
- xmpp_sha1_digest()
17+
118
0.9.1
219
- Fixed bug #95 (DNS lookup failing on Cygwin)
320
- Removed dependency on the check package

Makefile.am

Lines changed: 83 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ SSL_LIBS = @openssl_LIBS@
1111

1212
RESOLV_LIBS = @RESOLV_LIBS@
1313

14-
MESODE_FLAGS = -I$(top_srcdir)
14+
MESODE_FLAGS = -I$(top_srcdir) -Wall -Wextra -Wno-unused-parameter
1515
MESODE_LIBS = libmesode.la
1616

1717
## Main build targets
@@ -21,14 +21,42 @@ libmesode_la_CFLAGS = $(SSL_CFLAGS) $(MESODE_FLAGS) $(PARSER_CFLAGS)
2121
libmesode_la_LDFLAGS = $(SSL_LIBS) $(PARSER_LIBS) $(RESOLV_LIBS) -no-undefined
2222
# Export only public API
2323
libmesode_la_LDFLAGS += -export-symbols-regex '^xmpp_'
24-
libmesode_la_SOURCES = src/auth.c src/conn.c src/crypto.c src/ctx.c \
25-
src/event.c src/handler.c src/hash.c src/jid.c src/md5.c \
26-
src/resolver.c src/sasl.c src/scram.c src/sha1.c \
27-
src/snprintf.c src/sock.c src/stanza.c src/util.c \
28-
src/rand.c src/uuid.c \
29-
src/common.h src/hash.h src/md5.h src/ostypes.h src/parser.h \
30-
src/resolver.h src/sasl.h src/scram.h src/sha1.h src/snprintf.h \
31-
src/sock.h src/tls.h src/util.h src/rand.h
24+
25+
libmesode_la_SOURCES = \
26+
src/auth.c \
27+
src/conn.c \
28+
src/crypto.c \
29+
src/ctx.c \
30+
src/event.c \
31+
src/handler.c \
32+
src/hash.c \
33+
src/jid.c \
34+
src/md5.c \
35+
src/rand.c \
36+
src/resolver.c \
37+
src/sasl.c \
38+
src/scram.c \
39+
src/sha1.c \
40+
src/snprintf.c \
41+
src/sock.c \
42+
src/stanza.c \
43+
src/util.c \
44+
src/uuid.c
45+
libmesode_la_SOURCES += \
46+
src/common.h \
47+
src/hash.h \
48+
src/md5.h \
49+
src/ostypes.h \
50+
src/parser.h \
51+
src/rand.h \
52+
src/resolver.h \
53+
src/sasl.h \
54+
src/scram.h \
55+
src/sha1.h \
56+
src/snprintf.h \
57+
src/sock.h \
58+
src/tls.h \
59+
src/util.h
3260

3361
if DISABLE_TLS
3462
libmesode_la_SOURCES += src/tls_dummy.c
@@ -42,19 +70,32 @@ include_HEADERS = mesode.h
4270

4371
pkgconfig_DATA = libmesode.pc
4472

45-
EXTRA_DIST = docs rpm Doxyfile LICENSE.txt GPL-LICENSE.txt MIT-LICENSE.txt \
46-
src/tls_dummy.c src/tls_gnutls.c src/tls_schannel.c \
47-
examples/README.md
73+
EXTRA_DIST = \
74+
Doxyfile \
75+
GPL-LICENSE.txt \
76+
LICENSE.txt \
77+
MIT-LICENSE.txt \
78+
bootstrap.sh \
79+
build-android.sh \
80+
docs/footer.html \
81+
examples/README.md \
82+
jni/Android.mk \
83+
jni/Application.mk \
84+
tests/res_query_dump.c
4885

4986
## Examples
50-
noinst_PROGRAMS = examples/active examples/roster examples/basic examples/bot \
51-
examples/component examples/uuid
87+
noinst_PROGRAMS = \
88+
examples/active \
89+
examples/basic \
90+
examples/bot \
91+
examples/component \
92+
examples/roster \
93+
examples/uuid \
94+
examples/vcard
95+
5296
examples_active_SOURCES = examples/active.c
5397
examples_active_CFLAGS = $(MESODE_FLAGS)
5498
examples_active_LDADD = $(MESODE_LIBS)
55-
examples_roster_SOURCES = examples/roster.c
56-
examples_roster_CFLAGS = $(MESODE_FLAGS)
57-
examples_roster_LDADD = $(MESODE_LIBS)
5899
examples_basic_SOURCES = examples/basic.c
59100
examples_basic_CFLAGS = $(MESODE_FLAGS)
60101
examples_basic_LDADD = $(MESODE_LIBS)
@@ -64,14 +105,31 @@ examples_bot_LDADD = $(MESODE_LIBS)
64105
examples_component_SOURCES = examples/component.c
65106
examples_component_CFLAGS = $(MESODE_FLAGS)
66107
examples_component_LDADD = $(MESODE_LIBS)
108+
examples_roster_SOURCES = examples/roster.c
109+
examples_roster_CFLAGS = $(MESODE_FLAGS)
110+
examples_roster_LDADD = $(MESODE_LIBS)
67111
examples_uuid_SOURCES = examples/uuid.c
68112
examples_uuid_CFLAGS = $(MESODE_FLAGS)
69113
examples_uuid_LDADD = $(MESODE_LIBS)
114+
examples_vcard_SOURCES = examples/vcard.c
115+
examples_vcard_CFLAGS = $(MESODE_FLAGS)
116+
examples_vcard_LDADD = $(MESODE_LIBS)
70117

71118
## Tests
72-
TESTS = tests/check_parser tests/test_sha1 tests/test_md5 tests/test_rand \
73-
tests/test_scram tests/test_ctx tests/test_base64 tests/test_jid \
74-
tests/test_snprintf tests/test_string tests/test_resolver
119+
TESTS = \
120+
tests/check_parser \
121+
tests/test_sha1 \
122+
tests/test_md5 \
123+
tests/test_rand \
124+
tests/test_scram \
125+
tests/test_ctx \
126+
tests/test_base64 \
127+
tests/test_hash \
128+
tests/test_jid \
129+
tests/test_snprintf \
130+
tests/test_string \
131+
tests/test_resolver
132+
75133
check_PROGRAMS = $(TESTS)
76134

77135
tests_check_parser_SOURCES = tests/check_parser.c tests/test.h
@@ -90,6 +148,11 @@ tests_test_base64_CFLAGS = $(MESODE_FLAGS) -I$(top_srcdir)/src
90148
tests_test_base64_LDADD = $(MESODE_LIBS)
91149
tests_test_base64_LDFLAGS = -static
92150

151+
tests_test_hash_SOURCES = tests/test_hash.c
152+
tests_test_hash_CFLAGS = $(MESODE_FLAGS) -I$(top_srcdir)/src
153+
tests_test_hash_LDADD = $(MESODE_LIBS)
154+
tests_test_hash_LDFLAGS = -static
155+
93156
tests_test_jid_SOURCES = tests/test_jid.c
94157
tests_test_jid_CFLAGS = $(MESODE_FLAGS) -I$(top_srcdir)/src
95158
tests_test_jid_LDADD = $(MESODE_LIBS)

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
AC_INIT([libmesode], [0.9.1], [[email protected]])
1+
AC_INIT([libmesode], [0.9.2], [[email protected]])
22
AC_CONFIG_MACRO_DIR([m4])
33
AM_INIT_AUTOMAKE([foreign])
44
LT_INIT([dlopen])

examples/active.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,7 @@ void conn_handler(xmpp_conn_t * const conn, const xmpp_conn_event_t status,
5555
fprintf(stderr, "DEBUG: connected\n");
5656

5757
/* create iq stanza for request */
58-
iq = xmpp_stanza_new(ctx);
59-
xmpp_stanza_set_name(iq, "iq");
60-
xmpp_stanza_set_type(iq, "get");
61-
xmpp_stanza_set_id(iq, "active1");
58+
iq = xmpp_iq_new(ctx, "get", "active1");
6259
xmpp_stanza_set_to(iq, "xxxxxxxxx.com");
6360

6461
query = xmpp_stanza_new(ctx);

examples/bot.c

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,31 +73,44 @@ int version_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void
7373
int message_handler(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza, void * const userdata)
7474
{
7575
xmpp_ctx_t *ctx = (xmpp_ctx_t*)userdata;
76-
xmpp_stanza_t *reply;
76+
xmpp_stanza_t *body, *reply;
77+
const char *type;
7778
char *intext, *replytext;
79+
int quit = 0;
7880

79-
if (!xmpp_stanza_get_child_by_name(stanza, "body"))
81+
body = xmpp_stanza_get_child_by_name(stanza, "body");
82+
if (body == NULL)
8083
return 1;
81-
if (xmpp_stanza_get_type(stanza) != NULL && !strcmp(xmpp_stanza_get_type(stanza), "error"))
84+
type = xmpp_stanza_get_type(stanza);
85+
if (type != NULL && strcmp(type, "error") == 0)
8286
return 1;
8387

84-
intext = xmpp_stanza_get_text(xmpp_stanza_get_child_by_name(stanza, "body"));
88+
intext = xmpp_stanza_get_text(body);
8589

8690
printf("Incoming message from %s: %s\n", xmpp_stanza_get_from(stanza), intext);
8791

8892
reply = xmpp_stanza_reply(stanza);
8993
if (xmpp_stanza_get_type(reply) == NULL)
9094
xmpp_stanza_set_type(reply, "chat");
9195

92-
replytext = (char *) malloc(strlen(" to you too!") + strlen(intext) + 1);
93-
strcpy(replytext, intext);
94-
strcat(replytext, " to you too!");
96+
if (strcmp(intext, "quit") == 0) {
97+
replytext = strdup("bye!");
98+
quit = 1;
99+
} else {
100+
replytext = (char *) malloc(strlen(" to you too!") + strlen(intext) + 1);
101+
strcpy(replytext, intext);
102+
strcat(replytext, " to you too!");
103+
}
95104
xmpp_free(ctx, intext);
96105
xmpp_message_set_body(reply, replytext);
97106

98107
xmpp_send(conn, reply);
99108
xmpp_stanza_release(reply);
100109
free(replytext);
110+
111+
if (quit)
112+
xmpp_disconnect(conn);
113+
101114
return 1;
102115
}
103116

examples/roster.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,7 @@ void conn_handler(xmpp_conn_t * const conn, const xmpp_conn_event_t status,
6262
fprintf(stderr, "DEBUG: connected\n");
6363

6464
/* create iq stanza for request */
65-
iq = xmpp_stanza_new(ctx);
66-
xmpp_stanza_set_name(iq, "iq");
67-
xmpp_stanza_set_type(iq, "get");
68-
xmpp_stanza_set_id(iq, "roster1");
65+
iq = xmpp_iq_new(ctx, "get", "roster1");
6966

7067
query = xmpp_stanza_new(ctx);
7168
xmpp_stanza_set_name(query, "query");

0 commit comments

Comments
 (0)