Compare commits

..

No commits in common. "master" and "tsmpipe-7.1.6_0_1.6.6-0" have entirely different histories.

13 changed files with 47 additions and 160 deletions

View File

@ -1,4 +0,0 @@
.git/
lib/
scripts/
test/

View File

@ -1,19 +1,17 @@
stages:
- build
- test
- docker
- build
- test
# For some reason compiling on CentOS 6.x results in buffer corruption
# Compile on CentOS 6.x, for some reason compiling on CentOS 7.x results in buffer corruption
build:6-7.1:
stage: build
image: ${CI_REGISTRY}/leenooks/ci-tsm:6-7.1
image: leenooks/ci-tsm:6-7.1
script:
- make -f Makefile.linux64
only:
- c6
- master
tags:
- C
- x86_64
artifacts:
name: "$CI_BUILD_NAME"
paths:
@ -21,75 +19,39 @@ build:6-7.1:
test:6-7.1:
stage: test
image: ${CI_REGISTRY}/leenooks/ci-tsm:6-7.1
image: leenooks/ci-tsm:6-7.1
dependencies:
- build:6-7.1
script:
- cd test && ./test.sh
only:
- c6
- master
tags:
- C
- x86_64
# Compile on CentOS 6.x, for some reason compiling on CentOS 7.x results in buffer corruption
build:7-8.1:
build:7-7.1:
stage: build
image: ${CI_REGISTRY}/leenooks/ci-tsm:7-8.1
image: leenooks/ci-tsm:7-7.1
script:
- make -f Makefile.linux64
only:
- master
tags:
- C
- x86_64
artifacts:
name: "$CI_BUILD_NAME"
paths:
- tsmpipe
test:7-8.1:
test:7-7.1:
stage: test
image: ${CI_REGISTRY}/leenooks/ci-tsm:7-8.1
image: leenooks/ci-tsm:7-7.1
dependencies:
- build:7-8.1
- build:7-7.1
script:
- cd test && ./test.sh
only:
- master
tags:
- C
- x86_64
artifacts:
name: "$CI_BUILD_NAME"
paths:
- tsmpipe
docker:7-8.1:
stage: docker
image: docker:latest
services:
- docker:dind
before_script:
- docker info
- docker version
- echo "$CI_JOB_TOKEN" | docker login -u "$CI_REGISTRY_USER" "$CI_REGISTRY" --password-stdin
variables:
CACHETAG: build
VERSION: 8.1.7
DOCKER_HOST: tcp://docker:2375
dependencies:
- test:7-8.1
script:
- if [ -f init ]; then chmod 500 init; fi
- docker pull ${CI_REGISTRY_IMAGE}:${CACHETAG} || true
- docker build --cache-from ${CI_REGISTRY_IMAGE}:${CACHETAG} -t ${CI_REGISTRY_IMAGE}:${VERSION} -t ${CI_REGISTRY_IMAGE}:${CACHETAG} .
- docker run ${CI_REGISTRY_IMAGE}:${VERSION} -h
- docker push ${CI_REGISTRY_IMAGE}:${VERSION}
- docker push ${CI_REGISTRY_IMAGE}:${CACHETAG}
tags:
- docker
- x86_64
only:
- master

View File

