-rw-r--r-- | src/eyefiservice.cc | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/eyefiservice.cc b/src/eyefiservice.cc index 9ef4bb6..2586ade 100644 --- a/src/eyefiservice.cc +++ b/src/eyefiservice.cc | |||
@@ -41,48 +41,49 @@ int eyefiService::StartSession( | |||
41 | #endif | 41 | #endif |
42 | eyekinfig_t eyekinfig(macaddress); | 42 | eyekinfig_t eyekinfig(macaddress); |
43 | r.credential = binary_t(macaddress+cnonce+eyekinfig.get_upload_key()).md5().hex(); | 43 | r.credential = binary_t(macaddress+cnonce+eyekinfig.get_upload_key()).md5().hex(); |
44 | 44 | ||
45 | r.snonce = session_nonce.make_nonce().hex(); | 45 | r.snonce = session_nonce.make_nonce().hex(); |
46 | r.transfermode=transfermode; | 46 | r.transfermode=transfermode; |
47 | r.transfermodetimestamp=transfermodetimestamp; | 47 | r.transfermodetimestamp=transfermodetimestamp; |
48 | r.upsyncallowed=false; | 48 | r.upsyncallowed=false; |
49 | 49 | ||
50 | std::string cmd = eyekinfig.get_on_start_session(); | 50 | std::string cmd = eyekinfig.get_on_start_session(); |
51 | if(!cmd.empty()) { | 51 | if(!cmd.empty()) { |
52 | if(detached_child()) { | 52 | if(detached_child()) { |
53 | putenv( gnu::autosprintf("EYEFI_MACADDRESS=%s",macaddress.c_str()) ); | 53 | putenv( gnu::autosprintf("EYEFI_MACADDRESS=%s",macaddress.c_str()) ); |
54 | putenv( gnu::autosprintf("EYEFI_TRANSFERMODE=%d",transfermode) ); | 54 | putenv( gnu::autosprintf("EYEFI_TRANSFERMODE=%d",transfermode) ); |
55 | putenv( gnu::autosprintf("EYEFI_TRANSFERMODETIMESTAMP=%ld",transfermodetimestamp) ); | 55 | putenv( gnu::autosprintf("EYEFI_TRANSFERMODETIMESTAMP=%ld",transfermodetimestamp) ); |
56 | char *argv[] = { (char*)"/bin/sh", (char*)"-c", (char*)cmd.c_str(), 0 }; | 56 | char *argv[] = { (char*)"/bin/sh", (char*)"-c", (char*)cmd.c_str(), 0 }; |
57 | execv("/bin/sh",argv); | 57 | execv("/bin/sh",argv); |
58 | syslog(LOG_ERR,"Failed to execute '%s'",cmd.c_str()); | 58 | syslog(LOG_ERR,"Failed to execute '%s'",cmd.c_str()); |
59 | _exit(-1); | 59 | _exit(-1); |
60 | } | 60 | } |
61 | } | 61 | } |
62 | return SOAP_OK; | 62 | return SOAP_OK; |
63 | }catch(std::runtime_error& e) { | 63 | }catch(std::runtime_error& e) { |
64 | syslog(LOG_ERR,"error while processing StartSession: %s",e.what()); | 64 | syslog(LOG_ERR,"error while processing StartSession: %s",e.what()); |
65 | return soap_receiverfault(e.what(),0); | ||
65 | } | 66 | } |
66 | 67 | ||
67 | int eyefiService::GetPhotoStatus( | 68 | int eyefiService::GetPhotoStatus( |
68 | std::string credential, std::string macaddress, | 69 | std::string credential, std::string macaddress, |
69 | std::string filename, long filesize, std::string filesignature, | 70 | std::string filename, long filesize, std::string filesignature, |
70 | int flags, | 71 | int flags, |
71 | struct rns__GetPhotoStatusResponse &r ) { | 72 | struct rns__GetPhotoStatusResponse &r ) { |
72 | #ifndef NDEBUG | 73 | #ifndef NDEBUG |
73 | syslog(LOG_DEBUG, | 74 | syslog(LOG_DEBUG, |
74 | "GetPhotoStatus request from %s with credential=%s, filename=%s, filesize=%ld, filesignature=%s, flags=%d; session nonce=%s", | 75 | "GetPhotoStatus request from %s with credential=%s, filename=%s, filesize=%ld, filesignature=%s, flags=%d; session nonce=%s", |
75 | macaddress.c_str(), credential.c_str(), filename.c_str(), filesize, filesignature.c_str(), flags, | 76 | macaddress.c_str(), credential.c_str(), filename.c_str(), filesize, filesignature.c_str(), flags, |
76 | session_nonce.hex().c_str() ); | 77 | session_nonce.hex().c_str() ); |
77 | #endif | 78 | #endif |
78 | 79 | ||
79 | std::string computed_credential = binary_t(macaddress+eyekinfig_t(macaddress).get_upload_key()+session_nonce.hex()).md5().hex(); | 80 | std::string computed_credential = binary_t(macaddress+eyekinfig_t(macaddress).get_upload_key()+session_nonce.hex()).md5().hex(); |
80 | 81 | ||
81 | #ifndef NDEBUG | 82 | #ifndef NDEBUG |
82 | syslog(LOG_DEBUG, " computed credential=%s", computed_credential.c_str()); | 83 | syslog(LOG_DEBUG, " computed credential=%s", computed_credential.c_str()); |
83 | #endif | 84 | #endif |
84 | 85 | ||
85 | if (credential != computed_credential) throw std::runtime_error("card authentication failed"); | 86 | if (credential != computed_credential) throw std::runtime_error("card authentication failed"); |
86 | 87 | ||
87 | r.fileid = 1; r.offset = 0; | 88 | r.fileid = 1; r.offset = 0; |
88 | return SOAP_OK; | 89 | return SOAP_OK; |