Oracle OCI - failing with ORA-12705 when running as another user - c

I've got a C application using OCI to talk to a database. I'm using the instant client method so there is no standalone Oracle installation on the server - just a couple of libraries that the application is linked against.
Normally, the application runs as user dai, and everything works just fine. But if the application is run as another user (in group dai), it fails to run, reporting:
Error while trying to retrieve text for error ORA-12705
So I can imagine that this is a permissions error, but I'm not sure what files it is trying to access. The permissions of the Oracle libraries are
dai:/dai/oracle/lib> ls -l
total 201872
-rwxrwxrwx 1 dai dai 24719097 16 Feb 2009 libclntsh.a
-rwxrwxrwx 1 dai dai 5972457 16 Feb 2009 libocci.a
-rwxrwxrwx 1 dai dai 72651344 04 Jun 2010 libociei.so
As you can guess the main OCI libraries are statically linked, but there is one dynamically linked library (not sure why, but the AIX instantclient package came with these files...). My LIBPATH looks OK from both users:
LIBPATH=/dai/oracle/lib
Which other permissions do I need to check?
EDIT: I have just tried running truss (AIX equivalent of Linux strace) to see what is happening. I couldn't see it reading any unexpected files when running as the dai user. Truss seemed to have problems tracing a set-uid program - permissions on the C application were set like this:
dai:/dai/bin> ls -l stats_backup
-rwsrwsr-x 1 dai dai 6173358 Aug 12 10:08 stats_backup
So I did chmod a-s and tried again, and it now works!
So the program runs OK without the s-bit, but as soon as I put it back, it breaks again. I can't run truss with the s-bit set, which makes it difficult to find out why this should be. The program doesn't work in other circumstances without the s-bit set, so this isn't a viable solution, but hopefully a pointer to where the problem may be.

There are presumably some Oracle data files located somewhere that your other users don't have access to. According to Google, ORA-12705 happens because the NLS data files (wherever they are) can't be accessed, or perhaps there is some environment variable issue.

Related

chilkat - problems - sql server - download and unzip in memory without any zip file created

I'm testing the chilkat example code: (SQL Server) Download a Zip from a URL and OpenFromMemory. (No .zip fie is created) / https://www.example-code.com/sql/zip_openFromMemory.asp . But I only get an errormessage telling me:
Failed to find end-of-central-directory-record.
Failed to get central dir locations.
Does anyone get any solutions to this problem?
full ChilkatLog:
OpenFromMemory:
DllDate: Oct 28 2019
ChilkatVersion: 9.5.0.80
UnlockPrefix: XXXXXXXXXXX
Architecture: Little Endian; 64-bit
Language: ActiveX / x64
VerboseLogging: 0
Component successfully unlocked using purchased unlock code.
oemCodePage: 850
openFromMemData:
Failed to find end-of-central-directory-record.
Failed to get central dir locations.
--openFromMemData
Failed.
--OpenFromMemory
--ChilkatLog
I modified the example to avoid the problem. Also, it should perform better because it won't try to pass the actual binary data across COM boundaries.
Instead, it just uses the Chilkat BinData object. (We pass the reference to the BinData object instead of the data itself.)
Please go to https://www.example-code.com/sql/zip_openFromMemory.asp to see the changes. (Refresh the page if needed.)
Let me know if that helps.
Chilkat has responded to my support inquiry and made changes to the example script!
Thanks for the quick response!

deja vu: Why am I seeing "the application was unable to start correctly (0xc000007b)"

Platform: Windows 10 Pro 64-bit [Version 10.0.15063]; Xeon CPU E3-1220 v3, 3101 Mhz, 4 Core(s), no HT; 32 GB ECC memory; Visual Studio 2017 Community Edition.
I am working on NTPD, the Network Time Protocol Daemon, trying to make it more accurate.
My revised version of NTPD ran from 3/16/17 until yesterday, 8/20/17. I finally got my readTemps.exe C# program working yesterday; all it does is read the CPU and System temperatures every 10 seconds, and waits for NTPD to ask for them via UDP. NTPD starts readTemps.
However, there was a problem in that NTPD could not start readTemps as Administrator, which is needed, I believe, for readTemps to interface with WMI. So I put code in readTemps to detect if it is running as Administrator, and if not restart itself thusly.
In test mode, a driver program can start readTemps, access temperatures for a minute, and stop readTemps, but NTPD can no longer do anything!.
At first it stopped in the very beginning when it was trying to request privileges to set the system time (which is not my code and has worked forever).
Now it cannot even load, failing with the error "(t)he application was unable to start correctly (0xc000007b)."
Using my backup program I replaced the newly compiled versions of ntpd.exe and ntpd.lib with the versions that had run successfully from 3/16--8/20/17, but still I get the (0xc000007b) error.
I downloaded Dependency Walker (DW) and ran it on the ntpd.exe image that worked for 5 months. DW found the following errors:
Error: At least one required implicit or forwarded dependency was not
found.
Error: At least one module has an unresolved import due to a
missing export function in an implicitly dependent module.
Error:Modules with different CPU types were found.
Error: A circular dependency was detected.
Warning: At least one delay-load dependency module was not found.
Warning: At least one module has an unresolved import due to a
missing export function in a delay-load dependent module.
In particular, DW finds that dozens of dll's are missing, e..g.,
API-MS-WIN-CORE-REGISTRY-L1-1-1.DLL
API-MS-WIN-CORE-REGISTRY-L2-2-0.DLL
API-MS-WIN-CORE-RTLSUPPORT-L1-2-0.DLL
API-MS-WIN-CORE-SIDEBYSIDE-L1-1-0.DLL
API-MS-WIN-CORE-STRING-L2-1-0.DLL
etc., etc., etc
.
I can't find these dll's either using the dir /S command, not on C:, the system disk, and not on K:, where Visual Studio 2017 Community Edition is installed.
Does anyone have any idea what could possibly be wrong?