@ -1,26 +0,0 @@
# NAME deon/tsmpipe
# VERSION 8.1.7
FROM centos:7
# If using FTP source (change tar to not use z)
#RUN SOURCE_URL=ftp://public.dhe.ibm.com/storage/tivoli-storage-management/maintenance/client/v8r1/Linux/LinuxX86/BA/v812/8.1.2.0-TIV-TSMBAC-LinuxX86.tar \
# If using PPA source
RUN SOURCE_URL=http://yum.leenooks.vpn/docker/tsm/8.x/SP_CLIENT_8.1.7_LIN86_ML.tar.gz \
&& PREFIX=TSMCLI_LNX/tsmcli/linux86 \
&& CHARS=$(echo ${PREFIX} | awk -F"/" '{print NF}') \
&& curl -SL ${SOURCE_URL} | tar -zC /tmp/ --strip-components ${CHARS} -xf - ${PREFIX}/gskcrypt64-*.linux.x86_64.rpm ${PREFIX}/gskssl64-*.linux.x86_64.rpm ${PREFIX}/TIVsm-API64.x86_64.rpm \
&& yum install -y /tmp/*rpm && rm -rf /tmp/*rpm /var/cache/yum
RUN ln -s /tsm/dsm.sys /opt/tivoli/tsm/client/api/bin64/ \
&& ln -s /tsm/dsm.opt /opt/tivoli/tsm/client/api/bin64/ \
&& ln -s /tsm/dsmcert.kdb /opt/tivoli/tsm/client/api/bin64/ \
&& ln -s /tsm/dsmcert.sth /opt/tivoli/tsm/client/api/bin64/
COPY tsmpipe /usr/bin
VOLUME [ "/tsm" ]
# Starting
ENTRYPOINT [ "/usr/bin/tsmpipe" ]

View File

@ -1,10 +1,6 @@
# About
TSMPIPE is a Tivoli Storage Manager (TSM) or now known as Spectrum Protect client, that enables you to take data from STDIN and store that in TSM as a BACKUP or ARCHIVE object.
By using this client, you dont need to do a dump to disk process, followed by using the Spectrum Protect Backup Archive Client. (So no more consuming disk space with old dumps!)
TSMPIPE is a Tivoli Storage Manager client, that enables you to take data from STDIN and store that in TSM as a BACKUP or ARCHIVE object.
Restoring data, is the reverse step, restoring directly back to the application from Spectrum Protect.
# Using
In its simplest form, you can
```cat myfile.ext | tsmpipe -c [MORE OPTIONS]```
@ -17,24 +13,5 @@ Getting data back is the reverse
Or, back to your application
```tsmpipe -x [MORE OPTIONS] | myapp```
This client can also calculate a digest while backuping up data (like MD5, SHA1, etc) - so that you can verify that the dump out of the application matches what goes into
Spectrum Protect. For example:
```
myappdump > file
md5sum file
cat file | tsmpipe -cBs /example/ -f file -m md5
tsmpipe -xBs /example/ -f file > file2
md5sum file2
```
The MD5 calculation should match in all cases - including the MD5 printed by tsmpipe. See the build test script for more details.
# Building
Building TSMPIPE is hopefully relatively easy - it's currently only tested on Linux (specifically CentOS), but it should be buildable on other Spectrum Protect
supported platforms, however you may need to create an appropriate Makefile.
Here is a blog on building on Linux: https://thefrinkiac7.wordpress.com/data-protection/building-tsmpipe
# Help
For help, use tsmpipe -h
To test that you can connect to TSM, use tsmpipe -i

View File

@ -18,17 +18,16 @@ char *units(double size) {
int div = 0;
double rem = 0;
int base = 1024;
int s_size = 128;
char *s;
s = "\0";
s = malloc(s_size);
s = malloc(128);
if (s==NULL) {
perror("Arg, out of memory?");
exit(255);
}
memset(s,0x00,s_size);
memset(s,0x00,(sizeof s));
while (size >= base && div < (int)(sizeof SIZES / sizeof *SIZES)-1) {
if (verbose > 2)

View File

@ -72,16 +72,14 @@ dsmDate dsmStrToDate(char *s) {
char *dsmDateToStr(dsmDate date) {
char *s;
int s_size = 32;
s = malloc(s_size);
s = malloc(19);
if (s==NULL) {
perror("Arg, out of memory?");
exit(255);
}
memset(s,0x00,s_size);
memset(s,0x00,(sizeof s));
sprintf(s,"%04i-%02i-%02i %02i:%02i:%02i",
date.year,
@ -147,7 +145,7 @@ char *dsmObjnameToStr(dsmObjName objName) {
exit(255);
}
memset(s,0x00,sizeof(dsmObjName));
memset(s,0x00,(sizeof s));
sprintf(s,"%s%s%s",objName.fs,objName.hl,objName.ll);

View File

@ -133,11 +133,10 @@ double tsm_sendfile(dsUint32_t dsmHandle, char *fsname, char *filename, long lon
#ifdef USE_DIGEST
char digest_str[EVP_MAX_MD_SIZE*2];
EVP_MD_CTX *mdctx;
EVP_MD_CTX mdctx;
const EVP_MD *md=NULL;
unsigned char md_value[EVP_MAX_MD_SIZE];
unsigned int md_len, i;
mdctx = NULL;
if (digest) {
OpenSSL_add_all_digests();
@ -230,8 +229,8 @@ double tsm_sendfile(dsUint32_t dsmHandle, char *fsname, char *filename, long lon
#ifdef USE_DIGEST
if (digest) {
mdctx = EVP_MD_CTX_new();
EVP_DigestInit_ex(mdctx, md, NULL);
EVP_MD_CTX_init(&mdctx);
EVP_DigestInit_ex(&mdctx, md, NULL);
}
#endif
@ -251,7 +250,7 @@ double tsm_sendfile(dsUint32_t dsmHandle, char *fsname, char *filename, long lon
#ifdef USE_DIGEST
if (digest)
EVP_DigestUpdate(mdctx, buffer, nbytes);
EVP_DigestUpdate(&mdctx, buffer, nbytes);
#endif
dataBlk.bufferLen = nbytes;
@ -290,8 +289,8 @@ double tsm_sendfile(dsUint32_t dsmHandle, char *fsname, char *filename, long lon
#ifdef USE_DIGEST
if (digest) {
EVP_DigestFinal_ex(mdctx, md_value, &md_len);
EVP_MD_CTX_free(mdctx);
EVP_DigestFinal_ex(&mdctx, md_value, &md_len);
EVP_MD_CTX_cleanup(&mdctx);
for(i=0; i<md_len; i++)
sprintf(digest_str+(i*2), "%02x", md_value[i]);

View File

@ -23,7 +23,7 @@ char *tsm_printerr(dsUint32_t dsmHandle, dsInt16_t rc) {
char rcStr[DSM_MAX_RC_MSG_LENGTH];
char *s;
s = malloc(DSM_MAX_RC_MSG_LENGTH+5);
s = malloc(sizeof(rcStr));
if (rc == DSM_RC_WILL_ABORT) {
dsUint16_t reason;
@ -79,7 +79,6 @@ dsUint32_t tsm_initsess(char *options, char *password) {
dsInt16_t rc=0;
dsUint32_t dsmHandle=0;
dsmApiVersionEx applApi;
dsmAppVersion pipeApi;
dsmInitExIn_t initIn;
dsmInitExOut_t initOut;
optStruct dsmOpt;
@ -96,13 +95,6 @@ dsUint32_t tsm_initsess(char *options, char *password) {
applApi.level = DSM_API_LEVEL;
applApi.subLevel = DSM_API_SUBLEVEL;
memset(&pipeApi,0x00,sizeof(dsmAppVersion));
pipeApi.stVersion = appVersionVer;
pipeApi.applicationVersion = TSMPIPE_VERSION;
pipeApi.applicationRelease = TSMPIPE_RELEASE;
pipeApi.applicationLevel = TSMPIPE_LEVEL;
pipeApi.applicationSubLevel = TSMPIPE_SUBLEVEL;
memset(&initIn,0x00,sizeof(dsmInitExIn_t));
initIn.stVersion = dsmInitExInVersion;
initIn.apiVersionExP = &applApi;
@ -114,7 +106,6 @@ dsUint32_t tsm_initsess(char *options, char *password) {
initIn.options = options;
initIn.userNameP = NULL;
initIn.userPasswordP = NULL;
initIn.appVersionP = &pipeApi;
//initIn.dirDelimiter = dirDelimiter;
//initIn.useUnicode = useUnicode;
//initIn.bEncryptKeyEnabled = encrypt;
@ -180,11 +171,8 @@ int tsm_sessioninfo(dsUint32_t dsmHandle) {
dsmQueryApiVersionEx(&apiLibVer);
printf("Application Version:\n");
printf(" TSMPIPE Version: %d.%d.%d.%d\n",
TSMPIPE_VERSION,
TSMPIPE_RELEASE,
TSMPIPE_LEVEL,
TSMPIPE_SUBLEVEL);
printf(" TSMPIPE Version: %s\n",
_TSMPIPE_VERSION);
printf(" TSMPIPE API Version: %d.%d.%d.%d\n",
DSM_API_VERSION,
DSM_API_RELEASE,

View File

@ -1 +0,0 @@
COMPRESSAlways Y

View File

@ -3,7 +3,7 @@ SErvername test
COMMmethod TCPip
MANAGEDServices schedule
TCPPort 1500
TCPServeraddress tsm.leenooks.net
TCPServeraddress tsm.leenooks.vpn
PASSWORDAccess generate
SCHEDMode polling
@ -16,5 +16,3 @@ SErvername test
TCPBuffsize 32
TCPWindowsize 64
SSL No
PASSWORDDIR /tsm

View File

@ -8,7 +8,7 @@ VERBOSE=${VERBOSE:-""}
# Create TEST File
MD5=$(dd if=/dev/urandom bs=10240 count=1024 2>/dev/null |tee ${FILE} |md5sum |awk '{print $1}')
SIZE=$(ls -l ${FILE}|awk '{print $5}')
TSMOPT="-VIRTUALNODENAME=TEST -PASSWORD=password -COMPRESSALWAYS=YES"
TSMOPT="-VIRTUALNODENAME=TEST -PASSWORD=TEST -COMPRESSALWAYS=YES"
TSMPIPE=../tsmpipe
@ -69,7 +69,7 @@ cat ${FILE} | ${TSMPIPE} -Acm MD5 -s /test -f ${FILE} ${VERBOSE} -l ${SIZE} -D"T
DATE=$(date +%m%d%Y:%H%M%S)
# List it
echo "+ ARCHIVE: LIST FILE!"
echo "+ ARCIHVE: LIST FILE!"
${TSMPIPE} -Ats /test -f ${FILE} -O"${TSMOPT}"
# Get it back

View File

@ -67,7 +67,7 @@ int copy_env(const char *from, const char *to) {
void usage(void) {
fprintf(stderr,
"tsmpipe %d.%d.%d.%d, usage:\n"
"tsmpipe %s, usage:\n"
"\n"
"tsmpipe [-i|-p]|[[-A|-B|-U] [-c|-x|-d|-g|-t] -s fsname -f filepath [-l len] ...]\n"
" -i Show session information\n"
@ -102,7 +102,7 @@ void usage(void) {
#endif
" -v Verbose. More -v's gives more verbosity\n"
" -V Verbose information on TSM transfer\n"
,TSMPIPE_VERSION,TSMPIPE_RELEASE,TSMPIPE_LEVEL,TSMPIPE_SUBLEVEL);
,_TSMPIPE_VERSION);
exit(0);
}

View File

@ -1,7 +1,4 @@
#define TSMPIPE_VERSION 1
#define TSMPIPE_RELEASE 6
#define TSMPIPE_LEVEL 6
#define TSMPIPE_SUBLEVEL 0
#define _TSMPIPE_VERSION "1.6.6"
#define INPUTLEN 1025
#define ACTION_INFO 1