summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--runtime/queue.c11
-rw-r--r--runtime/stream.c20
2 files changed, 28 insertions, 3 deletions
diff --git a/runtime/queue.c b/runtime/queue.c
index 0f77bceb..d569318d 100644
--- a/runtime/queue.c
+++ b/runtime/queue.c
@@ -777,12 +777,21 @@ qqueueTryLoadPersistedInfo(qqueue_t *pThis)
(rsRetVal(*)(obj_t*,void*))qqueueLoadPersStrmInfoFixup, pThis));
CHKiRet(obj.Deserialize(&pThis->tVars.disk.pReadDel, (uchar*) "strm", psQIF,
(rsRetVal(*)(obj_t*,void*))qqueueLoadPersStrmInfoFixup, pThis));
-
/* create a duplicate for the read "pointer". */
CHKiRet(strm.Dup(pThis->tVars.disk.pReadDel, &pThis->tVars.disk.pReadDeq));
CHKiRet(strm.SetbDeleteOnClose(pThis->tVars.disk.pReadDeq, 0)); /* deq must NOT delete the files! */
CHKiRet(strm.ConstructFinalize(pThis->tVars.disk.pReadDeq));
+ /* if we use a crypto provider, we need to amend the objects with it's info */
+ if(pThis->useCryprov) {
+ CHKiRet(strm.Setcryprov(pThis->tVars.disk.pWrite, &pThis->cryprov));
+ CHKiRet(strm.SetcryprovData(pThis->tVars.disk.pWrite, pThis->cryprovData));
+ CHKiRet(strm.Setcryprov(pThis->tVars.disk.pReadDeq, &pThis->cryprov));
+ CHKiRet(strm.SetcryprovData(pThis->tVars.disk.pReadDeq, pThis->cryprovData));
+ CHKiRet(strm.Setcryprov(pThis->tVars.disk.pReadDel, &pThis->cryprov));
+ CHKiRet(strm.SetcryprovData(pThis->tVars.disk.pReadDel, pThis->cryprovData));
+ }
+dbgprintf("DDDD: seeking offsets (here we need crypto)\n");
CHKiRet(strm.SeekCurrOffs(pThis->tVars.disk.pWrite));
CHKiRet(strm.SeekCurrOffs(pThis->tVars.disk.pReadDel));
CHKiRet(strm.SeekCurrOffs(pThis->tVars.disk.pReadDeq));
diff --git a/runtime/stream.c b/runtime/stream.c
index ac97d484..0cac4f07 100644
--- a/runtime/stream.c
+++ b/runtime/stream.c
@@ -585,6 +585,7 @@ strmReadBuf(strm_t *pThis)
/* here we place our crypto interface */
if(pThis->cryprov != NULL) {
pThis->cryprov->Decrypt(pThis->cryprovFileData, pThis->pIOBuf, &iLenRead);
+dbgprintf("DDDD: data read, decrypted: %1024.1024s\n", pThis->pIOBuf);
}
pThis->iBufPtrMax = iLenRead;
bRun = 0; /* exit loop */
@@ -1483,17 +1484,32 @@ finalize_it:
}
-
/* seek to current offset. This is primarily a helper to readjust the OS file
* pointer after a strm object has been deserialized.
*/
static rsRetVal strmSeekCurrOffs(strm_t *pThis)
{
+ off64_t targetOffs;
+ uchar c;
DEFiRet;
ISOBJ_TYPE_assert(pThis, strm);
- iRet = strmSeek(pThis, pThis->iCurrOffs);
+dbgprintf("DDDD: seekCurrOffs file #%d, offs %lld\n", pThis->fd, (long long) pThis->iCurrOffs);
+ if(pThis->cryprov == NULL || pThis->tOperationsMode != STREAMMODE_READ) {
+ iRet = strmSeek(pThis, pThis->iCurrOffs);
+ FINALIZE;
+ }
+
+ targetOffs = pThis->iCurrOffs;
+ pThis->iCurrOffs = 0;
+dbgprintf("DDDD: skip read offs %lld, data: ", (long long) targetOffs);
+ while(targetOffs != pThis->iCurrOffs) {
+ CHKiRet(strmReadChar(pThis, &c));
+dbgprintf("%c", c);
+ }
+dbgprintf("\n");
+finalize_it:
RETiRet;
}