-
Notifications
You must be signed in to change notification settings - Fork 0
/
ADDCKDS
56 lines (53 loc) · 1.73 KB
/
ADDCKDS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef ADDCKDS_INCLUDE
#define ADDCKDS_INCLUDE
#include <delCKDS.h>
#include <do64.h> // colin special
/* --------------------------------------------------------------- */
/* Add a record to the keystore - if it exist already replace it */
/* --------------------------------------------------------------- */
#define RECORD_EXISTS 16036
int addCKDS1(char * key, char * pData, int lData)
{
int rc;
int rs;
int zero = 0;
do64(Key,key);
rc= CSNBKRC2(
&rc , /* return code */
&rs, /* reason code */
&zero, /* exit data length */
0, /* exit data[] */
&zero, /* rule array count */
0, /* rule array[] */
(char *) &Key, /* key key[64] */
&lData, /* key token length */
pData );/* key token[] */
if ( rc > 0)
{
printf(" addCKDS CSNBKRC2 add %s CKDS %i rs %i %s\n",key,
rc,rs,csfgetrc(rs));
}
if (rs == RECORD_EXISTS) return rs;
return rc;
}
int addCKDS(char * key, char * pData, int lData, char * pDelete)
{
int rc;
int i;
printf("addCKDS\n");
for( i = 0; i<2; i++ ) // go round twice once with delete
{
rc = addCKDS1(key, pData,lData);
if (rc == 0) break;
if (rc == RECORD_EXISTS && pDelete[0]=='Y')
{
printf(" Record existed and REPLACE=Y specified\n");
rc = deleteCKDS(key);
}
if (rc != 0) break;
}
if (rc == 0)
printf("addCKDS %s successful\n",key);
return rc;
}
#endif