]> git.sur5r.net Git - bacula/bacula/commitdiff
First cut of Python Events for Bacula. Director only.
authorKern Sibbald <kern@sibbald.com>
Sun, 28 Nov 2004 19:51:35 +0000 (19:51 +0000)
committerKern Sibbald <kern@sibbald.com>
Sun, 28 Nov 2004 19:51:35 +0000 (19:51 +0000)
  StartJob, EndJob, NewVolume events.

git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1726 91ce42f0-d328-0410-95d8-f526ca767f89

12 files changed:
bacula/autoconf/acconfig.h
bacula/autoconf/config.h.in
bacula/autoconf/config.h.in.save [new file with mode: 0644]
bacula/autoconf/configure.in
bacula/configure
bacula/src/dird/Makefile.in
bacula/src/dird/dird.c
bacula/src/dird/job.c
bacula/src/dird/newvol.c
bacula/src/lib/Makefile.in
bacula/src/lib/protos.h
bacula/src/lib/python.c [new file with mode: 0644]

index 618d8723bf7bd1c5e6fb6a72fa7486aa910f6d71..bd0bb6b78e29d7da5e27e4c4ddc8af989b9b0b52 100644 (file)
 #undef llu
 
 #undef HAVE_READLINE 
+#undef HAVE_PYTHON
 
 #undef HAVE_GMP
 
index f195ac729676173ee2a686fa2c6984c82f122935..c34113a08fcdafbaedfc902a312393543c6fa3b0 100644 (file)
 #undef llu
 
 #undef HAVE_READLINE 
+#undef HAVE_PYTHON
 
 #undef HAVE_GMP
 
