mirror of
https://github.com/strophe/libstrophe.git
synced 2026-08-05 03:16:21 +00:00
Compare commits
14 Commits
wip-fbsd-p
...
0.8.7
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2093aac817 | ||
|
|
29fa1bf27e | ||
|
|
f364ed184b | ||
|
|
40c9fe22b3 | ||
|
|
c33c0a6998 | ||
|
|
92e674e412 | ||
|
|
9f82aac8ce | ||
|
|
a3f1b83f3a | ||
|
|
b23104f920 | ||
|
|
057f9068c6 | ||
|
|
3231214344 | ||
|
|
55efc601cb | ||
|
|
dcbf3fb4d5 | ||
|
|
e2acd98612 |
8
.gitignore
vendored
8
.gitignore
vendored
@@ -22,9 +22,8 @@ autom4te.cache
|
|||||||
.sconsign*
|
.sconsign*
|
||||||
src/*.o
|
src/*.o
|
||||||
examples/*.o
|
examples/*.o
|
||||||
tests/*.o
|
|
||||||
tests/check_parser
|
|
||||||
*.a
|
*.a
|
||||||
|
*.pc
|
||||||
*.tar.gz
|
*.tar.gz
|
||||||
*.zip
|
*.zip
|
||||||
docs/html
|
docs/html
|
||||||
@@ -35,10 +34,15 @@ examples/active
|
|||||||
examples/roster
|
examples/roster
|
||||||
examples/bot
|
examples/bot
|
||||||
test_stamp
|
test_stamp
|
||||||
|
test-suite.log
|
||||||
tests/*.o
|
tests/*.o
|
||||||
|
tests/*.log
|
||||||
|
tests/*.trs
|
||||||
|
tests/check_parser
|
||||||
tests/test_base64
|
tests/test_base64
|
||||||
tests/test_ctx
|
tests/test_ctx
|
||||||
tests/test_hash
|
tests/test_hash
|
||||||
tests/test_jid
|
tests/test_jid
|
||||||
tests/test_sasl
|
tests/test_sasl
|
||||||
tests/test_sock
|
tests/test_sock
|
||||||
|
m4/
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
TBA
|
0.8.7
|
||||||
- SCRAM-SHA-1 authentication mechanism
|
- SCRAM-SHA-1 authentication mechanism
|
||||||
|
- pkg-config support
|
||||||
|
|
||||||
0.8.5
|
0.8.5
|
||||||
- libtoolize to generate .so
|
- libtoolize to generate .so
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
AUTOMAKE_OPTIONS = subdir-objects
|
AUTOMAKE_OPTIONS = subdir-objects
|
||||||
|
|
||||||
|
ACLOCAL_AMFLAGS = -I m4
|
||||||
AM_CFLAGS = -g -Wall
|
AM_CFLAGS = -g -Wall
|
||||||
|
|
||||||
PARSER_CFLAGS=@PARSER_CFLAGS@
|
PARSER_CFLAGS=@PARSER_CFLAGS@
|
||||||
@@ -35,6 +36,8 @@ endif
|
|||||||
include_HEADERS = strophe.h
|
include_HEADERS = strophe.h
|
||||||
noinst_HEADERS = strophepp.h
|
noinst_HEADERS = strophepp.h
|
||||||
|
|
||||||
|
pkgconfig_DATA = libstrophe.pc
|
||||||
|
|
||||||
EXTRA_DIST = docs
|
EXTRA_DIST = docs
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
@@ -60,3 +63,4 @@ tests_check_parser_SOURCES = tests/check_parser.c tests/test.h
|
|||||||
tests_check_parser_CFLAGS = @check_CFLAGS@ $(PARSER_CFLAGS) $(STROPHE_FLAGS) \
|
tests_check_parser_CFLAGS = @check_CFLAGS@ $(PARSER_CFLAGS) $(STROPHE_FLAGS) \
|
||||||
-I$(top_srcdir)/src
|
-I$(top_srcdir)/src
|
||||||
tests_check_parser_LDADD = @check_LIBS@ $(STROPHE_LIBS)
|
tests_check_parser_LDADD = @check_LIBS@ $(STROPHE_LIBS)
|
||||||
|
tests_check_parser_LDFLAGS = -static
|
||||||
|
|||||||
68
configure.ac
68
configure.ac
@@ -1,4 +1,5 @@
|
|||||||
AC_INIT([libstrophe], [0.8.7], [jack@metajack.im])
|
AC_INIT([libstrophe], [0.8.7], [jack@metajack.im])
|
||||||
|
AC_CONFIG_MACRO_DIR([m4])
|
||||||
AM_INIT_AUTOMAKE([foreign])
|
AM_INIT_AUTOMAKE([foreign])
|
||||||
LT_INIT([dlopen])
|
LT_INIT([dlopen])
|
||||||
|
|
||||||
@@ -11,7 +12,15 @@ AS_CASE([$host_os],
|
|||||||
[freebsd*], [PLATFORM="freebsd"],
|
[freebsd*], [PLATFORM="freebsd"],
|
||||||
[PLATFORM="nix"])
|
[PLATFORM="nix"])
|
||||||
|
|
||||||
PKG_CHECK_MODULES([openssl], [openssl], [], [AC_MSG_ERROR([openssl not found; openssl required])])
|
PKG_CHECK_MODULES([openssl], [openssl], [PC_REQUIRES+=(openssl)],
|
||||||
|
[AC_CHECK_HEADER([openssl/ssl.h],
|
||||||
|
[
|
||||||
|
openssl_LIBS="-lssl -lcrypto"
|
||||||
|
PC_LIBS+=($openssl_LIBS)
|
||||||
|
],
|
||||||
|
[AC_MSG_ERROR([openssl not found; openssl required])]
|
||||||
|
)])
|
||||||
|
|
||||||
PKG_CHECK_MODULES([check], [check >= 0.9.4], [], [AC_MSG_WARN([libcheck not found; unit tests will not be compilable])])
|
PKG_CHECK_MODULES([check], [check >= 0.9.4], [], [AC_MSG_WARN([libcheck not found; unit tests will not be compilable])])
|
||||||
|
|
||||||
AC_ARG_WITH([libxml2],
|
AC_ARG_WITH([libxml2],
|
||||||
@@ -21,18 +30,35 @@ AC_ARG_WITH([libxml2],
|
|||||||
|
|
||||||
if test "x$with_libxml2" != xno; then
|
if test "x$with_libxml2" != xno; then
|
||||||
PKG_CHECK_MODULES([libxml2], [libxml-2.0 >= 2.7],
|
PKG_CHECK_MODULES([libxml2], [libxml-2.0 >= 2.7],
|
||||||
[with_libxml2=yes], [dummy=1])
|
[
|
||||||
if test "x$with_libxml2" != xyes; then
|
with_libxml2=yes
|
||||||
old_CFLAGS=$CFLAGS
|
PC_REQUIRES+=(libxml-2.0)
|
||||||
CFLAGS="-I${includedir}/libxml2"
|
],
|
||||||
AC_CHECK_HEADER([libxml/parser.h],
|
[
|
||||||
[with_libxml2=yes; libxml2_CFLAGS="-I${includedir}/libxml2"; libxml2_LIBS="-lxml2"],
|
old_CFLAGS=$CFLAGS
|
||||||
[AC_MSG_ERROR([libxml2 not found.])])
|
CFLAGS="-I${includedir}/libxml2"
|
||||||
CFLAGS=$old_CFLAGS
|
AC_CHECK_HEADER([libxml/parser.h],
|
||||||
fi
|
[
|
||||||
|
with_libxml2=yes
|
||||||
|
libxml2_CFLAGS="-I${includedir}/libxml2"
|
||||||
|
libxml2_LIBS="-lxml2"
|
||||||
|
PC_LIBS+=($libxml2_LIBS)
|
||||||
|
PC_CFLAGS+=($libxml2_CFLAGS)
|
||||||
|
],
|
||||||
|
[AC_MSG_ERROR([libxml2 not found.])])
|
||||||
|
CFLAGS=$old_CFLAGS
|
||||||
|
])
|
||||||
else
|
else
|
||||||
PKG_CHECK_MODULES([expat], [expat >= 2.0.0], [],
|
PKG_CHECK_MODULES([expat], [expat >= 2.0.0],
|
||||||
[AC_CHECK_HEADER(expat.h, [expat_LIBS="-lexpat"], [AC_MSG_ERROR([expat not found; expat required.])])])
|
[PC_REQUIRES+=(expat)],
|
||||||
|
[AC_CHECK_HEADER([expat.h],
|
||||||
|
[
|
||||||
|
expat_LIBS="-lexpat"
|
||||||
|
PC_LIBS+=($expat_LIBS)
|
||||||
|
],
|
||||||
|
[AC_MSG_ERROR([expat not found; expat required.])]
|
||||||
|
)
|
||||||
|
])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "x$with_libxml2" = xyes; then
|
if test "x$with_libxml2" = xyes; then
|
||||||
@@ -53,16 +79,30 @@ AC_SEARCH_LIBS([socket], [socket])
|
|||||||
if test "x$PLATFORM" != xfreebsd; then
|
if test "x$PLATFORM" != xfreebsd; then
|
||||||
AC_CHECK_LIB([resolv], [res_query], [],
|
AC_CHECK_LIB([resolv], [res_query], [],
|
||||||
[AC_CHECK_LIB([resolv], [__res_query], [],
|
[AC_CHECK_LIB([resolv], [__res_query], [],
|
||||||
[AC_MSG_ERROR([libresolv not found; libresolv required. ])])])
|
[AC_MSG_ERROR([libresolv not found; libresolv required.])])])
|
||||||
|
PC_LIBS+=(-lresolv)
|
||||||
else
|
else
|
||||||
AC_MSG_NOTICE([skipping libresolv checks for freebsd])
|
AC_MSG_NOTICE([skipping libresolv checks for freebsd])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_CHECK_HEADERS([arpa/nameser_compat.h])
|
AC_CHECK_HEADERS([arpa/nameser_compat.h])
|
||||||
|
|
||||||
|
|
||||||
|
m4_ifdef([PKG_INSTALLDIR], [PKG_INSTALLDIR],
|
||||||
|
[AC_ARG_WITH([pkgconfigdir],
|
||||||
|
[AS_HELP_STRING([--with-pkgconfigdir],
|
||||||
|
[install directory for libstrophe.pc pkg-config file])],
|
||||||
|
[],[with_pkgconfigdir='$(libdir)/pkgconfig'])
|
||||||
|
AC_SUBST([pkgconfigdir], [${with_pkgconfigdir}])])
|
||||||
|
|
||||||
AM_CONDITIONAL([PARSER_EXPAT], [test x$with_parser != xlibxml2])
|
AM_CONDITIONAL([PARSER_EXPAT], [test x$with_parser != xlibxml2])
|
||||||
|
|
||||||
|
AC_SUBST([PC_REQUIRES], [${PC_REQUIRES[[@]]}])
|
||||||
|
AC_SUBST([PC_CFLAGS], [${PC_CFLAGS[[@]]}])
|
||||||
|
AC_SUBST([PC_LIBS], [${PC_LIBS[[@]]}])
|
||||||
|
|
||||||
AC_SUBST(PARSER_NAME)
|
AC_SUBST(PARSER_NAME)
|
||||||
AC_SUBST(PARSER_CFLAGS)
|
AC_SUBST(PARSER_CFLAGS)
|
||||||
AC_SUBST(PARSER_LIBS)
|
AC_SUBST(PARSER_LIBS)
|
||||||
AC_CONFIG_FILES([Makefile])
|
AC_CONFIG_FILES([Makefile libstrophe.pc])
|
||||||
AC_OUTPUT
|
AC_OUTPUT
|
||||||
|
|||||||
14
libstrophe.pc.in
Normal file
14
libstrophe.pc.in
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
prefix=@prefix@
|
||||||
|
exec_prefix=@exec_prefix@
|
||||||
|
libdir=@libdir@
|
||||||
|
includedir=@includedir@
|
||||||
|
|
||||||
|
Name: libstrophe
|
||||||
|
Description: A simple, lightweight C library for writing XMPP clients
|
||||||
|
URL: http://strophe.im/libstrophe/
|
||||||
|
Version: @VERSION@
|
||||||
|
Requires:
|
||||||
|
Requires.private: @PC_REQUIRES@
|
||||||
|
Libs: -L${libdir} -lstrophe
|
||||||
|
Libs.private: @PC_LIBS@
|
||||||
|
Cflags: -I${includedir} @PC_CFLAGS@
|
||||||
@@ -8,12 +8,24 @@ License: MIT/GPLv3
|
|||||||
URL: http://strophe.im/libstrophe/
|
URL: http://strophe.im/libstrophe/
|
||||||
Source0: libstrophe_git.tar.gz
|
Source0: libstrophe_git.tar.gz
|
||||||
|
|
||||||
|
BuildRequires: automake
|
||||||
|
BuildRequires: libtool
|
||||||
|
BuildRequires: openssl-devel
|
||||||
BuildRequires: expat-devel
|
BuildRequires: expat-devel
|
||||||
Requires: expat
|
Requires: expat
|
||||||
|
|
||||||
%description
|
%description
|
||||||
XMPP library in C
|
XMPP library in C
|
||||||
|
|
||||||
|
%package devel
|
||||||
|
Summary: Headers and libraries for building apps that use libstrophe
|
||||||
|
Group: Development/Libraries
|
||||||
|
Requires: %{name} = %{version}-%{release}
|
||||||
|
|
||||||
|
%description devel
|
||||||
|
This package contains headers and libraries required to build applications that
|
||||||
|
use the strophe XMPP library.
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -n libstrophe
|
%setup -n libstrophe
|
||||||
./bootstrap.sh
|
./bootstrap.sh
|
||||||
@@ -25,8 +37,21 @@ make %{?_smp_mflags}
|
|||||||
%install
|
%install
|
||||||
make install DESTDIR=%{buildroot}
|
make install DESTDIR=%{buildroot}
|
||||||
|
|
||||||
|
%post -p /sbin/ldconfig
|
||||||
|
|
||||||
|
%postun -p /sbin/ldconfig
|
||||||
|
|
||||||
%files
|
%files
|
||||||
|
%defattr(-,root,root,-)
|
||||||
|
%{_libdir}/libstrophe.so*
|
||||||
|
%doc
|
||||||
|
|
||||||
|
%files devel
|
||||||
|
%defattr(-,root,root,-)
|
||||||
%{_libdir}/libstrophe.a
|
%{_libdir}/libstrophe.a
|
||||||
|
%{_libdir}/libstrophe.la
|
||||||
|
%{_libdir}/pkgconfig/libstrophe.pc
|
||||||
%{_includedir}/strophe.h
|
%{_includedir}/strophe.h
|
||||||
|
%doc
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
|||||||
@@ -250,12 +250,13 @@ const char * hash_iter_next(hash_iterator_t *iter)
|
|||||||
{
|
{
|
||||||
hash_t *table = iter->table;
|
hash_t *table = iter->table;
|
||||||
hashentry_t *entry = iter->entry;
|
hashentry_t *entry = iter->entry;
|
||||||
int i = iter->index + 1;
|
int i;
|
||||||
|
|
||||||
/* advance until we find the next entry */
|
/* advance until we find the next entry */
|
||||||
if (entry != NULL) entry = entry->next;
|
if (entry != NULL) entry = entry->next;
|
||||||
if (entry == NULL) {
|
if (entry == NULL) {
|
||||||
/* we're off the end of list, search for a new entry */
|
/* we're off the end of list, search for a new entry */
|
||||||
|
i = iter->index + 1;
|
||||||
while (i < iter->table->length) {
|
while (i < iter->table->length) {
|
||||||
entry = table->entries[i];
|
entry = table->entries[i];
|
||||||
if (entry != NULL) {
|
if (entry != NULL) {
|
||||||
@@ -266,7 +267,7 @@ const char * hash_iter_next(hash_iterator_t *iter)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((entry == NULL) || (i >= table->length)) {
|
if (entry == NULL) {
|
||||||
/* no more keys! */
|
/* no more keys! */
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
29
src/sha1.c
29
src/sha1.c
@@ -90,19 +90,14 @@ A million repetitions of "a"
|
|||||||
|
|
||||||
#include "sha1.h"
|
#include "sha1.h"
|
||||||
|
|
||||||
|
static uint32_t host_to_be(uint32_t i);
|
||||||
static void SHA1_Transform(uint32_t state[5], const uint8_t buffer[64]);
|
static void SHA1_Transform(uint32_t state[5], const uint8_t buffer[64]);
|
||||||
|
|
||||||
#define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
|
#define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
|
||||||
|
|
||||||
/* blk0() and blk() perform the initial expand. */
|
/* blk0() and blk() perform the initial expand. */
|
||||||
/* I got the idea of expanding during the round function from SSLeay */
|
/* I got the idea of expanding during the round function from SSLeay */
|
||||||
/* FIXME: can we do this in an endian-proof way? */
|
#define blk0(i) (block->l[i] = host_to_be(block->l[i]))
|
||||||
#ifdef WORDS_BIGENDIAN
|
|
||||||
#define blk0(i) block->l[i]
|
|
||||||
#else
|
|
||||||
#define blk0(i) (block->l[i] = (rol(block->l[i],24)&0xFF00FF00) \
|
|
||||||
|(rol(block->l[i],8)&0x00FF00FF))
|
|
||||||
#endif
|
|
||||||
#define blk(i) (block->l[i&15] = rol(block->l[(i+13)&15]^block->l[(i+8)&15] \
|
#define blk(i) (block->l[i&15] = rol(block->l[(i+13)&15]^block->l[(i+8)&15] \
|
||||||
^block->l[(i+2)&15]^block->l[i&15],1))
|
^block->l[(i+2)&15]^block->l[i&15],1))
|
||||||
|
|
||||||
@@ -127,6 +122,26 @@ void SHAPrintContext(SHA1_CTX *context, char *msg){
|
|||||||
}
|
}
|
||||||
#endif /* VERBOSE */
|
#endif /* VERBOSE */
|
||||||
|
|
||||||
|
static uint32_t host_to_be(uint32_t i)
|
||||||
|
{
|
||||||
|
#define le_to_be(i) ((rol((i),24) & 0xFF00FF00) | (rol((i),8) & 0x00FF00FF))
|
||||||
|
#if defined(__BIG_ENDIAN__) || \
|
||||||
|
(defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && \
|
||||||
|
__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
|
||||||
|
return i;
|
||||||
|
#elif defined(__LITTLE_ENDIAN__) || \
|
||||||
|
(defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && \
|
||||||
|
__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
|
||||||
|
return le_to_be(i);
|
||||||
|
#else /* fallback to run-time check */
|
||||||
|
static const union {
|
||||||
|
uint32_t u;
|
||||||
|
unsigned char c;
|
||||||
|
} check = {1};
|
||||||
|
return check.c ? le_to_be(i) : i;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/* Hash a single 512-bit block. This is the core of the algorithm. */
|
/* Hash a single 512-bit block. This is the core of the algorithm. */
|
||||||
static void SHA1_Transform(uint32_t state[5], const uint8_t buffer[64])
|
static void SHA1_Transform(uint32_t state[5], const uint8_t buffer[64])
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user