How to add changes for NO ENCRYPT DB2 option to db2RestoreStruct - db2

I am trying to restore encrypted DB to non-encryped DB. I made changes by setting piDbEncOpts to SQL_ENCRYPT_DB_NO but still restore is being failed. Is there db2 sample code is there where I can check how to set "NO Encrypt" option in DB2. I am adding with below code snippet.
db2RestoreStruct->piDbEncOpts->encryptDb = SQL_ENCRYPT_DB_NO

The 'C' API named db2Restore will restore an encrypted-image to a unencrypted database , when used correctly.
You can use a modified version of IBM's samples files: dbrestore.sqc and related files, to see how to do it.
Depending on your 'C' compiler version and settings you might get a lot of warnings from IBM's code, because IBM does not appear to maintain the code of their samples as the years pass. However, you do not need to run IBM's sample code, you can study it to understand how to fix your own C code.
If installed, the samples component must match your Db2-server version+fixpack , and you must use the C include files that come with your Db2-server version+fixpack to get the relevant definitions.
The modifications to IBM's samples code include:
When using the db2Restore API ensure its first argument has a value that is compatible with your server Db2-version-and-fixpack to access the required functionality. If you specify the wrong version number for the first argument, for example a version of Db2 that did not support this functionality, then the API will fail. For example, on my Db2-LUW v11.1.4.6, I used the predefined db2Version1113 , like this:
db2Restore(db2Version1113, &restoreStruct, &sqlca);
When setting the restore iOptions field: enable the flag DB2RESTORE_NOENCRYPT, for example, in IBM's example, include the additional flag: restoreStruct.iOptions = DB2RESTORE_OFFLINE | DB2RESTORE_DB | DB2RESTORE_NODATALINK | DB2RESTORE_NOROLLFWD | DB2RESTORE_NOENCRYPT;
Ensure the restoredDbAlias differs from the encrypted-backup alias name.
I tested with Db2 v11.1.4.6 (db2Version1113 in the API) with gcc 9.3.
I also tested with Db2 v11.5 (db2Version11500 in the API) with gcc 9.3.

Related

How do we implement sqluvint action=SQLUV_QUERY_LOGS functionality for IBM DB2 vendorlib?

I am looking to understand how the functionality for searching a vendor device for sqluvint with action=SQLUV_QUERY_LOGS and db2VendorGetNextObj in the IBM DB2 vendorlib library should be implemented as part of the backup and restore functionality.
There is very minimal documentation on the input/response expectations available at https://www.ibm.com/docs/en/db2/11.1?topic=products-db2-call-sequence-vendor-apis and the sample code at https://github.com/IBM/db2-samples/blob/master/BARVendor/vendor.C does not provide any sample implementation for this.
Thanks in advance!!
Output of db2level:
DB21085I This instance or install (instance name, where applicable:
"db2inst1") uses "64" bits and DB2 code release "SQL11056" with level
identifier "0607010F".
Informational tokens are "DB2 v11.5.6.0", "s2106111000", "DYN2106111000AMD64",
and Fix Pack "0".
Product is installed at "/opt/ibm/db2/V11.5".

Recompile neccessary if another krbsrvname is needed?

According to https://www.postgresql.org/docs/current/gssapi-auth.html:
When GSSAPI uses Kerberos, it uses a standard principal in the format
servicename/hostname#realm
and
care needs to be taken to specify the correct principal details when
making the connection from the client using the krbsrvname connection
parameter. (See also Section 33.1.2.) The installation default can be
changed from the default postgres at build time using ./configure
--with-krb-srvnam=whatever.
But if I look into the Postgres source code at Github,
the settings seems to propagate into C program code as PG_KRB_SRVNAM
the only place it is used seems to be in the libpq library at https://github.com/postgres/postgres/blob/master/src/interfaces/libpq/fe-connect.c
Does this mean the server does not need to be recompiled if I need to use another krbsrvname?
It is the client, not the server, that would need to be recompiled. (Although usually you would probably recompile both together). Or you could just override the default with the correct value, and not recompile anything.

Problems when using Chapel 1.19 along with GASNet PSM (OmniPath) substrate

After Changing to version 1.19, but using Omnipath implementation, I'm randomly receiving the following error: ERROR calling: gasnet_barrier_try(id, 0).
I know that the Omnipath implementation of GASNet is no longer supported by the current version of Chapel. However, I would like to use some features available only in version 1.19, and the cluster I use runs over an Omnipath network.
In order to use the PSM substrate (OmniPath), I proceed as suggested by Chapel's Gitter community:
export CHPL_GASNET_ALLOW_BAD_SUBSTRATE=true
wget https://gasnet.lbl.gov/download/GASNet-1.32.0.tar.gz
tar xzf GASNet-1.32.0.tar.gz
rm -rf $CHPL_HOME/third-party/gasnet/gasnet-src
mv GASNet-1.32.0 $CHPL_HOME/third-party/gasnet/gasnet-src
Then, I setup other variables:
export CHPL_COMM='gasnet'
export CHPL_LAUNCHER='gasnetrun_psm'
export CHPL_COMM_SUBSTRATE='psm'
export CHPL_GASNET_SEGMENT='everything'
export CHPL_TARGET_CPU='native'
export GASNET_PSM_SPAWNER='ssh'
export HFI_NO_CPUAFFINITY=1
Next, I build the runtime, etc.
However, when I run experiments, I randomly receive the following error:
ERROR calling: gasnet_barrier_try(id, 0)
at: comm-gasnet.c:1020
error: GASNET_ERR_BARRIER_MISMATCH (Barrier id's mismatched)
Which finishes the execution of the program.
I cannot find in GASNet documentation the reason for this error. I could only find a bit of information on GASNet's code.
Do you know what's the cause of this problem?
Thank you all.
I realize this is an old question, but for the record the current version of Chapel (1.28.0) now embeds a version of GASNet (GASNet-EX 2022.3.0 as of this writing) that provides CHPL_COMM=gasnet CHPL_COMM_SUBSTRATE=ofi (aka GASNet ofi-conduit) that provides high-quality support for Intel Omni-Path.
In particular, there should no longer be any reason to clobber Chapel's embedded version of GASNet-EX with an ancient/outdated GASNet-1 to get Omni-Path support, as suggested in the original question.
For more details see Chapel's detailed Omni-Path instructions.

Security vulnerabilities with quoting in SQL

i am doing a simple select using the zend\db\sql classes and i got the following error.
Notice: Attempting to quote a value in Zend\Db\Adapter\Platform\Mysql
without extension/driver support can introduce security
vulnerabilities in a production environment. in
C:\wamp\vendor\zendframework\zend-db\Zend\Db\Adapter\Platform\Mysql.php
on line 134
Below is my code that output the errors.
$select2 = $this->sql->select()
->from('users')
->where(array("fbid = ?" => $id));
$selectSqlString = $this->sql->getSqlStringForSqlObject($select2);
$this->dbo->query($selectSqlString, Adapter::QUERY_MODE_EXECUTE);
May i know why does this happens and what should i do to prevent it?
Cheers~
By looking at the code for the MySQL class (I know that the provided link is for ZF2, but it looks like the same code is used), it would seem, that you are missing both the PDO and mysqli extension. That would mean that you are currently using mysql extension to connect to MySQL db, which is deprecated.
As a solution, I would recommend installing mysqli.

How do I use Puppet's ralsh with resource types provided by modules?

I have installed the postgresql module from Puppetforge.
How can I query Postgresql resources using ralsh ?
None of the following works:
# ralsh postgresql::db
# ralsh puppetlabs/postgresql::db
# ralsh puppetlabs-postgresql::db
I was hoping to use this to get a list of databases (including attributes such as character sets) and user names/passwords from the current system in a form that I can paste into a puppet manifest to recreate that setup on a different machine.
In principle, any puppet client gets the current state of your system from another program called Facter. You should create a custom Fact (a module of Facter), and then included into your puppet client. Afterwards, I think you could call this custom Fact from ralsh.
More information about creating a custom Fact can be found in here.
In creating your own Fact, you should execute your SQL query and then save the result into particular variable.