Nagios External Commands WILL NOT WORK

I've been banging my head against the wall for the past few days on this and promise I looked everywhere. If I'm wrong please teach me with a link :)
I'm trying to schedule downtime for some services and haven't been able to make it happen via the command line or the web GUI. For some reason the only thing I can do is commit host comments/downtime via the GUI and nothing else anywhere else. I should also mention that a cronjob of the scheduled downtime will show up in the Nagios web interface comments, but still doesn't work. The only difference I notice is the author as indicated by the GUI for host down time is "nagiosadmin" and of the non-working downtimes is "nagios" I did try chown'ing file paths with nagiosadmin.
Here are the relevant deets:
nagios.cfg
check_external_commands=1
nagios_user=nagios
nagios_group=nagios
command_file=/usr/local/nagios/var/rw/nagios.cmd
I have changed the permissions and owners for this directory MANY times, nothing seems to work:
ls -l /usr/local/nagios/var/rw
prwxrwxrwx. 1 nagios nagcmd 0 Jan 29 21:27 nagios.cmd
srw-rw----. 1 nagios nagcmd 0 Jan 29 14:09 nagios.qh
I added users to groups that they don't really need to be in to no avail:
cat /etc/group:
nagcmd:x:505:nagios,nagiosadmin,apache
nagios:x:501:nagios,apache,nagiosadmin
The script is pointed to the correct file paths but again it won't work from the GUI anyway.
infra2 nagios: Error: External command failed -> SCHEDULE_HOST_DOWNTIME;deploy1;1422507601;1422536401;0;28800;neo-nagios;Scheduled Daily Downtime (low usage period) Jan 29 21:27:20 infra2 nagios: External command error: Command failed
I know this isn't the root of the problem as nothing works from command line but:
ls -l /usr/local/nagios/etc/cgi.cfg -rw-rw-r--. 1 nagios nagios 12015 Jan 29 14:06 /usr/local/nagios/etc/cgi.cfg
ls -l /usr/local/nagios/sbin/cmd.cgi -rwxrwxr-x. 1 nagios nagios 288424 Jan 28 10:17 /usr/local/nagios/sbin/cmd.cgi
GUI error I'm tired of seeing:
"Sorry, but you are not authorized to commit the specified command...yada"
What am I missing?!?! Please help! and thanks in advance
Personnally I use post/get while using the nagios cmd.cgi. You can use curl/wget/etc to call the command with the correct parameters to do what you want as if you used the GUI.
The easiest way is to look at what is sent when you execute a post/get command via the GUI and reproduce it through a wget/curl command. Works like a charm, I personally have automated processes while deploying that call the cmd.cgi from script and auto-downtime or disable/enable services by service or host.
There are some things that appear to be out of sync. In nagios.cfg, you have:
nagios_user=nagios
nagios_group=nagios
But then the group name on nagios.cmd is nagcmd, not nagios.
Additionally, you showed the group assignments for the nagios and nagcmd users, but what user is actually running the commands? Additionally, was nagcmd (or nagios) added as a group to the web user (www-data or apache, depending on the OS)?
Finally, there are some locations that need write permissions, as well. Making sure the correct permissions are added to those directories (and, again, the right users have the nagios or nagcmd group permissions) should help.
See this post for more information:
Nagios - Could not open command file /usr/local/nagios/var/rw/nagios.cmd’ for update

g-wan updating servlets

I noticed in the g-wan User Manual pdf documentation as of 10/19/2012,
http://gwan.ch/download
that it says:
Updating servlets (C, C++, etc.)
When you need to add or update servlets located in the csp directory you can do so without stopping G-WAN (all cached files are updated in real-time).
Yet when I start gwan, it appears to compile everything in the csp directory. That would be down right ugly on a system with 1000's of .c files. Anyway, I tried updating the hello.c file just to see what happens. When I access it again, the changes do not take. I have to restart the server. Also, if I put in a new servlet, like hello2.c, I get "The requested URL was not found on this server." until I restart the server?
what gives?
G-WAN 3.3.28 64-bit (Mar 28 2012 11:24:16) - the latest version I saw in the download as of Oct 19th, 2012
This works for me. I'm running CentOS. The only issue I can find is with header files not updating.
I can't seem to replicate what you're experiencing. What OS are you on?
Gil found the answer. It was permissions. (for the linux newbie like myself) The csp directory must have the same owner/group as how the gwan server is started.
sudo ./gwan -d:www-data:www-data
If started as above, the csp directory must also be www-data as owner and group along with the actual servlet file. In my case it was the hello.c file.
Only applies to the next release which should be soon, version 3.10.x I believe. Search for the tag "g-wan" and you will see other threads where the new version is mentioned.

libfaketime and Mac OS, LD_PRELOAD

Running Mac OS 10.7.2 and trying to run libfaketime and nothing happen. I installed and ran exactly as directed only the time and date stay exactly as are set in the system? Is anyone else able to successfully run this on OSX?
$ date
Mon Jan 30 21:05:09 CST 2012
$ LD_PRELOAD=./libfaketime.so.1 FAKETIME="-15d" date
Mon Jan 30 21:05:32 CST 2012
Everything on OSX is prefixed DYLD, not LD. And they change the names a bit.. I think what you want is:
DYLD_INSERT_LIBRARIES
This is a colon separated list of dynamic libraries to load before the ones specified in the program. This lets you test new modules of existing dynamic shared libraries that are used in flat-
namespace images by loading a temporary dynamic shared library with just the new modules. Note that this has no effect on images built a two-level namespace images using a dynamic shared library unless DYLD_FORCE_FLAT_NAMESPACE is also used.

Resources