summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--configure.ac2
-rw-r--r--debian/compat2
-rw-r--r--debian/control4
-rwxr-xr-xdebian/iii.postinst2
-rwxr-xr-xdebian/iii.postrm1
-rw-r--r--debian/source/format1
-rw-r--r--doc/000000000000.conf2
-rw-r--r--src/eyefiservice.cc1
8 files changed, 8 insertions, 7 deletions
diff --git a/configure.ac b/configure.ac
index d580f58..f79983e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,47 +1,47 @@
1AC_INIT([iii], [0.2], [iii-bugs@klever.net]) 1AC_INIT([iii], [0.2], [iii-bugs@klever.net])
2AC_CONFIG_SRCDIR([src/iiid.cc]) 2AC_CONFIG_SRCDIR([src/iiid.cc])
3AC_CONFIG_HEADERS([config.h]) 3AC_CONFIG_HEADERS([config.h])
4AM_INIT_AUTOMAKE([dist-bzip2]) 4AM_INIT_AUTOMAKE([dist-bzip2])
5 5
6AC_PROG_INSTALL 6AC_PROG_INSTALL
7AC_PROG_CXX 7AC_PROG_CXX
8AC_PROG_CC 8AC_PROG_CC
9PKG_PROG_PKG_CONFIG 9PKG_PROG_PKG_CONFIG
10 10
11AC_HEADER_STDC 11AC_HEADER_STDC
12 12
13AC_PATH_PROG([XSLTPROC],[xsltproc],[true]) 13AC_PATH_PROG([XSLTPROC],[xsltproc],[true])
14 14
15PKG_CHECK_MODULES([MODULES],[gsoap++ openssl libconfuse]) 15PKG_CHECK_MODULES([MODULES],[gsoap++ libcrypto libconfuse])
16PKG_CHECK_MODULES([UUID],[uuid],[have_uuid=true],[have_uuid=false]) 16PKG_CHECK_MODULES([UUID],[uuid],[have_uuid=true],[have_uuid=false])
17AM_CONDITIONAL([HAVE_UUID],[$have_uuid]) 17AM_CONDITIONAL([HAVE_UUID],[$have_uuid])
18if $have_uuid ; then 18if $have_uuid ; then
19 AC_DEFINE([HAVE_LIBUUID],,[defined in presence of libuuid]) 19 AC_DEFINE([HAVE_LIBUUID],,[defined in presence of libuuid])
20 AC_SUBST([UUID_UUID],[uuid]) 20 AC_SUBST([UUID_UUID],[uuid])
21fi 21fi
22 22
23AC_PATH_PROG([SOAPCPP2],[soapcpp2],[false]) 23AC_PATH_PROG([SOAPCPP2],[soapcpp2],[false])
24test "$SOAPCPP2" = "false" && AC_MSG_ERROR([no soapcpp2 tool, part of gsoap package, found.]) 24test "$SOAPCPP2" = "false" && AC_MSG_ERROR([no soapcpp2 tool, part of gsoap package, found.])
25 25
26notfound=false 26notfound=false
27AC_CHECK_HEADERS([archive.h],[ 27AC_CHECK_HEADERS([archive.h],[
28 AC_CHECK_LIB([archive],[archive_read_new],,[notfound=true]) 28 AC_CHECK_LIB([archive],[archive_read_new],,[notfound=true])
29],[notfound=true]) 29],[notfound=true])
30$notfound && AC_MSG_ERROR([no required libarchive library found. get one from http://people.freebsd.org/~kientzle/libarchive/]) 30$notfound && AC_MSG_ERROR([no required libarchive library found. get one from http://people.freebsd.org/~kientzle/libarchive/])
31 31
32notfound=false 32notfound=false
33AC_LANG_PUSH([C++]) 33AC_LANG_PUSH([C++])
34AC_CHECK_HEADERS([autosprintf.h],[ 34AC_CHECK_HEADERS([autosprintf.h],[
35 AC_CHECK_LIB([asprintf],[main],,[notfound=true]) 35 AC_CHECK_LIB([asprintf],[main],,[notfound=true])
36],[notfound=true]) 36],[notfound=true])
37$notfound && AC_MSG_ERROR([no autosprintf, part of gettext, found]) 37$notfound && AC_MSG_ERROR([no autosprintf, part of gettext, found])
38AC_LANG_POP([C++]) 38AC_LANG_POP([C++])
39 39
40nitpick=false 40nitpick=false
41AC_ARG_ENABLE([nitpicking], 41AC_ARG_ENABLE([nitpicking],
42 AC_HELP_STRING([--enable-nitpicking],[make compiler somewhat overly fastidious about the code it deals with]), 42 AC_HELP_STRING([--enable-nitpicking],[make compiler somewhat overly fastidious about the code it deals with]),
43 [ test "$enableval" = "no" || nitpick=true ] 43 [ test "$enableval" = "no" || nitpick=true ]
44) 44)
45if $nitpick ; then 45if $nitpick ; then
46 CPP_NITPICK="-pedantic -Wall -Wextra -Wundef -Wshadow \ 46 CPP_NITPICK="-pedantic -Wall -Wextra -Wundef -Wshadow \
47 -Wunsafe-loop-optimizations -Wconversion -Wmissing-format-attribute \ 47 -Wunsafe-loop-optimizations -Wconversion -Wmissing-format-attribute \
diff --git a/debian/compat b/debian/compat
index b8626c4..7ed6ff8 100644
--- a/debian/compat
+++ b/debian/compat
@@ -1 +1 @@
4 5
diff --git a/debian/control b/debian/control
index 02a6138..aaa8c78 100644
--- a/debian/control
+++ b/debian/control
@@ -1,13 +1,13 @@
1Source: iii 1Source: iii
2Section: graphics 2Section: graphics
3Priority: optional 3Priority: optional
4Maintainer: Michael Krelin <hacker@klever.net> 4Maintainer: Michael Krelin <hacker@klever.net>
5Build-Depends: debhelper (>=7), gsoap, libssl-dev, libconfuse-dev, libarchive-dev, gettext 5Build-Depends: debhelper (>=7), gsoap, libssl-dev, libconfuse-dev, libarchive-dev, gettext
6Standards-Version: 3.8.0 6Standards-Version: 3.8.4
7 7
8Package: iii 8Package: iii
9Architecture: any 9Architecture: any
10Depends: adduser, ${shlibs:Depends} 10Depends: adduser, ${shlibs:Depends}, ${misc:Depends}
11Description: Eye-Fi Manager implementation 11Description: Eye-Fi Manager implementation
12 Implementation of Eye-Fi manager service for Linux 12 Implementation of Eye-Fi manager service for Linux
13 13
diff --git a/debian/iii.postinst b/debian/iii.postinst
index 20463a1..f52bf84 100755
--- a/debian/iii.postinst
+++ b/debian/iii.postinst
@@ -1,18 +1,18 @@
1#!/bin/sh 1#!/bin/sh
2set -e 2set -e
3UG=eyefi 3UG=eyefi
4P=eyekindo 4P=iii
5H=/var/lib/$P 5H=/var/lib/$P
6 6
7if [ "$1" = configure ] ; then 7if [ "$1" = configure ] ; then
8 getent group $UG >/dev/null 2>&1 || addgroup --system $UG 8 getent group $UG >/dev/null 2>&1 || addgroup --system $UG
9 getent passwd $UG >/dev/null 2>&1 || adduser --system --home $H \ 9 getent passwd $UG >/dev/null 2>&1 || adduser --system --home $H \
10 --no-create-home --disabled-password --ingroup $UG $UG 10 --no-create-home --disabled-password --ingroup $UG $UG
11 if ! test -d $H ; then 11 if ! test -d $H ; then
12 mkdir -p $H 12 mkdir -p $H
13 chown $UG:$UG $H 13 chown $UG:$UG $H
14 chmod 2770 $H 14 chmod 2770 $H
15 fi 15 fi
16fi 16fi
17 17
18#DEBHELPER# 18#DEBHELPER#
diff --git a/debian/iii.postrm b/debian/iii.postrm
index a2c66fa..6060c4f 100755
--- a/debian/iii.postrm
+++ b/debian/iii.postrm
@@ -1,3 +1,4 @@
1#!/bin/sh 1#!/bin/sh
2set -e
2 3
3#DEBHELPER# 4#DEBHELPER#
diff --git a/debian/source/format b/debian/source/format
new file mode 100644
index 0000000..89ae9db
--- a/dev/null
+++ b/debian/source/format
@@ -0,0 +1 @@
3.0 (native)
diff --git a/doc/000000000000.conf b/doc/000000000000.conf
index d7b365f..01f8fae 100644
--- a/doc/000000000000.conf
+++ b/doc/000000000000.conf
@@ -1,17 +1,17 @@
1# target directory for uploaded files, if the name contains %s, it is replaced 1# target directory for uploaded files, if the name contains %s, it is replaced
2# with eyefi card mac address. 2# with eyefi card mac address.
3targetdir = "/var/lib/eyekindo/%s/" 3targetdir = "/var/lib/iii/%s/"
4# the upload key as seen in Mac and (perhaps) windows Settings.xml file 4# the upload key as seen in Mac and (perhaps) windows Settings.xml file
5uploadkey = "e3e2c4a305cee6bce0ebb38a3259ac08" 5uploadkey = "e3e2c4a305cee6bce0ebb38a3259ac08"
6 6
7# commands to be executed at certain events, the commands also receive certain 7# commands to be executed at certain events, the commands also receive certain
8# values of interested passed via environment. 8# values of interested passed via environment.
9# for on-start-session: EYEFI_MACADDRESS, EYEFI_TRANSFER_MODE, EYEFI_TRANSFERMODETIMESTAMP 9# for on-start-session: EYEFI_MACADDRESS, EYEFI_TRANSFER_MODE, EYEFI_TRANSFERMODETIMESTAMP
10on-start-session = "bash /usr/local/lib/iii/on-start-session.bash" 10on-start-session = "bash /usr/local/lib/iii/on-start-session.bash"
11# for on-upload-photo: EYEFI_MACADDRESS, EYEFI_UPLOADED (uploaded file name) 11# for on-upload-photo: EYEFI_MACADDRESS, EYEFI_UPLOADED (uploaded file name)
12on-upload-photo = "bash /usr/local/lib/iii/on-upload-photo.bash" 12on-upload-photo = "bash /usr/local/lib/iii/on-upload-photo.bash"
13# for on-mark-last-photo-in-roll: EYEFI_MACADDRESS, EYEFI_MERGEDELTA 13# for on-mark-last-photo-in-roll: EYEFI_MACADDRESS, EYEFI_MERGEDELTA
14on-mark-last-photo-in-roll = "bash /usr/local/lib/iii/on-mark-last-photo-in-roll.bash" 14on-mark-last-photo-in-roll = "bash /usr/local/lib/iii/on-mark-last-photo-in-roll.bash"
15 15
16# file mode creation mask 16# file mode creation mask
17umask = 002 17umask = 002
diff --git a/src/eyefiservice.cc b/src/eyefiservice.cc
index 49521e0..9650ec1 100644
--- a/src/eyefiservice.cc
+++ b/src/eyefiservice.cc
@@ -1,41 +1,40 @@
1#include <cassert> 1#include <cassert>
2#include <iostream> 2#include <iostream>
3#include <fstream> 3#include <fstream>
4#include <stdexcept> 4#include <stdexcept>
5#include <iterator> 5#include <iterator>
6#include <syslog.h> 6#include <syslog.h>
7#include <sys/wait.h> 7#include <sys/wait.h>
8#include <autosprintf.h> 8#include <autosprintf.h>
9#include <openssl/rand.h>
10#include "eyekinfig.h" 9#include "eyekinfig.h"
11#include "eyetil.h" 10#include "eyetil.h"
12#include "soapeyefiService.h" 11#include "soapeyefiService.h"
13 12
14static binary_t session_nonce; 13static binary_t session_nonce;
15 14
16static bool detached_child() { 15static bool detached_child() {
17 pid_t p = fork(); 16 pid_t p = fork();
18 if(p<0) throw std::runtime_error("failed to fork()"); 17 if(p<0) throw std::runtime_error("failed to fork()");
19 if(!p) { 18 if(!p) {
20 p = fork(); 19 p = fork();
21 if(p<0) { 20 if(p<0) {
22 syslog(LOG_ERR,"Failed to re-fork child process"); 21 syslog(LOG_ERR,"Failed to re-fork child process");
23 _exit(-1); 22 _exit(-1);
24 } 23 }
25 if(!p) { 24 if(!p) {
26 setsid(); 25 setsid();
27 for(int i=getdtablesize();i>=0;--i) close(i); 26 for(int i=getdtablesize();i>=0;--i) close(i);
28 int i=open("/dev/null",O_RDWR); assert(i==0); 27 int i=open("/dev/null",O_RDWR); assert(i==0);
29 i = dup(i); assert(i==1); 28 i = dup(i); assert(i==1);
30 i = dup(i); assert(i==2); 29 i = dup(i); assert(i==2);
31 return true; 30 return true;
32 } 31 }
33 _exit(0); 32 _exit(0);
34 } 33 }
35 int rc; 34 int rc;
36 if(waitpid(p,&rc,0)<0) throw std::runtime_error("failed to waitpid()"); 35 if(waitpid(p,&rc,0)<0) throw std::runtime_error("failed to waitpid()");
37 if(!WIFEXITED(rc)) throw std::runtime_error("error in forked process"); 36 if(!WIFEXITED(rc)) throw std::runtime_error("error in forked process");
38 if(WEXITSTATUS(rc)) throw std::runtime_error("forked process signalled error"); 37 if(WEXITSTATUS(rc)) throw std::runtime_error("forked process signalled error");
39 return false; 38 return false;
40} 39}
41 40