Skip to content
Snippets Groups Projects
Commit c6ff33b1 authored by Edileuton Henrique de Oliveira's avatar Edileuton Henrique de Oliveira
Browse files

Merge branch 'build-env'


Conflicts:
	client/src/Makefile
	collect/network-scripts/collect/use/bandwidth-usage.tree

Signed-off-by: default avatarEdileuton Henrique de Oliveira <eho09@c3sl.ufpr.br>
parents ef3ac993 b626ce38
Branches
No related tags found
No related merge requests found
Showing
with 1139 additions and 17879 deletions
# Copyright (C) 2004-2013 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
#
# This file is part of proinfodata
#
# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
VERSION = 1.4.1
BASE = ..
BUILD = build
PACKAGE = $(BUILD)/SEED2-run
CC = gcc
CFLAGS = -g -O2 -m32 -static -Wall
LDFLAGS = -m32 -static -pthread
WGET_VERSION = 1.13.4
WGET_URL = http://gnu.c3sl.ufpr.br/ftp/wget/wget-$(WGET_VERSION).tar.gz
WGET = wget-$(WGET_VERSION)
BOOTSTRAP_INSTALL_SIZE = $(shell echo $$(( `wc -l bootstraps/bootstrap-install.sh | cut -d' ' -f1` + 1 )))
BOOTSTRAP_UPDATE_SIZE = $(shell echo $$(( `wc -l bootstraps/bootstrap-update.sh | cut -d' ' -f1` + 1 )))
all: proinfodata-$(VERSION)-update.run
install: proinfodata-$(VERSION)-install.run
clean:
@rm -rf $(BUILD)
cd $(BASE)/client; make clean
cd $(BASE)/collect; make clean
#######################
# BUILD WGET
########################
$(BUILD)/$(WGET).tar.gz:
@mkdir -p $(BUILD)
wget -O $@ $(WGET_URL)
$(BUILD)/$(WGET)/.extracted: $(BUILD)/$(WGET).tar.gz
cd $(BUILD); tar xzvf $(WGET).tar.gz
touch $@
$(BUILD)/$(WGET)/Makefile: $(BUILD)/$(WGET)/.extracted
cd $(BUILD)/$(WGET); \
CFLAGS=-m32 ./configure --prefix=$(realpath $(BUILD)) \
--without-ssl --disable-opie --disable-digest \
--disable-ntlm --disable-debug --disable-nls --disable-largefile \
--disable-ipv6 --disable-rpath --disable-iri
$(BUILD)/$(WGET)/src/wget: $(BUILD)/$(WGET)/Makefile
cd $(BUILD)/$(WGET); \
make LDFLAGS=-static
#######################
# BUILD AGENT
#######################
# client
$(BASE)/client/bin/client: $(BASE)/client/Makefile
cd $(BASE)/client; make
# collect
$(BASE)/collect/bin/collect-parser: $(BASE)/collect/Makefile
cd $(BASE)/collect; make
#######################
# BUILD PACKAGES
#######################
$(BUILD)/.package: $(BUILD)/$(WGET)/src/wget $(BASE)/client/bin/client $(BASE)/collect/bin/collect-parser
@mkdir -p "$(PACKAGE)"
cp -a "$(BASE)/collect/inventory.sh" "$(PACKAGE)/"
cp -a "$(BASE)/collect/network-usage.sh" "$(PACKAGE)/"
cp -a "$(BASE)/collect/integrity-checker.sh" "$(PACKAGE)/"
cp -a "$(BASE)/collect/load-config.sh" "$(PACKAGE)/"
cp -a "$(BASE)/collect/extra-tincuca.sh" "$(PACKAGE)/"
cp -a "$(BASE)/collect/rotate-log.sh" "$(PACKAGE)/"
cp -a "$(BASE)/collect/update.sh" "$(PACKAGE)/"
cp -a "$(BASE)/collect/agent.conf" "$(PACKAGE)/"
cp -ar "$(BASE)/collect/bin" "$(PACKAGE)/"
cp -ar "$(BASE)/collect/extra" "$(PACKAGE)/"
cp -ar "$(BASE)/collect/net" "$(PACKAGE)/"
cp -ar "$(BASE)/collect/network-scripts" "$(PACKAGE)/"
cp -ar "$(BASE)/collect/scripts" "$(PACKAGE)/"
@mkdir -p "$(PACKAGE)/client"
cp -a "$(BASE)/client/common.sh" "$(PACKAGE)/client/"
cp -a "$(BASE)/client/run.sh" "$(PACKAGE)/client/"
@mkdir -p "$(PACKAGE)/client/bin"
cp -ar "$(BASE)/client/bin/client" "$(PACKAGE)/client/bin/"
@mkdir -p "$(PACKAGE)/client/conf"
echo "$(VERSION)" > "$(PACKAGE)/client/conf/version"
@if ! test -z $(INEP); then \
echo "$(INEP)" > "$(PACKAGE)/client/conf/inep"; \
fi
cp -a "$(BUILD)/$(WGET)/src/wget" "$(PACKAGE)/bin/"
@touch $@
$(BUILD)/.backedup: $(BUILD)/.package
rm -rf "$(PACKAGE)/.backup"
mkdir -p "$(PACKAGE)/.backup"
cd "$(PACKAGE)"; for file in `find . | grep -v \.backup | grep -v \.md5sum | grep -v '\.$$'`; do \
cp -a --parents "$$file" ".backup/"; \
done
@touch $@
$(BUILD)/.md5summed: $(BUILD)/.backedup
rm -rf "$(PACKAGE)/.md5sum"
mkdir -p "$(PACKAGE)/.md5sum"
cd "$(PACKAGE)"; for dir in `find . -type d | grep -v \.backup | grep -v \.md5sum | grep -v '\.$$'`; do \
mkdir -p ".md5sum/$$dir"; \
done
cd "$(PACKAGE)"; for file in `find . -type f | grep -v \.backup | grep -v \.md5sum | grep -v '\.$$'`; do \
md5sum "$$file" | cut -d' ' -f1 > ".md5sum/$$file"; \
done
@touch $@
proinfodata-$(VERSION)-update.run: $(BUILD)/.md5summed
tar -C $(BUILD) -cvzf $(BUILD)/SEED2-run.tgz SEED2-run
md5sum $(BUILD)/SEED2-run.tgz | awk '{print $$1}' > $(BUILD)/SEED2-run.tgz.md5sum
sed "s/BOOTSTRAP_LINES=/BOOTSTRAP_LINES=$(BOOTSTRAP_UPDATE_SIZE)/g; \
s/FILE=/FILE=\"$@\"/g; \
s/MD5_CHECK=/MD5_CHECK=\"$$(md5sum $(PACKAGE).tgz | awk '{print $$1}')\"/g" \
bootstraps/bootstrap-update.sh > "$@"
cat $(BUILD)/SEED2-run.tgz >> "$@"
proinfodata-$(VERSION)-install.run: $(BUILD)/.md5summed
tar -C $(BUILD) -cvzf $(BUILD)/SEED2.tgz SEED2
md5sum $(BUILD)/SEED2.tgz | awk '{print $$1}' > $(BUILD)/SEED2.tgz.md5sum
sed "s/BOOTSTRAP_LINES=/BOOTSTRAP_LINES=$(BOOTSTRAP_INSTALL_SIZE)/g; \
s/MD5_CHECK=/MD5_CHECK=\"$$(md5sum $(PACKAGE).tgz | awk '{print $$1}')\"/g" \
bootstraps/bootstrap-install.sh > "$@"
cat $(BUILD)/SEED2.tgz >> "$@"
#!/bin/bash
# Copyright (C) 2009-2012 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
#
# This file is part of buildpackage
#
# buildpackage 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
# This is the installation bootstrap
# ------------------------------------------------------------------------------
# This function checks the integrity of the tar package
verify_md5(){
printf "Verificando MD5... " >&3
if [[ ${MD5_CHECK} == $(md5sum ${FILE} | awk '{print $1}') ]] ; then
printf "OK!\n" >&3
else
printf "ERRO: Este pacote está corrompido. %b" \
"Por favor, faça um novo download.\n" >&3
rm -rf "${FILE}" &> /dev/null
exit 4
fi
}
# ------------------------------------------------------------------------------
# This function collects the agent log, data and runs some tests, in case some
# error ocurred during the installation
collect_information(){
printf "\nAlgumas informações referentes ao agente PROINFODATA %b%b%b%b" \
"recém instalado serão coletadas. O resultado da coleta " \
"será armazenado no arquivo temporário \"${LOGFILE}\". Favor " \
"enviar esse arquivo para \"proinfodata@c3sl.ufpr.br\". Assim " \
"a equipe ficará ciente do problema para resolvê-lo.\n\n" >&3
printf "Iniciando coleta das informações (isso pode demorar alguns %b" \
"minutos)... " >&3
printf " Configuration files\n%b" \
" ===================\n\n"
printf "version\n"
cat ${AGENT_DIR}/client/conf/version
printf "proxy\n"
cat ${AGENT_DIR}/client/conf/proxy
printf "inep\n"
cat ${AGENT_DIR}/client/conf/inep
printf "\n\n----------------------------------\n\n"
printf " OS information\n%b" \
" ==============\n\n"
printf "Distro\n"
DISTRO=$(cut -sd ' ' -f1 /etc/issue | head -n 1)
if test -f "/etc/le_version"; then
printf "Linux Educacional $(cat /etc/le_version)\n"
elif test "${DISTRO}" = "Ubuntu" -a -f "/usr/lib/edu/fbedu/tutorial.htm"; then
printf "Linux Educacional\n"
elif test "${DISTRO}" = "Mandriva"; then
head -n 1 /etc/issue
elif test "${DISTRO}" = "Welcome"; then
cut -sd "\\" -f1 /etc/issue | cut -d ' ' -f3-
else
cut -sd "\\" -f1 /etc/issue
fi
printf "Kernel\n"
cut -d " " -f3 /proc/version
printf "\n\n----------------------------------\n\n"
printf " Commands\n%b" \
" ========\n\n"
printf "seed_mec user crontab\n"
crontab -u seed_mec -l
printf "ifconfig\n"
/sbin/ifconfig
printf "route\n"
/sbin/route
printf "Routes test\n"
for interface in $(/sbin/route | grep default | awk '{print $NF}'); do
printf "Tested interface: ${interface}\n"
# Send ICMP ECHO_REQUEST to root server I or J
ping -c 1 -I ${interface} 192.36.148.17
ping -c 1 -I ${interface} 192.58.128.30
done
printf "\n\n----------------------------------\n\n"
printf " seed_mec user files\n%b" \
" ===================\n\n"
ls -lR "${SEED_MEC_HOME}"
printf "\n\n----------------------------------\n\n"
printf " Inventory XML\n%b" \
" =============\n\n"
cat ${AGENT_DIR}/data/collect-data.xml
printf "\n\n----------------------------------\n\n"
printf " run.sh\n%b" \
" ========\n\n"
cat ${AGENT_DIR}/client/run.sh
printf "\n\n----------------------------------\n\n"
printf " agent.sh\n%b" \
" ========\n\n"
cat ${AGENT_DIR}/agent.sh
printf "\n\n----------------------------------\n\n"
printf " Collect agent log\n%b" \
" =================\n\n"
cat ${AGENT_DIR}/log/collect.log
printf "\n\n----------------------------------\n\n"
printf " Web service client log\n%b" \
" ======================\n\n"
cat ${AGENT_DIR}/client/run.log
printf "\n\n----------------------------------\n\n"
printf " TincUCA client log\n%b" \
" ==================\n\n"
cat ${AGENT_DIR}/log/tincucaclient-install.log
printf "\n\n----------------------------------\n\n"
printf "feito!\n\nFavor enviar o arquivo temporário \"${LOGFILE}\"%b%b%b" \
" para \"proinfodata@c3sl.ufpr.br\".\n\n" \
"Em caso de dúvidas, acesse o portal do PROINFODATA:\n" \
"proinfodata.c3sl.ufpr.br\n" >&3
}
# ------------------------------------------------------------------------------
printf "Iniciando instalação do agente PROINFODATA. Tenha certeza de %b%b%b" \
"estar conectado à Internet e executando este arquivo como super-" \
"usuário (root). Além disso, para o agente funcionar é necessário " \
"ter instalado no sistema os pacotes \"cron\" e \"sudo\".\n"
# These variables will be replaced when generating the installation package
MD5_CHECK=
BOOTSTRAP_LINES=
# Set variables
FILE="SEED2.tgz"
PROJECTOR=$(grep "Projetor ProInfo" /etc/issue 2> /dev/null)
UCA_SERVER=$(grep "Metasys School Server" /etc/issue 2> /dev/null)
UCA_CLASSMATE=$(grep "Metasys ClassmatePC" /etc/issue 2> /dev/null)
if test -f "/usr/sbin/projetor" -o -n "${PROJECTOR}"; then
SEED_MEC_HOME="/mnt/conf/seed_mec"
else
SEED_MEC_HOME="/opt/seed_mec"
fi
AGENT_DIR="${SEED_MEC_HOME}/SEED2"
LASTEXEC="${AGENT_DIR}/tmp/lastExec.tmp"
LOGFILE=/tmp/collected-information.log
# Save stdout to file descriptor 3 and redirect all output to $LOGFILE
exec 3>&1 &> ${LOGFILE}
# Check if lastExec.tmp exist then save its content to prevent that
# agent send a inventory more than once per day
if test -f ${LASTEXEC}; then
LASTEXECBACKUP=$(cat ${LASTEXEC})
fi
# Remove any previous installation of the agent
rm -rf "${AGENT_DIR}"
/usr/sbin/userdel -r seed_mec
/usr/sbin/groupdel seed_mec
# Create seed_mec group and exit on error (except by the error of previous
# existence of seed_mec group)
if ! /usr/sbin/groupadd -f seed_mec; then
printf "ERRO: Falha ao criar o grupo seed_mec.\n" >&3
exit 1
fi
# Create the directory path to make sure useradd(1) will be able to create the
# home for seed_mec user
mkdir -p "$(dirname ${SEED_MEC_HOME})"
# This is a temporary skel directory to avoid installing in the default skel
TMPSKEL=$(mktemp -d)
# Create seed_mec user with seed_mec as group, BASH as default shell,
# $SEED_MEC_HOME as home and $TMPSKEL as temporary skel
/usr/sbin/useradd -r -m -g seed_mec -s /bin/bash -d "${SEED_MEC_HOME}" \
-k "${TMPSKEL}" seed_mec
RETVAL=$?
# If an error occurred (return isn't 0), besides the previous existence of
# seed_mec user (return 9, which means the agent will be reinstalled), print an
# error message and exit
if test ${RETVAL} -ne 0 -a ${RETVAL} -ne 9; then
printf "ERRO: Falha ao criar o usuário seed_mec.\n" >&3
exit 2
fi
# Remove the temporary skel, as it isn't needed anymore
rmdir "${TMPSKEL}"
# ------------------------------------------------------------------------------
# Ensure seed_mec's home exists
mkdir -p "${SEED_MEC_HOME}"
# Remove old crontab of seed_mec, in case there's one, avoinding a specific
# error of wrong owner (lack of permissions)
crontab -u seed_mec -r
# Check if this is not an UCA Classmate, UCA Server nor PROINFO Projector, and
# if the line that gives root permission doesn't exist before adding it
if ! test -n "${PROJECTOR}" -o -f "/usr/sbin/projetor" -o \
-f "/etc/cmpc-release" -o -n "${UCA_SERVER}" -o \
-n "${UCA_CLASSMATE}"; then
# Remove any possible line containing a rule for seed_mec user before adding
# root permissions in the sudoers file
TMPFILE=$(mktemp)
sed '/^seed_mec[\t ]*ALL=(ALL/d' /etc/sudoers > "${TMPFILE}"
mv "${TMPFILE}" /etc/sudoers
chmod 440 /etc/sudoers
# Add root permissions to seed_mec user, without the need of password
if ! $(echo -e "seed_mec\tALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers)
then
printf "ERRO: Falha ao adicionar permissões de super-usuário %b" \
"ao usuário seed_mec.\n" >&3
exit 3
fi
fi
# ------------------------------------------------------------------------------
# Uncompress tar package and check its integrity
tail -n +${BOOTSTRAP_LINES} $0 > "${SEED_MEC_HOME}/${FILE}"
cd "${SEED_MEC_HOME}"
verify_md5
# Remove old agent and extract the new one
rm -rf "${AGENT_DIR}" &> /dev/null
tar xzf "${FILE}" &> /dev/null
rm -rf "${FILE}" &> /dev/null
# Change files' owner
if ! chown -R seed_mec:seed_mec "${SEED_MEC_HOME}"; then
rm -rf "${SEED_MEC_HOME}" &> /dev/null
printf "ERRO: Falha ao mudar dono dos arquivos.\n" >&3
exit 5
fi
# ------------------------------------------------------------------------------
# Export a variable to inform the agent that this is its first execution
export FIRST_EXECUTION=1
# Restore lastExec.tmp
if ! test -z ${LASTEXECBACKUP};then
echo ${LASTEXECBACKUP} > ${LASTEXEC}
fi
# Run the agent and check if its execution went alright, exiting in case of
# error
if ! su -c "bash ${AGENT_DIR}/update.sh" seed_mec ||
! su -c "bash ${AGENT_DIR}/inventory.sh" seed_mec; then
printf "ERRO: Falha na execução do novo agente.\n" >&3
collect_information
exit 6
fi
# Restore stdout and close fd 3
exec >&3 3>&-
printf "\nO agente PROINFODATA foi instalado com sucesso. %b%b" \
"Em caso de dúvidas, acesse o portal do PROINFODATA:\n" \
"proinfodata.c3sl.ufpr.br\n"
exit 0
#!/bin/bash
# Copyright (C) 2009-2012 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
#
# This file is part of buildpackage
#
# buildpackage 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
# This is the update bootstrap
# ------------------------------------------------------------------------------
# This function verifies if the package MD5 is correct
verify_md5(){
printf "[SEED2-update] Checking MD5... "
if [[ ${MD5_CHECK} == $(md5sum "${SEED_MEC_HOME}/update/tmp/${FILE}" | \
awk '{print $1}') ]]; then
printf "OK!\n"
else
printf "ERROR: This package is currupted.\n"
rm -rf ${FILE} &> /dev/null
exit 1
fi
}
# ------------------------------------------------------------------------------
# Re-create the inep and proxy's MD5
restore_inep_proxy_md5sum(){
for FILE in inep proxy; do
md5sum "${SEED_MEC_HOME}/SEED2/client/conf/${FILE}" |cut -d' ' -f1 > \
"${SEED_MEC_HOME}/${UPDATE_DIR}/.md5sum/client/conf/${FILE}"
# The backup md5 is the same
cp -a "${SEED_MEC_HOME}/${UPDATE_DIR}/.md5sum/client/conf/${FILE}" \
"${SEED_MEC_HOME}/${UPDATE_DIR}/.md5sum/.backup/client/conf/"
done
}
# ------------------------------------------------------------------------------
# Re-create the inep and proxy files' backup and copy the MD5 files
restore_inep_proxy_backup(){
for FILE in inep proxy; do
# The backup itself
cp -a "${SEED_MEC_HOME}/SEED2/client/conf/${FILE}" \
"${SEED_MEC_HOME}/${UPDATE_DIR}/.backup/client/conf/"
done
}
# ------------------------------------------------------------------------------
# These variables will be replaced while generating the package
FILE=
MD5_CHECK=
BOOTSTRAP_LINES=
if test -n "${HOME}"; then
SEED_MEC_HOME=${HOME}
else
SEED_MEC_HOME=/opt/seed_mec
fi
UPDATE_DIR="update/tmp/SEED2-run"
# ------------------------------------------------------------------------------
# Create auxiliar directories
mkdir -p "${SEED_MEC_HOME}/update/tmp"
mkdir -p "${SEED_MEC_HOME}/update/old"
# Extract the tar package
tail -n +${BOOTSTRAP_LINES} "$0" > "${SEED_MEC_HOME}/update/tmp/${FILE}"
verify_md5
cd "${SEED_MEC_HOME}/update/tmp"
tar xzf "${FILE}" &> /dev/null
cd - &> /dev/null
# ------------------------------------------------------------------------------
# Make sure the directories exist in the update tree to backup the inep and
# proxy files, along with their counterparts (backup and MD5)
mkdir -p "${SEED_MEC_HOME}/update/tmp/SEED2-run/client/conf"
mkdir -p "${SEED_MEC_HOME}/update/tmp/SEED2-run/.md5sum/client/conf"
mkdir -p "${SEED_MEC_HOME}/update/tmp/SEED2-run/.backup/client/conf"
mkdir -p "${SEED_MEC_HOME}/update/tmp/SEED2-run/.md5sum/.backup/client/conf"
# Check if the inep and proxy files exist
ERROR=0
INEP_PROXY="${SEED_MEC_HOME}/SEED2/client/conf/inep
${SEED_MEC_HOME}/SEED2/client/conf/proxy"
for FILE in ${INEP_PROXY}; do
test -f "${FILE}" || ERROR=1
done
# Copy the inep and proxy files. Also, copy their backups and MD5 counterparts,
# if they exist. Otherwise, create them
if test "${ERROR}" -eq 0; then
# Copy inep and proxy to the new tree
cp -a "${SEED_MEC_HOME}/SEED2/client/conf/"{inep,proxy} \
"${SEED_MEC_HOME}/update/tmp/SEED2-run/client/conf/"
# Copy or create the md5 files from inep and proxy
(test -d "${SEED_MEC_HOME}/SEED2/.md5sum" &&
cp -a "${SEED_MEC_HOME}/SEED2/.md5sum/client/conf/"{inep,proxy} \
"${SEED_MEC_HOME}/update/tmp/SEED2-run/.md5sum/client/conf/" &&
cp -a "${SEED_MEC_HOME}/SEED2/.md5sum/.backup/client/conf/"{inep,proxy} \
"${SEED_MEC_HOME}/update/tmp/SEED2-run/.md5sum/.backup/client/conf/") ||
restore_inep_proxy_md5sum
# Copy or create the backup files from inep and proxy
(test -d "${SEED_MEC_HOME}/SEED2/.backup" &&
cp -a "${SEED_MEC_HOME}/SEED2/.backup/client/conf/"{inep,proxy} \
"${SEED_MEC_HOME}/update/tmp/SEED2-run/.backup/client/conf/") ||
restore_inep_proxy_backup
fi
# ------------------------------------------------------------------------------
# TODO: do some security backup???
#cp -ra "${SEED_MEC_HOME}/SEED2/" "${SEED_MEC_HOME}/old/"
# If something interrupts the script here, the tree will not be entirely
# correct, so a file is created to mark that something happened. During the next
# next execution the package will try to recover itself
##### CRITICAL #####
touch "${SEED_MEC_HOME}/SEED2/updating"
# md5sum and backup folders
rm -rf "${SEED_MEC_HOME}/SEED2/.md5sum" \
"${SEED_MEC_HOME}/SEED2/.backup" &> /dev/null
mv -f "${SEED_MEC_HOME}/update/tmp/SEED2-run/"{.md5*,.back*}* \
"${SEED_MEC_HOME}/SEED2/"
# Copy the files themself
rm -rf "${SEED_MEC_HOME}/SEED2/"{bin,lib,net,client,extra,network-scripts,scripts} &> /dev/null
mv -f "${SEED_MEC_HOME}/update/tmp/SEED2-run/"* \
"${SEED_MEC_HOME}/SEED2/"
rm -f "${SEED_MEC_HOME}/SEED2/updating" &> /dev/null
### END CRITICAL ###
# ------------------------------------------------------------------------------
# Remove auxiliar directories
rm -rf "${SEED_MEC_HOME}/update" &> /dev/null
# Call the agent
"${SEED_MEC_HOME}/SEED2/update.sh"
exit 0
#!/bin/bash
set -o errexit
if [ $EUID -ne 0 ]; then
echo "This script must be run as root!" 1>&2
exit 1
fi
###########
## UTILS ##
###########
program=`basename $0`
function confirm() {
while true; do
read -p "$1" yn
# if user didnt input anything, overwrite with default ($2)
case ${yn:-"$2"} in
[Yy]* ) return 0 ;;
[Nn]* ) return 1 ;;
esac
done
}
function usage() {
echo "Usage of ${program}"
exit 1
}
function fatal() {
echo "${program}: ${1:-"unkown fatal error"}" >&2
exit 1
}
function terminate() {
echo
echo "Signal caught, terminating..."
bootstrap_umount
exit 1
}
function warn_mounted() {
echo
echo "The image is mounted. Remember to run '${program} umount' when you finished your work."
}
function is_mounted() {
grep -qs `readlink -f "${img_mount}"` /proc/mounts && return 0
return 1
}
function mount_image() {
if ! is_mounted; then
mkdir -p "${img_mount}"
mount -o loop "${img_file}" "${img_mount}"
#if [ ! -d "${build_home}" ]; then
# mkdir -p "${build_home}"
# chown "${orig_uid}:${orig_gid}" "${build_home}"
#fi
[ -d "${img_mount}/home/user/proinfo" ] && mount -o bind "${build_home}" \
"${img_mount}/home/user/proinfo"
mkdir -p "${img_mount}/dev" && mount -o bind /dev "${img_mount}/dev"
mkdir -p "${img_mount}/proc" && mount -t proc -o nosuid,nodev,noexec proc "${img_mount}/proc"
mkdir -p "${img_mount}/dev/pts" && mount -t devpts -o nosuid,noexec,gid=5,mode=620 devpts "${img_mount}/dev/pts"
mkdir -p "${img_mount}/sys" && mount -t sysfs -o nosuid,nodev,noexec sysfs "${img_mount}/sys"
mkdir -p "${img_mount}/run" && mount -t tmpfs -o nosuid,nodev,mode=755 tmpfs "${img_mount}/run"
mkdir -p "${img_mount}/tmp" && mount -t tmpfs -o nodev,nosuid tmpfs "${img_mount}/tmp"
mkdir -p "${img_mount}/etc"
cp "${img_mount}/proc/mounts" "${img_mount}/etc/mtab"
cp /etc/hosts "${img_mount}/etc/hosts"
cp /etc/resolv.conf "${img_mount}/etc/resolv.conf"
fi
}
function umount_image() {
if is_mounted; then
set +e
[ -d "${img_mount}/home/user/proinfo" ] && umount "${img_mount}/home/user/proinfo"
[ -d "${img_mount}/tmp" ] && umount "${img_mount}/tmp"
[ -d "${img_mount}/run" ] && umount "${img_mount}/run"
[ -d "${img_mount}/sys" ] && umount "${img_mount}/sys"
[ -d "${img_mount}/dev/pts" ] && umount "${img_mount}/dev/pts"
[ -d "${img_mount}/proc" ] && umount "${img_mount}/proc"
[ -d "${img_mount}/dev" ] && umount "${img_mount}/dev"
set -e
umount ${img_mount}
fi
}
########################
## BOOTSTRAP COMMANDS ##
########################
function bootstrap_help() {
echo "HELP"
}
function bootstrap_mount() {
mount_image
warn_mounted
}
function bootstrap_umount() {
umount_image
}
function bootstrap_create() {
local fromscratch=1
if [ -f "${img_file}" ]; then
confirm "Image file ${img_file} already exists, overwrite? [y/N] " "n" || return
if [ "$(stat -c%s ${img_file})" -eq "$((img_size*1048576))" ]; then
fromscratch=0
fi
fi
if is_mounted; then
confirm "The image is mounted, unmount? [Y/n] " "y" || return
umount_image
fi
if [ $fromscratch -eq 1 ]; then
echo "Creating empty image file..."
dd if=/dev/zero of="${img_file}" bs=1M count="${img_size}" 2>/dev/null
fi
echo "Create filesystem (ext2)..."
mke2fs -Fq "${img_file}"
echo "Mounting..."
mkdir -p "${img_mount}"
mount -o loop "${img_file}" "${img_mount}"
echo "Installing base Debian packages..."
debootstrap --variant=buildd --arch=i386 squeeze "${img_mount}" "${mirror_url}"
echo "Remounting..."
umount "${img_mount}"
mount_image
echo "Creating user..."
if [ -z "${orig_uid}" ]; then
orig_uid=1000
read -p "Not a suitable user, please enter your user ID [1000]: " orig_uid
fi
if confirm "Create user with UID=${orig_uid}? [Y/n]" "y"; then
chroot "${img_mount}" /usr/sbin/groupadd --force usergroup
chroot "${img_mount}" /usr/sbin/useradd --home-dir /home/user --no-create-home \
--gid usergroup --uid "${orig_uid}" --shell /bin/bash user
mkdir -p "${img_mount}/home/user/proinfo"
chroot "${img_mount}" /bin/chown --recursive "${orig_uid}:usergroup" /home/user
fi
echo "Unmounting..."
umount_image
echo
echo "Image created. Mount it with '${program} mount'."
}
function bootstrap_update() {
echo "NOTE: You should NOT update any package in order to build the binaries."
echo " Updating packages defeat the purpouse of the bootstrap-build system."
confirm "Do you really want to update? [y/N] " "n" || return
automount=false
if ! is_mounted; then
cofirm "The image is not mounted. Mount it? [Y/n] " "y" || return
automount=true
mount_image
fi
chroot "${img_mount}" /usr/bin/apt-get update
chroot "${img_mount}" /usr/bin/apt-get upgrade
$automount && warn_mounted
}
function bootstrap_shell() {
automount=false
if ! is_mounted; then
confirm "The image is not mounted. Mount it? [Y/n] " "y" || return
automount=true
mount_image
fi
chroot "${img_mount}" /bin/bash -l
$automount && warn_mounted
}
##########
## MAIN ##
##########
# default values fot parameters
build_home=..
img_size=1024
mirror_url="http://debian.c3sl.ufpr.br/debian"
no_confirm=0
passwd=$(getent passwd `logname`)
orig_uid=$(echo $passwd | awk -F':' '{print $3}')
orig_gid=$(echo $passwd | awk -F':' '{print $4}')
trap "terminate" SIGHUP SIGINT SIGTERM
long_opts="mirror:,img-size:,build-path:,noconfirm,help"
short_opts="m:h"
set -- `getopt --name $0 --unquoted --longoptions="${long_opts}" "${short_opts}" "$@"` || usage
[ $# -eq 0 ] && usage
while [ $# -gt 0 ]
do
case "$1" in
--mirror|-m) mirror_url="$2"; shift ;;
--img-size) img_size="$2"; shift ;;
--build-home) build_home="$2"; shift ;;
--noconfirm) no_confirm=1; shift ;;
--help|-h) bootstrap_help; exit 0; ;;
--) shift; break ;;
-*) usage ;;
*) break ;;
esac
shift
done
img_file="proinfodata-bootstrap.img"
img_mount=".root"
if [ $# -lt 1 ]; then
echo "No command specified." >&2
bootstrap_help
exit 1
fi
cmd=$1
shift
case $cmd in
help) bootstrap_help $* ;;
create) bootstrap_create $* ;;
mount) bootstrap_mount $* ;;
umount) bootstrap_umount $* ;;
update) bootstrap_update $* ;;
shell) bootstrap_shell $* ;;
*)
echo "Invalid command specified: '$cmd'" >&2
exit 1
;;
esac
exit 0
vim
bison
wget
flex
libssl-dev
SRCDIR = ./src
LIBDIR = ./lib
ELIBDIR = $(PWD)/lib
TOPDIR = ..
# Copyright (C) 2004-2013 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
#
# This file is part of proinfodata
#
# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
RUN = run.sh
BUILD = build
all:
@cd $(LIBDIR) && make all
SRCDIR = src
install: lib-install client
CC = gcc
CFLAGS = -m32 -static -Wall -I$(SRCDIR) -I$(BUILD)/include
LDFLAGS = -m32 -static -pthread
lib-install:
@cd $(LIBDIR) && make install
GSOAPVER = 2.7
GSOAPREL = 15
GSOAPURL = http://hivelocity.dl.sourceforge.net/project/gsoap2/gSOAP/gSOAP%20$(GSOAPVER).$(GSOAPREL)%20stable/gsoap_$(GSOAPVER).$(GSOAPREL).tar.gz
#GSOAPURL = http://ufpr.dl.sourceforge.net/project/gsoap2/gSOAP/gSOAP%20$(GSOAPVER).$(GSOAPREL)%20stable/gsoap_$(GSOAPVER).$(GSOAPREL).tar.gz
GSOAP = gsoap-$(GSOAPVER)
client:
@cd $(SRCDIR) && make install
@./run-config.sh
@chmod a+x $(RUN)
WSNAME = Seed2
WSURL = http://seed.c3sl.ufpr.br/tomcat/axis/$(WSNAME).jws?wsdl
win:
@cd $(LIBDIR) && make win
@cd $(SRCDIR) && make win
.PHONY: all
all: bin/client
.PHONY: clean
clean:
@cd $(SRCDIR) && make clean
@cd $(LIBDIR) && make clean
@rm -rf $(BUILD)
@rm -rf bin/client
distclean:
@cd $(LIBDIR) && make distclean
@cd $(SRCDIR) && make distclean
@rm -f run.log $(RUN)
#########
# gsoap #
#########
$(BUILD)/$(GSOAP).tar.gz:
@mkdir -p $(BUILD)
wget -O $@ $(GSOAPURL)
$(BUILD)/$(GSOAP)/.extracted: $(BUILD)/$(GSOAP).tar.gz
cd $(BUILD); tar xzvf $(GSOAP).tar.gz
@touch $@
$(BUILD)/$(GSOAP)/.patched: $(BUILD)/$(GSOAP)/.extracted
patch -d $(BUILD)/$(GSOAP) -p0 < stdsoap2.patch
@touch $@
$(BUILD)/$(GSOAP)/Makefile: $(BUILD)/$(GSOAP)/.patched
cd $(BUILD)/$(GSOAP); \
./configure --prefix=$(realpath $(BUILD)) CFLAGS="-m32 -static"
$(BUILD)/bin/wsdl2h: $(BUILD)/$(GSOAP)/Makefile
cd $(BUILD)/$(GSOAP); \
make; \
make install
#########################
# client #
#########################
$(BUILD)/$(WSNAME).wsdl:
@mkdir -p $(BUILD)
wget -O $@ $(WSURL)
$(BUILD)/wsclient.h: $(BUILD)/bin/wsdl2h $(BUILD)/$(WSNAME).wsdl
$(BUILD)/bin/wsdl2h -c -o $@ $(BUILD)/$(WSNAME).wsdl
$(BUILD)/soapC.c: $(BUILD)/wsclient.h
$(BUILD)/bin/soapcpp2 -d $(BUILD) -C -w -x $(BUILD)/wsclient.h
$(BUILD)/soapC.o: $(BUILD)/soapC.c
$(CC) -o $@ -I$(BUILD) $(CFLAGS) -c $<
$(BUILD)/soapClient.o: $(BUILD)/soapClient.c
$(CC) -o $@ -I$(BUILD) $(CFLAGS) -c $<
$(BUILD)/client.o: $(SRCDIR)/client.c $(BUILD)/soapC.o $(BUILD)/soapClient.o
$(CC) -o $@ -I$(BUILD) $(CFLAGS) -c $<
bin/client: $(BUILD)/client.o $(BUILD)/soapC.o $(BUILD)/soapClient.o $(BUILD)/lib/libgsoap.a
@mkdir -p bin
$(CC) -o $@ $(LDFLAGS) $^
1.4.0
LIBDIR = .
LIBGSOAPVER = 2.7
LIBGSOAPSVER = 15
LIBGSOAPDIR = gsoap-$(LIBGSOAPVER)
LIBGSOAP = gsoap
GSOAPDOWNLOADLINK = http://downloads.sourceforge.net/project/gsoap2/gSOAP/gSOAP%20$(LIBGSOAPVER).$(LIBGSOAPSVER)%20stable/gsoap_$(LIBGSOAPVER).$(LIBGSOAPSVER).tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fgsoap2%2Ffiles%2FgSOAP%2FgSOAP%2520$(LIBGSOAPVER).$(LIBGSOAPSVER)%2520stable%2F&ts=1320059439&use_mirror=ufpr
all: soap
win:
@wget -F "$(GSOAPDOWNLOADLINK)" -O "$(LIBGSOAP)_$(LIBGSOAPVER).$(LIBGSOAPSVER).tar.gz"
@tar xzf $(LIBGSOAP)_$(LIBGSOAPVER).$(LIBGSOAPSVER).tar.gz
soap:
@if ! test -d "$(LIBDIR)/$(LIBGSOAPDIR)"; then\
wget -nc "$(GSOAPDOWNLOADLINK)" -O "$(LIBGSOAP)_$(LIBGSOAPVER).$(LIBGSOAPSVER).tar.gz";\
tar xzf $(LIBGSOAP)_$(LIBGSOAPVER).$(LIBGSOAPSVER).tar.gz;\
echo "Installing gSOAP library, wait...";\
cp -f stdsoap2.? $(LIBDIR)/$(LIBGSOAPDIR)/${LIBGSOAP}/;\
cd $(LIBDIR)/$(LIBGSOAPDIR) && ./configure -q --prefix=$(PWD)/$(LIBGSOAP) && make;\
elif test -d "$(LIBDIR)/$(LIBGSOAPDIR)"; then\
echo "Packages already downloaded";\
fi
install:
@if ! test -d $(LIBGSOAP); then\
cd $(LIBDIR)/$(LIBGSOAPDIR) && make install;\
elif test -d $(LIBGSOAP); then\
echo "Packages already installed";\
fi
clean:
@cd $(LIBDIR)/$(LIBGSOAPDIR) && make clean
distclean:
@cd $(LIBDIR)/$(LIBGSOAPDIR) && make distclean
@rm -rf $(LIBGSOAP) $(LIBGSOAPDIR)
@rm -f *.tar.gz
This diff is collapsed.
This diff is collapsed.
#!/bin/bash
# Create run.sh file
# Copyright (C) 2009-2012 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
#
# This file is part of client
#
# client 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
cat > run.sh << 'EOF'
#!/bin/bash
# run.sh
# Copyright (C) 2009-2012 Centro de Computacao Cientifica e Software Livre
......@@ -98,4 +74,3 @@ else
echo "ERROR: run.sh call: wrong parameter (\"$1\")." >> ${log}
exit 102
fi
EOF
CC = gcc
WINCC= i686-w64-mingw32-gcc
LIBGSOAP = gsoap
LIBGSOAPVER = 2.7
TOPDIR = ..
BINDIR = $(TOPDIR)/bin
LIBDIR = $(TOPDIR)/lib
LIBGSOAPDIR = $(LIBDIR)/$(LIBGSOAP)
LIBGSOAPBIN = $(LIBGSOAPDIR)/bin
LIBGSOAPINC = $(LIBGSOAPDIR)/include
LIBGSOAPBINWIN = $(LIBDIR)/$(LIBGSOAP)-$(LIBGSOAPVER)/$(LIBGSOAP)/bin/win32
CCFLAGS = -g -Wall -m32 -static
WINCCFLAGS = -lws2_32
WSCLIENTH = wsclient.h
CDEP = client.c soapC.c soapClient.c stdsoap2.c
BIN = client
WINBIN = client.exe
WSSERVER = Seed2
PUSER =
PPASSWD =
URL = http://seed.c3sl.ufpr.br/tomcat/axis/$(WSSERVER).jws?wsdl
all: install
win: wsdl_win soap_win
@mkdir -p $(BINDIR)
@ln -sf $(LIBDIR)/stdsoap2.h stdsoap2.h
@ln -sf $(LIBDIR)/stdsoap2.c stdsoap2.c
@$(WINCC) $(CCFLAGS) -o $(BINDIR)/$(WINBIN) $(CDEP) $(WINCCFLAGS)
soap_win:
@wine $(LIBGSOAPBINWIN)/soapcpp2.exe -C -w -x $(WSCLIENTH)
wsdl_win:
@if ! test -f $(WSSERVER).wsdl; then \
wget $(URL) -O $(WSSERVER).wsdl; \
fi
@wine $(LIBGSOAPBINWIN)/wsdl2h.exe -c -o $(WSCLIENTH) $(WSSERVER).wsdl
install: client_dep
@mkdir -p $(BINDIR)
@ln -sf $(LIBDIR)/$(LIBGSOAP)-$(LIBGSOAPVER)/$(LIBGSOAP)/stdsoap2.h stdsoap2.h
@ln -sf $(LIBDIR)/$(LIBGSOAP)-$(LIBGSOAPVER)/$(LIBGSOAP)/stdsoap2.c stdsoap2.c
@$(CC) $(CCFLAGS) -o $(BINDIR)/$(BIN) $(CDEP)
client_dep: wsdl soap
# @wget $(URL) --proxy-user=$(PUSER) --proxy-password=$(PPASSWD) --output-document=$(WSSERVER).wsdl
wsdl:
@wget $(URL) --proxy-user=$(PUSER) --proxy-password=$(PPASSWD) -O $(WSSERVER).wsdl
@$(LIBGSOAPBIN)/wsdl2h -c -o $(WSCLIENTH) $(WSSERVER).wsdl
soap:
@$(LIBGSOAPBIN)/soapcpp2 -C -w -x $(WSCLIENTH)
clean:
@find . \( -name '*~' -o -name '*.o' -o -name '*.bak' -o -name 'core*' \) -exec rm -f {} \;
distclean:
@find . \( -name '*.o' -o -name '*~' -o -name '*.bak' -o -name 'core*' \) -exec rm -f {} \;
@rm -rf $(WSSERVER)* soap* $(WSCLIENTH) stdsoap* $(BINDIR)
--- gsoap/stdsoap2.c 2009-11-07 18:07:06.000000000 -0200
+++ gsoap/stdsoap2.c 2013-02-16 04:24:46.355904609 -0200
@@ -3277,6 +3277,10 @@
soap->omode &= ~SOAP_IO_UDP; /* to force close the socket */
soap->keep_alive = 0; /* to force close the socket */
soap_closesock(soap);
+
+ if (soap->device)
+ free(soap->device);
+
#ifdef WITH_COOKIES
soap_free_cookies(soap);
#endif
@@ -3575,9 +3579,38 @@
#ifndef WITH_LEAN
if ((soap->omode & SOAP_IO_UDP))
fd = socket(AF_INET, SOCK_DGRAM, 0);
- else
+ else {
#endif
fd = socket(AF_INET, SOCK_STREAM, 0);
+
+#ifndef WIN32
+ if (soap->device)
+ { struct ifreq ifr;
+ struct sockaddr_in addr;
+ memset(&ifr, 0, sizeof(struct ifreq));
+ memcpy(ifr.ifr_name, soap->device, IFNAMSIZ);
+ /* Obtain the address of the network interface */
+ if (ioctl(fd, SIOCGIFADDR, &ifr) < 0)
+ { soap_set_sender_error(soap, tcp_error(soap), "failed to obtain the specified device address in tcp_connect()", NIC_ERROR);
+ soap->fclosesocket(soap, fd);
+ return SOAP_INVALID_SOCKET;
+ }
+ memset(&addr, 0, sizeof(struct sockaddr_in));
+ addr.sin_family = AF_INET;
+ addr.sin_addr = ((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr;
+ addr.sin_port = htons(0);
+ /* Bind the socket to the specific network interface */
+ if (bind(fd, (struct sockaddr *) &addr, sizeof(addr)) < 0)
+ { soap_set_sender_error(soap, tcp_error(soap), "bind to the specified device failed in tcp_connect()", NIC_ERROR);
+ soap->fclosesocket(soap, fd);
+ return SOAP_INVALID_SOCKET;
+ }
+ }
+#endif
+#ifndef WITH_LEAN
+ }
+#endif
+
#endif
if (!soap_valid_socket(fd))
{
@@ -4018,7 +4051,12 @@
{ X509_EXTENSION *ext = X509_get_ext(peer, i);
const char *ext_str = OBJ_nid2sn(OBJ_obj2nid(X509_EXTENSION_get_object(ext)));
if (ext_str && !strcmp(ext_str, "subjectAltName"))
- { X509V3_EXT_METHOD *meth = X509V3_EXT_get(ext);
+ {
+#if (OPENSSL_VERSION_NUMBER >= 0x10000000L)
+ const X509V3_EXT_METHOD *meth = X509V3_EXT_get(ext);
+#else
+ X509V3_EXT_METHOD *meth = X509V3_EXT_get(ext);
+#endif
void *ext_data;
#if (OPENSSL_VERSION_NUMBER >= 0x0090800fL)
const unsigned char *data;
--- gsoap/stdsoap2.h 2009-11-07 18:07:06.000000000 -0200
+++ gsoap/stdsoap2.h 2013-02-16 04:20:10.874063689 -0200
@@ -51,6 +51,12 @@
--------------------------------------------------------------------------------
*/
+#ifndef WIN32
+# include <sys/ioctl.h>
+# include <net/if.h>
+# include <linux/sockios.h>
+#endif
+
#ifdef WITH_SOAPDEFS_H
# include "soapdefs.h" /* include user-defined stuff */
#endif
@@ -1056,6 +1062,7 @@
#define SOAP_OCCURS 44
#define SOAP_LENGTH 45
#define SOAP_FD_EXCEEDED 46
+#define NIC_ERROR 50
#define soap_xml_error_check(e) ((e) == SOAP_TAG_MISMATCH || (e) == SOAP_NO_TAG || (e) == SOAP_SYNTAX_ERROR || (e) == SOAP_NAMESPACE || (e) == SOAP_DUPLICATE_ID || (e) == SOAP_MISSING_ID || (e) == SOAP_REQUIRED || (e) == SOAP_PROHIBITED || (e) == SOAP_OCCURS || (e) == SOAP_LENGTH || (e) == SOAP_NULL || (e) == SOAP_HREF)
#define soap_soap_error_check(e) ((e) == SOAP_CLI_FAULT || (e) == SOAP_SVR_FAULT || (e) == SOAP_VERSIONMISMATCH || (e) == SOAP_MUSTUNDERSTAND || (e) == SOAP_FAULT || (e) == SOAP_NO_METHOD)
@@ -1604,6 +1611,7 @@
struct SOAP_STD_API soap
{ short state; /* 0 = uninitialized, 1 = initialized, 2 = copy of another soap struct */
short version; /* 1 = SOAP1.1 and 2 = SOAP1.2 (set automatically from namespace URI in nsmap table) */
+ char *device; /* points to the name of the device to which a client must bind */
soap_mode mode;
soap_mode imode;
soap_mode omode;
--- gsoap/stdsoap2.cpp 2010-04-06 18:23:14.000000000 +0200
+++ gsoap/stdsoap2.cpp 2010-04-13 09:56:31.708062760 +0200
@@ -3998,7 +3998,12 @@ again:
{ X509_EXTENSION *ext = X509_get_ext(peer, i);
const char *ext_str = OBJ_nid2sn(OBJ_obj2nid(X509_EXTENSION_get_object(ext)));
if (ext_str && !strcmp(ext_str, "subjectAltName"))
- { X509V3_EXT_METHOD *meth = X509V3_EXT_get(ext);
+ {
+#if (OPENSSL_VERSION_NUMBER >= 0x10000000L)
+ const X509V3_EXT_METHOD *meth = X509V3_EXT_get(ext);
+#else
+ X509V3_EXT_METHOD *meth = X509V3_EXT_get(ext);
+#endif
void *ext_data;
#if (OPENSSL_VERSION_NUMBER >= 0x0090800fL)
const unsigned char *data;
# Copyright (C) 2004-2013 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
#
# This file is part of proinfodata
#
# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
TOPDIR = .
SRCDIR = $(TOPDIR)/src
BUILD = build
LIBDIR = $(TOPDIR)/lib
BINDIR = bin
LIBXMLDIR = lib
SRCDIR = src
all:
cd $(LIBDIR) && make all
cd $(SRCDIR) && make all
CC = gcc
CFLAGS = -m32 -static -Wall -I$(SRCDIR) -I$(BUILD)/include
LDFLAGS = -m32 -static -pthread
collect-parser:
cd $(SRCDIR) && make all
LIBXMLVER = 2.7
LIBXMLREL = 8
LIBXMLURL = ftp://xmlsoft.org/libxml2/libxml2-$(LIBXMLVER).$(LIBXMLREL).tar.gz
LIBXML = libxml2-$(LIBXMLVER).$(LIBXMLREL)
install: all
@cd $(LIBDIR) && make install
@cd $(SRCDIR) && make install
@echo "Setting variables in agent.conf..."
@grep -v "XMLPARSER=" agent.conf > temp.conf\
&& cat temp.conf > agent.conf && rm -f temp.conf
@echo XMLPARSER=$$\{PREFIX\}/$(BINDIR)/collect-parser >> agent.conf
.PHONY: all
all: bin/collect-parser
.PHONY: clean
clean:
cd $(LIBDIR) && make clean
cd $(SRCDIR) && make clean
@rm -rf $(BUILD)
@rm -rf bin/collect-parser
distclean:
cd $(LIBDIR) && make distclean
cd $(SRCDIR) && make distclean
###########
# libxml2 #
###########
$(BUILD)/$(LIBXML).tar.gz:
@mkdir -p $(BUILD)
wget -O $@ $(LIBXMLURL)
$(BUILD)/$(LIBXML)/.extracted: $(BUILD)/$(LIBXML).tar.gz
cd $(BUILD); tar xzvf $(LIBXML).tar.gz
touch $@
$(BUILD)/$(LIBXML)/Makefile: $(BUILD)/$(LIBXML)/.extracted
cd $(BUILD)/$(LIBXML); \
./configure --with-minimum --with-writer --with-tree --prefix=$(realpath $(BUILD)) CFLAGS="-m32 -static"
$(BUILD)/lib/libxml2.a: $(BUILD)/$(LIBXML)/Makefile
cd $(BUILD)/$(LIBXML); \
make; \
make install
##################
# collect-parser #
##################
$(BUILD)/collect-parser.o: $(SRCDIR)/collect-parser.c $(BUILD)/lib/libxml2.a
$(CC) -o $@ -I$(BUILD)/include/libxml2 $(CFLAGS) -c $<
bin/collect-parser: $(BUILD)/collect-parser.o $(BUILD)/lib/libxml2.a
@mkdir -p bin
$(CC) -o $@ $(LDFLAGS) $^
LIBDIR = .
LIBXMLVER = 2.7.8
LIBXMLDIR = libxml2-$(LIBXMLVER)
LIBXML = libxml2
LIBINSTDIR = $(PWD)/lib
LIBINSTINC = $(PWD)/include
all: xml
xml:
@test -f "$(PWD)/$(LIBXML)-$(LIBXMLVER).tar.gz" ||\
wget ftp://xmlsoft.org/libxml2/$(LIBXMLDIR).tar.gz
@if ! test -d "$(LIBDIR)/$(LIBXMLDIR)"; then\
tar xzf $(LIBXML)-$(LIBXMLVER).tar.gz;\
cd $(LIBDIR)/$(LIBXMLDIR);\
./configure --with-minimum --with-writer --with-tree --prefix=$(PWD)/$(LIBXML) CFLAGS="-m32 -static" && make all && make install;\
fi
install: all
@if ! test -d "$(LIBINSTDIR)"; then\
mv $(PWD)/$(LIBXML)/include $(PWD)/;\
mkdir $(LIBINSTDIR);\
mv $(PWD)/$(LIBXML)/lib/$(LIBXML).a $(LIBINSTDIR);\
rm -r $(PWD)/$(LIBXML)-$(LIBXMLVER).tar.gz $(PWD)/$(LIBXML)\
$(PWD)/$(LIBXMLDIR);\
fi
clean:
@find $(PWD) -type f \( -name '*~' -o -name '*.bak' -o -name 'core*' \)\
-exec rm -f {} \;
distclean:
@rm -rf $(LIBXML) $(LIBXMLDIR) $(LIBINSTDIR) $(LIBINSTINC)
@find $(PWD) -type f \( -name '*~' -o -name '*.bak' -o -name 'core*' \)\
-exec rm -f {} \;
@rm -f *.tar.gz
......@@ -66,7 +66,7 @@ function clientExec()
# ------------------------------------------------------------------------------
export PREFIX="$(dirname $(readlink -f $0))"
source ${PREFIX}/load-config.sh || exit 1
PREVIOUS_TRAFFIC="${PREFIX}/net/previous-traffic.txt"
PREVIOUS_TRAFFIC="${PREFIX}/net/previous"
exec >> ${LOGFILE} 2>&1
......@@ -82,7 +82,7 @@ fi
# Collect and send system data if elapsed enough time or if it's the first
# execution of the agent
if elapsedTime && test -s "${PREVIOUS_TRAFFIC}"; then
if elapsedTime && test -d "${PREVIOUS_TRAFFIC}"; then
if test -z "${NETXMLFILENAME}"; then
printf "ERROR: Net XML filename not defined at configuration file.\n"
exit 3
......@@ -107,6 +107,9 @@ if elapsedTime && test -s "${PREVIOUS_TRAFFIC}"; then
exit 6
fi
# Remove data already sent
rm -rf ${PREVIOUS_TRAFFIC}
# Record the current execution time to be used by elapsedTime()
date +%s > ${NETLASTEXEC}
fi
......
CC= gcc
TOPDIR = ..
LIBXML := $(shell test -d "$(TOPDIR)/lib/libxml2" && echo libxml2)
BINDIR = $(TOPDIR)/bin
LIBDIR = $(TOPDIR)/lib
XMLDIR = $(LIBDIR)/$(LIBXML)
INCXMLDIR = $(XMLDIR)/include
LIBXMLDIR = $(XMLDIR)/lib
RELNANO = 1.1
CCFLAGS = -m32 -static -g -Wall -I$(INCXMLDIR)/libxml2 -pthread -L$(LIBXMLDIR) -lxml2
OBJ = collect-parser.o
BIN = collect-parser
all: $(OBJ)
$(CC) $(CCFLAGS) $(OBJ) $(LIBXMLDIR)/libxml2.a -o $(PWD)/$(BIN)
install: all
@mkdir -p $(BINDIR)
@mv -f $(PWD)/$(BIN) $(BINDIR)/$(BIN)
collect-parser.o: collect-parser.c
$(CC) $(CCFLAGS) -c collect-parser.c
clean:
@find $(PWD) -type f \( -name '*~' -o -name '*.bak' -o -name 'core*' \)\
-exec rm -f {} \;
distclean:
@find $(PWD) -type f \( -name '*.o' -o -name '*~' -o -name '*.bak' -o\
-name 'core*' \) -exec rm -f {} \;
@rm -f $(PWD)/$(BIN) $(BINDIR)/$(BIN)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment