Initial pass at zms authentication.

git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@1181 e3e1d417-86f3-4887-817a-d78f3d33393f
This commit is contained in:
stan 2004-12-29 18:03:13 +00:00
parent a0c4bf0b7f
commit 3805c8b9ac
19 changed files with 418 additions and 81 deletions

View File

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.7 from Makefile.am. # Makefile.in generated by automake 1.7.8 from Makefile.am.
# @configure_input@ # @configure_input@
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
# Free Software Foundation, Inc. # Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation # This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -163,10 +163,10 @@ RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \
all-recursive install-data-recursive install-exec-recursive \ all-recursive install-data-recursive install-exec-recursive \
installdirs-recursive install-recursive uninstall-recursive \ installdirs-recursive install-recursive uninstall-recursive \
check-recursive installcheck-recursive check-recursive installcheck-recursive
DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.am \ DIST_COMMON = README $(srcdir)/Makefile.in $(srcdir)/configure AUTHORS \
Makefile.in NEWS TODO aclocal.m4 config.h.in configure \ COPYING ChangeLog INSTALL Makefile.am NEWS TODO aclocal.m4 \
configure.in depcomp install-sh missing mkinstalldirs \ config.h.in configure configure.in depcomp install-sh missing \
zmconfig.pl.in mkinstalldirs zmconfig.pl.in
DIST_SUBDIRS = $(SUBDIRS) DIST_SUBDIRS = $(SUBDIRS)
all: config.h all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive $(MAKE) $(AM_MAKEFLAGS) all-recursive
@ -307,9 +307,15 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP) $(TAGS_FILES) $(LISP)
tags=; \ tags=; \
here=`pwd`; \ here=`pwd`; \
if (etags --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
else \
include_option=--include; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \ list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \ if test "$$subdir" = .; then :; else \
test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ test -f $$subdir/TAGS && \
tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
fi; \ fi; \
done; \ done; \
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
@ -363,9 +369,11 @@ distdir: $(DISTFILES)
mkdir $(distdir) mkdir $(distdir)
$(mkinstalldirs) $(distdir)/. $(mkinstalldirs) $(distdir)/.
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \ list='$(DISTFILES)'; for file in $$list; do \
case $$file in \ case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \ esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
@ -419,13 +427,12 @@ distcheck: dist
$(am__remove_distdir) $(am__remove_distdir)
GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf -
chmod -R a-w $(distdir); chmod a+w $(distdir) chmod -R a-w $(distdir); chmod a+w $(distdir)
mkdir $(distdir)/=build mkdir $(distdir)/_build
mkdir $(distdir)/=inst mkdir $(distdir)/_inst
chmod a-w $(distdir) chmod a-w $(distdir)
dc_install_base=`$(am__cd) $(distdir)/=inst && pwd` \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& $(mkinstalldirs) $$dc_destdir \ && cd $(distdir)/_build \
&& cd $(distdir)/=build \
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \
$(DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \
@ -437,7 +444,9 @@ distcheck: dist
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
distuninstallcheck \ distuninstallcheck \
&& chmod -R a-w "$$dc_install_base" \ && chmod -R a-w "$$dc_install_base" \
&& ({ $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && ({ \
(cd ../.. && $(mkinstalldirs) "$$dc_destdir") \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
@ -450,7 +459,7 @@ distcheck: dist
@echo "$(distdir).tar.gz is ready for distribution" | \ @echo "$(distdir).tar.gz is ready for distribution" | \
sed 'h;s/./=/g;p;x;p;x' sed 'h;s/./=/g;p;x;p;x'
distuninstallcheck: distuninstallcheck:
cd $(distuninstallcheck_dir) \ @cd $(distuninstallcheck_dir) \
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|| { echo "ERROR: files left after uninstall:" ; \ || { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \ if test -n "$(DESTDIR)"; then \
@ -459,11 +468,11 @@ distuninstallcheck:
$(distuninstallcheck_listfiles) ; \ $(distuninstallcheck_listfiles) ; \
exit 1; } >&2 exit 1; } >&2
distcleancheck: distclean distcleancheck: distclean
if test '$(srcdir)' = . ; then \ @if test '$(srcdir)' = . ; then \
echo "ERROR: distcleancheck can only run from a VPATH build" ; \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \
exit 1 ; \ exit 1 ; \
fi fi
test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left in build directory after distclean:" ; \ || { echo "ERROR: files left in build directory after distclean:" ; \
$(distcleancheck_listfiles) ; \ $(distcleancheck_listfiles) ; \
exit 1; } >&2 exit 1; } >&2
@ -493,7 +502,7 @@ mostlyclean-generic:
clean-generic: clean-generic:
distclean-generic: distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES) -rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic: maintainer-clean-generic:
@echo "This command is intended for maintainers to use" @echo "This command is intended for maintainers to use"
@ -504,6 +513,7 @@ clean-am: clean-generic mostlyclean-am
distclean: distclean-recursive distclean: distclean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-hdr distclean-tags distclean-am: clean-am distclean-generic distclean-hdr distclean-tags
dvi: dvi-recursive dvi: dvi-recursive
@ -528,7 +538,8 @@ installcheck-am:
maintainer-clean: maintainer-clean-recursive maintainer-clean: maintainer-clean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf autom4te.cache -rm -rf $(top_srcdir)/autom4te.cache
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive mostlyclean: mostlyclean-recursive

View File

@ -1,5 +1,8 @@
/* config.h.in. Generated from configure.in by autoheader. */ /* config.h.in. Generated from configure.in by autoheader. */
/* Define to 1 if you have the declaration of `MD5', and to 0 if you don't. */
#undef HAVE_DECL_MD5
/* Define to 1 if you have the declaration of `round', and to 0 if you don't. /* Define to 1 if you have the declaration of `round', and to 0 if you don't.
*/ */
#undef HAVE_DECL_ROUND #undef HAVE_DECL_ROUND
@ -17,6 +20,9 @@
/* Define to 1 if you have the `avformat' library (-lavformat). */ /* Define to 1 if you have the `avformat' library (-lavformat). */
#undef HAVE_LIBAVFORMAT #undef HAVE_LIBAVFORMAT
/* Define to 1 if you have the `crypto' library (-lcrypto). */
#undef HAVE_LIBCRYPTO
/* Define to 1 if you have the `dl' library (-ldl). */ /* Define to 1 if you have the `dl' library (-ldl). */
#undef HAVE_LIBDL #undef HAVE_LIBDL

131
configure vendored
View File

@ -4540,6 +4540,70 @@ _ACEOF
fi fi
echo "$as_me:$LINENO: checking whether MD5 is declared" >&5
echo $ECHO_N "checking whether MD5 is declared... $ECHO_C" >&6
if test "${ac_cv_have_decl_MD5+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <openssl/md5.h>
int
main ()
{
#ifndef MD5
char *p = (char *) MD5;
#endif
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_have_decl_MD5=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_have_decl_MD5=no
fi
rm -f conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_have_decl_MD5" >&5
echo "${ECHO_T}$ac_cv_have_decl_MD5" >&6
if test $ac_cv_have_decl_MD5 = yes; then
cat >>confdefs.h <<_ACEOF
#define HAVE_DECL_MD5 1
_ACEOF
else
cat >>confdefs.h <<_ACEOF
#define HAVE_DECL_MD5 0
_ACEOF
fi
echo "$as_me:$LINENO: checking for jpeg_start_compress in -ljpeg" >&5 echo "$as_me:$LINENO: checking for jpeg_start_compress in -ljpeg" >&5
echo $ECHO_N "checking for jpeg_start_compress in -ljpeg... $ECHO_C" >&6 echo $ECHO_N "checking for jpeg_start_compress in -ljpeg... $ECHO_C" >&6
@ -4813,6 +4877,73 @@ echo "$as_me: error: zm requires libmysqlclient.a" >&2;}
fi fi
echo "$as_me:$LINENO: checking for MD5 in -lcrypto" >&5
echo $ECHO_N "checking for MD5 in -lcrypto... $ECHO_C" >&6
if test "${ac_cv_lib_crypto_MD5+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lcrypto $LIBS"
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char MD5 ();
int
main ()
{
MD5 ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_lib_crypto_MD5=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_lib_crypto_MD5=no
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_crypto_MD5" >&5
echo "${ECHO_T}$ac_cv_lib_crypto_MD5" >&6
if test $ac_cv_lib_crypto_MD5 = yes; then
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBCRYPTO 1
_ACEOF
LIBS="-lcrypto $LIBS"
else
{ echo "$as_me:$LINENO: WARNING: libcrypto.a is required for authenticated streaming" >&5
echo "$as_me: WARNING: libcrypto.a is required for authenticated streaming" >&2;}
fi
echo "$as_me:$LINENO: checking for pcre_compile in -lpcre" >&5 echo "$as_me:$LINENO: checking for pcre_compile in -lpcre" >&5
echo $ECHO_N "checking for pcre_compile in -lpcre... $ECHO_C" >&6 echo $ECHO_N "checking for pcre_compile in -lpcre... $ECHO_C" >&6
if test "${ac_cv_lib_pcre_pcre_compile+set}" = set; then if test "${ac_cv_lib_pcre_pcre_compile+set}" = set; then

View File

@ -117,10 +117,12 @@ AC_CHECK_HEADERS(pcre/pcre.h,,,)
AC_CHECK_HEADERS(pcre.h,,,) AC_CHECK_HEADERS(pcre.h,,,)
AC_CHECK_DECLS(round,,,[#include <math.h>]) AC_CHECK_DECLS(round,,,[#include <math.h>])
AC_CHECK_DECLS(strsignal,,,[#include <string.h>]) AC_CHECK_DECLS(strsignal,,,[#include <string.h>])
AC_CHECK_DECLS(MD5,,,[#include <openssl/md5.h>])
AC_CHECK_LIB(jpeg,jpeg_start_compress,,AC_MSG_ERROR(zm requires libjpeg.a)) AC_CHECK_LIB(jpeg,jpeg_start_compress,,AC_MSG_ERROR(zm requires libjpeg.a))
AC_CHECK_LIB(z,compress,,AC_MSG_ERROR(zm requires libz.a)) AC_CHECK_LIB(z,compress,,AC_MSG_ERROR(zm requires libz.a))
AC_CHECK_LIB(dl,dlsym,,AC_MSG_ERROR(zm requires libdl.a)) AC_CHECK_LIB(dl,dlsym,,AC_MSG_ERROR(zm requires libdl.a))
AC_CHECK_LIB(mysqlclient,mysql_init,,AC_MSG_ERROR(zm requires libmysqlclient.a)) AC_CHECK_LIB(mysqlclient,mysql_init,,AC_MSG_ERROR(zm requires libmysqlclient.a))
AC_CHECK_LIB(crypto,MD5,,AC_MSG_WARN(libcrypto.a is required for authenticated streaming))
AC_CHECK_LIB(pcre,pcre_compile,,AC_MSG_WARN(libpcre.a is required for remote/network camera support)) AC_CHECK_LIB(pcre,pcre_compile,,AC_MSG_WARN(libpcre.a is required for remote/network camera support))
AC_CHECK_LIB(avcodec,avcodec_init,,AC_MSG_WARN(libavcodec.a is required for MPEG streaming)) AC_CHECK_LIB(avcodec,avcodec_init,,AC_MSG_WARN(libavcodec.a is required for MPEG streaming))
AC_CHECK_LIB(avformat,av_new_stream,,AC_MSG_WARN(libavformat.a is required for MPEG streaming),-lavcodec) AC_CHECK_LIB(avformat,av_new_stream,,AC_MSG_WARN(libavformat.a is required for MPEG streaming),-lavcodec)

View File

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.7 from Makefile.am. # Makefile.in generated by automake 1.7.8 from Makefile.am.
# @configure_input@ # @configure_input@
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
# Free Software Foundation, Inc. # Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation # This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -150,11 +150,12 @@ EXTRA_DIST = \
zmalter-1.19.5.sql zmalter-1.19.5.sql
subdir = db subdir = db
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES = CONFIG_CLEAN_FILES =
DIST_SOURCES = DIST_SOURCES =
DIST_COMMON = Makefile.am Makefile.in DIST_COMMON = $(srcdir)/Makefile.in Makefile.am
all: all-am all: all-am
.SUFFIXES: .SUFFIXES:
@ -177,9 +178,11 @@ distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
distdir: $(DISTFILES) distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \ list='$(DISTFILES)'; for file in $$list; do \
case $$file in \ case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \ esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
@ -205,7 +208,6 @@ check: check-am
all-am: Makefile all-am: Makefile
installdirs: installdirs:
install: install-am install: install-am
install-exec: install-exec-am install-exec: install-exec-am
install-data: install-data-am install-data: install-data-am
@ -225,7 +227,7 @@ mostlyclean-generic:
clean-generic: clean-generic:
distclean-generic: distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES) -rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic: maintainer-clean-generic:
@echo "This command is intended for maintainers to use" @echo "This command is intended for maintainers to use"
@ -235,7 +237,7 @@ clean: clean-am
clean-am: clean-generic mostlyclean-am clean-am: clean-generic mostlyclean-am
distclean: distclean-am distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-am: clean-am distclean-generic
dvi: dvi-am dvi: dvi-am
@ -257,7 +259,7 @@ install-man:
installcheck-am: installcheck-am:
maintainer-clean: maintainer-clean-am maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am mostlyclean: mostlyclean-am

View File

@ -10,6 +10,10 @@ CREATE TABLE Groups (
PRIMARY KEY (Id) PRIMARY KEY (Id)
) TYPE=MyISAM; ) TYPE=MyISAM;
-- --
-- Make changes to Users table
--
alter table Users modify MonitorIds tinytext not null default '';
--
-- Make changes to Monitors table -- Make changes to Monitors table
-- --
alter table Monitors modify column Function enum('None','Monitor','Modect','Record','Mocord','Nodect') NOT NULL default 'Monitor'; alter table Monitors modify column Function enum('None','Monitor','Modect','Record','Mocord','Nodect') NOT NULL default 'Monitor';

View File

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.7 from Makefile.am. # Makefile.in generated by automake 1.7.8 from Makefile.am.
# @configure_input@ # @configure_input@
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
# Free Software Foundation, Inc. # Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation # This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -151,13 +151,14 @@ EXTRA_DIST = \
zm.z zm.z
subdir = scripts subdir = scripts
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES = CONFIG_CLEAN_FILES =
SCRIPTS = $(bin_SCRIPTS) SCRIPTS = $(bin_SCRIPTS)
DIST_SOURCES = DIST_SOURCES =
DIST_COMMON = Makefile.am Makefile.in DIST_COMMON = $(srcdir)/Makefile.in Makefile.am
all: all-am all: all-am
.SUFFIXES: .SUFFIXES:
@ -200,9 +201,11 @@ distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
distdir: $(DISTFILES) distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \ list='$(DISTFILES)'; for file in $$list; do \
case $$file in \ case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \ esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
@ -229,7 +232,6 @@ all-am: Makefile $(SCRIPTS)
installdirs: installdirs:
$(mkinstalldirs) $(DESTDIR)$(bindir) $(mkinstalldirs) $(DESTDIR)$(bindir)
install: install-am install: install-am
install-exec: install-exec-am install-exec: install-exec-am
install-data: install-data-am install-data: install-data-am
@ -249,7 +251,7 @@ mostlyclean-generic:
clean-generic: clean-generic:
distclean-generic: distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES) -rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic: maintainer-clean-generic:
@echo "This command is intended for maintainers to use" @echo "This command is intended for maintainers to use"
@ -259,7 +261,7 @@ clean: clean-am
clean-am: clean-generic mostlyclean-am clean-am: clean-generic mostlyclean-am
distclean: distclean-am distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-am: clean-am distclean-generic
dvi: dvi-am dvi: dvi-am
@ -281,7 +283,7 @@ install-man:
installcheck-am: installcheck-am:
maintainer-clean: maintainer-clean-am maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am mostlyclean: mostlyclean-am

View File

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.7 from Makefile.am. # Makefile.in generated by automake 1.7.8 from Makefile.am.
# @configure_input@ # @configure_input@
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
# Free Software Foundation, Inc. # Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation # This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -199,6 +199,7 @@ noinst_HEADERS = \
EXTRA_DIST = zm_config.h.z EXTRA_DIST = zm_config.h.z
subdir = src subdir = src
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES = CONFIG_CLEAN_FILES =
@ -275,7 +276,7 @@ DIST_SOURCES = $(zma_SOURCES) $(zmc_SOURCES) $(zmf_SOURCES) \
$(zmfix_SOURCES) $(zms_SOURCES) $(zmu_SOURCES) $(zmfix_SOURCES) $(zms_SOURCES) $(zmu_SOURCES)
HEADERS = $(noinst_HEADERS) HEADERS = $(noinst_HEADERS)
DIST_COMMON = $(noinst_HEADERS) Makefile.am Makefile.in DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.in Makefile.am
SOURCES = $(zma_SOURCES) $(zmc_SOURCES) $(zmf_SOURCES) $(zmfix_SOURCES) $(zms_SOURCES) $(zmu_SOURCES) SOURCES = $(zma_SOURCES) $(zmc_SOURCES) $(zmf_SOURCES) $(zmfix_SOURCES) $(zms_SOURCES) $(zmu_SOURCES)
all: all-am all: all-am
@ -360,13 +361,10 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zms.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zms.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zmu.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zmu.Po@am__quote@
distclean-depend:
-rm -rf ./$(DEPDIR)
.c.o: .c.o:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ @am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
@am__fastdepCC_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ @am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCC_TRUE@ fi @am__fastdepCC_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@ -376,19 +374,19 @@ distclean-depend:
.c.obj: .c.obj:
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ @am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'`; \ @am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \
@am__fastdepCC_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ @am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCC_TRUE@ fi @am__fastdepCC_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'` @am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
.cpp.o: .cpp.o:
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \ @am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
@am__fastdepCXX_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ @am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCXX_TRUE@ fi @am__fastdepCXX_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@ -398,14 +396,14 @@ distclean-depend:
.cpp.obj: .cpp.obj:
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ @am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCXX_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'`; \ @am__fastdepCXX_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \
@am__fastdepCXX_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \ @am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ @am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCXX_TRUE@ fi @am__fastdepCXX_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'` @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
uninstall-info-am: uninstall-info-am:
ETAGS = etags ETAGS = etags
@ -468,9 +466,11 @@ distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
distdir: $(DISTFILES) distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \ list='$(DISTFILES)'; for file in $$list; do \
case $$file in \ case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \ esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
@ -500,7 +500,6 @@ all-am: Makefile $(PROGRAMS) $(HEADERS)
installdirs: installdirs:
$(mkinstalldirs) $(DESTDIR)$(bindir) $(mkinstalldirs) $(DESTDIR)$(bindir)
install: install-am install: install-am
install-exec: install-exec-am install-exec: install-exec-am
install-data: install-data-am install-data: install-data-am
@ -520,7 +519,7 @@ mostlyclean-generic:
clean-generic: clean-generic:
distclean-generic: distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES) -rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic: maintainer-clean-generic:
@echo "This command is intended for maintainers to use" @echo "This command is intended for maintainers to use"
@ -530,9 +529,10 @@ clean: clean-am
clean-am: clean-binPROGRAMS clean-generic mostlyclean-am clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
distclean: distclean-am distclean: distclean-am
-rm -rf ./$(DEPDIR)
distclean-am: clean-am distclean-compile distclean-depend \ -rm -f Makefile
distclean-generic distclean-tags distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am dvi: dvi-am
@ -555,7 +555,8 @@ install-man:
installcheck-am: installcheck-am:
maintainer-clean: maintainer-clean-am maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am mostlyclean: mostlyclean-am
@ -574,11 +575,11 @@ uninstall-am: uninstall-binPROGRAMS uninstall-info-am
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
clean-generic ctags distclean distclean-compile \ clean-generic ctags distclean distclean-compile \
distclean-depend distclean-generic distclean-tags distdir dvi \ distclean-generic distclean-tags distdir dvi dvi-am info \
dvi-am info info-am install install-am install-binPROGRAMS \ info-am install install-am install-binPROGRAMS install-data \
install-data install-data-am install-exec install-exec-am \ install-data-am install-exec install-exec-am install-info \
install-info install-info-am install-man install-strip \ install-info-am install-man install-strip installcheck \
installcheck installcheck-am installdirs maintainer-clean \ installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \ maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
uninstall-am uninstall-binPROGRAMS uninstall-info-am uninstall-am uninstall-binPROGRAMS uninstall-info-am

View File

@ -17,21 +17,123 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// //
#include <openssl/md5.h>
#include "zm.h" #include "zm.h"
#include "zm_db.h" #include "zm_db.h"
#include "zm_monitor.h" #include "zm_monitor.h"
bool validateAuth( const char *user, char *auth, int id )
{
#ifdef HAVE_DECL_MD5
if ( !(bool)config.Item( ZM_OPT_USE_AUTH ) )
{
return( true );
}
char **env_ptr = environ;
const char *remote_addr = "";
const char *remote_addr_str = "REMOTE_ADDR=";
while ( *env_ptr )
{
if ( !strncasecmp( remote_addr_str, *env_ptr, strlen(remote_addr_str) ) )
{
remote_addr = strchr( *env_ptr, '=' )+1;
break;
}
env_ptr++;
}
if ( !*remote_addr )
{
Warning(( "Can't determine remote address, using null" ));
}
char sql[BUFSIZ] = "";
if ( id > 0 )
{
snprintf( sql, sizeof(sql), "select Username, Password from Users where Username = '%s' and Enabled = 1 and Stream = 'View' and ( MonitorIds = '' or find_in_set( '%d', MonitorIds ) )", user, id );
}
else
{
snprintf( sql, sizeof(sql), "select Username, Password from Users where Username = '%s' and Enabled = 1 and Events != 'None'", user );
}
if ( mysql_query( &dbconn, sql ) )
{
Error(( "Can't run query: %s", mysql_error( &dbconn ) ));
exit( mysql_errno( &dbconn ) );
}
MYSQL_RES *result = mysql_store_result( &dbconn );
if ( !result )
{
Error(( "Can't use query result: %s", mysql_error( &dbconn ) ));
exit( mysql_errno( &dbconn ) );
}
int n_users = mysql_num_rows( result );
if ( n_users < 1 )
{
Warning(( "Unable to authenticate user %s", user ));
return( false );
}
MYSQL_ROW dbrow = mysql_fetch_row( result );
char auth_key[512] = "";
char auth_md5[32+1] = "";
unsigned char md5sum[64] = "";
time_t now = time( 0 );
int max_tries = 2;
for ( int i = 0; i < max_tries; i++, now -= (60*60) )
{
struct tm *now_tm = localtime( &now );
snprintf( auth_key, sizeof(auth_key), "%s%s%s%s%d%d%d%d",
(const char *)config.Item( ZM_AUTH_SECRET ),
user,
dbrow[1],
remote_addr,
now_tm->tm_hour,
now_tm->tm_mday,
now_tm->tm_mon,
now_tm->tm_year
);
MD5( (unsigned char *)auth_key, strlen(auth_key), md5sum );
auth_md5[0] = '\0';
for ( int j = 0; j < strlen((const char *)md5sum); j++ )
{
sprintf( auth_md5+strlen(auth_md5), "%02x", md5sum[j] );
}
if ( !strcmp( auth, auth_md5 ) )
{
// We have a match
return( true );
}
}
return( false );
#else // HAVE_DECL_MD5
return( true );
#endif // HAVE_DECL_MD5
}
int main( int argc, const char *argv[] ) int main( int argc, const char *argv[] )
{ {
enum { ZMS_JPEG, ZMS_MPEG, ZMS_SINGLE } mode = ZMS_JPEG; enum { ZMS_JPEG, ZMS_MPEG, ZMS_SINGLE } mode = ZMS_JPEG;
char format[32] = ""; char format[32] = "";
int id = 1; int id = 0;
int event = 0; int event = 0;
unsigned int scale = 100; unsigned int scale = 100;
unsigned int rate = 100; unsigned int rate = 100;
unsigned int maxfps = 10; unsigned int maxfps = 10;
unsigned int bitrate = 100000; unsigned int bitrate = 100000;
unsigned int ttl = 0; unsigned int ttl = 0;
char auth[64] = "";
char user[64] = "";
zm_dbg_name = "zms"; zm_dbg_name = "zms";
@ -44,10 +146,21 @@ int main( int argc, const char *argv[] )
nph = true; nph = true;
} }
//extern char **environ;
//char **env_ptr = environ;
//while ( *env_ptr )
//{
//printf( "X-Env: %s\n", *env_ptr );
//env_ptr++;
//}
//exit( 0 );
zmDbgInit(); zmDbgInit();
zmLoadConfig(); zmLoadConfig();
zmDbConnect();
const char *query = getenv( "QUERY_STRING" ); const char *query = getenv( "QUERY_STRING" );
if ( query ) if ( query )
{ {
@ -89,10 +202,26 @@ int main( int argc, const char *argv[] )
bitrate = atoi( value ); bitrate = atoi( value );
else if ( !strcmp( name, "ttl" ) ) else if ( !strcmp( name, "ttl" ) )
ttl = atoi(value); ttl = atoi(value);
else if ( (bool)config.Item( ZM_OPT_USE_AUTH ) )
{
if ( !strcmp( name, "auth" ) )
{
strncpy( auth, value, sizeof(auth) );
}
else if ( !strcmp( name, "user" ) )
{
strncpy( user, value, sizeof(user) );
}
}
} }
} }
zmDbConnect(); if ( !validateAuth( user, auth, id ) )
{
Error(( "Unable to validate authentication on '%s'", query ));
fprintf( stderr, "Unable to validate authentication on '%s'\n", query );
return( -1 );
}
setbuf( stdout, 0 ); setbuf( stdout, 0 );
if ( nph ) if ( nph )

View File

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.7 from Makefile.am. # Makefile.in generated by automake 1.7.8 from Makefile.am.
# @configure_input@ # @configure_input@
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
# Free Software Foundation, Inc. # Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation # This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -294,13 +294,14 @@ EXTRA_DIST = \
zm_lang_pt_br.php zm_lang_pt_br.php
subdir = web subdir = web
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES = CONFIG_CLEAN_FILES =
DIST_SOURCES = DIST_SOURCES =
DATA = $(web_DATA) DATA = $(web_DATA)
DIST_COMMON = Makefile.am Makefile.in DIST_COMMON = $(srcdir)/Makefile.in Makefile.am
all: all-am all: all-am
.SUFFIXES: .SUFFIXES:
@ -341,9 +342,11 @@ distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
distdir: $(DISTFILES) distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \ list='$(DISTFILES)'; for file in $$list; do \
case $$file in \ case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \ esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
@ -370,7 +373,6 @@ all-am: Makefile $(DATA)
installdirs: installdirs:
$(mkinstalldirs) $(DESTDIR)$(webdir) $(mkinstalldirs) $(DESTDIR)$(webdir)
install: install-am install: install-am
install-exec: install-exec-am install-exec: install-exec-am
install-data: install-data-am install-data: install-data-am
@ -390,7 +392,7 @@ mostlyclean-generic:
clean-generic: clean-generic:
distclean-generic: distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES) -rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic: maintainer-clean-generic:
@echo "This command is intended for maintainers to use" @echo "This command is intended for maintainers to use"
@ -400,7 +402,7 @@ clean: clean-am
clean-am: clean-generic mostlyclean-am clean-am: clean-generic mostlyclean-am
distclean: distclean-am distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-am: clean-am distclean-generic
dvi: dvi-am dvi: dvi-am
@ -424,7 +426,7 @@ install-man:
installcheck-am: installcheck-am:
maintainer-clean: maintainer-clean-am maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am mostlyclean: mostlyclean-am

View File

@ -18,7 +18,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// //
import_request_variables( "EGPCS" ); import_request_variables( "GPC" );
error_reporting (E_ALL ^ E_NOTICE); error_reporting (E_ALL ^ E_NOTICE);
$debug = false; $debug = false;
@ -138,6 +138,8 @@ else
} }
} }
session_start();
if ( !$HTTP_SESSION_VARS['format'] ) if ( !$HTTP_SESSION_VARS['format'] )
{ {
$HTTP_SESSION_VARS['format'] = $format; $HTTP_SESSION_VARS['format'] = $format;

View File

@ -32,6 +32,7 @@ function userLogin( $username, $password )
if ( $db_user = mysql_fetch_assoc( $result ) ) if ( $db_user = mysql_fetch_assoc( $result ) )
{ {
$HTTP_SESSION_VARS['user'] = $user = $db_user; $HTTP_SESSION_VARS['user'] = $user = $db_user;
$HTTP_SESSION_VARS['password_hash'] = $user['Password'];
} }
else else
{ {
@ -50,6 +51,43 @@ function userLogout()
session_destroy(); session_destroy();
} }
function authHash()
{
global $HTTP_SESSION_VARS;
if ( ZM_OPT_USE_AUTH )
{
$time = localtime();
$auth_key = ZM_AUTH_SECRET.$HTTP_SESSION_VARS['username'].$HTTP_SESSION_VARS['password_hash'].$HTTP_SESSION_VARS['remote_addr'].$time[2].$time[3].$time[4].$time[5];
$auth = md5( $auth_key );
}
else
{
$auth = "0";
}
return( $auth );
}
function getStreamSrc( $args )
{
global $HTTP_SESSION_VARS;
$stream_src = ZM_PATH_ZMS;
if ( ZM_OPT_USE_AUTH )
{
$args[] = "auth=".authHash();
$args[] = "user=".$HTTP_SESSION_VARS['username'];
}
if ( count($args) )
{
$stream_src .= "?".join( "&", $args );
}
return( $stream_src );
}
function visibleMonitor( $mid ) function visibleMonitor( $mid )
{ {
global $user; global $user;

View File

@ -123,7 +123,7 @@ window.setTimeout( "window.location.replace( '<?= "$PHP_SELF?view=cycle&group=$g
<?php <?php
if ( $mode == "stream" ) if ( $mode == "stream" )
{ {
$stream_src = ZM_PATH_ZMS."?mode=jpeg&monitor=".$monitor['Id']."&scale=".$scale."&maxfps=".ZM_WEB_VIDEO_MAXFPS."&ttl=".ZM_WEB_REFRESH_CYCLE; $stream_src = getStreamSrc( array( "mode=jpeg", "monitor=".$monitor['Id'], "scale=".$scale, "maxfps=".ZM_WEB_VIDEO_MAXFPS, "ttl=".ZM_WEB_REFRESH_CYCLE ) );
if ( canStreamNative() ) if ( canStreamNative() )
{ {
?> ?>
@ -139,7 +139,7 @@ if ( $mode == "stream" )
} }
else else
{ {
$image_src = ZM_PATH_ZMS."?mode=single&monitor=".$monitor['Id']."&scale=".$scale; $image_src = getStreamSrc( array( "mode=single", "monitor=".$monitor['Id'], "scale=".$scale ) );
?> ?>
<tr><td colspan="3" align="center"><a href="javascript: newWindow( '<?= $PHP_SELF ?>?view=watch&mid=<?= $monitor['Id'] ?>', 'zmWatch<?= $monitor['Id'] ?>', <?= $monitor['Width']+$jws['watch']['w'] ?>, <?= $monitor['Height']+$jws['watch']['h'] ?> );"><img src="<?= $image_src ?>" border="0" width="<?= reScale( $monitor['Width'], $scale ) ?>" height="<?= reScale( $monitor['Height'], $scale ) ?>"></a></td></tr> <tr><td colspan="3" align="center"><a href="javascript: newWindow( '<?= $PHP_SELF ?>?view=watch&mid=<?= $monitor['Id'] ?>', 'zmWatch<?= $monitor['Id'] ?>', <?= $monitor['Width']+$jws['watch']['w'] ?>, <?= $monitor['Height']+$jws['watch']['h'] ?> );"><img src="<?= $image_src ?>" border="0" width="<?= reScale( $monitor['Width'], $scale ) ?>" height="<?= reScale( $monitor['Height'], $scale ) ?>"></a></td></tr>
<?php <?php

View File

@ -289,7 +289,7 @@ if ( $mode == "stream" )
<?php <?php
if ( ZM_VIDEO_STREAM_METHOD == 'mpeg' && ZM_VIDEO_REPLAY_FORMAT ) if ( ZM_VIDEO_STREAM_METHOD == 'mpeg' && ZM_VIDEO_REPLAY_FORMAT )
{ {
$stream_src = ZM_PATH_ZMS."?mode=mpeg&event=$eid&scale=$scale&rate=$rate&bitrate=".ZM_WEB_VIDEO_BITRATE."&maxfps=".ZM_WEB_VIDEO_MAXFPS."&format=".ZM_VIDEO_REPLAY_FORMAT; $stream_src = getStreamSrc( array( "mode=mpeg", "event=".$eid, "scale=".$scale, "rate=".$rate, "bitrate=".ZM_WEB_VIDEO_BITRATE, "maxfps=".ZM_WEB_VIDEO_MAXFPS, "format=".ZM_VIDEO_REPLAY_FORMAT ) );
if ( isWindows() ) if ( isWindows() )
{ {
if ( isInternetExplorer() ) if ( isInternetExplorer() )
@ -336,7 +336,7 @@ autostart="true">
} }
else else
{ {
$stream_src = ZM_PATH_ZMS."?mode=jpeg&event=$eid&scale=$scale&rate=$rate&maxfps=".ZM_WEB_VIDEO_MAXFPS; $stream_src = getStreamSrc( array( "mode=jpeg", "event=".$eid, "scale=".$scale, "rate=".$rate, "maxfps=".ZM_WEB_VIDEO_MAXFPS ) );
if ( canStreamNative() ) if ( canStreamNative() )
{ {
?> ?>

View File

@ -55,7 +55,7 @@ header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false); header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0 header("Pragma: no-cache"); // HTTP/1.0
$image_src = ZM_PATH_ZMS."?mode=single&monitor=".$monitor['Id']."&scale=".$scale; $image_src = getStreamSrc( array( "mode=single", "monitor=".$monitor['Id'], "scale=".$scale ) );
?> ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
@ -100,7 +100,7 @@ if ( $mode == "stream" )
{ {
if ( ZM_VIDEO_STREAM_METHOD == 'mpeg' && ZM_VIDEO_LIVE_FORMAT ) if ( ZM_VIDEO_STREAM_METHOD == 'mpeg' && ZM_VIDEO_LIVE_FORMAT )
{ {
$stream_src = ZM_PATH_ZMS."?mode=mpeg&monitor=".$monitor['Id']."&scale=$scale&bitrate=".ZM_WEB_VIDEO_BITRATE."&maxfps=".ZM_WEB_VIDEO_MAXFPS."&format=".ZM_VIDEO_LIVE_FORMAT; $stream_src = getStreamSrc( array( "mode=mpeg", "monitor=".$monitor['Id'], "scale=".$scale, "bitrate=".ZM_WEB_VIDEO_BITRATE, "maxfps=".ZM_WEB_VIDEO_MAXFPS, "format=".ZM_VIDEO_LIVE_FORMAT ) );
if ( isWindows() ) if ( isWindows() )
{ {
if ( isInternetExplorer() ) if ( isInternetExplorer() )
@ -147,7 +147,7 @@ autostart="true">
} }
else else
{ {
$stream_src = ZM_PATH_ZMS."?mode=jpeg&monitor=".$monitor['Id']."&scale=$scale&maxfps=".ZM_WEB_VIDEO_MAXFPS; $stream_src = getStreamSrc( array( "mode=jpeg", "monitor=".$monitor['Id'], "scale=".$scale, "maxfps=".ZM_WEB_VIDEO_MAXFPS ) );
if ( canStreamNative() ) if ( canStreamNative() )
{ {
?> ?>

View File

@ -52,7 +52,7 @@ header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false); header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0 header("Pragma: no-cache"); // HTTP/1.0
$image_src = ZM_PATH_ZMS."?mode=single&monitor=".$monitor['Id']."&scale=".$scale; $image_src = getStreamSrc( array( "mode=single", "monitor=".$monitor['Id'], "scale=".$scale ) );
?> ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
@ -97,7 +97,7 @@ if ( $mode == "stream" )
{ {
if ( ZM_VIDEO_STREAM_METHOD == 'mpeg' && ZM_VIDEO_LIVE_FORMAT ) if ( ZM_VIDEO_STREAM_METHOD == 'mpeg' && ZM_VIDEO_LIVE_FORMAT )
{ {
$stream_src = ZM_PATH_ZMS."?mode=mpeg&monitor=".$monitor['Id']."&scale=$scale&bitrate=".ZM_WEB_VIDEO_BITRATE."&maxfps=".ZM_WEB_VIDEO_MAXFPS."&format=".ZM_VIDEO_LIVE_FORMAT; $stream_src = getStreamSrc( array( "mode=mpeg", "monitor=".$monitor['Id'], "scale=".$scale, "bitrate=".ZM_WEB_VIDEO_BITRATE, "maxfps=".ZM_WEB_VIDEO_MAXFPS, "format=".ZM_VIDEO_LIVE_FORMAT ) );
if ( isWindows() ) if ( isWindows() )
{ {
if ( isInternetExplorer() ) if ( isInternetExplorer() )
@ -144,7 +144,7 @@ autostart="true">
} }
else else
{ {
$stream_src = ZM_PATH_ZMS."?mode=jpeg&monitor=".$monitor['Id']."&scale=$scale&maxfps=".ZM_WEB_VIDEO_MAXFPS; $stream_src = getStreamSrc( array( "mode=jpeg", "monitor=".$monitor['Id'], "scale=".$scale, "maxfps=".ZM_WEB_VIDEO_MAXFPS ) );
if ( canStreamNative() ) if ( canStreamNative() )
{ {
?> ?>

View File

@ -55,8 +55,7 @@ foreach( $monitors as $monitor )
$scale = (int)(($width_scale<$height_scale)?$width_scale:$height_scale); $scale = (int)(($width_scale<$height_scale)?$width_scale:$height_scale);
$scale /= 2; // Try and get two pics per line $scale /= 2; // Try and get two pics per line
$image_src = ZM_PATH_ZMS."?mode=single&monitor=".$monitor['Id']."&scale=".$scale; $image_src = getStreamSrc( array( "mode=single", "monitor=".$monitor['Id'], "scale=".$scale ) );
?> ?>
<a href="<?= $PHP_SELF ?>?view=watch&amp;mid=<?= $monitor['Id'] ?>"><img src="<?= $image_src ?>" style="border: 0" width="<?= reScale( $monitor['Width'], $scale ) ?>" height="<?= reScale( $monitor['Height'], $scale ) ?>" alt="<?= $monitor['Name'] ?>"></a> <a href="<?= $PHP_SELF ?>?view=watch&amp;mid=<?= $monitor['Id'] ?>"><img src="<?= $image_src ?>" style="border: 0" width="<?= reScale( $monitor['Width'], $scale ) ?>" height="<?= reScale( $monitor['Height'], $scale ) ?>" alt="<?= $monitor['Name'] ?>"></a>
<?php <?php

View File

@ -93,8 +93,7 @@ $width_scale = ($device_width*SCALE_SCALE)/$monitor['Width'];
$height_scale = ($device_height*SCALE_SCALE)/$monitor['Height']; $height_scale = ($device_height*SCALE_SCALE)/$monitor['Height'];
$scale = (int)(($width_scale<$height_scale)?$width_scale:$height_scale); $scale = (int)(($width_scale<$height_scale)?$width_scale:$height_scale);
$image_src = ZM_PATH_ZMS."?mode=single&monitor=".$monitor['Id']."&scale=".$scale; $image_src = getStreamSrc( array( "mode=single", "monitor=".$monitor['Id'], "scale=".$scale ) );
?> ?>
<html> <html>
<head> <head>

View File

@ -213,6 +213,15 @@ my @options =
type => $types{boolean}, type => $types{boolean},
category => 'system', category => 'system',
}, },
{
name => "ZM_AUTH_SECRET",
default => "",
description => "Secret used when encoding authentication information",
help => "When ZoneMinder is running in authentcated mode it is sometimes necessary to generate hashed strings containing sensitive information such as usernames and password. Although these string are reasonably secure the addition of a random secret increases security substantially.",
requires => [ { name=>"ZM_OPT_USE_AUTH", value=>"yes" } ],
type => $types{string},
category => 'system',
},
{ {
name => "ZM_DIR_EVENTS", name => "ZM_DIR_EVENTS",
default => "events", default => "events",