diff --git a/bacula/autoconf/config.h.in.save b/bacula/autoconf/config.h.in.save
new file mode 100644 (file)
index 0000000..f195ac7
--- /dev/null
@@ -0,0 +1,665 @@
+/* autoconf/config.h.in.  Generated from autoconf/configure.in by autoheader.  */
+/* ------------------------------------------------------------------------- */
+/* --                     CONFIGURE SPECIFIED FEATURES                    -- */
+/* ------------------------------------------------------------------------- */
+   
+/* Define if you want to use MySQL as Catalog database */
+#undef USE_MYSQL_DB
+
+/* Define if you want SmartAlloc debug code enabled */
+#undef SMARTALLOC
+
+/* Define to `int' if <sys/types.h> doesn't define.  */
+#undef daddr_t
+
+/* Define to `int' if <sys/types.h> doesn't define.  */
+#undef major_t
+
+/* Define to `int' if <sys/types.h> doesn't define.  */
+#undef minor_t
+
+/* Define to `int' if <sys/types.h> doesn't define.  */
+#undef ssize_t
+
+/* Define if you want to use PostgreSQL */
+#undef HAVE_POSTGRESQL
+
+/* Define if you want to use MySQL */
+#undef HAVE_MYSQL
+
+/* Defined if MySQL thread safe library is present */
+#undef HAVE_THREAD_SAFE_MYSQL
+
+/* Define if you want to use embedded MySQL */
+#undef HAVE_EMBEDDED_MYSQL
+
+/* Define if you want to use SQLite */
+#undef HAVE_SQLITE
+
+/* Define if you want to use Berkeley DB */
+#undef HAVE_BERKELEY_DB
+
+
+/* Define if you want to use PostgreSQL */
+#undef HAVE_PGSQL
+
+/* Define if you want to use mSQL */
+#undef HAVE_MSQL
+
+/* Define if you want to use iODBC */
+#undef HAVE_IODBC
+
+/* Define if you want to use unixODBC */
+#undef HAVE_UNIXODBC
+
+/* Define if you want to use Solid SQL Server */
+#undef HAVE_SOLID
+
+/* Define if you want to use OpenLink ODBC (Virtuoso) */
+#undef HAVE_VIRT
+
+/* Define if you want to use EasySoft ODBC */
+#undef HAVE_EASYSOFT
+
+/* Define if you want to use Interbase SQL Server */
+#undef HAVE_IBASE
+
+/* Define if you want to use Oracle 8 SQL Server */
+#undef HAVE_ORACLE8
+
+/* Define if you want to use Oracle 7 SQL Server */
+#undef HAVE_ORACLE7
+
+
+/* ------------------------------------------------------------------------- */
+/* --                     CONFIGURE DETECTED FEATURES                     -- */
+/* ------------------------------------------------------------------------- */
+
+/* Define if you need function prototypes */
+#undef PROTOTYPES
+
+/* Define if you have XPointer typedef */
+#undef HAVE_XPOINTER
+
+/* Define if you have _GNU_SOURCE getpt() */
+#undef HAVE_GETPT
+
+/* Define if you have GCC */
+#undef HAVE_GCC
+
+/* Define if you have the Andrew File System.  */
+#undef AFS
+
+/* Define If you want find -nouser and -nogroup to make tables of
+   used UIDs and GIDs at startup instead of using getpwuid or
+   getgrgid when needed.  Speeds up -nouser and -nogroup unless you
+   are running NIS or Hesiod, which make password and group calls
+   very expensive.  */
+#undef CACHE_IDS
+
+/* Define to use SVR4 statvfs to get filesystem type.  */
+#undef FSTYPE_STATVFS
+
+/* Define to use SVR3.2 statfs to get filesystem type.  */
+#undef FSTYPE_USG_STATFS
+
+/* Define to use AIX3 statfs to get filesystem type.  */
+#undef FSTYPE_AIX_STATFS
+
+/* Define to use 4.3BSD getmntent to get filesystem type.  */
+#undef FSTYPE_MNTENT
+
+/* Define to use 4.4BSD and OSF1 statfs to get filesystem type.  */
+#undef FSTYPE_STATFS
+
+/* Define to use Ultrix getmnt to get filesystem type.  */
+#undef FSTYPE_GETMNT
+
+/* Define to `unsigned long' if <sys/types.h> doesn't define.  */
+#undef dev_t
+
+/* Define to `unsigned long' if <sys/types.h> doesn't define.  */
+#undef ino_t
+
+/* Define to 1 if utime.h exists and declares struct utimbuf.  */
+#undef HAVE_UTIME_H
+
+#if (HAVE_MYSQL||HAVE_POSTGRESQL||HAVE_MSQL||HAVE_IODBC||HAVE_UNIXODBC||HAVE_SOLID||HAVE_VIRT||HAVE_IBASE||HAVE_ORACLE8||HAVE_ORACLE7||HAVE_EASYSOFT)
+#define HAVE_SQL
+#endif
+
+/* Data types */
+#undef HAVE_U_INT
+#undef HAVE_INTXX_T
+#undef HAVE_U_INTXX_T
+#undef HAVE_UINTXX_T
+#undef HAVE_INT64_T
+#undef HAVE_U_INT64_T
+#undef HAVE_INTMAX_T
+#undef HAVE_U_INTMAX_T
+/* Define if you want TCP Wrappers support */
+#undef HAVE_LIBWRAP
+
+/* Define if you have sys/bitypes.h */
+#undef HAVE_SYS_BITYPES_H
+/* Directory for PID files */
+#undef _PATH_BACULA_PIDDIR
+
+/* Define if you have zlib */
+#undef HAVE_LIBZ
+
+/* Define if you have libacl */
+#undef HAVE_ACL
+
+/* General libs */
+#undef LIBS
+
+/* File daemon specif libraries */
+#undef FDLIBS
+
+/* Path to Sendmail program */
+#undef SENDMAIL_PATH
+
+/* What kind of signals we have */
+#undef HAVE_POSIX_SIGNALS
+#undef HAVE_BSD_SIGNALS
+#undef HAVE_USG_SIGHOLD
+
+/* Operating systems */
+/* OSes */
+#undef HAVE_LINUX_OS
+#undef HAVE_FREEBSD_OS
+#undef HAVE_NETBSD_OS
+#undef HAVE_OPENBSD_OS
+#undef HAVE_BSDI_OS
+#undef HAVE_HPUX_OS
+#undef HAVE_SUN_OS
+#undef HAVE_IRIX_OS
+#undef HAVE_AIX_OS
+#undef HAVE_SGI_OS
+#undef HAVE_CYGWIN
+#undef HAVE_OSF1_OS
+#undef HAVE_DARWIN_OS
+
+/* Set to correct scanf value for long long int */
+#undef lld
+#undef llu
+
+#undef HAVE_READLINE 
+
+#undef HAVE_GMP
+
+#undef HAVE_CWEB
+
+#undef HAVE_FCHDIR
+
+#undef HAVE_GETOPT_LONG
+
+#undef HAVE_LIBSM
+
+/* Check for thread safe routines */
+#undef HAVE_LOCALTIME_R
+#undef HAVE_READDIR_R
+#undef HAVE_STRERROR_R
+#undef HAVE_GETHOSTBYNAME_R
+
+#undef HAVE_STRTOLL
+#undef HAVE_INET_PTON
+
+#undef HAVE_SOCKLEN_T
+
+#undef HAVE_OLD_SOCKOPT
+#undef HAVE_BIGENDIAN
+
+/* Defined if Gtk+-2.4 or greater is present */
+#undef HAVE_GTK_2_4
+
+/* Define to 1 if the `closedir' function returns void instead of `int'. */
+#undef CLOSEDIR_VOID
+
+/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
+   systems. This function is required for `alloca.c' support on those systems.
+   */
+#undef CRAY_STACKSEG_END
+
+/* Define to 1 if using `alloca.c'. */
+#undef C_ALLOCA
+
+/* Define to 1 if you have `alloca', as a function or macro. */
+#undef HAVE_ALLOCA
+
+/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
+   */
+#undef HAVE_ALLOCA_H
+
+/* Define to 1 if you have the <arpa/nameser.h> header file. */
+#undef HAVE_ARPA_NAMESER_H
+
+/* Define to 1 if you have the <assert.h> header file. */
+#undef HAVE_ASSERT_H
+
+/* Define to 1 if you have the `chflags' function. */
+#undef HAVE_CHFLAGS
+
+/* Set if Bacula conio support enabled */
+#undef HAVE_CONIO
+
+/* Define to 1 if you have the <curses.h> header file. */
+#undef HAVE_CURSES_H
+
+/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
+   */
+#undef HAVE_DIRENT_H
+
+/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
+#undef HAVE_DOPRNT
+
+/* Define to 1 if you have the `fchdir' function. */
+#undef HAVE_FCHDIR
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#undef HAVE_FCNTL_H
+
+/* Define to 1 if your system has a working POSIX `fnmatch' function. */
+#undef HAVE_FNMATCH
+
+/* Define to 1 if you have the `fork' function. */
+#undef HAVE_FORK
+
+/* Define to 1 if you have the `getcwd' function. */
+#undef HAVE_GETCWD
+
+/* Define to 1 if you have the `getdomainname' function. */
+#undef HAVE_GETDOMAINNAME
+
+/* Define to 1 if you have the `gethostbyname2' function. */
+#undef HAVE_GETHOSTBYNAME2
+
+/* Define to 1 if you have the `gethostbyname_r' function. */
+#undef HAVE_GETHOSTBYNAME_R
+
+/* Define to 1 if you have the `gethostid' function. */
+#undef HAVE_GETHOSTID
+
+/* Define to 1 if you have the `gethostname' function. */
+#undef HAVE_GETHOSTNAME
+
+/* Define to 1 if you have the `getmntent' function. */
+#undef HAVE_GETMNTENT
+
+/* Define to 1 if you have the `getpid' function. */
+#undef HAVE_GETPID
+
+/* Define to 1 if you have the `gettimeofday' function. */
+#undef HAVE_GETTIMEOFDAY
+
+/* Define to 1 if you have the <grp.h> header file. */
+#undef HAVE_GRP_H
+
+/* Define to 1 if you have the `inet_ntop' function. */
+#undef HAVE_INET_NTOP
+
+/* Define to 1 if you have the `inet_pton' function. */
+#undef HAVE_INET_PTON
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Whether to enable IPv6 support */
+#undef HAVE_IPV6
+
+/* Define to 1 if you have the `lchown' function. */
+#undef HAVE_LCHOWN
+
+/* Define to 1 if you have the <libc.h> header file. */
+#undef HAVE_LIBC_H
+
+/* Define to 1 if you have the `inet' library (-linet). */
+#undef HAVE_LIBINET
+
+/* Define to 1 if you have the `nsl' library (-lnsl). */
+#undef HAVE_LIBNSL
+
+/* Define to 1 if you have the `resolv' library (-lresolv). */
+#undef HAVE_LIBRESOLV
+
+/* Define to 1 if you have the `socket' library (-lsocket). */
+#undef HAVE_LIBSOCKET
+
+/* Define to 1 if you have the `sun' library (-lsun). */
+#undef HAVE_LIBSUN
+
+/* Define to 1 if you have the `xnet' library (-lxnet). */
+#undef HAVE_LIBXNET
+
+/* Define to 1 if you have the <limits.h> header file. */
+#undef HAVE_LIMITS_H
+
+/* Define to 1 if you have the `localtime_r' function. */
+#undef HAVE_LOCALTIME_R
+
+/* Define to 1 if you have the `lstat' function. */
+#undef HAVE_LSTAT
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the <mtio.h> header file. */
+#undef HAVE_MTIO_H
+
+/* Define to 1 if you have the `nanosleep' function. */
+#undef HAVE_NANOSLEEP
+
+/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
+#undef HAVE_NDIR_H
+
+/* Define to 1 if you have the `nl_langinfo' function. */
+#undef HAVE_NL_LANGINFO
+
+/* Define to 1 if you have the `putenv' function. */
+#undef HAVE_PUTENV
+
+/* Define to 1 if you have the <pwd.h> header file. */
+#undef HAVE_PWD_H
+
+/* Define to 1 if you have the `readdir_r' function. */
+#undef HAVE_READDIR_R
+
+/* Define to 1 if you have the <regex.h> header file. */
+#undef HAVE_REGEX_H
+
+/* Define to 1 if you have the <resolv.h> header file. */
+#undef HAVE_RESOLV_H
+
+/* Define if sa_len field exists in struct sockaddr */
+#undef HAVE_SA_LEN
+
+/* Define to 1 if you have the `select' function. */
+#undef HAVE_SELECT
+
+/* Define to 1 if you have the `setenv' function. */
+#undef HAVE_SETENV
+
+/* Define to 1 if you have the `setlocale' function. */
+#undef HAVE_SETLOCALE
+
+/* Define to 1 if you have the `setpgid' function. */
+#undef HAVE_SETPGID
+
+/* Define to 1 if you have the `setpgrp' function. */
+#undef HAVE_SETPGRP
+
+/* Define to 1 if you have the `setsid' function. */
+#undef HAVE_SETSID
+
+/* Define to 1 if you have the `signal' function. */
+#undef HAVE_SIGNAL
+
+/* Define to 1 if you have the `snprintf' function. */
+#undef HAVE_SNPRINTF
+
+/* Define to 1 if you have the <stdarg.h> header file. */
+#undef HAVE_STDARG_H
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the `strcasecmp' function. */
+#undef HAVE_STRCASECMP
+
+/* Define to 1 if you have the `strerror' function. */
+#undef HAVE_STRERROR
+
+/* Define to 1 if you have the `strerror_r' function. */
+#undef HAVE_STRERROR_R
+
+/* Define to 1 if you have the `strftime' function. */
+#undef HAVE_STRFTIME
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the `strncmp' function. */
+#undef HAVE_STRNCMP
+
+/* Define to 1 if you have the `strncpy' function. */
+#undef HAVE_STRNCPY
+
+/* Define to 1 if you have the `strtoll' function. */
+#undef HAVE_STRTOLL
+
+/* Define to 1 if `st_blksize' is member of `struct stat'. */
+#undef HAVE_STRUCT_STAT_ST_BLKSIZE
+
+/* Define to 1 if `st_blocks' is member of `struct stat'. */
+#undef HAVE_STRUCT_STAT_ST_BLOCKS
+
+/* Define to 1 if `st_rdev' is member of `struct stat'. */
+#undef HAVE_STRUCT_STAT_ST_RDEV
+
+/* Define to 1 if `tm_zone' is member of `struct tm'. */
+#undef HAVE_STRUCT_TM_TM_ZONE
+
+/* Define to 1 if your `struct stat' has `st_blksize'. Deprecated, use
+   `HAVE_STRUCT_STAT_ST_BLKSIZE' instead. */
+#undef HAVE_ST_BLKSIZE
+
+/* Define to 1 if your `struct stat' has `st_blocks'. Deprecated, use
+   `HAVE_STRUCT_STAT_ST_BLOCKS' instead. */
+#undef HAVE_ST_BLOCKS
+
+/* Define to 1 if your `struct stat' has `st_rdev'. Deprecated, use
+   `HAVE_STRUCT_STAT_ST_RDEV' instead. */
+#undef HAVE_ST_RDEV
+
+/* Define to 1 if you have the <sys/bitypes.h> header file. */
+#undef HAVE_SYS_BITYPES_H
+
+/* Define to 1 if you have the <sys/byteorder.h> header file. */
+#undef HAVE_SYS_BYTEORDER_H
+
+/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
+   */
+#undef HAVE_SYS_DIR_H
+
+/* Define to 1 if you have the <sys/ioctl.h> header file. */
+#undef HAVE_SYS_IOCTL_H
+
+/* Define to 1 if you have the <sys/mtio.h> header file. */
+#undef HAVE_SYS_MTIO_H
+
+/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
+   */
+#undef HAVE_SYS_NDIR_H
+
+/* Define to 1 if you have the <sys/select.h> header file. */
+#undef HAVE_SYS_SELECT_H
+
+/* Define to 1 if you have the <sys/socket.h> header file. */
+#undef HAVE_SYS_SOCKET_H
+
+/* Define to 1 if you have the <sys/sockio.h> header file. */
+#undef HAVE_SYS_SOCKIO_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/tape.h> header file. */
+#undef HAVE_SYS_TAPE_H
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#undef HAVE_SYS_TIME_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
+#undef HAVE_SYS_WAIT_H
+
+/* Define to 1 if you have the `tcgetattr' function. */
+#undef HAVE_TCGETATTR
+
+/* Define to 1 if you have the <termcap.h> header file. */
+#undef HAVE_TERMCAP_H
+
+/* Define to 1 if you have the <termios.h> header file. */
+#undef HAVE_TERMIOS_H
+
+/* Define to 1 if you have the <term.h> header file. */
+#undef HAVE_TERM_H
+
+/* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use
+   `HAVE_STRUCT_TM_TM_ZONE' instead. */
+#undef HAVE_TM_ZONE
+
+/* Define to 1 if you don't have `tm_zone' but do have the external array
+   `tzname'. */
+#undef HAVE_TZNAME
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to 1 if you have the <varargs.h> header file. */
+#undef HAVE_VARARGS_H
+
+/* Define to 1 if you have the `vfprintf' function. */
+#undef HAVE_VFPRINTF
+
+/* Define to 1 if you have the `vprintf' function. */
+#undef HAVE_VPRINTF
+
+/* Define to 1 if you have the `vsnprintf' function. */
+#undef HAVE_VSNPRINTF
+
+/* Define to 1 if you have the <zlib.h> header file. */
+#undef HAVE_ZLIB_H
+
+/* Define to 1 if `major', `minor', and `makedev' are declared in <mkdev.h>.
+   */
+#undef MAJOR_IN_MKDEV
+
+/* Define to 1 if `major', `minor', and `makedev' are declared in
+   <sysmacros.h>. */
+#undef MAJOR_IN_SYSMACROS
+
+/* Define to 1 if your C compiler doesn't accept -c and -o together. */
+#undef NO_MINUS_C_MINUS_O
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Define as the return type of signal handlers (`int' or `void'). */
+#undef RETSIGTYPE
+
+/* Define to 1 if the `setpgrp' function takes no argument. */
+#undef SETPGRP_VOID
+
+/* The size of a `char', as computed by sizeof. */
+#undef SIZEOF_CHAR
+
+/* The size of a `int', as computed by sizeof. */
+#undef SIZEOF_INT
+
+/* The size of a `int *', as computed by sizeof. */
+#undef SIZEOF_INT_P
+
+/* The size of a `long int', as computed by sizeof. */
+#undef SIZEOF_LONG_INT
+
+/* The size of a `long long int', as computed by sizeof. */
+#undef SIZEOF_LONG_LONG_INT
+
+/* The size of a `short int', as computed by sizeof. */
+#undef SIZEOF_SHORT_INT
+
+/* If using the C implementation of alloca, define if you know the
+   direction of stack growth for your system; otherwise it will be
+   automatically deduced at run-time.
+        STACK_DIRECTION > 0 => grows toward higher addresses
+        STACK_DIRECTION < 0 => grows toward lower addresses
+        STACK_DIRECTION = 0 => direction of growth unknown */
+#undef STACK_DIRECTION
+
+/* Define to 1 if the `S_IS*' macros in <sys/stat.h> do not work properly. */
+#undef STAT_MACROS_BROKEN
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#undef TIME_WITH_SYS_TIME
+
+/* Define to 1 if your <sys/time.h> declares `struct tm'. */
+#undef TM_IN_SYS_TIME
+
+/* Define to 1 if the X Window System is missing or not being used. */
+#undef X_DISPLAY_MISSING
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+#undef _FILE_OFFSET_BITS
+
+/* Define to make fseeko etc. visible, on some hosts. */
+#undef _LARGEFILE_SOURCE
+
+/* Define for large files, on AIX-style hosts. */
+#undef _LARGE_FILES
+
+/* Define to empty if `const' does not conform to ANSI C. */
+#undef const
+
+/* Define to `long' if <sys/types.h> does not define. */
+#undef daddr_t
+
+/* Define to `unsigned long' if <sys/types.h> does not define. */
+#undef dev_t
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+#undef gid_t
+
+/* Define to `unsigned long' if <sys/types.h> does not define. */
+#undef ino_t
+
+/* Define to `int' if <sys/types.h> does not define. */
+#undef major_t
+
+/* Define to `int' if <sys/types.h> does not define. */
+#undef minor_t
+
+/* Define to `int' if <sys/types.h> does not define. */
+#undef mode_t
+
+/* Define to `long' if <sys/types.h> does not define. */
+#undef off_t
+
+/* Define to `int' if <sys/types.h> does not define. */
+#undef pid_t
+
+/* Define to `unsigned' if <sys/types.h> does not define. */
+#undef size_t
+
+/* Define to `int' if <sys/types.h> does not define. */
+#undef ssize_t
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+#undef uid_t
index 9dc22a53eb11e2baedcca9e0dcc948f66f6000c8..b15a1b8a8fe85982e00e92c689466d325799ad34 100644 (file)
@@ -154,6 +154,7 @@ support_static_fd=no
 support_static_sd=no
 support_static_dir=no
 support_static_cons=no
+support_python=no
 build_client_only=no
 cats=
 db_name=Internal
@@ -505,6 +506,56 @@ AC_CHECK_HEADERS(varargs.h)
 # End of readline/conio stuff
 # -----------------------------------------------------------------------
 
+# -----------------------------------------------------------------------
+#  Check for Python support
+#
+AC_MSG_CHECKING(for Python support)
+AC_ARG_WITH(python,
+[
+  --with-python[=DIR]    Include Python support.  DIR is the Python base
+                         install directory, default is to search through
+                         a number of common places for the Python files.],
+[
+  PYTHON_INCDIR=.
+  PYTHON_LIBS=
+  if test "$withval" != "no"; then
+     if test "$withval" = "yes"; then
+       if test -f /usr/include/python2.2/Python.h; then
+          PYTHON_INCDIR=/usr/include/python2.2
+          PYTHON_LIBS="-L/usr/lib/python2.2/config -lpython2.2 -lutil -ldl"
+       elif test -f $prefix/include/Python.h; then
+          PYTHON_INCDIR=$prefix/include
+          PYTHON_LIBS="-L$prefix/lib/config -lpython -lutil -ldl"
+       else
+          AC_MSG_RESULT(no)
+          AC_MSG_ERROR(Unable to find Python.h in standard locations)
+       fi
+     else
+       if test -f $withval/Python.h; then
+          PYTHON_INCDIR=$withval
+          PYTHON_LIBS="-L$withval/config -lpython -lutil -ldl"
+       elif test -f $withval/include/Python.h; then
+          PYTHON_INCDIR=$withval/include
+          PYTHON_LIBS="-L$withval/lib/config -lpython -lutil -ldl"
+       else
+          AC_MSG_RESULT(no)
+          AC_MSG_ERROR(Invalid Python directory $withval - unable to find Python.h under $withval)
+       fi
+     fi
+     AC_DEFINE([HAVE_PYTHON], 1)
+     AC_MSG_RESULT(yes)
+     support_python=yes
+
+  else
+     AC_MSG_RESULT(no)
+  fi
+],[
+  AC_MSG_RESULT(no)
+])
+AC_SUBST(PYTHON_LIBS)
+AC_SUBST(PYTHON_INCDIR)
+  
+
 # -------------------------------------------
 # check for cdrecord writer location
 # get scsibus,target,lun
@@ -1005,7 +1056,7 @@ AC_ARG_WITH(bimagemgr-bingroup,
 
 bimagemgr_dataowner=apache
 AC_ARG_WITH(bimagemgr-dataowner,
-   [  --with-bimagemgr-dataowner=USER   specify bimagemgr data file owner],
+   [  --with-bimagemgr-dataowner=USER  specify bimagemgr data file owner],
    [
        if test "x$withval" != "xno" ; then     
           bimagemgr_dataowner=$withval
@@ -1015,7 +1066,7 @@ AC_ARG_WITH(bimagemgr-dataowner,
 
 bimagemgr_datagroup=apache
 AC_ARG_WITH(bimagemgr-datagroup,
-   [  --with-bimagemgr-datagroup=USER   specify bimagemgr data file group],
+   [  --with-bimagemgr-datagroup=USER  specify bimagemgr data file group],
    [
        if test "x$withval" != "xno" ; then     
           bimagemgr_datagroup=$withval
@@ -1958,9 +2009,9 @@ AC_OUTPUT([autoconf/Make.common \
           src/win32/Makefile \
           src/win32/console/bconsole.conf \
           src/win32/wx-console/wx-console.conf \
-        src/win32/pebuilder/Makefile \
-        src/bimagemgr/Makefile \
-        src/bimagemgr/bacula-bimagemgr.spec \
+       src/win32/pebuilder/Makefile \
+       src/bimagemgr/Makefile \
+       src/bimagemgr/bacula-bimagemgr.spec \
           $PFILES ],  
          [(echo "Doing make of dependencies"; ${MAKE:-make} depend;) ]
 )
@@ -2087,6 +2138,7 @@ Configuration on `date`:
   enable-tray-monitor:       ${support_tray_monitor}
   client-only:               ${build_client_only}
   ACL support:               ${have_acl}
+  Python support:            ${support_python} ${PYTHON_LIBS}
 
   " > config.out
 
@@ -2094,4 +2146,4 @@ cat config.out
 
 # old stuff
 # cweb support:              ${got_cweb} ${CWEB_SRC}
-  # gmp support:                     ${got_gmp} ${GMP_SRC}
+# gmp support:               ${got_gmp} ${GMP_SRC}
index 51992be77667434ad96b20472394225004e822d3..99bb88fd918b84aa2c7fc422057ce6e4dfa81c2c 100755 (executable)
@@ -308,7 +308,7 @@ ac_includes_default="\
 # include <unistd.h>
 #endif"
 
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS BUILD_DIR TRUEPRG FALSEPRG VERSION DATE LSMDATE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX CXXFLAGS ac_ct_CXX CPP EGREP INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA RANLIB ac_ct_RANLIB MV RM CP SED AWK ECHO CMP TBL AR OPENSSL MTX PKGCONFIG WXCONFIG CDRECORD ARFLAGS MAKE_SHELL LOCAL_LIBS LOCAL_CFLAGS LOCAL_LDFLAGS LOCAL_DEFS build build_cpu build_vendor build_os host host_cpu host_vendor host_os HAVE_SUN_OS_TRUE HAVE_SUN_OS_FALSE HAVE_OSF1_OS_TRUE HAVE_OSF1_OS_FALSE HAVE_AIX_OS_TRUE HAVE_AIX_OS_FALSE HAVE_HPUX_OS_TRUE HAVE_HPUX_OS_FALSE HAVE_LINUX_OS_TRUE HAVE_LINUX_OS_FALSE HAVE_FREEBSD_OS_TRUE HAVE_FREEBSD_OS_FALSE HAVE_NETBSD_OS_TRUE HAVE_NETBSD_OS_FALSE HAVE_OPENBSD_OS_TRUE HAVE_OPENBSD_OS_FALSE HAVE_BSDI_OS_TRUE HAVE_BSDI_OS_FALSE HAVE_SGI_OS_TRUE HAVE_SGI_OS_FALSE HAVE_IRIX_OS_TRUE HAVE_IRIX_OS_FALSE HAVE_DARWIN_OS_TRUE HAVE_DARWIN_OS_FALSE INSIDE_GNOME_COMMON_TRUE INSIDE_GNOME_COMMON_FALSE MSGFMT GNOME_INCLUDEDIR GNOMEUI_LIBS GNOME_LIBDIR GNOME_LIBS GNOMEGNORBA_LIBS GTKXMHTML_LIBS ZVT_LIBS GNOME_CONFIG ORBIT_CONFIG ORBIT_IDL HAVE_ORBIT_TRUE HAVE_ORBIT_FALSE ORBIT_CFLAGS ORBIT_LIBS HAVE_GNORBA_TRUE HAVE_GNORBA_FALSE GNORBA_CFLAGS GNORBA_LIBS GNOME_APPLETS_LIBS GNOME_DOCKLETS_LIBS GNOME_CAPPLET_LIBS GNOME_DIR WXCONS_CPPFLAGS WXCONS_LDFLAGS WX_DIR TRAY_MONITOR_CPPFLAGS TRAY_MONITOR_LDFLAGS TRAY_MONITOR_DIR TTOOL_LDFLAGS STATIC_FD STATIC_SD STATIC_DIR STATIC_CONS STATIC_GNOME_CONS STATIC_WX_CONS ALL_DIRS CONS_INC CONS_OBJ CONS_SRC CONS_LIBS CONS_LDFLAGS READLINE_SRC CDSTL working_dir scriptdir dump_email job_email smtp_host piddir subsysdir baseport dir_port fd_port sd_port dir_password fd_password sd_password mon_dir_password mon_fd_password mon_sd_password bimagemgr_cgidir bimagemgr_docdir bimagemgr_binowner bimagemgr_bingroup bimagemgr_dataowner bimagemgr_datagroup dir_user dir_group sd_user sd_group fd_user fd_group SBINPERM SQL_LFLAGS SQL_INCLUDE SQL_BINDIR cats DB_NAME GETCONF ac_ct_GETCONF X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS LIBOBJS ALLOCA FDLIBS DEBUG DINCLUDE DLIB DB_LIBS WCFLAGS WLDFLAGS OBJLIST hostname TAPEDRIVE PSCMD WIN32 MACOSX DISTNAME DISTVER LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS BUILD_DIR TRUEPRG FALSEPRG VERSION DATE LSMDATE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX CXXFLAGS ac_ct_CXX CPP EGREP INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA RANLIB ac_ct_RANLIB MV RM CP SED AWK ECHO CMP TBL AR OPENSSL MTX PKGCONFIG WXCONFIG CDRECORD ARFLAGS MAKE_SHELL LOCAL_LIBS LOCAL_CFLAGS LOCAL_LDFLAGS LOCAL_DEFS build build_cpu build_vendor build_os host host_cpu host_vendor host_os HAVE_SUN_OS_TRUE HAVE_SUN_OS_FALSE HAVE_OSF1_OS_TRUE HAVE_OSF1_OS_FALSE HAVE_AIX_OS_TRUE HAVE_AIX_OS_FALSE HAVE_HPUX_OS_TRUE HAVE_HPUX_OS_FALSE HAVE_LINUX_OS_TRUE HAVE_LINUX_OS_FALSE HAVE_FREEBSD_OS_TRUE HAVE_FREEBSD_OS_FALSE HAVE_NETBSD_OS_TRUE HAVE_NETBSD_OS_FALSE HAVE_OPENBSD_OS_TRUE HAVE_OPENBSD_OS_FALSE HAVE_BSDI_OS_TRUE HAVE_BSDI_OS_FALSE HAVE_SGI_OS_TRUE HAVE_SGI_OS_FALSE HAVE_IRIX_OS_TRUE HAVE_IRIX_OS_FALSE HAVE_DARWIN_OS_TRUE HAVE_DARWIN_OS_FALSE INSIDE_GNOME_COMMON_TRUE INSIDE_GNOME_COMMON_FALSE MSGFMT GNOME_INCLUDEDIR GNOMEUI_LIBS GNOME_LIBDIR GNOME_LIBS GNOMEGNORBA_LIBS GTKXMHTML_LIBS ZVT_LIBS GNOME_CONFIG ORBIT_CONFIG ORBIT_IDL HAVE_ORBIT_TRUE HAVE_ORBIT_FALSE ORBIT_CFLAGS ORBIT_LIBS HAVE_GNORBA_TRUE HAVE_GNORBA_FALSE GNORBA_CFLAGS GNORBA_LIBS GNOME_APPLETS_LIBS GNOME_DOCKLETS_LIBS GNOME_CAPPLET_LIBS GNOME_DIR WXCONS_CPPFLAGS WXCONS_LDFLAGS WX_DIR TRAY_MONITOR_CPPFLAGS TRAY_MONITOR_LDFLAGS TRAY_MONITOR_DIR TTOOL_LDFLAGS STATIC_FD STATIC_SD STATIC_DIR STATIC_CONS STATIC_GNOME_CONS STATIC_WX_CONS ALL_DIRS CONS_INC CONS_OBJ CONS_SRC CONS_LIBS CONS_LDFLAGS READLINE_SRC PYTHON_LIBS PYTHON_INCDIR CDSTL working_dir scriptdir dump_email job_email smtp_host piddir subsysdir baseport dir_port fd_port sd_port dir_password fd_password sd_password mon_dir_password mon_fd_password mon_sd_password bimagemgr_cgidir bimagemgr_docdir bimagemgr_binowner bimagemgr_bingroup bimagemgr_dataowner bimagemgr_datagroup dir_user dir_group sd_user sd_group fd_user fd_group SBINPERM SQL_LFLAGS SQL_INCLUDE SQL_BINDIR cats DB_NAME GETCONF ac_ct_GETCONF X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS LIBOBJS ALLOCA FDLIBS DEBUG DINCLUDE DLIB DB_LIBS WCFLAGS WLDFLAGS OBJLIST hostname TAPEDRIVE PSCMD WIN32 MACOSX DISTNAME DISTVER LTLIBOBJS'
 ac_subst_files='MCOMMON'
 
 # Initialize some variables set by options.
@@ -878,6 +878,10 @@ Optional Packages:
   --with-gnome-libs       Specify location of GNOME libs
   --with-gnome            Specify prefix for GNOME files
  --with-readline=DIR            specify readline library directory
+
+  --with-python=DIR      Include Python support.  DIR is the Python base
+                         install directory, default is to search through
+                         a number of common places for the Python files.
   --with-tcp-wrappers=DIR       enable tcpwrappers support
   --with-working-dir=PATH       specify path of Bacula working directory
   --with-scriptdir=PATH    specify path of Bacula scripts directory
@@ -897,8 +901,8 @@ Optional Packages:
   --with-bimagemgr-docdir=DIR   specify bimagemgr doc root dir
   --with-bimagemgr-binowner=USER   specify bimagemgr binary file owner
   --with-bimagemgr-bingroup=USER   specify bimagemgr binary file group
-  --with-bimagemgr-dataowner=USER   specify bimagemgr data file owner
-  --with-bimagemgr-datagroup=USER   specify bimagemgr data file group
+  --with-bimagemgr-dataowner=USER      specify bimagemgr data file owner
+  --with-bimagemgr-datagroup=USER      specify bimagemgr data file group
   --with-dir-user=USER          specify user for Director daemon
   --with-dir-group=GROUP                specify group for Director daemon
   --with-sd-user=USER           specify user for Storage daemon
@@ -4379,6 +4383,7 @@ support_static_fd=no
 support_static_sd=no
 support_static_dir=no
 support_static_cons=no
+support_python=no
 build_client_only=no
 cats=
 db_name=Internal
@@ -6881,6 +6886,71 @@ done
 # End of readline/conio stuff
 # -----------------------------------------------------------------------
 
+# -----------------------------------------------------------------------
+#  Check for Python support
+#
+echo "$as_me:$LINENO: checking for Python support" >&5
+echo $ECHO_N "checking for Python support... $ECHO_C" >&6
+
+# Check whether --with-python or --without-python was given.
+if test "${with_python+set}" = set; then
+  withval="$with_python"
+
+  PYTHON_INCDIR=.
+  PYTHON_LIBS=
+  if test "$withval" != "no"; then
+     if test "$withval" = "yes"; then
+       if test -f /usr/include/python2.2/Python.h; then
+          PYTHON_INCDIR=/usr/include/python2.2
+          PYTHON_LIBS="-L/usr/lib/python2.2/config -lpython2.2 -lutil -ldl"
+       elif test -f $prefix/include/Python.h; then
+          PYTHON_INCDIR=$prefix/include
+          PYTHON_LIBS="-L$prefix/lib/config -lpython -lutil -ldl"
+       else
+          echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+          { { echo "$as_me:$LINENO: error: Unable to find Python.h in standard locations" >&5
+echo "$as_me: error: Unable to find Python.h in standard locations" >&2;}
+   { (exit 1); exit 1; }; }
+       fi
+     else
+       if test -f $withval/Python.h; then
+          PYTHON_INCDIR=$withval
+          PYTHON_LIBS="-L$withval/config -lpython -lutil -ldl"
+       elif test -f $withval/include/Python.h; then
+          PYTHON_INCDIR=$withval/include
+          PYTHON_LIBS="-L$withval/lib/config -lpython -lutil -ldl"
+       else
+          echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+          { { echo "$as_me:$LINENO: error: Invalid Python directory $withval - unable to find Python.h under $withval" >&5
+echo "$as_me: error: Invalid Python directory $withval - unable to find Python.h under $withval" >&2;}
+   { (exit 1); exit 1; }; }
+       fi
+     fi
+     cat >>confdefs.h <<\_ACEOF
+#define HAVE_PYTHON 1
+_ACEOF
+
+     echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+     support_python=yes
+
+  else
+     echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+  fi
+
+else
+
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+
+fi;
+
+
+
+
 # -------------------------------------------
 # check for cdrecord writer location
 # get scsibus,target,lun
@@ -20121,6 +20191,8 @@ s,@CONS_SRC@,$CONS_SRC,;t t
 s,@CONS_LIBS@,$CONS_LIBS,;t t
 s,@CONS_LDFLAGS@,$CONS_LDFLAGS,;t t
 s,@READLINE_SRC@,$READLINE_SRC,;t t
+s,@PYTHON_LIBS@,$PYTHON_LIBS,;t t
+s,@PYTHON_INCDIR@,$PYTHON_INCDIR,;t t
 s,@CDSTL@,$CDSTL,;t t
 s,@working_dir@,$working_dir,;t t
 s,@scriptdir@,$scriptdir,;t t
@@ -20824,6 +20896,7 @@ Configuration on `date`:
   enable-tray-monitor:       ${support_tray_monitor}
   client-only:               ${build_client_only}
   ACL support:               ${have_acl}
+  Python support:            ${support_python} ${PYTHON_LIBS}
 
   " > config.out
 
@@ -20831,4 +20904,4 @@ cat config.out
 
 # old stuff
 # cweb support:              ${got_cweb} ${CWEB_SRC}
-  # gmp support:                     ${got_gmp} ${GMP_SRC}
+# gmp support:               ${got_gmp} ${GMP_SRC}
index cd24084c5069c6a5a04fa82d5a342ebb46889a6b..4374f63c4ce5adf3974257c8c4844fc879652bc1 100644 (file)
@@ -18,6 +18,8 @@ thisdir = src/dird
 
 DEBUG=@DEBUG@
 
+PYTHON_LIBS = @PYTHON_LIBS@
+
 first_rule: all
 dummy:
 
@@ -68,11 +70,11 @@ all: Makefile bacula-dir @STATIC_DIR@
 
 bacula-dir:  $(SVROBJS) ../lib/libbac.a ../cats/libsql.a ../findlib/libfind.a
        $(CXX) $(WLDFLAGS) $(LDFLAGS) -L../lib -L../cats -L../findlib -o $@ $(SVROBJS) \
-             -lsql -lfind -lbac -lm $(DLIB) $(DB_LIBS) $(LIBS) 
+             -lsql -lfind -lbac -lm $(PYTHON_LIBS) $(DLIB) $(DB_LIBS) $(LIBS)
 
 static-bacula-dir:  $(SVROBJS) ../lib/libbac.a ../cats/libsql.a ../findlib/libfind.a
        $(CXX) $(WLDFLAGS) $(LDFLAGS) -static -L../lib -L../cats -L../findlib -o $@ $(SVROBJS) \
-             -lsql -lbac -lfind -lm $(DLIB) $(DB_LIBS) $(LIBS) 
+             -lsql -lbac -lfind -lm $(PYTHON_LIBS) $(DLIB) $(DB_LIBS) $(LIBS) 
        strip $@
 
 
index 9f74f27d37ad1e60f7665adab6198823cb2f6444..c032ade3047d15ad9d47b491f871a9eebdecf47a 100644 (file)
@@ -223,6 +223,8 @@ int main (int argc, char *argv[])
 
    init_console_msg(working_directory);
 
+   init_python_interpreter(director->hdr.name);
+
    set_thread_concurrency(director->MaxConcurrentJobs * 2 +
       4 /* UA */ + 4 /* sched+watchdog+jobsvr+misc */);
 
index 676d1bcef7e1a77bbaaf62afd9ffefa57804ddc8..57d5413876f54fd7126c7fe936ccf7022bf956a9 100644 (file)
@@ -189,6 +189,7 @@ static void *job_thread(void *arg)
       } else {
 
         /* Run Job */
+         generate_event(jcr, "StartJob");
         if (jcr->job->RunBeforeJob) {
            POOLMEM *before = get_pool_memory(PM_FNAME);
            int status;
@@ -278,6 +279,7 @@ static void *job_thread(void *arg)
               }
            }
         }
+         generate_event(jcr, "EndJob");
         /* Send off any queued messages */
         if (jcr->msg_queue->size() > 0) {
            dequeue_messages(jcr);
index 0863e67014b4ad026b1db2df2060a3c30ae368e9..39f3280abecb4c17b0e06b535a7e21b46688be04 100644 (file)
@@ -57,9 +57,12 @@ bool newVolume(JCR *jcr, MEDIA_DBR *mr)
       if (pr.MaxVols == 0 || pr.NumVols < pr.MaxVols) {
         memset(mr, 0, sizeof(MEDIA_DBR));
         set_pool_dbr_defaults_in_media_dbr(mr, &pr);
+        jcr->VolumeName[0] = 0;
         bstrncpy(mr->MediaType, jcr->store->media_type, sizeof(mr->MediaType));
+         if (generate_event(jcr, "NewVolume") == 1 && jcr->VolumeName[0]) {
+           bstrncpy(mr->VolumeName, jcr->VolumeName, sizeof(mr->VolumeName));
         /* Check for special characters */
-        if (is_volume_name_legal(NULL, pr.LabelFormat)) {
+        } else if (is_volume_name_legal(NULL, pr.LabelFormat)) {
            /* No special characters, so apply simple algorithm */
            if (!create_simple_name(jcr, mr, &pr)) {
               goto bail_out;
index 25084eb0f9b51d92422b872d8afe036ef7bbafff..3a43fe3a49c5b6047815ef6d8f102d3499122d09 100644 (file)
@@ -12,6 +12,8 @@ PDFTEX = pdftex
 XDVI = xdvi
 DVIPS = dvips
 
+python = @PYTHON_INCDIR@
+
 srcdir =       .
 VPATH =        .
 .PATH:         .
@@ -40,7 +42,7 @@ LIBSRCS = alloc.c attr.c base64.c berrno.c bsys.c bget_msg.c \
          queue.c rwlock.c scan.c serial.c sha1.c \
          semlock.c signal.c smartall.c tree.c \
          util.c var.c watchdog.c workq.c btimers.c \
-         address_conf.c
+         address_conf.c python.c 
 
 
 LIBOBJS = alloc.o attr.o base64.o berrno.o bsys.o bget_msg.o \
@@ -52,7 +54,7 @@ LIBOBJS = alloc.o attr.o base64.o berrno.o bsys.o bget_msg.o \
          queue.o rwlock.o scan.o serial.o sha1.o \
          semlock.o signal.o smartall.o tree.o \
          util.o var.o watchdog.o workq.o btimers.o \
-         address_conf.o
+         address_conf.o python.o
 
 
 EXTRAOBJS = @OBJLIST@
@@ -98,6 +100,9 @@ Makefile: $(srcdir)/Makefile.in $(topdir)/config.status
        cd $(topdir) \
          && CONFIG_FILES=$(thisdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
 
+python.o: python.c
+       $(CXX) $(DEFS) $(DEBUG) -c $(WCFLAGS) $(CPPFLAGS) -I$(python) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) $<
+
 rwlock_test:
        rm -f rwlock.o
        $(CXX) -DTEST_RWLOCK $(DEFS) $(DEBUG) -c $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE)  $(CFLAGS) rwlock.c
@@ -144,7 +149,7 @@ depend:
        @$(MV) Makefile Makefile.bak
        @$(SED) "/^# DO NOT DELETE:/,$$ d" Makefile.bak > Makefile
        @$(ECHO) "# DO NOT DELETE: nice dependency list follows" >> Makefile
-       @$(CXX) -S -M $(CPPFLAGS) $(XINC) -I$(srcdir) -I$(basedir) $(SQL_INC) *.c >> Makefile
+       @$(CXX) -S -M $(CPPFLAGS) $(XINC) -I$(python) -I$(srcdir) -I$(basedir) $(SQL_INC) *.c >> Makefile
        @if test -f Makefile ; then \
            $(RMF) Makefile.bak; \
        else \
index bb055f22230ca46bcec00382e0ecb01d16de768c..d859f48c24728f4a3d4cab1dfa8197fe568eb5b1 100644 (file)
 struct JCR;
 
 /* attr.c */
-ATTR     *new_attr();
-void      free_attr(ATTR *attr);
-int       unpack_attributes_record(JCR *jcr, int32_t stream, char *rec, ATTR *attr);
-void      build_attr_output_fnames(JCR *jcr, ATTR *attr);
-void      print_ls_output(JCR *jcr, ATTR *attr);
+ATTR    *new_attr();
+void     free_attr(ATTR *attr);
+int      unpack_attributes_record(JCR *jcr, int32_t stream, char *rec, ATTR *attr);
+void     build_attr_output_fnames(JCR *jcr, ATTR *attr);
+void     print_ls_output(JCR *jcr, ATTR *attr);
 
 /* base64.c */
-void      base64_init            (void);
-int       to_base64              (intmax_t value, char *where);
-int       from_base64            (intmax_t *value, char *where);
-int       bin_to_base64          (char *buf, char *bin, int len);
+void     base64_init            (void);
+int      to_base64              (intmax_t value, char *where);
+int      from_base64            (intmax_t *value, char *where);
+int      bin_to_base64          (char *buf, char *bin, int len);
 
 /* bsys.c */
-char     *bstrncpy               (char *dest, const char *src, int maxlen);
-char     *bstrncpy               (char *dest, POOL_MEM &src, int maxlen);
-char     *bstrncat               (char *dest, const char *src, int maxlen);
-char     *bstrncat               (char *dest, POOL_MEM &src, int maxlen);
-void     *b_malloc               (const char *file, int line, size_t size);
+char    *bstrncpy               (char *dest, const char *src, int maxlen);
+char    *bstrncpy               (char *dest, POOL_MEM &src, int maxlen);
+char    *bstrncat               (char *dest, const char *src, int maxlen);
+char    *bstrncat               (char *dest, POOL_MEM &src, int maxlen);
+void    *b_malloc               (const char *file, int line, size_t size);
 #ifndef DEBUG
-void     *bmalloc                (size_t size);
+void    *bmalloc                (size_t size);
 #endif
-void     *brealloc               (void *buf, size_t size);
-void     *bcalloc                (size_t size1, size_t size2);
-int       bsnprintf              (char *str, int32_t size, const char *format, ...);
-int       bvsnprintf             (char *str, int32_t size, const char *format, va_list ap);
-int       pool_sprintf           (char *pool_buf, const char *fmt, ...);
-void      create_pid_file        (char *dir, const char *progname, int port);
-int       delete_pid_file        (char *dir, const char *progname, int port);
-void      drop                   (char *uid, char *gid);
-int       bmicrosleep            (time_t sec, long usec);
-char     *bfgets                 (char *s, int size, FILE *fd);
-void      make_unique_filename   (POOLMEM **name, int Id, char *what);
+void    *brealloc               (void *buf, size_t size);
+void    *bcalloc                (size_t size1, size_t size2);
+int      bsnprintf              (char *str, int32_t size, const char *format, ...);
+int      bvsnprintf             (char *str, int32_t size, const char *format, va_list ap);
+int      pool_sprintf           (char *pool_buf, const char *fmt, ...);
+void     create_pid_file        (char *dir, const char *progname, int port);
+int      delete_pid_file        (char *dir, const char *progname, int port);
+void     drop                   (char *uid, char *gid);
+int      bmicrosleep            (time_t sec, long usec);
+char    *bfgets                 (char *s, int size, FILE *fd);
+void     make_unique_filename   (POOLMEM **name, int Id, char *what);
 #ifndef HAVE_STRTOLL
-long long int strtoll            (const char *ptr, char **endptr, int base);
+long long int strtoll           (const char *ptr, char **endptr, int base);
 #endif
-void      read_state_file(char *dir, const char *progname, int port);
-int       bstrerror(int errnum, char *buf, size_t bufsiz);
+void     read_state_file(char *dir, const char *progname, int port);
+int      bstrerror(int errnum, char *buf, size_t bufsiz);
 
 /* bnet.c */
-int32_t    bnet_recv             (BSOCK *bsock);
-bool       bnet_send             (BSOCK *bsock);
-bool       bnet_fsend            (BSOCK *bs, const char *fmt, ...);
-bool       bnet_set_buffer_size  (BSOCK *bs, uint32_t size, int rw);
-bool       bnet_sig              (BSOCK *bs, int sig);
-int        bnet_ssl_server       (BSOCK *bsock, char *password, int ssl_need, int ssl_has);
-int        bnet_ssl_client       (BSOCK *bsock, char *password, int ssl_need);
-BSOCK *    bnet_connect            (JCR *jcr, int retry_interval,
-               int max_retry_time, const char *name, char *host, char *service, 
-               int port, int verbose);
-void       bnet_close            (BSOCK *bsock);
-BSOCK *    init_bsock            (JCR *jcr, int sockfd, const char *who, const char *ip, 
-                                  int port, struct sockaddr *client_addr);
-BSOCK *    dup_bsock             (BSOCK *bsock);
-void       term_bsock            (BSOCK *bsock);
-const char *bnet_strerror         (BSOCK *bsock);
-const char *bnet_sig_to_ascii     (BSOCK *bsock);
-int        bnet_wait_data        (BSOCK *bsock, int sec);
-int        bnet_wait_data_intr   (BSOCK *bsock, int sec);
-int        bnet_despool_to_bsock (BSOCK *bsock, void update(ssize_t size), ssize_t size);
-bool       is_bnet_stop          (BSOCK *bsock);
-int        is_bnet_error         (BSOCK *bsock);
-void       bnet_suppress_error_messages(BSOCK *bsock, bool flag);
+int32_t    bnet_recv            (BSOCK *bsock);
+bool      bnet_send             (BSOCK *bsock);
+bool      bnet_fsend            (BSOCK *bs, const char *fmt, ...);
+bool      bnet_set_buffer_size  (BSOCK *bs, uint32_t size, int rw);
+bool      bnet_sig              (BSOCK *bs, int sig);
+int       bnet_ssl_server       (BSOCK *bsock, char *password, int ssl_need, int ssl_has);
+int       bnet_ssl_client       (BSOCK *bsock, char *password, int ssl_need);
+BSOCK *    bnet_connect           (JCR *jcr, int retry_interval,
+              int max_retry_time, const char *name, char *host, char *service, 
+              int port, int verbose);
+void      bnet_close            (BSOCK *bsock);
+BSOCK *    init_bsock           (JCR *jcr, int sockfd, const char *who, const char *ip, 
+                                 int port, struct sockaddr *client_addr);
+BSOCK *    dup_bsock            (BSOCK *bsock);
+void      term_bsock            (BSOCK *bsock);
+const char *bnet_strerror        (BSOCK *bsock);
+const char *bnet_sig_to_ascii    (BSOCK *bsock);
+int       bnet_wait_data        (BSOCK *bsock, int sec);
+int       bnet_wait_data_intr   (BSOCK *bsock, int sec);
+int       bnet_despool_to_bsock (BSOCK *bsock, void update(ssize_t size), ssize_t size);
+bool      is_bnet_stop          (BSOCK *bsock);
+int       is_bnet_error         (BSOCK *bsock);
+void      bnet_suppress_error_messages(BSOCK *bsock, bool flag);
 dlist *bnet_host2ipaddrs(const char *host, int family, const char **errstr);
 
 /* bget_msg.c */
-int      bget_msg(BSOCK *sock);
+int     bget_msg(BSOCK *sock);
 
 /* bpipe.c */
-BPIPE *          open_bpipe(char *prog, int wait, const char *mode);
-int              close_wpipe(BPIPE *bpipe);
-int              close_bpipe(BPIPE *bpipe);
+BPIPE *         open_bpipe(char *prog, int wait, const char *mode);
+int             close_wpipe(BPIPE *bpipe);
+int             close_bpipe(BPIPE *bpipe);
 
 /* cram-md5.c */
 int cram_md5_get_auth(BSOCK *bs, char *password, int ssl_need);
 int cram_md5_auth(BSOCK *bs, char *password, int ssl_need);
 void hmac_md5(uint8_t* text, int text_len, uint8_t*  key,
-              int key_len, uint8_t *hmac);
+             int key_len, uint8_t *hmac);
 
 /* crc32.c */
 
 uint32_t bcrc32(uint8_t *buf, int len);
 
 /* daemon.c */
-void     daemon_start            ();
+void    daemon_start            ();
 
 /* edit.c */
-uint64_t         str_to_uint64(char *str);
-int64_t          str_to_int64(char *str);
-char *           edit_uint64_with_commas   (uint64_t val, char *buf);
-char *           add_commas              (char *val, char *buf);
-char *           edit_uint64             (uint64_t val, char *buf);
-int              duration_to_utime       (char *str, utime_t *value);
-int              size_to_uint64(char *str, int str_len, uint64_t *rtn_value);
-char             *edit_utime             (utime_t val, char *buf, int buf_len);
-bool             is_a_number             (const char *num);
-bool             is_an_integer           (const char *n);
-bool             is_name_valid           (char *name, POOLMEM **msg);
+uint64_t        str_to_uint64(char *str);
+int64_t         str_to_int64(char *str);
+char *          edit_uint64_with_commas   (uint64_t val, char *buf);
+char *          add_commas              (char *val, char *buf);
+char *          edit_uint64             (uint64_t val, char *buf);
+int             duration_to_utime       (char *str, utime_t *value);
+int             size_to_uint64(char *str, int str_len, uint64_t *rtn_value);
+char            *edit_utime             (utime_t val, char *buf, int buf_len);
+bool            is_a_number             (const char *num);
+bool            is_an_integer           (const char *n);
+bool            is_name_valid           (char *name, POOLMEM **msg);
 
 /* jcr.c (most definitions are in src/jcr.h) */
 void init_last_jobs_list();
@@ -136,36 +136,36 @@ void job_end_push(JCR *jcr, void job_end_cb(JCR *jcr,void *), void *ctx);
 
 
 /* lex.c */
-LEX *     lex_close_file         (LEX *lf);
-LEX *     lex_open_file          (LEX *lf, const char *fname, LEX_ERROR_HANDLER *scan_error);
-int       lex_get_char           (LEX *lf);
-void      lex_unget_char         (LEX *lf);
-const char *  lex_tok_to_str     (int token);
-int       lex_get_token          (LEX *lf, int expect);
+LEX *    lex_close_file         (LEX *lf);
+LEX *    lex_open_file          (LEX *lf, const char *fname, LEX_ERROR_HANDLER *scan_error);
+int      lex_get_char           (LEX *lf);
+void     lex_unget_char         (LEX *lf);
+const char *  lex_tok_to_str    (int token);
+int      lex_get_token          (LEX *lf, int expect);
 
 /* message.c */
-void       my_name_is            (int argc, char *argv[], const char *name);
-void       init_msg              (JCR *jcr, MSGS *msg);
-void       term_msg              (void);
-void       close_msg             (JCR *jcr);
-void       add_msg_dest          (MSGS *msg, int dest, int type, char *where, char *dest_code);
-void       rem_msg_dest          (MSGS *msg, int dest, int type, char *where);
-void       Jmsg                  (JCR *jcr, int type, time_t mtime, const char *fmt, ...);
-void       dispatch_message      (JCR *jcr, int type, time_t mtime, char *buf);
-void       init_console_msg      (const char *wd);
-void       free_msgs_res         (MSGS *msgs);
-void       dequeue_messages      (JCR *jcr);
-void       set_trace             (int trace_flag);
-void       set_exit_on_error     (int value);
+void      my_name_is            (int argc, char *argv[], const char *name);
+void      init_msg              (JCR *jcr, MSGS *msg);
+void      term_msg              (void);
+void      close_msg             (JCR *jcr);
+void      add_msg_dest          (MSGS *msg, int dest, int type, char *where, char *dest_code);
+void      rem_msg_dest          (MSGS *msg, int dest, int type, char *where);
+void      Jmsg                  (JCR *jcr, int type, time_t mtime, const char *fmt, ...);
+void      dispatch_message      (JCR *jcr, int type, time_t mtime, char *buf);
+void      init_console_msg      (const char *wd);
+void      free_msgs_res         (MSGS *msgs);
+void      dequeue_messages      (JCR *jcr);
+void      set_trace             (int trace_flag);
+void      set_exit_on_error     (int value);
 
 /* bnet_server.c */
-void       bnet_thread_server(dlist *addr, int max_clients, workq_t *client_wq, 
-                   void *handle_client_request(void *bsock));
-void       bnet_stop_thread_server(pthread_t tid);
-void             bnet_server             (int port, void handle_client_request(BSOCK *bsock));
-int              net_connect             (int port);
-BSOCK *          bnet_bind               (int port);
-BSOCK *          bnet_accept             (BSOCK *bsock, char *who);
+void      bnet_thread_server(dlist *addr, int max_clients, workq_t *client_wq, 
+                  void *handle_client_request(void *bsock));
+void      bnet_stop_thread_server(pthread_t tid);
+void            bnet_server             (int port, void handle_client_request(BSOCK *bsock));
+int             net_connect             (int port);
+BSOCK *         bnet_bind               (int port);
+BSOCK *         bnet_accept             (BSOCK *bsock, char *who);
 
 /* idcache.c */
 char *getuser(uid_t uid);
@@ -173,43 +173,46 @@ void free_getuser_cache();
 char *getgroup (gid_t gid);
 void free_getgroup_cache();
 
+/* python.c */
+void init_python_interpreter(char *progname);
+int generate_event(JCR *jcr, const char *event);
 
 /* signal.c */
-void             init_signals             (void terminate(int sig));
-void             init_stack_dump          (void);
+void            init_signals             (void terminate(int sig));
+void            init_stack_dump          (void);
 
 /* scan.c */
-void             strip_trailing_junk     (char *str);
-void             strip_trailing_slashes  (char *dir);
-bool             skip_spaces             (char **msg);
-bool             skip_nonspaces          (char **msg);
-int              fstrsch                 (const char *a, const char *b);
-char            *next_arg(char **s);
-int              parse_args(POOLMEM *cmd, POOLMEM **args, int *argc, 
-                        char **argk, char **argv, int max_args);
-void            split_path_and_filename(const char *fname, POOLMEM **path, 
-                        int *pnl, POOLMEM **file, int *fnl);
-int             bsscanf(const char *buf, const char *fmt, ...);
+void            strip_trailing_junk     (char *str);
+void            strip_trailing_slashes  (char *dir);
+bool            skip_spaces             (char **msg);
+bool            skip_nonspaces          (char **msg);
+int             fstrsch                 (const char *a, const char *b);
+char           *next_arg(char **s);
+int             parse_args(POOLMEM *cmd, POOLMEM **args, int *argc, 
+                       char **argk, char **argv, int max_args);
+void           split_path_and_filename(const char *fname, POOLMEM **path, 
+                       int *pnl, POOLMEM **file, int *fnl);
+int            bsscanf(const char *buf, const char *fmt, ...);
 
 
 /* util.c */
-int              is_buf_zero             (char *buf, int len);
-void             lcase                   (char *str);
-void             bash_spaces             (char *str);
-void             bash_spaces             (POOL_MEM &pm);
-void             unbash_spaces           (char *str);
-void             unbash_spaces           (POOL_MEM &pm);
-char *           encode_time             (time_t time, char *buf);
-char *           encode_mode             (mode_t mode, char *buf);
-int              do_shell_expansion      (char *name, int name_len);
-void             jobstatus_to_ascii      (int JobStatus, char *msg, int maxlen);
-int              run_program             (char *prog, int wait, POOLMEM *results);
-const char *     job_type_to_str         (int type);
-const char *     job_status_to_str       (int stat);
-const char *     job_level_to_str        (int level);
-void             make_session_key        (char *key, char *seed, int mode);
-POOLMEM         *edit_job_codes(JCR *jcr, char *omsg, char *imsg, const char *to);
-void             set_working_directory(char *wd);
+int             is_buf_zero             (char *buf, int len);
+void            lcase                   (char *str);
+void            bash_spaces             (char *str);
+void            bash_spaces             (POOL_MEM &pm);
+void            unbash_spaces           (char *str);
+void            unbash_spaces           (POOL_MEM &pm);
+char *          encode_time             (time_t time, char *buf);
+char *          encode_mode             (mode_t mode, char *buf);
+int             do_shell_expansion      (char *name, int name_len);
+void            jobstatus_to_ascii      (int JobStatus, char *msg, int maxlen);
+int             run_program             (char *prog, int wait, POOLMEM *results);
+const char *    job_type_to_str         (int type);
+const char *    job_status_to_str       (int stat);
+const char *    job_level_to_str        (int level);
+void            make_session_key        (char *key, char *seed, int mode);
+POOLMEM        *edit_job_codes(JCR *jcr, char *omsg, char *imsg, const char *to);
+void            set_working_directory(char *wd);
 
 
 /* watchdog.c */
diff --git a/bacula/src/lib/python.c b/bacula/src/lib/python.c
new file mode 100644 (file)
index 0000000..aea7ff5
--- /dev/null
@@ -0,0 +1,207 @@
+/*
+
+   Bacula interface to Python
+
+   Kern Sibbald, November MMIV
+   
+   Copyright (C) 2004 Kern Sibbald
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2 of
+   the License, or (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public
+   License along with this program; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+   MA 02111-1307, USA.
+
+ */
+
+#include "bacula.h"
+#include "../dird/dird_conf.h"
+#define DIRECTOR_DAEMON 1
+#include "../cats/cats.h"
+#include "jcr.h"
+
+
+#ifdef HAVE_PYTHON
+#include <Python.h>
+
+bool run_module(const char *module);
+
+static PyObject *bacula_get(PyObject *self, PyObject *args);
+static PyObject *bacula_set(PyObject *self, PyObject *args, PyObject *keyw);
+
+/* Define Bacula entry points */
+static PyMethodDef BaculaMethods[] = {
+    {"get", bacula_get, METH_VARARGS, "Get Bacula variables."},
+    {"set", (PyCFunction)bacula_set, METH_VARARGS|METH_KEYWORDS,
+        "Set Bacula variables."}, 
+    {NULL, NULL, 0, NULL}            /* last item */
+};
+
+
+/* Return Bacula variables */
+static PyObject*
+bacula_get(PyObject *self, PyObject *args)
+{
+   PyObject *CObject;
+   JCR *jcr;
+   char *item;
+   if (!PyArg_ParseTuple(args, "Os:get", &CObject, &item)) {
+      return NULL;
+   }
+   jcr = (JCR *)PyCObject_AsVoidPtr(CObject);
+   /* ***FIXME*** put this in a table */
+   if (strcmp(item, "JobId") == 0) {
+      return Py_BuildValue("i", jcr->JobId);
+   } else if (strcmp(item, "Client") == 0) {
+      return Py_BuildValue("s", jcr->client->hdr.name);
+   } else if (strcmp(item, "Pool") == 0) {
+      return Py_BuildValue("s", jcr->pool->hdr.name);
+   } else if (strcmp(item, "Storage") == 0) {
+      return Py_BuildValue("s", jcr->store->hdr.name);
+   } else if (strcmp(item, "Catalog") == 0) {
+      return Py_BuildValue("s", jcr->catalog->hdr.name);
+   } else if (strcmp(item, "MediaType") == 0) {
+      return Py_BuildValue("s", jcr->store->media_type);
+   } else if (strcmp(item, "NumVols") == 0) {
+      return Py_BuildValue("i", jcr->NumVols);
+   } else if (strcmp(item, "DirName") == 0) {
+      return Py_BuildValue("s", my_name);
+   } else if (strcmp(item, "Level") == 0) {
+      return Py_BuildValue("s", job_level_to_str(jcr->JobLevel));
+   } else if (strcmp(item, "Type") == 0) {
+      return Py_BuildValue("s", job_type_to_str(jcr->JobType));
+   } else if (strcmp(item, "Job") == 0) {
+      return Py_BuildValue("s", jcr->job->hdr.name);
+   } else if (strcmp(item, "JobName") == 0) {
+      return Py_BuildValue("s", jcr->Job);
+   }
+   return NULL;
+}
+
+/* Set Bacula variables */
+static PyObject*                                        
+bacula_set(PyObject *self, PyObject *args, PyObject *keyw)
+{
+   PyObject *CObject;
+   JCR *jcr;
+   char *msg = NULL;
+   char *VolumeName = NULL;
+   static char *kwlist[] = {"jcr", "JobReport", "VolumeName", NULL};
+   if (!PyArg_ParseTupleAndKeywords(args, keyw, "O|ss:set", kwlist, 
+       &CObject, &msg, &VolumeName)) {
+      return NULL;
+   }
+   jcr = (JCR *)PyCObject_AsVoidPtr(CObject);
+   if (msg) {
+      Jmsg(jcr, M_INFO, 0, "%s", msg);
+   }
+   if (VolumeName) {
+      pm_strcpy(jcr->VolumeName, VolumeName);
+   }
+   return Py_BuildValue("i", 1);
+}
+
+
+void init_python_interpreter(char *progname)
+{
+   Py_SetProgramName(progname);
+   Py_Initialize();
+   PyEval_InitThreads();
+   Py_InitModule("bacula", BaculaMethods);
+   PyRun_SimpleString("import sys\n"
+                      "sys.path.append('.')\n");
+   PyEval_ReleaseLock();
+}
+
+void term_python_interpreter()
+{
+   Py_Finalize();
+}
+
+
+/* 
+ * Generate and process a Bacula event by importing a Python
+ *  module and running it.
+ *
+ *  Returns: 0 if Python not configured or module not found
+ *         -1 on Python error
+ *          1 OK
+ */
+int generate_event(JCR *jcr, const char *event)
+{
+   PyObject *pName, *pModule, *pDict, *pFunc;
+   PyObject *pArgs, *pValue;
+
+   pName = PyString_FromString(event);
+   if (!pName) {
+      Jmsg(jcr, M_ERROR, 0, "Could not convert \"%s\" to Python string.\n", event);
+      return -1;                     /* Could not convert string */
+   }
+
+   pModule = PyImport_Import(pName);
+   Py_DECREF(pName);                 /* release pName */
+
+   if (pModule != NULL) {
+      pDict = PyModule_GetDict(pModule);
+      /* pDict is a borrowed reference */
+
+      pFunc = PyDict_GetItemString(pDict, (char *)event);
+      /* pFun: Borrowed reference */
+
+      if (pFunc && PyCallable_Check(pFunc)) {
+         /* Create JCR argument to send to function */
+         pArgs = PyTuple_New(1);
+         pValue = PyCObject_FromVoidPtr((void *)jcr, NULL);
+         if (!pValue) {
+            Py_DECREF(pArgs);
+            Py_DECREF(pModule);
+             Jmsg(jcr, M_ERROR, 0, "Could not convert JCR to Python CObject.\n");
+            return -1;               /* Could not convert JCR to CObject */
+         }
+         /* pValue reference stolen here: */
+         PyTuple_SetItem(pArgs, 0, pValue);
+
+         /* Finally, we call the module here */
+         pValue = PyObject_CallObject(pFunc, pArgs);
+         Py_DECREF(pArgs);
+         if (pValue != NULL) {
+            Py_DECREF(pValue);
+         } else {
+            Py_DECREF(pModule);
+            PyErr_Print();
+             Jmsg(jcr, M_ERROR, 0, "Error running Python module: %s\n", event);
+            return 0;                /* error running function */
+         }
+         /* pDict and pFunc are borrowed and must not be Py_DECREF-ed */
+      } else {
+         Jmsg(jcr, M_ERROR, 0, "Python function \"%s\" not found in module.\n", event);
+        return -1;                   /* function not found */ 
+      }
+      Py_DECREF(pModule);
+   } else {
+      return 0;                      /* Module not present */
+   }
+   return 1;
+}
+
+#else
+
+/*
+ *  No Python configured
+ */
+
+int generate_event(JCR *jcr, const char *event) { return 0; }
+void init_python_interpreter(char *progname) { }
+void term_python_interpreter() { }
+
+
+#endif /* HAVE_PYTHON */